/* base.css — shared foundation (SPEC §2, §4, §3.3). Static first: every animation start state lives under
   html.motion only. Page-specific rules go in assets/home.css and assets/servicios.css (one owner each). */

/* ---------- Bricolage Grotesque, self-hosted (latin, variable opsz 12-96 + wght 200-800). The same file is preloaded
   in both pages, so every browser (iOS included) uses the preload. Spanish fits the latin subset. ---------- */
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Instrument Serif italic 400 and JetBrains Mono 500, self-hosted (latin subset, @fontsource 5.3.0, OFL). ---------- */
@font-face {
  font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/instrument-serif-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/jetbrains-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Metric fallbacks (CLS 0). Measured 2026-10-23 (headless Chromium, Liberation = Arial / Times metrics):
   size-adjust = real width / fallback width per weight band; ascent/descent = font metric (930/270, Instrument 990/310)
   divided by size-adjust. Arial is first; Liberation is its metric twin on Linux. ---------- */
@font-face { font-family: "Bricolage Fallback"; font-weight: 100 549; src: local("Arial"), local("ArialMT"), local("Liberation Sans"); size-adjust: 103.6%; ascent-override: 89.8%; descent-override: 26.1%; line-gap-override: 0%; }
@font-face { font-family: "Bricolage Fallback"; font-weight: 550 679; src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"); size-adjust: 96%; ascent-override: 96.9%; descent-override: 28.1%; line-gap-override: 0%; }
@font-face { font-family: "Bricolage Fallback"; font-weight: 680 900; src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"); size-adjust: 89.4%; ascent-override: 104%; descent-override: 30.2%; line-gap-override: 0%; }
@font-face { font-family: "Instrument Fallback"; font-style: italic; src: local("Times New Roman Italic"), local("TimesNewRomanPS-ItalicMT"), local("Liberation Serif Italic"); size-adjust: 90.6%; ascent-override: 109.3%; descent-override: 34.2%; line-gap-override: 0%; }
@font-face { font-family: "JetBrains Fallback"; src: local("Courier New"); size-adjust: 100%; ascent-override: 102%; descent-override: 30%; }

/* ---------- Tokens: light ---------- */
:root {
  color-scheme: light;
  --paper: #F4F2EC; --ink: #0E0E0C; --ink-2: #4C4A45; --field: #77736B;
  --solved: #EB4614; --solved-ink: #B3300C; --on-solved: #0E0E0C;
  --void: #07070A; --star: #F4F1EA; --star-2: #9C988F;
  --shadow-1: 0 1px 2px rgb(14 14 12 / .06), 0 2px 8px rgb(14 14 12 / .06);
  --shadow-2: 0 12px 40px -12px rgb(14 14 12 / .22);
  --elev-border: transparent;

  --f-sans: "Bricolage Grotesque", "Bricolage Fallback", system-ui, sans-serif;
  --f-serif: "Instrument Serif", "Instrument Fallback", Georgia, serif;
  --f-mono: "JetBrains Mono", "JetBrains Fallback", ui-monospace, monospace;
  --t-display: clamp(2.75rem, 10vw, 9.5rem);
  --t-h2: clamp(2rem, 1.2rem + 3.6vw, 4.5rem);
  --t-statement: clamp(1.75rem, 1rem + 3.4vw, 4rem);
  --t-h3: clamp(1.5rem, 1.1rem + 1.8vw, 2.5rem);
  --t-lead: clamp(1.125rem, 1rem + .6vw, 1.375rem);
  --t-body: clamp(1rem, .95rem + .3vw, 1.125rem);
  --t-mono: .8125rem;
  --t-numeral: clamp(6rem, 22vw, 16rem);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;
  --gutter: clamp(16px, 4vw, 56px);
  --section-y: clamp(64px, 10vw, 160px);
  --content: 1280px; --wide: 1600px; --bar-h: 64px;

  --r-xs: 4px; --r-s: 10px; --r-m: 16px; --r-l: 28px; --r-bubble: 18px; --r-pill: 999px;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --d-micro: 120ms; --d-ui: 200ms; --d-reveal: 600ms; --d-stagger: 80ms; --d-word: 40ms; --d-type: 28ms; --d-pulse: 3000ms;
}
/* Dark: same block twice (system preference unless forced light; and forced dark). Keep both in sync. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0B0B0F; --ink: #F1EEE6; --ink-2: #A7A39A; --field: #7A766D;
    --solved: #FF6A3D; --solved-ink: #FF8A66;
    --shadow-1: none; --shadow-2: none; --elev-border: color-mix(in oklab, var(--ink) 14%, transparent);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0B0B0F; --ink: #F1EEE6; --ink-2: #A7A39A; --field: #7A766D;
  --solved: #FF6A3D; --solved-ink: #FF8A66;
  --shadow-1: none; --shadow-2: none; --elev-border: color-mix(in oklab, var(--ink) 14%, transparent);
}
/* Night stage: identical in both themes. Components need no variants. */
[data-stage="void"], .bar[data-on-void] {
  color-scheme: dark;
  --paper: var(--void); --ink: var(--star); --ink-2: var(--star-2); --field: #7A766D;
  --solved: #FF6A3D; --solved-ink: #FF8A66; --focus: var(--star);
  --shadow-1: none; --shadow-2: none; --elev-border: color-mix(in oklab, var(--ink) 14%, transparent);
}
/* Derived tokens are re-declared wherever their inputs change, so var() resolves locally. */
:root, [data-stage="void"], .bar[data-on-void] {
  --rule: color-mix(in oklab, var(--ink) 12%, transparent);
  --surface: color-mix(in oklab, var(--ink) 4%, var(--paper));
  --surface-2: color-mix(in oklab, var(--ink) 8%, var(--paper));
}
:root { --focus: var(--solved-ink); }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  background: var(--paper); overflow-x: clip; scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; hyphens: manual;
}
body {
  min-height: 100svh; background: var(--paper); color: var(--ink);
  font-family: var(--f-sans); font-size: var(--t-body); line-height: 1.5; font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg, canvas, video { display: block; max-width: 100%; }
svg { overflow: visible; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul[role="list"], ol[role="list"], .list-reset { list-style: none; padding: 0; }
h1, h2, h3, h4 { font-weight: 650; line-height: 1.05; text-wrap: balance; overflow-wrap: break-word; }
p, li, figcaption, dd { text-wrap: pretty; }
[hidden] { display: none !important; }
/* SplitText pieces (SPEC §3.6): inline-block so transforms apply; no will-change. */
.w, .c { display: inline-block; }
[data-stage="void"] { background: var(--paper); color: var(--ink); }

/* Lenis 1.1.14 dist/lenis.css, inlined (SPEC §9.1) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- Typography ---------- */
.t-display { font-size: var(--t-display); line-height: .92; letter-spacing: -.04em; font-weight: 700; font-variation-settings: "opsz" 96; }
.t-h2 { font-size: var(--t-h2); line-height: 1; letter-spacing: -.03em; font-weight: 650; }
.t-statement { font-size: var(--t-statement); line-height: 1.08; letter-spacing: -.02em; font-weight: 550; }
.t-h3 { font-size: var(--t-h3); line-height: 1.1; letter-spacing: -.02em; font-weight: 650; }
.t-lead { font-size: var(--t-lead); line-height: 1.45; }
.t-body { font-size: var(--t-body); line-height: 1.5; }
.kicker, .t-mono {
  font-family: var(--f-mono); font-size: var(--t-mono); line-height: 1.3; letter-spacing: .08em; font-weight: 500;
  text-transform: uppercase; font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.t-numeral {
  font-size: var(--t-numeral); line-height: .85; font-weight: 700; letter-spacing: -.04em;
  color: transparent; -webkit-text-stroke: 1.5px var(--ink);
}
em, .em { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
.measure { max-width: 36ch; } .measure-wide { max-width: 60ch; }
.sub { color: var(--ink-2); }
.solved { color: var(--solved); }

/* Body links: underline 1px, 2px solid-ink on hover/focus */
a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover, a:focus-visible { text-decoration-thickness: 2px; text-decoration-color: var(--solved-ink); }
a:not([class]) { transition: text-decoration-color var(--d-micro) var(--ease); }

/* ---------- Focus (never removed) ---------- */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; top: var(--s-2); left: var(--s-2); z-index: 100; padding: var(--s-3) var(--s-4);
  background: var(--ink); color: var(--paper); border-radius: var(--r-s); font-weight: 600; text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus-visible { transform: none; }

/* ---------- Layout primitives ---------- */
.wrap { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--wide { max-width: calc(var(--wide) + 2 * var(--gutter)); }
.section { padding-block: var(--section-y); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gutter); }
.grid > * { grid-column: 1 / -1; min-width: 0; }
.stack > * + * { margin-top: var(--stack, var(--s-5)); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); align-items: center; }
.rule-top { border-top: 1px solid var(--rule); }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); } }

/* ---------- Stacking contract (SPEC §2.4): cosmos canvas 0, content 1, S4 indicator 5, bar 50, menu 60, skip 100.
   Section backgrounds paint below the canvas; section children sit above it. A pinned section becomes
   transparent and its background moves to the .pin-spacer GSAP wraps it in. ---------- */
.cosmos { position: fixed; top: 0; left: 0; width: 100%; height: 100lvh; z-index: 0; pointer-events: none; }
html:not(.motion) .cosmos { display: none; }
main > section > *, main > .section > *, .site-footer > * { position: relative; z-index: 1; }
.motion .pin-spacer { background: var(--paper); }
.motion .pin-spacer:has(> [data-stage="void"]) { background: var(--void); }
.motion .pin-spacer > * { z-index: 1; background: transparent !important; }
/* consecutive night blocks (hero, impacto, mientras, cierre, footer) meet at fractional svh heights: some engines
   (Safari) leave a 1px seam where the paper body shows as a thin grey line. Each night block bleeds 2px of night
   under the next one; the next block paints over it, so nothing changes where they already meet cleanly.
   Only where the next block is night too (never over a paper section or footer). */
:is(.motion .pin-spacer:has(> [data-stage="void"]), main > [data-stage="void"], .dusk):has(+ [data-stage="void"], + .pin-spacer > [data-stage="void"], + .dawn) { box-shadow: 0 2px 0 var(--void); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  --btn-px: var(--s-5); min-height: 48px; padding: 0 var(--btn-px); border-radius: var(--r-pill);
  font-weight: 600; font-size: 1rem; line-height: 1.1; text-decoration: none; white-space: nowrap;
  border: 1.5px solid var(--field); color: var(--ink); background: transparent;
  transition: transform var(--d-micro) var(--ease), background-color var(--d-micro) var(--ease), border-color var(--d-micro) var(--ease);
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn--solved { background: var(--solved); border-color: var(--solved); color: var(--on-solved); }
.btn--solved:hover { border-color: var(--solved); }
.btn--ghost { border-color: var(--field); }
.btn--xl { --btn-px: var(--s-6); min-height: 56px; font-size: 1.0625rem; }
.btn--block { width: 100%; }
/* Arrow icon (replaces the → glyph). .ico: the arrow in a round badge at the end of a button; .arrow: bare, inline. */
.ico svg, svg.arrow { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.arrow { display: inline-block; vertical-align: -.125em; transition: transform var(--d-micro) var(--ease); }
.arrow--down, .ico--down svg { transform: rotate(90deg); }
.ico {
  display: inline-grid; place-items: center; flex: none; width: 2em; height: 2em; margin-right: calc(12px - var(--btn-px, 0px));
  border-radius: 50%; font-size: .875em; background: var(--ink); color: var(--paper);
  transition: background-color var(--d-micro) var(--ease), color var(--d-micro) var(--ease);
}
.ico svg { transition: transform var(--d-micro) var(--ease); }
.btn--solved .ico { background: color-mix(in srgb, var(--on-solved) 14%, transparent); color: var(--on-solved); }
.btn--xl .ico { margin-right: calc(14px - var(--btn-px)); font-size: .95em; }
.btn:hover .ico svg, .btn:focus-visible .ico svg, a:hover > svg.arrow, a:focus-visible > svg.arrow { transform: translateX(3px); }
.btn:hover .ico--down svg, .btn:focus-visible .ico--down svg { transform: rotate(90deg) translateX(3px); }
.btn--solved:hover .ico, .btn--solved:focus-visible .ico { background: var(--on-solved); color: var(--solved); }
/* Outline: the secondary action next to a solid CTA, or alone (panel links); the badge turns «solved» on hover */
.btn--outline { border-color: color-mix(in srgb, var(--ink) 35%, transparent); background: transparent; color: var(--ink); }
.btn--outline:hover, .btn--outline:focus-visible { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.btn--outline:hover .ico, .btn--outline:focus-visible .ico { background: var(--solved); color: var(--on-solved); }
.btn:focus-visible { outline-offset: 4px; }

/* Chips (index nav + radio chips share the box; selection = ink fill + ✓, never color alone) */
.chip {
  position: relative; display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-4); border-radius: var(--r-pill);
  border: 1.5px solid var(--field); font-size: .9375rem; line-height: 1; text-decoration: none; white-space: nowrap;
  transition: background-color var(--d-ui) var(--ease), color var(--d-ui) var(--ease);
}
.chip[aria-current="true"], .chip[aria-pressed="true"], .chip:has(:checked) { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip[aria-current="true"]::before, .chip[aria-pressed="true"]::before, .chip:has(:checked)::before { content: "✓"; }
.chip > input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip:has(:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------- Glyph: star (one star = one problem; off = unsolved, on = solved) ---------- */
.star { width: var(--star-size, 12px); height: var(--star-size, 12px); color: var(--star-off, var(--field)); flex: none; }
[data-stage="void"] { --star-off: var(--star-2); }
.star circle { fill: transparent; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; transition: fill var(--d-ui) var(--ease), stroke var(--d-ui) var(--ease); }
.star .star__glow { display: none; }
.star.is-on { color: var(--solved); }
.star.is-on circle { fill: var(--solved); stroke: var(--solved); }
.star.is-on .star__glow { display: block; opacity: .25; stroke: none; }
.motion .pulse { animation: pulse var(--d-pulse) ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }

/* ---------- Bar (SPEC §4.1) ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: var(--bar-h); color: var(--ink);
  background: var(--paper);   /* solid: at 85 % the light sections (cards, demos) read through it */
  border-bottom: 1px solid var(--rule); box-shadow: var(--shadow-2);
  transition: transform var(--d-ui) var(--ease), background-color var(--d-ui) var(--ease);
}
/* over the night the bar takes the night colour (--paper is --void here), never transparent: text scrolls under it */
.bar[data-on-void] { background: var(--paper); border-bottom-color: transparent; box-shadow: none; }
.motion .bar[data-hidden] { transform: translateY(-100%); }
.bar__in { display: flex; align-items: center; gap: var(--s-1); height: 100%; }
.bar__brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; letter-spacing: -.04em; font-size: clamp(1.125rem, .9rem + 1vw, 1.375rem); text-decoration: none; margin-right: auto; padding-block: var(--s-2); }
.bar nav { display: flex; align-items: center; }
.bar__links { display: none; list-style: none; padding: 0; gap: var(--s-1); }
.bar__links a, .bar__menu summary, .bar__menu a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-3);
  text-decoration: none; font-size: .9375rem; font-weight: 500; border-radius: var(--r-pill);
}
.bar__links a:hover, .bar__links a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--solved-ink); text-decoration-thickness: 2px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-width: 44px; min-height: 44px; border-radius: var(--r-pill); color: inherit;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.bar__pause .ico-play { display: none; }
.bar__pause[aria-pressed="true"] .ico-pause { display: none; }
.bar__pause[aria-pressed="true"] .ico-play { display: block; }
.bar__pause-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bar__theme { display: none; }
.bar__cta { --btn-px: var(--s-3); min-height: 44px; gap: var(--s-2); font-size: .9375rem; }
.bar__cta .long { display: none; }
.bar__progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--solved);
  transform: scaleX(0); transform-origin: 0 50%;
}
html:not(.motion) .bar__progress { display: none; }

.bar__menu { position: static; }
.bar__menu summary { list-style: none; cursor: pointer; }
.bar__menu summary::-webkit-details-marker { display: none; }
.bar__menu[open] summary { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--solved-ink); }
.bar__menu-panel {
  position: absolute; top: var(--bar-h); left: 0; right: 0; z-index: 60;
  background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--rule); box-shadow: var(--shadow-2);
  padding: var(--s-3) var(--gutter) var(--s-5);
}
.bar__menu-panel ul { list-style: none; padding: 0; }
.bar__menu-panel a, .bar__menu-panel .icon-btn { width: 100%; justify-content: flex-start; font-size: 1.125rem; min-height: 48px; padding: 0; }

@media (min-width: 768px) {
  .bar__in { gap: var(--s-3); }
  .bar__cta { --btn-px: var(--s-4); }
  .bar__links { display: flex; }
  .bar__menu { display: none; }
  .bar__theme { display: inline-flex; }
}
@media (min-width: 1280px) {
  .bar__cta .long { display: inline; }
  .bar__cta .short { display: none; }
  .bar__pause { padding-inline: var(--s-3); }
  .bar__pause-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; font-size: .875rem; }
}

/* ---------- Footer (SPEC §4.2) ---------- */
.site-footer { padding-block: clamp(24px, 3vw, 48px) var(--s-6); overflow-x: clip; }
.site-footer .wrap { max-width: calc(var(--wide) + 2 * var(--gutter)); }
.footer__mark {
  display: block; font-weight: 700; letter-spacing: -.04em; line-height: .9; white-space: nowrap;
  font-size: min(clamp(2.75rem, 1rem + 6.5vw, 6.5rem), calc((100vw - 2 * var(--gutter)) / (var(--brand-len, 9) * .62 + 1.5)));
}
.footer__tag { margin-top: var(--s-4); color: var(--ink-2); font-size: var(--t-lead); }
.footer__nav ul { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-4); margin-top: var(--s-5); }
.footer__nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--f-mono); font-size: var(--t-mono); letter-spacing: .08em; text-transform: uppercase;
}
.footer__nav a[aria-disabled="true"] { color: var(--ink-2); text-decoration: none; cursor: default; }
.footer__legal { margin-top: var(--s-5); color: var(--ink-2); font-size: .875rem; }
@media (min-width: 768px) {
  .footer__nav ul { display: flex; flex-wrap: wrap; gap: 0 var(--s-6); }
}
@media (min-width: 1280px) {
  /* 8/4 grid; the wordmark spans the full row because its size formula assumes the full content width */
  .footer__grid { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); column-gap: var(--gutter); align-items: end; }
  .footer__brand { display: contents; }
  .footer__mark { grid-column: 1 / -1; }
  .footer__nav ul { margin-top: 0; justify-content: flex-end; }
}

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

/* nudge.js Big Bang (motion + fine pointer only): flash and shock rings, created and removed on the fly */
.bang { position: fixed; z-index: 1; border-radius: 50%; pointer-events: none; will-change: transform, opacity; }
.bang--flash { background: radial-gradient(circle, currentColor 0, color-mix(in srgb, currentColor 55%, transparent) 22%, color-mix(in srgb, currentColor 15%, transparent) 45%, transparent 70%); }
.bang--ring { border: 1.5px solid currentColor; box-shadow: 0 0 18px color-mix(in srgb, currentColor 35%, transparent), inset 0 0 18px color-mix(in srgb, currentColor 25%, transparent); }

/* ---------- Theme toggle: the icon names the current theme ---------- */
[data-theme-toggle] .ti { display: none; }
[data-theme-toggle]:not([data-state]) .ti--auto, [data-theme-toggle][data-state="auto"] .ti--auto,
[data-theme-toggle][data-state="light"] .ti--light, [data-theme-toggle][data-state="dark"] .ti--dark { display: block; }
.motion [data-theme-toggle][data-state] .ti { animation: ti-in .35s var(--ease); }
@keyframes ti-in { from { transform: rotate(-60deg) scale(.6); opacity: 0; } }

/* ---------- Back to top: a little constellation, not a button-looking button ---------- */
.to-top {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 40;
  width: 48px; height: 60px; padding: 4px; color: #fff; mix-blend-mode: difference;   /* visible on night and on paper */
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity var(--d-ui) var(--ease), transform var(--d-ui) var(--ease), visibility 0s linear var(--d-ui);
}
.to-top.is-shown { opacity: .8; visibility: visible; transform: none; transition-delay: 0s; }
.to-top:hover, .to-top:focus-visible { opacity: 1; }
.to-top svg { width: 100%; height: 100%; overflow: visible; }
.to-top circle { fill: currentColor; }
.to-top__lines { fill: none; stroke: currentColor; stroke-width: .9; stroke-linecap: round; stroke-linejoin: round; opacity: .45;
  stroke-dasharray: 120; stroke-dashoffset: 0; transition: opacity var(--d-ui) var(--ease); }
.to-top:hover .to-top__lines, .to-top:focus-visible .to-top__lines { opacity: .9; }
.to-top:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-s); mix-blend-mode: normal; color: var(--ink); }
.motion .to-top svg { animation: to-top-float 2.6s var(--ease) infinite; }
.motion .to-top__lead { transform-box: fill-box; transform-origin: center; animation: to-top-lead 2.6s ease-in-out infinite; }
.motion .to-top:hover svg { animation-duration: 1.1s; }
@keyframes to-top-float { 0%, 100% { transform: translateY(3px); } 50% { transform: translateY(-4px); } }
@keyframes to-top-lead { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.45); opacity: 1; } }
.motion .to-top__trail { animation: to-top-trail 2.6s ease-in-out infinite; }
@keyframes to-top-trail { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@media print { .to-top { display: none; } }

/* ---------- Brand mark (assets/brand/haznova-simbolo.svg): before the name in the bar, larger in the footer ---------- */
.bar__brand { display: inline-flex; align-items: center; gap: .4em; }
.footer__mark { display: flex; align-items: center; gap: .3em; }
.brand-mark { display: block; flex: none; height: .8em; width: auto; } /* ~ cap height of the wordmark: icon and name read as one line */
@media (max-width: 420px) { .bar__brand { gap: .3em; letter-spacing: -.05em; } }
/* under 375px the name does not fit next to Menú/pausa/Contacto: the symbol alone, the name stays for screen readers */
@media (max-width: 374px) { .bar__brand span[data-brand] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .bar__brand .brand-mark { height: 1.1em; } }
@media (min-width: 375px) { .bar__brand { flex-shrink: 0; } }

/* ---------- Language selector (ADR 0005): ES · CA · EN in the bar (from 768px), in the mobile menu and in the footer ---------- */
.lang { display: inline-flex; align-items: center; }
.lang a {
  position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 44px; padding: 0 var(--s-1);
  font-size: .8125rem; font-weight: 600; letter-spacing: .06em; text-decoration: none; color: var(--ink-2);
}
/* The "·" sits in the gap BEFORE the link, outside its box: out of flow, it takes neither the aria-current underline,
   nor the focus ring, nor clicks (pointer-events: none lets them fall on the group). */
.lang a + a { margin-left: calc(var(--s-1) * 2); }
.lang a + a::before {
  content: "·"; position: absolute; top: 0; bottom: 0; left: calc(var(--s-1) * -2); width: calc(var(--s-1) * 2);
  display: flex; align-items: center; justify-content: center; color: var(--ink-2); font-weight: 400; pointer-events: none;
}
.lang a:hover { color: var(--ink); }
.lang a[aria-current="true"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--solved-ink); text-decoration-thickness: 2px; text-underline-offset: .3em; }
.lang a:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-radius: var(--r-s); }
.bar__lang { display: none; }
.bar__menu-panel .lang a { width: auto; min-height: 48px; padding: 0 var(--s-1); font-size: 1.125rem; }
.bar__menu-panel .lang a:first-child { padding-left: 0; }
.footer__nav .lang a { font-size: var(--t-mono); letter-spacing: .08em; }
@media (min-width: 768px) { .bar__lang { display: inline-flex; } }
.bar__links a { white-space: nowrap; }
@media (min-width: 768px) and (max-width: 1023px) {
  .bar__in { gap: var(--s-1); }
  .bar__links { gap: 0; }
  .bar__links a { padding: 0 var(--s-2); }
  .bar__lang a { min-width: 28px; }
  .bar__cta { --btn-px: var(--s-3); }
}
/* 768-899px: no room for four things next to the selector; the "Contacto" link goes (the button next to it says the same) */
@media (min-width: 768px) and (max-width: 899px) { .bar__links li:last-child { display: none; } }
