/*
 * Kestara — global styles.
 *
 * Tokens live in theme.json; this file only adds behaviour theme.json cannot
 * express: focus visibility, transitions, typographic refinements, utilities.
 * Rules are intentionally low-specificity (:where) so users can override them.
 */

/* ---- Focus visibility ---------------------------------------------------- */
:where(a, button, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
	border-radius: var(--wp--custom--radius--sm);
}

/* On dark surfaces the primary ring can disappear: switch to the base colour. */
:where(.has-contrast-background-color, .has-secondary-background-color)
	:where(a, button, summary):focus-visible {
	outline-color: var(--wp--preset--color--base);
}

/* ---- Transitions (motion token: 200ms ease-out) ------------------------- */
:where(a, .wp-element-button, .wp-block-button__link) {
	transition:
		color var(--wp--custom--transition--base),
		background-color var(--wp--custom--transition--base),
		border-color var(--wp--custom--transition--base),
		outline-color var(--wp--custom--transition--base);
}

/* ---- Links inside navigation, buttons and titles stay clean ------------- */
:where(.wp-element-button, .wp-block-button__link) {
	text-decoration: none;
}

:where(.wp-block-navigation) a {
	text-decoration: none;
}

:where(.wp-block-navigation) a:hover {
	text-decoration: underline;
}

:where(.wp-block-site-title, .wp-block-post-title) a {
	text-decoration: none;
}

/* ---- Typographic refinements ------------------------------------------- */
:where(h1, h2, h3, h4, .wp-block-post-title) {
	text-wrap: balance;
}

:where(p, li, dd, blockquote) {
	text-wrap: pretty;
}

/* ---- Media -------------------------------------------------------------- */
:where(img, svg, video, iframe) {
	max-width: 100%;
}

:where(img) {
	height: auto;
}

/* ---- Selection ---------------------------------------------------------- */
::selection {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

/* ---- Utility: editorial label (uppercase, tracked) ---------------------- */
.kestara-label {
	margin-block-end: var(--wp--preset--spacing--20);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: var(--wp--custom--typography--tracking--label);
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}

.kestara-label.has-base-color {
	color: var(--wp--preset--color--base);
}

/* ---- Brand lockup: logo and site title --------------------------------- */
/*
 * The site logo is sized by its own width control (core/site-logo exposes
 * width only); the height always follows the aspect ratio of the uploaded
 * image because nothing in the theme sets a height on it.
 */
:where(.kestara-brand) {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--30);
}

:where(.kestara-brand) .wp-block-site-logo {
	margin: 0;
	line-height: 0;
}

:where(.kestara-brand) .wp-block-site-logo img {
	max-width: 100%;
	height: auto;
}

:where(.kestara-brand) .wp-block-site-title {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	line-height: 1.12;
	letter-spacing: var(--wp--custom--typography--tracking--heading);
}

:where(.kestara-brand) .wp-block-site-title a {
	color: inherit;
}

/*
 * Show the site title only while no logo is set: an empty core/site-logo
 * renders no element at all, so the adjacent sibling selector never matches
 * in that case. Scoped to the front end because the editor always renders a
 * placeholder for the logo.
 */
:where(body:not(.editor-styles-wrapper)) .kestara-brand .wp-block-site-logo:not(:empty) + .wp-block-site-title {
	display: none;
}

/* ---- Post meta rows ----------------------------------------------------- */
:where(.kestara-meta) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

:where(.kestara-meta) a {
	color: inherit;
}

:where(.kestara-meta) p,
:where(.kestara-meta) .wp-block-post-date,
:where(.kestara-meta) .wp-block-post-author-name,
:where(.kestara-meta) .wp-block-post-terms {
	margin: 0;
}

/* ---- Cards used by the post grids -------------------------------------- */
:where(.kestara-card) {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
	height: 100%;
	padding: var(--wp--preset--spacing--40);
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--surface);
	box-shadow: var(--wp--custom--shadow--sm);
}

:where(.kestara-card) .wp-block-post-featured-image {
	margin: 0;
}

:where(.kestara-card) .wp-block-post-featured-image img {
	width: 100%;
	aspect-ratio: 16 / 10;
	border-radius: var(--wp--custom--radius--sm);
	object-fit: cover;
}

:where(.kestara-card) .wp-block-post-excerpt {
	margin-top: auto;
}

/* ---- Search form -------------------------------------------------------- */
:where(.wp-block-search) .wp-block-search__inside-wrapper {
	padding: 6px;
	border: 1px solid var(--wp--preset--color--surface-2);
	border-radius: var(--wp--custom--radius--sm);
	background-color: var(--wp--preset--color--base);
}

:where(.wp-block-search) .wp-block-search__input {
	border: 0;
	background-color: transparent;
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
}

:where(.wp-block-search) .wp-block-search__input::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

:where(.wp-block-search) .wp-block-search__input:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* ---- Footer ------------------------------------------------------------- */
:where(.kestara-footer-nav) .wp-block-page-list {
	display: grid;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding: 0;
	list-style: none;
}

:where(.kestara-footer-nav) .wp-block-page-list a {
	color: inherit;
	text-decoration: none;
}

:where(.kestara-footer-nav) .wp-block-page-list a:hover {
	text-decoration: underline;
}

.kestara-copyright {
	margin: 0;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

/* ---- Pattern utilities -------------------------------------------------- */
:where(.kestara-panel) {
	overflow: hidden;
	border-radius: var(--wp--custom--radius--lg);
	background-color: var(--wp--preset--color--surface);
}

:where(.kestara-panel) .wp-block-image,
:where(.kestara-panel) figure {
	margin: 0;
}

:where(.kestara-panel) img {
	display: block;
	width: 100%;
}

:where(.kestara-monogram) {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1 / 1;
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--surface-2);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 600;
	line-height: 1.1;
	letter-spacing: var(--wp--custom--typography--tracking--heading);
	color: var(--wp--preset--color--muted);
}

:where(.kestara-step) {
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid var(--wp--preset--color--surface-2);
}

:where(.kestara-quote) {
	margin: 0;
	padding-left: var(--wp--preset--spacing--40);
	border-left: 3px solid var(--wp--preset--color--primary);
}

:where(.kestara-quote) cite {
	font-size: var(--wp--preset--font-size--small);
	font-style: normal;
	color: var(--wp--preset--color--muted);
}

:where(.kestara-stat__value),
:where(.kestara-price) {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	line-height: 1.08;
	letter-spacing: var(--wp--custom--typography--tracking--heading);
}

:where(.kestara-wordmark) {
	margin: 0;
	font-weight: 600;
	letter-spacing: var(--wp--custom--typography--tracking--label);
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

:where(.kestara-pricing-card) {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
	height: 100%;
	padding: var(--wp--preset--spacing--50);
	border: 1px solid var(--wp--preset--color--surface-2);
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--surface);
}

:where(.kestara-pricing-card.is-featured) {
	border-color: var(--wp--preset--color--primary);
	box-shadow: var(--wp--custom--shadow--md);
}

:where(.kestara-pricing-card) .wp-block-buttons {
	margin-top: auto;
}

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

/* ---- Layout utilities (G0) ---------------------------------------------- */
/*
 * Full-bleed sections keep their background edge to edge; the inner
 * .kestara-container holds the 1320px content shell with a fluid gutter.
 */
.kestara-container {
	width: 100%;
	max-width: var(--wp--custom--layout--container, 1320px);
	margin-inline: auto;
	padding-inline: var(--wp--custom--layout--gutter, 24px);
}

.kestara-section {
	width: 100%;
}

.kestara-section--lg {
	padding-block: var(--wp--custom--space--section-lg, 160px);
}

.kestara-grid {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--50);
}

.kestara-display {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: clamp(2.75rem, 6vw, 5rem);
	font-weight: 600;
	line-height: 1.03;
	letter-spacing: -0.03em;
	text-wrap: balance;
}

.kestara-eyebrow {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: var(--wp--custom--typography--tracking--label);
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}

/* Responsive grid: 12 -> 6 -> 2 columns. */
@media (max-width: 1023px) {
	.kestara-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

@media (max-width: 599px) {
	.kestara-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--wp--preset--spacing--40);
	}
}

/* ---- G1: wide layout shells --------------------------------------------- */
/*
 * A wide group keeps its 1320px box but, by default, constrains its children to
 * the 720px content size. Inside a wide section the children should use the wide
 * shell. The shell rules are body-scoped: the homepage and archives go wide,
 * while pages and single posts keep the readable 720px text column.
 */
:where(.wp-block-group.alignwide) {
	--wp--style--global--content-size: min(var(--wp--style--global--wide-size), 100%);
}

body.home main#main,
body.blog main#main,
body.archive main#main,
body.tax-kestara_project_category main#main {
	--wp--style--global--content-size: min(var(--wp--style--global--wide-size), 100%) !important;
}

body.home .wp-block-post-content {
	--wp--style--global--content-size: min(var(--wp--style--global--wide-size), 100%) !important;
}

/*
 * Full-bleed sections carry their own padding, so the automatic 24px block gap
 * between top-level blocks would show up as a page-coloured strip between them
 * (header → content, hero → proof band, section → section). Neutralise it for
 * those blocks only: the theme-wide flow gap stays intact for article text and
 * inner groups.
 */
body .wp-site-blocks > *,
.wp-block-post-content.is-layout-flow > .alignfull {
	margin-block-start: 0;
}

.kestara-header,
.kestara-footer {
	--wp--style--global--content-size: min(1320px, 100%) !important;
}

/* ---- G2/G3: header and footer ------------------------------------------- */
.kestara-header {
	position: relative;
	z-index: 60;
}

/*
 * Sticky must live on the template part wrapper: the header is as tall as its
 * wrapper, so on its own it has no room to stick and scrolls away with the page.
 */
.wp-block-template-part:has(> .kestara-header) {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: 60;
	/* Contain the header margin used to compensate the reduced sticky height. */
	display: flow-root;
}

/*
 * Top bar part: sits right above the header, so the block gap that
 * .wp-site-blocks applies between template parts must not open a white band
 * under the strip (and the strip itself needs no margin).
 */
.wp-block-template-part:has(> .kestara-topbar) {
	margin-block: 0 !important;
}

.wp-block-template-part:has(> .kestara-topbar) + .wp-block-template-part {
	margin-block-start: 0 !important;
}

/*
 * Touch targets in the header: the visible boxes keep their size (24px menu
 * icon, 36px buttons on phones) while the hit area reaches 44px through a
 * pseudo element, so the rows do not grow taller.
 */
@media (max-width: 1023px) {
	.kestara-header .wp-block-navigation__responsive-container-open {
		position: relative;
	}

	.kestara-header .wp-block-navigation__responsive-container-open::after {
		content: "";
		position: absolute;
		inset: -10px;
	}
}

/*
 * The default header must sit on the same vertical guide as the page blocks:
 * hero and sections use `min(1320px, 100% - 2 * gutter)` with a
 * clamp(20px, 4vw, 48px) gutter, so the header uses that padding instead of the
 * 24px root padding. Vertical paddings and the bottom border are untouched.
 */
.kestara-header.kestara-header--default {
	padding-inline: clamp(20px, 4vw, 48px);
}

/* Desktop only: more air between the menu and the search/switch/CTA block. */
@media (min-width: 1024px) {
	.kestara-header--default .kestara-header__tools {
		margin-left: 24px;
	}
}

/*
 * Centered header: core gives the navigation block its own margins, which
 * pushed the centred row ~7px left of centre on phones.
 */
.kestara-header--centered .wp-block-navigation {
	margin: 0 !important;
}

.kestara-header.has-background {
	background-color: color-mix(in srgb, var(--wp--preset--color--base) 86%, transparent);
}

.kestara-header .wp-block-navigation {
	font-size: var(--wp--preset--font-size--small);
}

.kestara-header .wp-block-navigation a {
	padding-block: 4px;
}

/*
 * Core shows the inline navigation from 600px. The theme keeps the hamburger
 * through tablet: the default header wraps and grows from 88 to 168px at 768px
 * when the inline navigation is visible.
 */
@media (min-width: 600px) and (max-width: 1023px) {
	.kestara-header .wp-block-navigation__responsive-container-open {
		display: flex !important;
	}

	.kestara-header .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none !important;
	}
}

/*
 * The CTA is not hidden on small screens: it switches to a compact form in the
 * responsive header matrix (G8).
 */

.kestara-footer {
	position: relative;
}

.kestara-footer-rule {
	height: 3px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(90deg, #2EBCF1 0%, #6B50DA 34%, #BB39D8 68%, #FB6E81 100%);
	opacity: 0.9;
	margin-block: var(--wp--preset--spacing--50);
}

.kestara-back-to-top {
	position: fixed;
	right: clamp(16px, 2vw, 28px);
	bottom: clamp(16px, 2vw, 28px);
	z-index: 50;
	display: inline-grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: linear-gradient(145deg, var(--wp--preset--color--primary), color-mix(in srgb, var(--wp--preset--color--secondary) 60%, var(--wp--preset--color--primary)));
	color: var(--wp--preset--color--base);
	box-shadow: 0 14px 34px color-mix(in srgb, var(--wp--preset--color--primary) 36%, transparent);
	text-decoration: none;
	opacity: 0;
	visibility: hidden;
	transform: translateY(14px);
	transition: opacity 250ms ease, transform 250ms ease, box-shadow 250ms ease, visibility 0s linear 250ms;
}

/* Gradient hairline ring, same brand ramp as the footer rule. */
.kestara-back-to-top::before {
	content: "";
	position: absolute;
	inset: -4px;
	padding: 2px;
	border-radius: inherit;
	background: conic-gradient(from 140deg, #2EBCF1 0%, #6B50DA 34%, #BB39D8 68%, #FB6E81 100%);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	mask-composite: exclude;
	pointer-events: none;
}

.kestara-back-to-top::after {
	content: "\2191";
	font-family: var(--wp--preset--font-family--body);
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	transition: transform 250ms ease;
}

.kestara-back-to-top.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.kestara-back-to-top:hover,
.kestara-back-to-top:focus-visible {
	background: linear-gradient(145deg, color-mix(in srgb, var(--wp--preset--color--primary) 82%, var(--wp--preset--color--secondary)), var(--wp--preset--color--secondary));
	color: var(--wp--preset--color--base);
	transform: translateY(-3px);
	box-shadow: 0 20px 44px color-mix(in srgb, var(--wp--preset--color--primary) 46%, transparent);
}

.kestara-back-to-top:hover::after,
.kestara-back-to-top:focus-visible::after {
	transform: translateY(-3px);
}

.kestara-back-to-top__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Smooth in-page jumps; the reduced-motion block cancels it. */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

/* Defensive: stack core columns on small screens. */
@media (max-width: 1023px) {
	.wp-block-columns {
		flex-wrap: wrap;
	}

	.wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
		flex-basis: 100% !important;
	}
}

/* ---- G4: homepage visual uplift ----------------------------------------- */
/* Gradient orb behind the hero of every homepage (first wide section). */
body.home .wp-block-post-content > .wp-block-group.alignwide:first-child {
	position: relative;
	isolation: isolate;
	overflow: clip;
}

body.home .wp-block-post-content > .wp-block-group.alignwide:first-child::before {
	content: "";
	position: absolute;
	top: -18%;
	right: -8%;
	width: min(620px, 64vw);
	aspect-ratio: 1;
	border-radius: 50%;
	background:
		radial-gradient(circle at 32% 30%, rgba(46, 188, 241, 0.28), transparent 62%),
		radial-gradient(circle at 70% 72%, rgba(187, 57, 216, 0.22), transparent 62%);
	filter: blur(44px);
	z-index: -1;
	pointer-events: none;
}

body.home .wp-block-post-content > .wp-block-group.alignwide:first-child h2 {
	font-size: clamp(2.75rem, 6vw, 5.25rem);
	line-height: 1.02;
	letter-spacing: -0.035em;
}

body.home .wp-block-post-content > .wp-block-group.alignwide:first-child .kestara-panel {
	border: 1px solid var(--wp--preset--color--surface-2);
	box-shadow: var(--wp--custom--shadow--lg);
}

/* Cards react on hover without moving layout. */
.kestara-card {
	transition:
		transform var(--wp--custom--transition--base),
		box-shadow var(--wp--custom--transition--base),
		border-color var(--wp--custom--transition--base);
}

.kestara-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--wp--custom--shadow--md);
}

/* Stats and prices get more presence. */
:where(.kestara-stat__value),
:where(.kestara-price) {
	font-size: clamp(2.1rem, 4vw, 3.4rem);
}

/* ---- G7: responsive fixes ----------------------------------------------- */
@media (max-width: 1023px) {
	/*
	 * G1 widened the constrained children of wide groups to 1320px. On small
	 * screens that forces horizontal overflow, so the shell collapses to 100%.
	 */
	:where(.wp-block-group.alignwide),
	body.home main#main,
	body.blog main#main,
	body.archive main#main,
	body.tax-kestara_project_category main#main,
	body.home .wp-block-post-content,
	.kestara-header,
	.kestara-footer {
		--wp--style--global--content-size: 100% !important;
	}

	.wp-block-columns {
		flex-wrap: wrap;
	}

	/* Force stacking even when a block carries is-not-stacked-on-mobile. */
	.wp-block-columns > .wp-block-column {
		flex-basis: 100% !important;
		min-width: 0;
	}

	.kestara-panel,
	.kestara-panel img,
	.wp-block-image,
	.wp-block-image img {
		max-width: 100%;
		height: auto;
	}
}

@media (max-width: 599px) {
	body.home .wp-block-post-content > .wp-block-group.alignwide:first-child h2 {
		font-size: clamp(2.2rem, 9vw, 3rem);
	}
}

/* ---- G7b: mobile menu as a compact panel -------------------------------- */
@media (max-width: 1023px) {
	/* Let the panel anchor to the header, not to the navigation block. */
	.kestara-header .wp-block-navigation {
		position: static !important;
	}

	/* The full-screen layer becomes the panel itself, under the header. */
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open {
		position: absolute !important;
		top: 100% !important;
		right: var(--wp--preset--spacing--40) !important;
		left: auto !important;
		bottom: auto !important;
		display: block !important;
		z-index: 70 !important;
		box-sizing: border-box !important;
		width: min(320px, calc(100vw - 48px)) !important;
		height: auto !important;
		max-height: none !important;
		overflow: visible;
		padding-top: 16px;
		padding-right: 16px;
		padding-bottom: 16px;
		padding-left: 16px;
		border: 1px solid var(--wp--preset--color--surface-2);
		border-radius: var(--wp--custom--radius--md);
		background-color: var(--wp--preset--color--base);
		box-shadow: var(--wp--custom--shadow--lg);
	}

	/* Click-outside is handled by assets/js/navigation.js. */
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-overlay {
		display: none;
	}

	/* Core locks the page while the menu is open; the panel is compact, so the
	   page must keep scrolling behind it while the panel stays stuck. */
	html.has-modal-open {
		overflow: auto;
	}

	/* The inner content flows normally inside the panel. */
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		position: static;
		width: 100%;
		max-height: none;
		padding: 0;
		background: transparent;
		border: 0;
		box-shadow: none;
	}

	/* Core positions the dialog, which would trap the close button inside the
	   panel padding; let the panel be the containing block instead. */
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
		position: static;
	}

	/* Close button in the top-right corner, above the items. */
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
		position: absolute;
		top: 0px;
		right: 0px;
		z-index: 3;
		display: inline-flex;
		transform: translate(50%, -50%);
		align-items: center;
		justify-content: center;
		width: 24px;
		height: 24px;
		padding: 0;
		border: 1px solid var(--wp--preset--color--surface-2);
		border-radius: 999px;
		background-color: var(--wp--preset--color--surface);
		color: var(--wp--preset--color--primary);
		box-shadow: var(--wp--custom--shadow--sm);
		transition:
			background-color var(--wp--custom--transition--base),
			color var(--wp--custom--transition--base),
			border-color var(--wp--custom--transition--base),
			transform var(--wp--custom--transition--base);
	}

	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close svg {
		width: 16px;
		height: 16px;
		fill: currentColor;
	}

	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close:hover,
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close:focus-visible {
		background-color: var(--wp--preset--color--primary) !important;
		color: var(--wp--preset--color--base) !important;
		border-color: var(--wp--preset--color--primary) !important;
		transform: translate(50%, -50%) rotate(90deg);
	}

	/* Items left aligned, tighter. */
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		display: flex;
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: flex-start;
		justify-content: flex-start;
		width: 100%;
		max-height: calc(100dvh - 160px);
		min-height: 0;
		overflow-x: hidden;
		overflow-y: auto;
		margin: 0;
		padding: 0;
		gap: 0;
	}

	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		flex-shrink: 0;
		width: 100%;
	}

	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		position: relative;
		display: block;
		box-sizing: border-box;
		width: 100%;
		padding: 6px 12px;
		border-radius: var(--wp--custom--radius--sm);
		color: var(--wp--preset--color--contrast);
		text-decoration: none;
		text-align: left;
		transition:
			color var(--wp--custom--transition--base),
			background-color var(--wp--custom--transition--base),
			padding-left var(--wp--custom--transition--base);
	}

	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover,
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:focus-visible {
		color: var(--wp--preset--color--primary);
		background-color: color-mix(in srgb, var(--wp--preset--color--primary) 8%, transparent);
		padding-left: 18px;
		text-decoration: none;
	}

}

/* Hard stop for horizontal overflow at phone widths. */
/* ---- Graphic details ----------------------------------------------------- */
/* Editorial label gets a short gradient accent. */
.kestara-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.kestara-label::before {
	content: "";
	width: 20px;
	height: 2px;
	border-radius: 999px;
	background: linear-gradient(90deg, #2EBCF1 0%, #6B50DA 50%, #BB39D8 100%);
}

/* Cards reveal a gradient hairline on hover. */
.kestara-card {
	position: relative;
	overflow: hidden;
}

.kestara-card::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, #2EBCF1 0%, #6B50DA 34%, #BB39D8 68%, #FB6E81 100%);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform var(--wp--custom--transition--base);
}

.kestara-card:hover::before {
	transform: scaleX(1);
}

/* Buttons lift slightly with a soft shadow. */
:where(.wp-element-button, .wp-block-button__link) {
	box-shadow: 0 1px 2px rgba(20, 23, 28, 0.08);
}

:where(.wp-element-button, .wp-block-button__link):hover {
	transform: translateY(-1px);
	box-shadow: var(--wp--custom--shadow--md);
}

/* Links: refined underline. */
:where(a) {
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

/* ---- Default demo patterns ---------------------------------------------- */
.kestara-hero-columns-classic {
	overflow: hidden;
}

.kestara-hero-columns-classic .kestara-display {
	margin: 0;
	font-size: clamp(2.75rem, 6.2vw, 5.5rem);
	line-height: 0.92;
	letter-spacing: -0.05em;
	text-wrap: balance;
}

.kestara-hero-columns-classic__grid {
	align-items: center;
}

.kestara-hero-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
}

.kestara-hero-tags span {
	padding: 6px 10px;
	border: 1px solid var(--wp--preset--color--surface-2);
	border-radius: var(--wp--custom--radius--pill, 999px);
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: var(--wp--custom--typography--tracking--label);
	text-transform: uppercase;
}

.kestara-hero-foot {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid var(--wp--preset--color--surface-2);
	gap: var(--wp--preset--spacing--30);
}

.kestara-hero-foot p {
	margin: 0;
}

.kestara-proof-logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--40);
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

.kestara-proof-metrics .wp-block-column {
	border-left: 1px solid var(--wp--preset--color--surface-2);
	padding-left: var(--wp--preset--spacing--40);
}

.kestara-proof-metrics .wp-block-column:first-child {
	border-left: 0;
	padding-left: 0;
}

.kestara-proof-metrics p {
	margin: 0;
}

.kestara-team-card__media {
	margin: 0;
}

.kestara-team-card__media img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	object-position: center 28%;
	border-radius: var(--wp--custom--radius--sm);
}

.kestara-team-card h3,
.kestara-team-card p {
	margin: 0;
}

.kestara-contact-strip__details p {
	margin: 0;
}

.kestara-contact-strip__details a {
	color: var(--wp--preset--color--contrast);
}

.kestara-contact-strip__details a:hover {
	color: var(--wp--preset--color--primary);
}

.kestara-contact-strip .wp-block-buttons {
	justify-content: flex-end;
}

@media (max-width: 1023px) {
	.kestara-team-photos__grid > .wp-block-column {
		flex-basis: calc(50% - var(--wp--preset--spacing--40) / 2) !important;
	}

	.kestara-proof-metrics > .wp-block-column {
		flex-basis: calc(33.333% - var(--wp--preset--spacing--40)) !important;
	}

	.kestara-proof-metrics .wp-block-column {
		border-left: 0;
		padding-left: 0;
	}

	.kestara-contact-strip .wp-block-buttons {
		justify-content: flex-start;
	}
}

@media (max-width: 599px) {
	.kestara-team-photos__grid > .wp-block-column {
		flex-basis: 100% !important;
	}

	.kestara-proof-metrics > .wp-block-column {
		flex-basis: calc(33.333% - var(--wp--preset--spacing--30)) !important;
	}

	.kestara-hero-foot {
		margin-top: var(--wp--preset--spacing--40);
	}
}

/* ---- Default demo: shared pattern polish, scoped to the demo ------------- */
.kestara-demo-default .kestara-card {
	border: 1px solid var(--wp--preset--color--surface-2);
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--base);
	box-shadow: var(--wp--custom--shadow--sm);
	padding: var(--wp--preset--spacing--40);
}

.kestara-demo-default .kestara-card .wp-block-post-featured-image {
	margin: 0;
}

.kestara-demo-default .kestara-card .wp-block-post-featured-image img {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: var(--wp--custom--radius--sm);
}

.kestara-demo-default .kestara-panel {
	border-radius: var(--wp--custom--radius--sm);
}

.kestara-demo-default .kestara-panel img {
	width: 100%;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.kestara-demo-default .kestara-step {
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid var(--wp--preset--color--surface-2);
}

.kestara-demo-default details {
	border-bottom: 1px solid var(--wp--preset--color--surface-2);
}

.kestara-demo-default details summary {
	list-style: none;
	cursor: pointer;
	padding: var(--wp--preset--spacing--30) 40px var(--wp--preset--spacing--30) 0;
	position: relative;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--large);
	letter-spacing: var(--wp--custom--typography--tracking--heading);
}

.kestara-demo-default details summary::-webkit-details-marker {
	display: none;
}

.kestara-demo-default details summary::after {
	content: "+";
	position: absolute;
	right: 4px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--wp--preset--color--primary);
	font-size: 20px;
	line-height: 1;
}

.kestara-demo-default details[open] summary::after {
	content: "−";
}

.kestara-demo-default details p {
	margin: 0 0 var(--wp--preset--spacing--30);
	color: var(--wp--preset--color--muted);
}

/* Testimonials with real portraits */
.kestara-testimonials-photos__grid .kestara-testimonial-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--surface-2);
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--base);
}

.kestara-testimonial-who {
	gap: var(--wp--preset--spacing--20);
	margin-top: auto;
}

.kestara-testimonial-who p {
	margin: 0;
}

.kestara-testimonial-avatar {
	flex: none;
	margin: 0;
}

.kestara-testimonial-avatar img {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

@media (max-width: 1023px) {
	.kestara-testimonials-photos__grid > .wp-block-column {
		flex-basis: calc(50% - var(--wp--preset--spacing--40) / 2) !important;
	}
}

@media (max-width: 599px) {
	.kestara-testimonials-photos__grid > .wp-block-column {
		flex-basis: 100% !important;
	}
}

@media (max-width: 1023px) {
	html,
	body {
		overflow-x: clip;
	}

	.kestara-header,
	.kestara-header .wp-block-group,
	.kestara-footer,
	.kestara-footer .wp-block-group {
		max-width: 100% !important;
	}

	body.home .wp-block-post-content,
	body.home .wp-block-post-content > .wp-block-group,
	body.home .wp-block-post-content .wp-block-columns,
	body.home .wp-block-post-content .wp-block-column {
		width: 100% !important;
		max-width: 100% !important;
	}

	body.home .wp-block-post-content .wp-block-columns {
		display: block !important;
	}

	body.home .wp-block-post-content .wp-block-column {
		flex-basis: auto !important;
		margin-inline: 0 !important;
	}
}


/* ---- G8: responsive header matrix --------------------------------------- */
/*
 * Modes: MobileV <600, MobileO/Tablet 600-1023, Desktop >=1024.
 * Header padding is inline in the parts, hence !important.
 */

.kestara-header .custom-logo {
	height: auto !important;
}

/* Header rows never wrap: the inline nav is hidden below 1024. */
.kestara-header--default > .wp-block-group,
.kestara-header--default > .wp-block-group > .wp-block-group,
.kestara-header--utility > .wp-block-group:last-child,
.kestara-header--utility > .wp-block-group:last-child > .wp-block-group,
.kestara-header--centered .kestara-brand {
	flex-wrap: nowrap !important;
}

/* Desktop */
@media (min-width: 1024px) {
	.kestara-header--default {
		padding-top: 24px !important;
		padding-bottom: 24px !important;
	}

	.kestara-header--default .custom-logo {
		width: 160px !important;
	}

	.kestara-header--centered {
		padding-top: 40px !important;
		padding-bottom: 16px !important;
	}

	.kestara-header--centered .custom-logo {
		width: 150px !important;
	}

	.kestara-header--utility {
		padding: 0 !important;
	}

	.kestara-header--utility > .wp-block-group:last-child {
		padding-top: 16px !important;
		padding-bottom: 16px !important;
	}

	.kestara-header--utility .custom-logo {
		width: 150px !important;
	}
}

/* Tablet: hamburger, CTA normal */
@media (min-width: 600px) and (max-width: 1023px) {
	.kestara-header--default {
		padding-top: 20px !important;
		padding-bottom: 20px !important;
	}

	.kestara-header--default .custom-logo {
		width: 136px !important;
	}

	.kestara-header--centered {
		padding-top: 24px !important;
		padding-bottom: 12px !important;
	}

	.kestara-header--centered .custom-logo {
		width: 136px !important;
	}

	.kestara-header--utility {
		padding: 0 !important;
	}

	.kestara-header--utility > .wp-block-group:last-child {
		padding-top: 12px !important;
		padding-bottom: 12px !important;
	}

	.kestara-header--utility .custom-logo {
		width: 128px !important;
	}
}

/* MobileV: hamburger, compact CTA, utility bar hidden */
@media (max-width: 599px) {
	.kestara-header--default {
		padding-top: 16px !important;
		padding-bottom: 16px !important;
	}

	.kestara-header--default .custom-logo {
		width: 112px !important;
	}

	.kestara-header--centered {
		padding-top: 20px !important;
		padding-bottom: 12px !important;
	}

	.kestara-header--centered .custom-logo {
		width: 120px !important;
	}

	.kestara-header--utility {
		padding: 0 !important;
	}

	.kestara-header--utility > .wp-block-group:first-child {
		display: none !important;
	}

	.kestara-header--utility > .wp-block-group:last-child {
		padding-top: 12px !important;
		padding-bottom: 12px !important;
	}

	.kestara-header--utility .custom-logo {
		width: 112px !important;
	}

	.kestara-header .wp-block-button__link {
		padding: 8px 12px !important;
		font-size: 13px !important;
		line-height: 1.2 !important;
	}

	/*
	 * Phones: the light/dark switch joins the hamburger and the CTA on one row.
	 * The markup gap (--wp--preset--spacing--40) is too wide for three controls:
	 * 12px keeps logo + hamburger + switch + CTA inside a 360px viewport.
	 */
	.kestara-header--default > .wp-block-group > .wp-block-group,
	.kestara-header--utility > .wp-block-group:last-child > .wp-block-group,
	.kestara-header--centered .wp-block-group > .wp-block-group {
		gap: 12px !important;
	}
}

@media (max-width: 360px) {
	.kestara-header--default .custom-logo {
		width: 96px !important;
	}

	.kestara-header--centered .custom-logo {
		width: 104px !important;
	}

	.kestara-header--utility .custom-logo {
		width: 96px !important;
	}
}

/* Panel width by mode (base rule lives in G7b). */
@media (max-width: 599px) {
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open {
		right: 16px !important;
		width: min(320px, calc(100vw - 32px)) !important;
		padding-top: 12px !important;

	}
}

@media (min-width: 600px) and (max-width: 1023px) {
	.kestara-header .wp-block-navigation__responsive-container.is-menu-open {
		width: min(360px, calc(100vw - 48px)) !important;
	}
}

/* ---- G9: reduced sticky header ------------------------------------------ */
/*
 * The header shrinks after 24px of scroll. Every reduction is compensated with
 * margin-bottom, so the document below does not move: the sticky wrapper keeps
 * the same height. The panel is anchored to the header padding box, so it
 * follows the reduced bottom automatically.
 */

.kestara-header {
	transition:
		padding-top var(--wp--custom--transition--base),
		padding-bottom var(--wp--custom--transition--base),
		margin-bottom var(--wp--custom--transition--base);
}

.kestara-header .custom-logo {
	transition: width var(--wp--custom--transition--base);
}

/* Default */
@media (min-width: 1024px) {
	.kestara-header--default.is-scrolled {
		padding-top: 5px !important;
		padding-bottom: 5px !important;
		margin-bottom: 32px !important;
	}

	.kestara-header--default.is-scrolled .custom-logo {
		width: 136px !important;
	}
}

@media (min-width: 600px) and (max-width: 1023px) {
	.kestara-header--default.is-scrolled {
		padding-top: 10px !important;
		padding-bottom: 10px !important;
		margin-bottom: 29px !important;
	}

	.kestara-header--default.is-scrolled .custom-logo {
		width: 112px !important;
	}
}

@media (max-width: 599px) {
	.kestara-header--default.is-scrolled {
		padding-top: 8px !important;
		padding-bottom: 8px !important;
		margin-bottom: 27px !important;
	}

	.kestara-header--default.is-scrolled .custom-logo {
		width: 80px !important;
	}

	.kestara-header--default.is-scrolled .wp-block-buttons,
	.kestara-header--utility.is-scrolled .wp-block-buttons {
		display: none !important;
	}
}

/* Centered header: the switch sits at the far right of the navigation row, so
 * the menu itself stays perfectly centred. Without :has() support the switch
 * simply stays inline next to the menu.
 */
@media (min-width: 1024px) {
	.kestara-header--centered .wp-block-group:has(> .kestara-scheme-toggle-wrap) {
		position: relative;
	}

	.kestara-header--centered .wp-block-group > .kestara-scheme-toggle-wrap {
		position: absolute;
		top: 50%;
		right: 0;
		transform: translateY(-50%);
	}

	/* Search sits just left of the switch, so the menu stays centred. */
	.kestara-header--centered .wp-block-group > .kestara-search {
		position: absolute;
		top: 50%;
		right: 56px;
		transform: translateY(-50%);
	}
}

/*
 * Phones under 600px: the top bar part carries the CTA (it replaces the header
 * button, because the row needs the space for logo + search + switch + menu).
 * The body class comes from the mobile switch of the strip.
 */
@media (max-width: 599px) {
	.kestara-has-topbar-mobile .kestara-header .wp-block-buttons {
		display: none !important;
	}
}

/*
 * Phones under 480px without the strip: logo + search + switch + hamburger +
 * CTA is 356px, more than the ~350px available at 390. The CTA leaves the
 * header (it stays in the menu, in the hero and in the sections).
 */
@media (max-width: 479px) {
	.kestara-header--default .wp-block-buttons,
	.kestara-header--utility .wp-block-buttons {
		display: none !important;
	}
}

/* Centered */
@media (min-width: 1024px) {
	.kestara-header--centered.is-scrolled {
		padding-top: 28px !important;
		padding-bottom: 8px !important;
		margin-bottom: 25px !important;
	}

	.kestara-header--centered.is-scrolled .custom-logo {
		width: 136px !important;
	}
}

@media (min-width: 600px) and (max-width: 1023px) {
	.kestara-header--centered.is-scrolled {
		padding-top: 16px !important;
		padding-bottom: 8px !important;
		margin-bottom: 21px !important;
	}

	.kestara-header--centered.is-scrolled .custom-logo {
		width: 112px !important;
	}
}

@media (max-width: 599px) {
	.kestara-header--centered.is-scrolled {
		padding-top: 12px !important;
		padding-bottom: 8px !important;
		margin-bottom: 24px !important;
	}

	.kestara-header--centered.is-scrolled .custom-logo {
		width: 88px !important;
	}
}

/* Utility */
@media (min-width: 1024px) {
	.kestara-header--utility.is-scrolled > .wp-block-group:first-child {
		padding-top: 4px !important;
		padding-bottom: 4px !important;
	}

	.kestara-header--utility.is-scrolled > .wp-block-group:last-child {
		padding-top: 8px !important;
		padding-bottom: 8px !important;
	}

	.kestara-header--utility.is-scrolled .custom-logo {
		width: 136px !important;
	}

	.kestara-header--utility.is-scrolled {
		margin-bottom: 29px !important;
	}
}

@media (min-width: 600px) and (max-width: 1023px) {
	.kestara-header--utility.is-scrolled > .wp-block-group:first-child {
		padding-top: 4px !important;
		padding-bottom: 4px !important;
	}

	.kestara-header--utility.is-scrolled > .wp-block-group:last-child {
		padding-top: 8px !important;
		padding-bottom: 8px !important;
	}

	.kestara-header--utility.is-scrolled .custom-logo {
		width: 112px !important;
	}

	.kestara-header--utility.is-scrolled {
		margin-bottom: 21px !important;
	}
}

@media (max-width: 599px) {
	.kestara-header--utility.is-scrolled > .wp-block-group:last-child {
		padding-top: 8px !important;
		padding-bottom: 8px !important;
	}

	.kestara-header--utility.is-scrolled .custom-logo {
		width: 80px !important;
	}

	.kestara-header--utility.is-scrolled {
		margin-bottom: 19px !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kestara-header,
	.kestara-header .custom-logo {
		transition: none;
	}
}
