/**
 * SAConnects header chrome (framework module).
 *
 * ENQUEUE. functions.php registers this as `framework-navigation` with
 * wp_enqueue_style() + wp_style_add_data( …, 'path', … ) UNCONDITIONALLY on
 * wp_enqueue_scripts — NOT via wp_enqueue_block_style( 'core/navigation', … ).
 * ASRI's QA found the regression the conditional form causes: per-block styles
 * attached to a block nested INSIDE a template part are not collected on the
 * front-page template path, so the homepage served no navigation.css at all
 * while every interior page was fine. Conditional loading buys nothing anyway
 * — the header part renders on every front-end view. The 'path' data keeps it
 * inlined by the perf inliner. Because it loads everywhere, this file also
 * legitimately hosts the dark-footer link rules.
 *
 * IT NO LONGER HOSTS THE SEARCH-RESULTS FORM. That moved to
 * assets/css/search.css on 2026-08-24, when the results form was rebuilt on
 * the theme's own input system and the paginator gained the shared mixin.
 * Loading on every page made this file a convenient host, but it also made it
 * a LATE one — head index 33 against a block skin's <=26 — so its rules beat
 * the new stylesheet at equal specificity from a file that has nothing to do
 * with the search page. Section 4 has been deleted rather than left inert.
 *
 * WHAT THIS FILE IS NOT ANY MORE. It used to carry ~1,200 lines of
 * core/navigation overrides: the 600px→992px collapse pair, the open-overlay
 * padding/submenu chains, the drill-down sheet, the desktop dropdown panels,
 * a `.utility-bar`, a `.header-search` and a `.header-apply`/`.menu-cta` CTA
 * pair. ALL of it was dead the moment the header navigation moved to the
 * `saconnects/mega-nav` block: that block renders none of core's
 * `wp-block-navigation__responsive-container*` classes, and the design has no
 * utility bar, no bar CTA and no search FIELD at any width. Dead overrides are
 * worse than missing ones — the next agent reads them as authoritative — so
 * they are gone rather than commented out. Their measured rationale survives
 * in CLAUDE.md §Navigation, which is where it belongs.
 *
 * WHERE THE HEADER'S CSS LIVES NOW:
 *  - the bar shell, the logo clamp and the sticky/compact state: THIS FILE.
 *    They style `.site-header` and `core/site-logo`, which belong to
 *    parts/header.html, not to any block.
 *  - the menu itself (top-level row, mega panels, phone/tablet sheet):
 *    src/blocks/mega-nav/style.scss, shipped as that block's `style`.
 *  - the FOOTER's core/navigation: §3 below, unchanged.
 *
 * FREE FROM ELSEWHERE — DO NOT RE-DECLARE HERE:
 *  - functions.php inline CSS → the global 3px :focus-visible ring
 *    (var(--wp--custom--focus--ring), outline-offset 2px) — never restate an
 *    outline here; `*{box-sizing:border-box}`;
 *    `header.wp-block-template-part{display:contents}` (the only reason the
 *    sticky header group sticks at all — a sticky group inside a template part
 *    is contained by the short part wrapper); and
 *    `html{scroll-padding-top:calc(var(--wp--custom--header--height,92px) + var(--wp--preset--spacing--30,24px))}`
 *    (plus assets/js/anchor-settle.js, which holds the landing while the page settles).
 *  - theme.json styles.elements.button → any pill in the header.
 *
 * JS HOOKS. assets/js/nav-drilldown.js writes `--saconnects-menu-top` (the
 * bar's live bottom edge) on the mega-nav block root and toggles `.is-open` /
 * `.is-dismissed`; the functions.php scroll listener toggles `.is-scrolled` on
 * the bar.
 */

/* =========================================================================
 * 1. FIXED BAR  (.site-header)
 *
 * FIXED, NOT STICKY (client, 2026-08-21: "el header tiene que estar en
 * position fixed"). The bar is transparent over the hero, so it is an OVERLAY
 * on that surface rather than a band the page starts below — which is what
 * fixed expresses and sticky does not.
 *
 * Core's position support is therefore GONE from parts/header.html rather than
 * overridden here. It owns `position` and `top` on this same element at
 * (0,1,0), and the old comment in this slot was right that fighting it from
 * here loses: a rule that restates `position` un-sticks the header, and one
 * that restates `top` drops the admin-bar calc(). The fix is to stop core
 * emitting the rule at all, then own both properties outright — which also
 * means this file now carries the admin-bar offset itself. That variable is
 * the same one core used; keep it.
 *
 * TAKING THE BAR OUT OF FLOW leaves a hole where it used to stand. §1c pays
 * that back with padding on the content, on exactly the pages that need it —
 * a page whose hero sits UNDER the bar by design must not also be pushed down
 * by it.
 *
 * Z-INDEX. Core hardcodes `z-index: 10` in that same (0,1,0) rule. CLAUDE.md
 * §Navigation warns that a bar HOSTING a fixed panel should not take a
 * z-index of its own — but that warning is about a bar with a NEIGHBOURING
 * bar above it (ASRI's utility strip), where the new stacking context trapped
 * the panel underneath the neighbour. This design has exactly one bar and no
 * neighbour, and without a raise the sticky header paints under the page's
 * own bands. The mega panels are DESCENDANTS of this element, so raising it
 * lifts them with it.
 *
 * GEOMETRY. 1440x92 with padding 28/60/17/60 (Figma 14460:26035); 768x80 and
 * 390x80 with padding 15/gutter (bundle nodes 7524:52 / 7524:53). The
 * asymmetric desktop pair is the whole content of
 * var(--wp--custom--header--padding); the 92px is
 * var(--wp--custom--header--height), which functions.php also uses for
 * scroll-padding-top, so the sticky offset and the anchor clearance can never
 * disagree.
 * ====================================================================== */

header .site-header {
	position: fixed;
	/*
	 * THE ADMIN BAR OFFSET, computed rather than inherited.
	 *
	 * The first attempt reused core's own `--wp-admin--admin-bar--position-offset`
	 * and it silently resolved to nothing: core defines that variable at
	 * `html :where(.is-position-sticky)` — a class emitted by the position
	 * support we deliberately removed from parts/header.html. No class, no
	 * variable, `0px` fallback, and the bar sat under the admin bar for every
	 * logged-in viewer (client, 2026-08-21).
	 *
	 * `--wp-admin--admin-bar--height` is the one core sets on `html` itself, so
	 * it survives without the class. Measured in core's admin-bar.min.css: 32px
	 * base, 46px at max-width 782. The `0px` fallback is what a logged-OUT
	 * visitor gets, because that stylesheet is only enqueued when the bar
	 * actually renders.
	 */
	top: var(--wp-admin--admin-bar--height, 0px);
	right: 0;
	left: 0;
	z-index: 120; /* no z-index tokens; beats core's position-support z-index:10 at (0,1,1) */
	min-height: var(--wp--custom--header--height);
	padding: var(--wp--custom--header--padding);
}

header .site-header .wp-block-group {
	min-height: 0;
}

/*
 * THE CONTRAST SCRIM (client QA #58, 2026-09-02: "el menu tiene fallas de
 * contraste dependiendo del banner"). The bar is a transparent overlay with
 * near-white links — designed for the ink heroes, and unreadable the moment
 * a hero PHOTO puts a light region behind them. A top-down fade of the ink
 * token guarantees the links a dark backdrop on every page: 70% ink over a
 * pure-white worst case measures ≈5.4:1 against the near-white link ink
 * (AA for the 16px labels), and over the ink heroes it simply deepens the
 * top edge. color-mix over the token, no local hex (the card-grid hover
 * wash precedent). z-index -1 stays INSIDE the bar's own stacking context
 * (it has z-index 120), so the scrim paints under the links and over the
 * page — and the -28px reach lets the fade finish below the bar instead of
 * cutting at the padding edge. pointer-events: none — it is paint, never a
 * hit surface over the hero.
 *
 * OPACITY-GATED TO THE TRANSPARENT STATE since 2026-09-16 (client beta: with
 * the bar SOLID — sheet open, and the same held for the scrolled state — the
 * -28px tail stuck out below the bar's crisp edge as a semi-transparent
 * fringe over whatever sat behind; "el before excede el alto del header").
 * The scrim exists to give the links a dark backdrop while the bar is
 * see-through; a solid bar IS that backdrop, so the scrim rides exactly the
 * transparent condition (§1b sets the 1) and crossfades in the same 0.35s
 * the background swap uses — the two surfaces move as one.
 */
header .site-header::before {
	content: "";
	position: absolute;
	inset: 0 0 -28px 0;
	z-index: -1;
	pointer-events: none;
	opacity: 0;
	background: linear-gradient(
		180deg,
		color-mix(in srgb, var(--wp--preset--color--contrast) 70%, transparent),
		transparent
	);
}

/*
 * REFLOW (WCAG 1.4.10; client QA #59, 2026-09-02). At 400% zoom a 858px
 * screen becomes a ~215px viewport and the FIXED 80px bar permanently ate
 * 37% of it (measured on staging). Below a 500px viewport HEIGHT the bar
 * goes absolute: the same overlay at the top of the page, scrolled away
 * with the content — exactly the QA's "oculte el header al hacer scroll",
 * with no JS and no change at any normal zoom (a sub-500px-tall window is
 * already a zoomed or snapped context). The mobile sheet keeps working:
 * nav-drilldown.js measures the sheet top from the bar's LIVE rect at open
 * time, so a scrolled-away bar simply opens its sheet wherever it sits.
 */
@media (max-height: 500px) {
	header .site-header {
		position: absolute;
	}
}

/* Below the nav-collapse breakpoint the bar is 80px tall with symmetric 15px
   padding and the compact logo. 80px and 15px are comp values with no token;
   the horizontal gutter clamp already reproduces the comp's 24px @768 and
   16px @390 exactly, so only the vertical pair is stated. */
/*
 * BREAKPOINT MOVED 1365.98 -> 1365.98 (client, 2026-08-23: the nav overflowed
 * between 992 and 1280 with the burger still hidden).
 *
 * These three queries give the BAR its compact geometry (80px min-height, the
 * 15px vertical pad, the compact sticky lockup). mega-nav/style.scss moved the
 * sheet/burger cut-over to 1365.98; leaving these at 1365.98 half-lands the move
 * — MEASURED symptom: a 95px-tall bar carrying the DESKTOP logo clamp
 * (262-296px) sitting above a burger menu, right across the new 992..1279 band.
 * The two files must always name the same number.
 */
/*
 * THE COMPACT BAR HEIGHT, as a property, because a second file now needs it.
 *
 * `--wp--custom--header--height` is the RESTING 92px. The bar is 80px once
 * `.is-scrolled` flips, and that number was written twice below and nowhere
 * else — so anything outside this file had to guess it. A sticky block in
 * post content has to clear the bar it will actually meet, and by definition
 * it only meets the scrolled one (functions.php, the sticky-clearance rule).
 */
:root {
	--saconnects-header-compact: 80px;
}

@media (max-width: 1365.98px) {
	header .site-header {
		min-height: var(--saconnects-header-compact);
		padding-block: 15px;
	}
}

/* The scrolled/compact state. The design documents a "Desktop - Sticky" frame
   (1440x80, padding 25/60/20/60, logo 236x35) but never draws a scrolled BAR
   for tablet or phone — and below 992 the bar is ALREADY 80px with the compact
   logo, so there is nothing left to shrink. The class is toggled by the
   rAF-coalesced scroll listener in the functions.php inline block; CSS cannot
   observe scroll position. */
@media not all and (max-width: 1365.98px) {
	header .site-header.is-scrolled {
		min-height: var(--saconnects-header-compact);
		padding-block: 25px 20px;
	}
}

/* The shadow token is pinned to `none`, so the bar simply never gains one —
   which IS the resting state in this design. Declared rather than omitted so
   restoring it is a one-key change in theme.json (CLAUDE.md: retire a shadow
   by pinning it, never by deleting it). */
header .site-header.is-scrolled {
	box-shadow: var(--wp--custom--shadow--header);
}

/*
 * COLOUR AND SHADOW ARE FEEDBACK, NOT MOTION (CLAUDE.md §theme.json rules:
 * gating a non-motion property silently removes the feedback for
 * reduced-motion users) — so the background/shadow swap and the scrim's
 * opacity crossfade run UNGATED, and the two surfaces stay in sync for
 * everyone. Size IS motion: the gated arm below restates the FULL list
 * (a transition declaration replaces, never merges), so min-height and
 * padding only ease when motion is welcome.
 */
/*
 * ONE CLOCK FOR THE WHOLE COMPACT STATE (client, 2026-09-16: the logo "hace
 * un resize muy brusco" going sticky and back). Four things change together
 * when `.is-scrolled` flips — bar padding, bar min-height, the logo width and
 * the nav link padding — and before this only the bar's two eased: the logo
 * snapped 315 -> 236px and the links snapped 12 -> 6px while the bar around
 * them was still mid-tween, which is exactly the jolt. Every participant now
 * reads the same duration and curve from these two inherited properties, so
 * they cannot drift apart again.
 *
 * The curve is an ease-in-out (easeInOutCubic), not the old `ease`: this is
 * a shape MORPHING in place, in both directions, and plain `ease` front-loads
 * most of the change into the first third — the part that read as a jump.
 */
header .site-header {
	--saconnects-header-duration: 0.35s;
	--saconnects-header-ease: cubic-bezier(0.645, 0.045, 0.355, 1);

	transition:
		box-shadow var(--saconnects-header-duration) var(--saconnects-header-ease),
		background-color var(--saconnects-header-duration) var(--saconnects-header-ease);
}

header .site-header::before {
	transition: opacity var(--saconnects-header-duration) var(--saconnects-header-ease);
}

@media (prefers-reduced-motion: no-preference) {
	header .site-header {
		/* Height/padding animate because the compact state changes both, and
		   the bar's bottom edge is what the mega panels hang from — a jump
		   there reads as the whole menu twitching. The full list is restated:
		   a transition declaration replaces, never merges. */
		transition:
			box-shadow var(--saconnects-header-duration) var(--saconnects-header-ease),
			min-height var(--saconnects-header-duration) var(--saconnects-header-ease),
			padding var(--saconnects-header-duration) var(--saconnects-header-ease),
			background-color var(--saconnects-header-duration) var(--saconnects-header-ease);
	}
}

/* =========================================================================
 * 2. SITE LOGO  (core/site-logo)
 *
 * core/site-logo's `width` attribute emits NO CSS — it only filters the
 * <img>'s width/height attributes — so the fluid size has to be a stylesheet
 * rule, and it must sit on `.wp-block-site-logo` ITSELF: the custom class
 * lands on the SAME element, and a descendant form never matches.
 *
 * ONE CLAMP, NO SWAP. The design gives two lockups — 315x47 (header) and
 * 236x35 ("Sticky", and the same artwork the 768 and 390 frames use) — and
 * never says where one becomes the other. 236/315 is a uniform 74.6% scale of
 * the same drawing, so a single clamp reproduces both endpoints with no hard
 * swap and nothing to keep in sync. The ramp is the line through (768, 236)
 * and (1440, 315): slope 79/672 = 11.756vw, intercept 145.72px. It reads
 * 236.3px at 768 and 315px at 1440, and hits its 235px floor just below 760 —
 * which is the collapse sanity-check CLAUDE.md §Layout gotchas asks for: the
 * floor arrives well below the 992px nav collapse, so the logo is never
 * clamped while the seven-item row is still on screen.
 * ====================================================================== */

header .site-header .wp-block-site-logo {
	width: clamp(
		var(--wp--custom--logo--compact),
		calc(11.756vw + 145.72px),
		var(--wp--custom--logo--header)
	);
	flex: none;
}

header .site-header .wp-block-site-logo img {
	width: 100%;
	max-width: none;
	height: auto;
	display: block;
}

/*
 * Below 600px core flips #wpadminbar from `position: fixed` to `absolute`, so
 * it SCROLLS AWAY with the page. Holding a 46px offset there would leave the
 * bar floating under a strip of nothing the moment the admin bar scrolled off.
 * Core's own sticky offset makes exactly this exception; this mirrors it.
 *
 * ---------------------------------------------------------------------------
 * 2026-08-23. THAT PREMISE IS STILL TRUE, AND `top: 0` WAS STILL WRONG.
 * (client: "en mobile el wp-adminbar esta entrando en conflicto con el menu.
 * ajusta el top del header cuando este el wp adminbar.")
 *
 * A constant offset strands a strip — correct. But `top: 0` puts the fixed
 * header UNDER the bar while the bar is still on screen, and the bar is
 * z-index 99999 against this header's 120, so the bar always paints on top.
 * MEASURED logged in at 390 and 560, homepage, every scroll offset:
 *
 *   ENGLISH   bar at viewport 0..46 at scroll-top; header 0..80.
 *             y0 overlap 46px — document.elementFromPoint at the burger's
 *             centre AND the logo's centre both return #wpadminbar, and a
 *             real (non-forced) click on the burger fails outright. The
 *             mobile menu cannot be opened at scroll-top.
 *   SPANISH   bar at viewport 46..92 at scroll-top; overlap 34px at y0 and
 *             46px from y8 to y46, with both controls covered over that band.
 *
 * The two languages fail on DIFFERENT scroll offsets because the bar is not
 * in the same place in the two states — which is the second finding, below.
 *
 * THE FIX IS A MEASURED OFFSET, NOT A CONSTANT AND NOT A CLASS. The header's
 * top is the admin bar's LIVE bottom edge, so it is 46 (or 92) at scroll-top
 * and reaches 0 at exactly the moment the bar has finished scrolling away —
 * which is the strip-free behaviour the paragraph above asks for, instead of
 * a workaround for it. Trialled and rejected at runtime before shipping:
 *   top:46 constant            -> 46px overlap AND a 46px blank band (the bar
 *                                 is not where the constant assumes).
 *   top:46 dropped on          -> `.is-scrolled` is stamped at scrollY > 8,
 *   `.is-scrolled`                which is 38..84px too early: an 8px dead
 *                                 strip at y8 and 36px of overlap back at y10.
 *                                 Right producer, wrong gate.
 * `--saconnects-bar-offset` is written by the SAME passive, rAF-coalesced
 * scroll listener that already stamps `.is-scrolled` (the `framework-header-
 * shadow` IIFE printed from wp_footer in functions.php) — one extra property
 * on an element it already holds, not a new header-measuring script. CSS
 * cannot observe scroll position, so there is no CSS-only route to this value;
 * `animation-timeline: scroll()` is the only candidate and it is unsupported
 * in the mobile Safari this defect is reported on.
 *
 * THE FALLBACK IS TODAY'S VALUE ON PURPOSE. `var(--…, 0px)` reproduces the
 * shipped `top: 0` exactly, so if the footer script never runs the header is
 * no worse than it is now rather than newly broken somewhere else.
 * ---------------------------------------------------------------------------
 *
 * AND THE BAR ITSELF IS DISPLACED — BUT ONLY WHILE TRANSLATED.
 *
 * Core reserves the strip with `html { margin-top: 46px }` and places the
 * absolute bar in it. GTranslate's cross-origin Google stylesheet
 * (`el_main_css`, gstatic.com/_/translate_http/…) declares
 * `body { position: relative; top: 0 }`, which makes BODY the containing block
 * for the absolute bar — so the bar starts at the body box (document y=46)
 * instead of the initial containing block (y=0), and core's reserved strip is
 * left empty above it.
 *
 * MEASURED, and this is the part that must not be simplified into a constant:
 * that stylesheet's rule only applies WHILE A TRANSLATION IS ACTIVE. Logged in
 * at 390, computed `body` position is `static` with the bar at 0..46 in
 * English, and `relative` with the bar at 46..92 in Spanish. A blanket
 * `top: calc(-1 * 46px)` counter-rule — the obvious fix, and the one the H2
 * recon recommended after measuring only the translated state on this
 * Spanish-locale machine — would therefore push a correctly-placed bar to
 * -46..0 and hide the whole admin bar for every logged-in ENGLISH editor.
 * That is a worse bug than the one being fixed, and only measuring both
 * languages catches it (CLAUDE.md §Navigation: verify with real translated
 * labels, not just English — it cuts both ways).
 *
 * So the counter-shift is measured too, and measured as an ERROR TERM rather
 * than derived from its cause: an absolute admin bar belongs at document y=0,
 * so the listener folds whatever `rect.top + scrollY` reads into
 * `--saconnects-bar-shift` until it reads 0. Untranslated, and on any install
 * without GTranslate, the first pass already reads 0, nothing is written, and
 * this rule is an exact no-op — the dependency cancels itself instead of
 * having to be remembered.
 *
 * WHEN it is measured matters as much as how. GTranslate's stylesheet applies
 * AFTER DOMContentLoaded and after `load`, so a one-shot measurement leaves
 * the bar displaced until the visitor scrolls — the reported bug, just later.
 * The producer therefore re-syncs on the injected stylesheet's own load event
 * (a head childList observer attaches one to every <link> added after it) and
 * on <html> lang/class changes, as well as on scroll, resize and load.
 *
 * Specificity: `#wpadminbar` is (1,0,0), the same weight as core's own
 * `@media (max-width:600px) #wpadminbar{position:absolute;top:0}`. It wins on
 * SOURCE ORDER, measured rather than assumed: in the served logged-in head
 * `admin-bar-css` is the 4th stylesheet and `framework-navigation-inline-css`
 * the 40th. No `!important` is needed and none is used. If that order ever
 * changes the symptom is the bar staying at 46..92 while translated — re-check
 * here before adding weight.
 */
@media screen and (max-width: 600px) {
	#wpadminbar {
		top: calc(-1 * var(--saconnects-bar-shift, 0px));
	}

	header .site-header {
		top: var(--saconnects-bar-offset, 0px);
	}
}

/* =========================================================================
 * 1b. THE BAR'S BACKGROUND  (client, 2026-08-21)
 *
 * "en desktop al inicial el header es transparent. y el sticky es con #132230"
 * — which also answers the open question the header spec left flagged: the
 * comp draws the bar transparent over a hero and never draws a scrolled state,
 * so the sticky background was a guess until now.
 *
 * SOLID IS THE DEFAULT AND TRANSPARENT IS THE EXCEPTION, on purpose. The bar's
 * ink is white and the wordmark is cream + red, so a transparent bar over a
 * light page is an invisible header. Measured: /design-system/ renders ZERO
 * page-hero blocks, so it is exactly that page. Defaulting to transparent and
 * patching the exceptions would ship a broken header on every page nobody
 * remembered to check.
 *
 * The transparent state therefore requires THREE conditions to hold:
 *   - a hero is the first thing in the post content, i.e. there is something
 *     dark behind the bar, and
 *   - the bar has not scrolled away from it, and
 *   - the mobile sheet is CLOSED (client beta, 2026-09-16: opening the menu
 *     at the top of a hero page hung a white sheet from a see-through bar —
 *     the hero ran on behind the logo row while the menu was up; "cuando se
 *     abre el menu en mobile que se aplique el fondo del sticky"). The
 *     `.is-open` cluster lives INSIDE .site-header, so `:has()` reads the
 *     state with no new JS hook — and with JS off the sheet cannot open at
 *     all (nav-drilldown.js's no-JS contract), so the selector can never
 *     disagree with the screen.
 * The moment any of them stops being true, the solid band is already the
 * default and nothing has to be turned back on.
 *
 * The background moved OUT of parts/header.html for this: `backgroundColor`
 * emits `has-contrast-background-color`, and preset colour classes carry
 * `!important` (CLAUDE.md §theme.json rules), so no rule here could ever have
 * beaten it without an !important of its own.
 * ====================================================================== */

header .site-header {
	background-color: var( --wp--preset--color--contrast );
}

body:has(
		.wp-block-post-content > .wp-block-saconnects-page-hero:first-child
	)
	header
	.site-header:not( .is-scrolled ):not(
		:has( .wp-block-saconnects-mega-nav__cluster.is-open )
	) {
	background-color: transparent;
}

/* The contrast scrim rides EXACTLY the transparent state above — one
   condition, two surfaces (§1b's comment block owns the reasoning). */
body:has(
		.wp-block-post-content > .wp-block-saconnects-page-hero:first-child
	)
	header
	.site-header:not( .is-scrolled ):not(
		:has( .wp-block-saconnects-mega-nav__cluster.is-open )
	)::before {
	opacity: 1;
}

/* The swap is a colour change, so it belongs with the bar's other transitions
   OUTSIDE the reduced-motion gate — colour is not motion; see §1. */

/* =========================================================================
 * 1c. PAYING BACK THE FLOW SPACE
 *
 * `position: fixed` takes the bar out of flow, so the page would start
 * underneath it. On a HERO page that is the point — the bar is transparent and
 * the hero is meant to run under it. On every other page it is a bug: the
 * first heading lands behind the bar.
 *
 * So the padding is added on exactly the pages the transparent rule above does
 * NOT match. The two rules are deliberately the same condition, once positive
 * and once negative: a page either has a hero under the bar (transparent bar,
 * no padding) or it does not (solid bar, padding). Writing them as one pair
 * means a third state cannot quietly appear.
 *
 * --wp--custom--header--height is the same token functions.php uses for
 * scroll-padding-top, so the bar's height, the anchor clearance and this
 * offset can never disagree.
 * ====================================================================== */

/*
 * The offset lands on `main`, NOT on `.wp-block-post-content`.
 *
 * On page.html post-content IS main's first child, so the two are the same
 * thing. On single.html, archive.html and index.html it is not: the post date,
 * the title and the featured image (or the archive title) all sit in a wrapper
 * group ABOVE post-content, so a padding on post-content paid the header back
 * halfway down the article and left the lede underneath the bar. Measured on a
 * migrated post at 1280px: the bar ends at y=80 and the date started at y=77 —
 * three pixels behind it (client, 2026-08-23: "el time esta muy pegado al
 * header").
 *
 * It cannot go on those wrapper groups either: they carry an INLINE
 * padding-top from the template's style attribute, which no stylesheet rule
 * can outrank. `main` is the one element in every template that is both above
 * the fold content and free of inline padding.
 */
body:not(
		:has( .wp-block-post-content > .wp-block-saconnects-page-hero:first-child )
	)
	main#main {
	padding-top: var( --wp--custom--header--height );
}

/* The compact sticky lockup. */
@media not all and (max-width: 1365.98px) {
	header .site-header.is-scrolled .wp-block-site-logo {
		width: var(--wp--custom--logo--compact);
	}

	/*
	 * …and the nav link has to yield with it, or the compact state is a no-op.
	 *
	 * `min-height: 80px` above only floors the bar; it cannot shrink a taller
	 * child. The resting link is 46.4px (22.4px line box + 12px block padding
	 * either side), so the scrolled bar computed 25 + 46.4 + 20 = 91.39px — a
	 * 0.6px change from its 92px resting height, i.e. nothing moved. The logo
	 * was never the constraint: it compacts to ~35px via the rule above.
	 *
	 * 6px brings the link to 34.4px, so the content stack is 79.4px and the
	 * 80px floor is what finally sets the height. The target stays 34.4px tall,
	 * comfortably over the 24px WCAG 2.5.8 minimum — the resting 12px was
	 * chosen to fill the 47px content box, not to reach that floor.
	 */
	header .site-header.is-scrolled .wp-block-saconnects-mega-nav__link {
		padding-block: 6px;
	}
}

/*
 * The compact state's two CHILD participants ride the bar's clock (§1 owns
 * the reasoning). Size is motion, so both sit behind the gate — reduced-motion
 * users get the same instant swap as before, logo and bar together.
 *
 * `width` rather than a transform on purpose: the logo's box height is part of
 * what sets the bar's height (the 80px compact bar only computes because the
 * lockup really shrinks to ~35px tall), and a scale() leaves the layout box at
 * full size — the bar would stop compacting. It is one small image, so the
 * per-frame reflow is confined to the header row.
 *
 * Desktop band only, matching the compact rules above: below 1366px nothing
 * here changes on scroll. Known trade-off: a live window resize also eases the
 * vw-driven clamp by 0.35s instead of tracking the edge — the bar's own
 * min-height/padding already behave that way.
 */
/* Two NESTED queries, not one: a leading `not` negates the ENTIRE query list
   entry, so `not all and (max-width) and (prefers-reduced-motion)` would also
   match reduced-motion desktops and every narrow screen. */
@media not all and (max-width: 1365.98px) {
	@media (prefers-reduced-motion: no-preference) {
		header .site-header .wp-block-site-logo {
			transition: width var(--saconnects-header-duration) var(--saconnects-header-ease);
		}

		header .site-header .wp-block-saconnects-mega-nav__link {
			transition: padding-block var(--saconnects-header-duration) var(--saconnects-header-ease);
		}
	}
}

/**
 * TRANSLATED LABELS. GTranslate rewrites <html lang> away from the site
 * default (transiently to "auto"), which is the zero-JS hook CLAUDE.md
 * §Navigation ships: es/fr/de labels run 20–35% longer than the English the
 * bar was measured against, and the fixed part of the row (logo + 12 + 21 +
 * 12 + 38) already eats 398px of the 1320px content box. Same slope, intercept
 * dropped 80px, so the logo yields the width the labels need at every desktop
 * size instead of the row wrapping.
 *
 * This is INERT until a translation plugin is installed (the selector cannot
 * match while <html lang> is the site default), and it must be verified with
 * real translated labels — the brand font has not been delivered, so today's
 * fallback stack measures differently from what will ship.
 */
html:not([lang="en-US"], [lang="auto"]) header .site-header .wp-block-site-logo {
	width: clamp(
		var(--wp--custom--logo--compact),
		calc(11.756vw + 65.72px),
		var(--wp--custom--logo--header)
	);
}

/* =========================================================================
 * 3. HEADER ROW
 *
 * The bar is a gutter-padded FULL-WIDTH row whose content is capped at the
 * 1320px container (1440 − 2×60). The cap comes from the outer group's
 * constrained layout in parts/header.html; this only stops the flex row from
 * wrapping when a translated label grows, and gives the two items — the logo
 * and the mega-nav block — their nowrap/space-between geometry.
 * ====================================================================== */

header .site-header > .wp-block-group > .wp-block-group {
	align-items: center;
}

header .site-header .wp-block-saconnects-mega-nav {
	flex: 0 1 auto;
	min-width: 0;
	/* The row is justify-content:space-between with TWO children, so the
	   cluster is pinned right — but only while both exist. core/site-logo
	   renders NOTHING until a logo is uploaded, and with one child
	   space-between left-aligns it (measured on this install, which has no
	   logo set yet: the seven-item row started at x=60 instead of ending at
	   x=1380). An auto start margin pins the cluster right either way. */
	margin-inline-start: auto;
}

/* =========================================================================
 * 5. FOOTER  (dark bands only)
 *
 * Link columns rest on the onDark.link token and whiten on hover/focus;
 * the legal bar and address block ride on-dark muted/text because low
 * mockup grays fail small-text AA on a dark footer. Direct rules on the
 * link content beat the nav block's inherited textColor deterministically.
 *
 * GATED behind a dark ancestor — `.footer--dark` (explicit opt-in) or the
 * `.has-contrast-background-color` band class core emits — so a LIGHT
 * footer is never fought. The seed shipped these ungated, and ASRI (light
 * footer) had to delete them: they painted cream on a light band AND made
 * core/navigation unusable in the footer, because at (0,3,0) on the <a>
 * nothing expressible in block markup can beat them. `:is()` takes the
 * specificity of its most specific argument — (0,1,0) — so the gate adds
 * exactly one class to each weight.
 * ====================================================================== */

footer :is(.footer--dark, .has-contrast-background-color) .wp-block-navigation .wp-block-navigation-item__content {
	color: var(--wp--custom--on-dark--link);
}

footer :is(.footer--dark, .has-contrast-background-color) .wp-block-navigation .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--white);
}

/**
 * Footer bottom bar (.footer-legal) and address block (.footer-address):
 * per conventions the legal links ride on-dark muted and lift to on-dark
 * text on hover/focus. Address links carry on-dark text emphasis and
 * whiten on hover.
 */
footer :is(.footer--dark, .has-contrast-background-color) .footer-legal a {
	color: var(--wp--custom--on-dark--muted);
	text-decoration: none;
}

footer :is(.footer--dark, .has-contrast-background-color) .footer-legal a:hover {
	color: var(--wp--custom--on-dark--text);
}

footer :is(.footer--dark, .has-contrast-background-color) .footer-address a {
	color: var(--wp--custom--on-dark--text);
	font-weight: 600;
	text-decoration: none;
}

footer :is(.footer--dark, .has-contrast-background-color) .footer-address a:hover {
	color: var(--wp--preset--color--white);
}

/**
 * Footer text-link target padding (ASRI sign-off D4): +3px of vertical
 * padding on every footer text link inside a paragraph (address mailto/tel
 * links, legal-band policy links). Scoped to `p a` on purpose: buttons and
 * social anchors are NOT inside paragraphs and carry their own geometry.
 * The anchors are INLINE, and that is what makes this free: vertical
 * padding on an inline box paints and hit-tests but contributes nothing to
 * line-box height, so the footer's rendered height is unchanged.
 */
footer .footer-legal p a,
footer .footer-address a {
	padding-block: 3px;
}
