/* ============ Family header · pixel.ceo + code.pixel.ceo ============
   One bar, one panel, one behaviour. Only the lockup and the panel content change.
   Every rule lives under .fh (prefix .fh-), no dependencies, no inline styles: CSP-safe.
   Sites map their palette to the --fh-* tokens (see README). Defaults = family dark.
   Motion: transform + opacity only, ease-out, keyboard = instant, reduced motion = fade.
   Direction: logical properties throughout, so dir="rtl" mirrors the bar; the logos keep
   their own left-to-right drawing. */

:where(.fh) {
  --fh-font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --fh-wordmark-font: "Space Grotesk", Inter, ui-sans-serif, sans-serif;
  --fh-codeword-font: Geist, Inter, ui-sans-serif, sans-serif;
  --fh-badge-font: Silkscreen, ui-monospace, monospace;
  --fh-ink: #F2F0FF;
  --fh-muted: #B9B4CF;
  --fh-dim: #8F8AAD;
  --fh-glass: rgba(27, 25, 46, 0.74);
  --fh-glass-strong: rgba(21, 19, 38, 0.94);
  --fh-line: rgba(255, 255, 255, 0.1);
  --fh-hover: rgba(255, 255, 255, 0.08);
  --fh-accent: #6A3DF0;
  --fh-accent-hover: #7A52F5;
  --fh-on-accent: #FFFFFF;
  --fh-accent-soft: rgba(139, 108, 255, 0.12);
  --fh-accent-line: rgba(139, 108, 255, 0.4);
  --fh-accent-text: #A994FF;
  --fh-focus: #8B6CFF;
  --fh-shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.7);
  --fh-blur: 18px;
  /* radii: pixel.ceo's soft corners, the same in BOTH sites (decision 2026-10-14) */
  --fh-r-bar: 14px;
  --fh-r-panel: 16px;
  --fh-r-ctl: 9px;
  --fh-r-cta: 999px;
  --fh-top: 10px;
  --fh-gutter: 16px;
  --fh-max: 1200px;
  --fh-bar-h: 58px;
  --fh-panel-w: 560px;
  --fh-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --fh-t: 200ms;
}

/* ---- frame ---- */
.fh { position: fixed; top: var(--fh-top); inset-inline: 0; z-index: 80; pointer-events: none; font-family: var(--fh-font); color: var(--fh-ink); -webkit-font-smoothing: antialiased; }
.fh.fh--sticky { position: sticky; }
.fh *, .fh *::before, .fh *::after { box-sizing: border-box; }
.fh a, .fh a:hover { text-decoration: none; }
.fh p { margin: 0; }
.fh .fh-sr { position: absolute; 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; }
.fh .fh-bar, .fh .fh-panel {
  pointer-events: auto; width: min(var(--fh-max), 100% - 2 * var(--fh-gutter)); margin-inline: auto;
  background: var(--fh-glass); border: 1px solid var(--fh-line); box-shadow: var(--fh-shadow);
  -webkit-backdrop-filter: blur(var(--fh-blur)) saturate(150%); backdrop-filter: blur(var(--fh-blur)) saturate(150%);
}
.fh .fh-bar { position: relative; min-height: var(--fh-bar-h); padding-block: 6px; padding-inline: 14px 7px; display: flex; align-items: center; gap: 4px; border-radius: var(--fh-r-bar); }

/* focus: always visible, never relies on a site token */
.fh a:focus-visible, .fh button:focus-visible { outline: 2px solid var(--fh-focus); outline-offset: 2px; }
.fh a:focus:not(:focus-visible), .fh button:focus:not(:focus-visible) { outline: none; }

/* ---- lockups ---- */
.fh .fh-brand { position: relative; flex: none; display: inline-flex; align-items: center; min-height: 44px; color: var(--fh-ink); border-radius: var(--fh-r-ctl); }
.fh .fh-px { display: block; shape-rendering: crispEdges; image-rendering: pixelated; }
/* Code: P / code (the P keeps its 12-unit pitch at 3 px, as pixelcode-p.svg; crisp like the Moño) */
.fh .fh-brand--code { gap: 0; padding-inline-end: 2px; direction: ltr; }
.fh .fh-p { display: block; flex: none; line-height: 0; color: var(--fh-ink); }
.fh .fh-sl { flex: none; width: 1px; height: 20px; margin: 0 9px; background: currentColor; opacity: 0.28; transform: skewX(-14deg); }
.fh .fh-codeword { font: 600 27px/1 var(--fh-codeword-font); letter-spacing: -0.035em; white-space: nowrap; transform: translateY(-1px); }
/* CEO: the Moño. Rest = the official tile; the bow unfolds «pixel▪ceo» (family-header.js) */
.fh .fh-brand--ceo { min-width: 44px; }
.fh .fh-tile { display: flex; align-items: center; position: absolute; inset-block: 0; inset-inline-start: 0; line-height: 0; pointer-events: none; }
.fh .fh-word { direction: ltr; unicode-bidi: isolate; display: inline-flex; align-items: baseline; font: 600 19px/1 var(--fh-wordmark-font); letter-spacing: -0.025em; white-space: nowrap; }
.fh .fh-dot { display: inline-flex; align-items: center; align-self: stretch; margin-block: 0; margin-inline: 2px 3px; line-height: 0; }
.fh .fh-dot .fh-px { transform: translateY(1px); }
.fh .fh-word--anim .fh-l { display: inline-block; }
.fh .fh-k0 { --fh-k: 0; } .fh .fh-k1 { --fh-k: 1; } .fh .fh-k2 { --fh-k: 2; } .fh .fh-k3 { --fh-k: 3; } .fh .fh-k4 { --fh-k: 4; }
.fh .fh-brand--ceo .fh-l, .fh .fh-brand--ceo .fh-dot, .fh .fh-brand--ceo .fh-tile {
  transition-property: transform, opacity; transition-duration: 620ms; transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
/* open (the name): the icon waits folded inside the bow */
.fh .fh-brand--ceo .fh-l { transition-duration: 620ms, 420ms; transition-delay: calc(140ms + var(--fh-k) * 30ms); }
.fh .fh-brand--ceo .fh-tile { opacity: 0; transform: translateX(var(--fh-bdx, 40px)) scale(0.56); transition-delay: 0ms; }
/* closed (the icon): letters slide into the bow, the bow grows into the tile */
.fh .fh-brand--ceo.is-closed .fh-l { opacity: 0; transform: translateX(var(--fh-dx, 0px)) scale(0.2); transition-duration: 540ms, calc(240ms + var(--fh-k) * 70ms); transition-delay: calc(var(--fh-k) * 25ms); }
.fh .fh-brand--ceo.is-closed .fh-dot { opacity: 0; transform: translateX(calc(var(--fh-bdx, 40px) * -1)) scale(1.78); transition-delay: 160ms; }
.fh .fh-brand--ceo.is-closed .fh-tile { opacity: 1; transform: none; transition-delay: 160ms; }
/* badge (optional site readout, CEO: «PL 01 HALL»): hugs the lockup, slides over the folded name */
.fh .fh-badge {
  display: none; flex: none; align-items: center; gap: 6px; height: 20px; margin-inline-start: 8px; padding-inline-start: 12px;
  border-inline-start: 1px solid var(--fh-line); font: 400 10px/1 var(--fh-badge-font); color: var(--fh-dim); white-space: nowrap; pointer-events: none;
  transition: transform 620ms cubic-bezier(0.22, 1, 0.36, 1) 60ms;
}
.fh .fh-brand--ceo.is-closed ~ .fh-badge { transform: translateX(var(--fh-fdx, 0px)); transition-delay: 200ms; }
/* a readout like a logo: its parts keep their left-to-right order in rtl pages */
.fh:dir(rtl) .fh-badge { flex-direction: row-reverse; }
.fh:dir(rtl) .fh-badge > * { direction: ltr; }

/* ---- centre nav (>= 1024) ---- */
.fh .fh-nav { display: none; flex: 1 1 auto; min-width: 0; justify-content: center; gap: 1px; }
.fh .fh-link {
  position: relative; flex: none; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; border-radius: var(--fh-r-ctl);
  font: 500 13px/1 var(--fh-font); color: var(--fh-muted); white-space: nowrap;
  transition: color var(--fh-t) var(--fh-ease), background-color var(--fh-t) var(--fh-ease);
}
.fh .fh-link::before { content: ""; position: absolute; inset: -4px 0; }
.fh .fh-link::after { content: ""; position: absolute; inset-inline: calc(50% - 7px); bottom: 4px; height: 2px; background: var(--fh-focus); transform: scaleX(0); transition: transform 240ms var(--fh-ease); }
.fh .fh-link[aria-current="page"], .fh .fh-link[aria-current="true"] { color: var(--fh-ink); }
.fh .fh-link[aria-current="page"]::after, .fh .fh-link[aria-current="true"]::after { transform: scaleX(1); }
.fh .fh-out { width: 8px; height: 8px; flex: none; opacity: 0.7; }
.fh:dir(rtl) .fh-out { transform: scaleX(-1); }
.fh .fh-link--sib { color: var(--fh-ink); }

/* ---- utilities ---- */
.fh .fh-util { margin-inline-start: auto; flex: none; display: flex; align-items: center; gap: 4px; }
.fh .fh-ib, .fh .fh-btn {
  position: relative; flex: none; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--fh-r-ctl);
  border: 1px solid transparent; background: transparent; color: var(--fh-muted); cursor: pointer; white-space: nowrap; margin: 0;
  transition: color var(--fh-t) var(--fh-ease), background-color var(--fh-t) var(--fh-ease), border-color var(--fh-t) var(--fh-ease), transform 160ms var(--fh-ease);
}
/* 36 px tall look, 46 px tall target; widths are real (>= 44) so neighbours never steal a tap */
.fh .fh-ib::before, .fh .fh-btn::before { content: ""; position: absolute; inset: -5px 0; }
.fh .fh-ib { width: 44px; padding: 0; font: 600 11px/1 var(--fh-font); letter-spacing: 0.06em; }
.fh .fh-ic { width: 15px; height: 15px; flex: none; display: block; }
.fh .fh-btn { padding: 0 14px; gap: 8px; font: 500 13px/1 var(--fh-font); }
.fh .fh-btn--ghost, .fh .fh-btn--primary { border-radius: var(--fh-r-cta); }
.fh .fh-btn--ghost { border-color: var(--fh-line); color: var(--fh-ink); }
.fh .fh-btn--primary { background: var(--fh-accent); color: var(--fh-on-accent); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.fh .fh-btn--primary .fh-ic { width: 14px; height: 14px; }
.fh .fh-menu { border-color: var(--fh-line); color: var(--fh-ink); padding: 0 12px; }
.fh .fh-bars { position: relative; width: 14px; height: 9px; flex: none; }
.fh .fh-bars::before, .fh .fh-bars::after { content: ""; position: absolute; inset-inline: 0; height: 1.5px; border-radius: 1px; background: currentColor; transition: transform 240ms var(--fh-ease); }
.fh .fh-bars::before { top: 0; }
.fh .fh-bars::after { bottom: 0; }
.fh .fh-menu[aria-expanded="true"] .fh-bars::before { transform: translateY(3.75px) rotate(45deg); }
.fh .fh-menu[aria-expanded="true"] .fh-bars::after { transform: translateY(-3.75px) rotate(-45deg); }
.fh .fh-ib:active, .fh .fh-btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .fh .fh-link:hover, .fh .fh-ib:hover { color: var(--fh-ink); background: var(--fh-hover); }
  .fh .fh-btn--ghost:hover { background: var(--fh-hover); }
  .fh .fh-btn--primary:hover { background: var(--fh-accent-hover); }
  .fh .fh-pill:hover, .fh .fh-card:hover { background: var(--fh-hover); }
}

/* ---- panel ---- */
.fh .fh-panel {
  position: relative; margin-top: 8px; padding: 14px; border-radius: var(--fh-r-panel); background: var(--fh-glass-strong);
  max-height: calc(100vh - var(--fh-top) - var(--fh-bar-h) - 18px); max-height: calc(100dvh - var(--fh-top) - var(--fh-bar-h) - 18px);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  transform-origin: 50% 0; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(0.98);
  transition: opacity 160ms var(--fh-ease), transform 200ms var(--fh-ease), visibility 0s linear 200ms;
}
.fh .fh-panel.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity var(--fh-t) var(--fh-ease), transform 240ms var(--fh-ease), visibility 0s; }
.fh.is-instant .fh-panel, .fh.is-instant .fh-bars::before, .fh.is-instant .fh-bars::after { transition: none; }
.fh .fh-card {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--fh-r-ctl);
  border: 1px solid var(--fh-accent-line); background: var(--fh-accent-soft); color: var(--fh-ink);
  transition: background-color var(--fh-t) var(--fh-ease);
}
.fh .fh-card__mark { flex: none; width: 36px; height: 36px; display: grid; place-items: center; line-height: 0; color: var(--fh-ink); }
.fh .fh-card__txt { display: grid; gap: 3px; min-width: 0; }
.fh .fh-card__title { display: inline-flex; align-items: center; gap: 6px; font: 600 14px/1.2 var(--fh-font); }
.fh .fh-card__sub { font: 400 12.5px/1.35 var(--fh-font); color: var(--fh-muted); text-wrap: balance; }
.fh .fh-panel__brand { display: none; justify-content: center; margin-bottom: 12px; color: var(--fh-ink); }
.fh .fh-panel__brand .fh-word { font-size: 21px; }
.fh .fh-panel__title { margin-bottom: 12px; text-align: center; font: 600 10.5px/1.2 var(--fh-font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--fh-dim); }
.fh .fh-panel__links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fh .fh-pill {
  position: relative; min-width: 0; min-height: 44px; padding: 6px 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--fh-r-ctl); border: 1px solid var(--fh-line); background: transparent; color: var(--fh-ink); cursor: pointer; margin: 0;
  font: 500 13px/1.2 var(--fh-font); text-align: center; overflow-wrap: anywhere;
  transition: background-color var(--fh-t) var(--fh-ease), transform 160ms var(--fh-ease);
}
.fh .fh-pill:active { transform: scale(0.97); }
/* a lone last pill takes the whole row instead of a third of it (CEO: 7 links, «Mi cuenta») */
.fh .fh-panel__links > .fh-pill:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
.fh .fh-pill[aria-current="page"], .fh .fh-pill[aria-current="true"] { border-color: var(--fh-accent-line); background: var(--fh-accent-soft); }
.fh .fh-panel__foot { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.fh .fh-panel__foot--one { grid-template-columns: 1fr; }
.fh .fh-panel__foot .fh-pill { font-weight: 600; }

/* ---- breakpoints ---- */
/* >= 1024: the nav lives in the bar, the sibling is a nav link, the panel drops from the button */
@media (min-width: 1024px) {
  .fh .fh-nav { display: flex; }
  .fh .fh-util { margin-inline-start: 0; }
  .fh .fh-card { display: none; }
  .fh .fh-panel { width: min(var(--fh-panel-w), 100% - 2 * var(--fh-gutter)); margin-inline: auto max(var(--fh-gutter), (100% - var(--fh-max)) / 2); transform-origin: 100% 0; }
  .fh:dir(rtl) .fh-panel { transform-origin: 0 0; }
}
@media (min-width: 1380px) { .fh .fh-badge { display: inline-flex; } }
@media (min-width: 1024px) and (max-width: 1259.98px) { .fh .fh-wide { display: none; } }
/* < 1024 or touch: every control is a full 44 px target */
@media (max-width: 1023.98px), (pointer: coarse) {
  .fh .fh-ib, .fh .fh-btn { height: 44px; min-width: 44px; }
  .fh .fh-ib { width: 44px; }
  .fh .fh-link { height: 44px; }
  .fh .fh-ib::before, .fh .fh-btn::before { inset: 0; }
}
/* the panel foot repeats theme and language only when the bar hides them */
@media (min-width: 720px) { .fh .fh-panel__foot { display: none; } }
@media (max-width: 719.98px) {
  .fh .fh-ib { display: none; }
  .fh .fh-bar { padding-inline-start: 12px; }
}
/* < 600: download and menu become 44 px icons; their names stay for screen readers */
@media (max-width: 599.98px) {
  .fh .fh-dl, .fh .fh-menu { width: 44px; padding: 0; }
  .fh .fh-dl .fh-lbl, .fh .fh-menu .fh-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .fh .fh-dl .fh-ic { width: 16px; height: 16px; }
  .fh .fh-signin { padding: 0 12px; }
}
/* < 480: the CEO bar keeps the tile; the full name moves to the panel */
@media (max-width: 479.98px) {
  .fh .fh-brand--ceo .fh-word { display: none; }
  .fh .fh-brand--ceo .fh-tile { position: static; opacity: 1; transform: none; transition: none; }
  .fh .fh-panel__brand { display: flex; }
}
@media (max-width: 419.98px) {
  .fh .fh-panel__links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fh .fh-panel__links > .fh-pill:last-child:nth-child(3n + 1) { grid-column: auto; }
  .fh .fh-panel__links > .fh-pill:last-child:nth-child(2n + 1) { grid-column: 1 / -1; }
  .fh .fh-codeword { font-size: 24px; }
  .fh .fh-sl { margin: 0 7px; height: 18px; }
  .fh .fh-util { gap: 3px; }
  .fh .fh-bar { gap: 2px; padding-inline: 10px 6px; }
  .fh .fh-signin { padding: 0 10px; }
}

/* ---- CEO lockup at rest: the tile and the name side by side, nothing folds (>= 480) ---- */
@media (min-width: 480px) {
  .fh .fh-brand--ceo:not([data-fold="scroll"]) { gap: 10px; }
  .fh .fh-brand--ceo:not([data-fold="scroll"]) .fh-tile { position: static; }
  .fh .fh-brand--ceo:not([data-fold="scroll"]) .fh-tile, .fh .fh-brand--ceo.is-closed:not([data-fold="scroll"]) .fh-tile,
  .fh .fh-brand--ceo:not([data-fold="scroll"]) .fh-l, .fh .fh-brand--ceo.is-closed:not([data-fold="scroll"]) .fh-l,
  .fh .fh-brand--ceo:not([data-fold="scroll"]) .fh-dot, .fh .fh-brand--ceo.is-closed:not([data-fold="scroll"]) .fh-dot { opacity: 1; transform: none; transition: none; }
  .fh .fh-brand--ceo.is-closed:not([data-fold="scroll"]) ~ .fh-badge { transform: none; }
}
/* scroll mode (homes): the name is typed in, letter by letter, while the hero shows the Moño */
.fh .fh-i0 { --fh-i: 0; } .fh .fh-i1 { --fh-i: 1; } .fh .fh-i2 { --fh-i: 2; } .fh .fh-i3 { --fh-i: 3; } .fh .fh-i4 { --fh-i: 4; }
.fh .fh-i5 { --fh-i: 5; } .fh .fh-i6 { --fh-i: 6; } .fh .fh-i7 { --fh-i: 7; } .fh .fh-i8 { --fh-i: 8; }
.fh .fh-brand--ceo.is-typing .fh-l, .fh .fh-brand--ceo.is-typing .fh-dot { transition: none; transform: none; animation: fh-type 1ms steps(1, end) both; animation-delay: calc(120ms + var(--fh-i) * 85ms); }
/* the caret rides on the last letter typed, then blinks after the «o» */
.fh .fh-brand--ceo[data-fold="scroll"] .fh-l { position: relative; }
.fh .fh-brand--ceo.is-typing .fh-l::after { content: ""; position: absolute; inset-block: 12% 6%; inset-inline-end: -4px; width: 2px; background: currentColor; opacity: 0; animation: fh-caret-on 85ms steps(1, end); animation-delay: calc(120ms + var(--fh-i) * 85ms); }
.fh .fh-brand--ceo.is-typing .fh-i8::after { animation: fh-caret 1100ms steps(1, end) both; animation-delay: calc(120ms + 8 * 85ms); }
@keyframes fh-caret-on { from, to { opacity: 1; } }
@keyframes fh-type { from { opacity: 0; } to { opacity: 1; } }
@keyframes fh-caret { 0%, 30%, 70% { opacity: 1; } 15%, 50%, 90%, 100% { opacity: 0; } }
@media (max-width: 479.98px) {
  .fh .fh-brand--ceo[data-fold="scroll"] .fh-word { display: inline-flex; }
  .fh .fh-brand--ceo[data-fold="scroll"] .fh-tile { position: absolute; }
  .fh .fh-brand--ceo[data-fold="scroll"]:not(.is-closed) .fh-tile { opacity: 0; transform: translateX(var(--fh-bdx, 40px)) scale(0.56); }
}
@media (min-width: 1024px) { .fh .fh-brand--ceo .fh-word { font-size: 22px; } }
/* CEO's short nav sits in the true centre of the bar once there is room for it */
@media (min-width: 1260px) {
  .fh--ceo .fh-nav { position: absolute; inset-inline-start: 50%; transform: translateX(-50%); }
  .fh--ceo:dir(rtl) .fh-nav { transform: translateX(50%); }
  .fh--ceo .fh-util { margin-inline-start: auto; }
}

/* ---- reduced motion: a fade, nothing travels ---- */
@media (prefers-reduced-motion: reduce) {
  .fh .fh-panel, .fh .fh-panel.is-open { transform: none; }
  .fh .fh-panel { transition: opacity 120ms linear, visibility 0s linear 120ms; }
  .fh .fh-panel.is-open { transition: opacity 120ms linear, visibility 0s; }
  .fh .fh-brand--ceo .fh-l, .fh .fh-brand--ceo .fh-dot, .fh .fh-brand--ceo .fh-tile { transition-duration: 220ms; transition-delay: 0ms; transition-timing-function: linear; }
  .fh .fh-brand--ceo.is-closed .fh-l, .fh .fh-brand--ceo.is-closed .fh-dot, .fh .fh-brand--ceo .fh-tile { transform: none; }
  .fh .fh-badge { transition: none; }
  .fh .fh-ib:active, .fh .fh-btn:active, .fh .fh-pill:active { transform: none; }
}

/* ---- forced colours ---- */
@media (forced-colors: active) {
  .fh .fh-bar, .fh .fh-panel, .fh .fh-btn, .fh .fh-pill, .fh .fh-card { border: 1px solid CanvasText; }
  .fh .fh-bars::before, .fh .fh-bars::after { background: CanvasText; }
}

/* scroll lock while the panel is the page's navigation (< 1024) */
html.fh-locked { overflow: hidden; }
