/**
 * Base styles that theme.json cannot express.
 * Colors, sizes and spacing come from theme.json presets only (see docs/DESIGN.md).
 */

/* Header, main, CTA and footer sit flush; sections handle their own spacing. */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* In-page anchors (#chi-tiet, #bang-gia…) land below the sticky header. */
:where([id]) {
	scroll-margin-top: 96px;
}

/* Breadcrumbs (core block): quiet links. */
.wp-block-breadcrumbs a {
	color: inherit;
	text-decoration: none;
}

.wp-block-breadcrumbs a:hover {
	color: var(--wp--preset--color--primary-strong);
	text-decoration: underline;
}

/* Links */
a {
	text-underline-offset: 0.15em;
	text-decoration-thickness: 1px;
}

/* Focus */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* Buttons: lift on hover. Ghost buttons underline instead. */
.wp-block-button__link {
	transition: transform var(--wp--custom--transition), box-shadow var(--wp--custom--transition);
}

.wp-block-button__link:hover {
	transform: translateY(-1px);
	box-shadow: var(--wp--preset--shadow--card-hover);
}

.wp-block-button.is-style-ghost .wp-block-button__link {
	text-align: left;
}

.wp-block-button.is-style-ghost .wp-block-button__link:hover {
	transform: none;
	box-shadow: none;
	text-decoration: underline;
}

/* Button icons: add class gcvn-icon--<name> to a Button block. Icons are masks, so they follow the text color. */
[class*="gcvn-icon--"] > .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

[class*="gcvn-icon--"] > .wp-block-button__link::before {
	content: "";
	flex: none;
	width: 20px;
	height: 20px;
	background-color: currentColor;
	-webkit-mask: center / contain no-repeat;
	mask: center / contain no-repeat;
}

/* Icon file per class: assets/css/icons.css (generated). */

/*
 * Icon above a block's content: add classes gcvn-has-icon gcvn-icon--<name>
 * (usually on a card heading). ::before is the tinted square, ::after the icon.
 */
.gcvn-has-icon {
	position: relative;
	padding-top: 64px;
}

.gcvn-has-icon::before,
.gcvn-has-icon::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
}

.gcvn-has-icon::before {
	width: 48px;
	height: 48px;
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--primary-soft);
}

.gcvn-has-icon::after {
	top: 12px;
	left: 12px;
	width: 24px;
	height: 24px;
	background-color: var(--wp--preset--color--primary-strong);
	-webkit-mask: center / contain no-repeat;
	mask: center / contain no-repeat;
}

.gcvn-has-icon.has-text-align-center::before {
	left: calc(50% - 24px);
}

.gcvn-has-icon.has-text-align-center::after {
	left: calc(50% - 12px);
}

/*
 * Card grids with a fixed column count per breakpoint, so a row never ends with one lone card.
 * Add to a Group with grid layout (or to a Query block, for its post template):
 *   gcvn-grid-4: 4 → 2 → 1 columns; gcvn-grid-3: 3 → 2 → 1;
 *   + gcvn-grid--phone-2 keeps two columns on phones (short cards);
 *   gcvn-grid-center: odd counts (e.g. 5) — rows of 5 / 3 / 2 with the last row centered.
 */
.wp-block-group.gcvn-grid-3,
.wp-block-group.gcvn-grid-4,
.wp-block-query.gcvn-grid-4 > .wp-block-post-template {
	grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 599.98px) {
	.wp-block-group.gcvn-grid--phone-2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 600px) {
	.wp-block-group.gcvn-grid-3,
	.wp-block-group.gcvn-grid-4,
	.wp-block-query.gcvn-grid-4 > .wp-block-post-template {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {
	.wp-block-group.gcvn-grid-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.wp-block-group.gcvn-grid-4,
	.wp-block-query.gcvn-grid-4 > .wp-block-post-template {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.wp-block-group.gcvn-grid-center {
	--gcvn-per-row: 2;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

.wp-block-group.gcvn-grid-center > * {
	flex: 0 0 calc((100% - (var(--gcvn-per-row) - 1) * var(--wp--style--block-gap, 24px)) / var(--gcvn-per-row));
	margin: 0;
}

@media (min-width: 600px) {
	.wp-block-group.gcvn-grid-center {
		--gcvn-per-row: 3;
	}
}

@media (min-width: 1100px) {
	.wp-block-group.gcvn-grid-center {
		--gcvn-per-row: 5;
	}
}

/*
 * gcvn-grid-center-3: card count not known in advance (Query Loop of pages or posts) —
 * rows of 3 / 2 / 1 with the last row centered. Add to a Group or a Query block.
 */
.wp-block-group.gcvn-grid-center-3,
.wp-block-query.gcvn-grid-center-3 > .wp-block-post-template {
	--gcvn-per-row: 1;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--wp--style--block-gap, 24px);
	padding: 0;
	list-style: none;
}

.wp-block-group.gcvn-grid-center-3 > *,
.wp-block-query.gcvn-grid-center-3 > .wp-block-post-template > * {
	flex: 0 0 calc((100% - (var(--gcvn-per-row) - 1) * var(--wp--style--block-gap, 24px)) / var(--gcvn-per-row));
	margin: 0;
}

@media (min-width: 600px) {
	.wp-block-group.gcvn-grid-center-3,
	.wp-block-query.gcvn-grid-center-3 > .wp-block-post-template {
		--gcvn-per-row: 2;
	}
}

@media (min-width: 1100px) {
	.wp-block-group.gcvn-grid-center-3,
	.wp-block-query.gcvn-grid-center-3 > .wp-block-post-template {
		--gcvn-per-row: 3;
	}
}

/* List with check marks: add class gcvn-checklist to a List block. */
.gcvn-checklist {
	padding-left: 0;
	list-style: none;
}

.gcvn-checklist li {
	position: relative;
	padding-left: 28px;
}

.gcvn-checklist li + li {
	margin-top: var(--wp--preset--spacing--20);
}

.gcvn-checklist li::before {
	content: "";
	position: absolute;
	top: 0.3em;
	left: 0;
	width: 18px;
	height: 18px;
	background-color: var(--wp--preset--color--primary-strong);
	-webkit-mask: url(../icons/check.svg) center / contain no-repeat;
	mask: url(../icons/check.svg) center / contain no-repeat;
}

/* Small pill label: add class gcvn-badge to a Paragraph (or Post Terms). */
.gcvn-badge {
	display: inline-block;
	width: fit-content;
	padding: 4px 10px;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--primary-soft);
	/* primary-strong alone is 4.01:1 on primary-soft; 15% contrast brings it to 5.1:1 (light) / 5.5:1 (dark). */
	color: color-mix(in srgb, var(--wp--preset--color--primary-strong) 85%, var(--wp--preset--color--contrast));
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	line-height: 1.4;
}

.gcvn-badge a {
	color: inherit;
	text-decoration: none;
}

/* Page content made of full-width sections (front page, service pages): sections sit flush, each carries its own vertical padding. */
.gcvn-sections > * + * {
	margin-block-start: 0;
}

/* Cards inside a Query Loop fill the row height. */
.wp-block-post > .is-style-card {
	height: 100%;
}

/* Pricing (patterns/pricing-table.php, shared): the featured plan stands out. */
.gcvn-plan {
	display: flex;
	flex-direction: column;
	gap: var(--wp--style--block-gap);
}

/* Spacing comes from the gap (flow layout margins would let the button touch the list in the tallest card). */
.is-style-card.gcvn-plan > * {
	margin-block: 0;
}

.is-style-card.gcvn-plan > .wp-block-buttons {
	margin-top: auto;
}

.gcvn-plan--featured {
	border: 2px solid var(--wp--preset--color--primary-strong) !important;
}

/* Featured image box (service hero, case study header): gradient placeholder keeps its shape when there is no featured image. */
.gcvn-media-box {
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

.gcvn-media-box > .wp-block-post-featured-image {
	height: 100%;
	margin: 0;
}

/* Phones and small tablets: an empty placeholder box would only push the content down. */
@media (max-width: 781.98px) {
	.gcvn-media-box:not(:has(img)) {
		display: none;
	}
}

/* Search form (class gcvn-search on a Search block): pill field with the button inside. */
.gcvn-search {
	max-width: 560px;
}

.gcvn-search.has-text-align-center,
.has-text-align-center + .gcvn-search,
.is-layout-constrained > .gcvn-search {
	margin-inline: auto;
}

.gcvn-search .wp-block-search__inside-wrapper {
	padding: 4px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--base);
}

.gcvn-search .wp-block-search__input {
	padding: 0 var(--wp--preset--spacing--40);
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--medium);
}

.gcvn-search .wp-block-search__input:focus-visible {
	outline: none;
}

.gcvn-search .wp-block-search__inside-wrapper:focus-within {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.gcvn-search .wp-block-search__button {
	margin: 0;
	border-radius: var(--wp--custom--radius--pill);
}

/* FAQ (patterns/service-faq.php, academy-faq.php; core Details): one card per question, chevron that turns when open. */
.gcvn-faq {
	max-width: var(--wp--style--global--content-size);
	margin-inline: auto;
}

.gcvn-faq > .wp-block-details {
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--surface);
}

.gcvn-faq > .wp-block-details + .wp-block-details {
	margin-top: var(--wp--preset--spacing--30);
}

.gcvn-faq summary {
	position: relative;
	padding-right: 32px;
	font-weight: 600;
	list-style: none;
	cursor: pointer;
}

.gcvn-faq summary::-webkit-details-marker {
	display: none;
}

.gcvn-faq summary::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 0;
	width: 20px;
	height: 20px;
	background-color: var(--wp--preset--color--primary-strong);
	-webkit-mask: url(../icons/chevron-right.svg) center / contain no-repeat;
	mask: url(../icons/chevron-right.svg) center / contain no-repeat;
	transform: translateY(-50%) rotate(90deg);
	transition: transform var(--wp--custom--transition);
}

.gcvn-faq details[open] > summary::after {
	transform: translateY(-50%) rotate(-90deg);
}

.gcvn-faq details > :not(summary) {
	margin-top: var(--wp--preset--spacing--30);
}

/* CTA band (styles/section-cta.json): outline buttons turn white on the gradient. */
.is-style-section-cta .wp-block-button.is-style-outline > .wp-block-button__link {
	border-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--white);
}

/* Cards: lift on hover. */
.is-style-card {
	transition: transform var(--wp--custom--transition), box-shadow var(--wp--custom--transition);
}

.is-style-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--wp--preset--shadow--card-hover);
}

/* Highlight (mark) inside a heading renders as gradient text. */
:where(h1, h2, h3, h4) mark {
	background: var(--wp--preset--gradient--brand);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

/*
 * Hover/focus label for icon-only buttons, read from aria-label.
 * Add class gcvn-tooltip (label on the left) or gcvn-tooltip gcvn-tooltip--bottom.
 */
.gcvn-tooltip {
	position: relative;
}

.gcvn-tooltip::after {
	content: attr(aria-label);
	position: absolute;
	top: 50%;
	right: calc(100% + 10px);
	z-index: 1;
	padding: 6px 10px;
	border-radius: var(--wp--custom--radius--sm);
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	transform: translateY(-50%);
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--wp--custom--transition), visibility 0s 200ms;
}

.gcvn-tooltip--bottom::after {
	top: calc(100% + 8px);
	right: 50%;
	transform: translateX(50%);
}

.gcvn-tooltip:hover::after,
.gcvn-tooltip:focus-visible::after {
	visibility: visible;
	opacity: 1;
	transition: opacity var(--wp--custom--transition), visibility 0s;
}

/* Dark mode toggle */
.gcvn-theme-toggle {
	display: inline-grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
}

.gcvn-theme-toggle .gcvn-icon {
	width: 20px;
	height: 20px;
}

.gcvn-theme-toggle[aria-pressed="true"] .gcvn-icon-moon,
.gcvn-theme-toggle[aria-pressed="false"] .gcvn-icon-sun {
	display: none;
}

/* Images that only fit one mode. */
.gcvn-dark-only {
	display: none !important;
}

:root[data-theme="dark"] .gcvn-dark-only {
	display: revert !important;
}

:root[data-theme="dark"] .gcvn-light-only {
	display: none !important;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .gcvn-dark-only {
		display: revert !important;
	}

	:root:not([data-theme="light"]) .gcvn-light-only {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}
}
