/* ONE header for every page (2026-11-19). Markup: src/lib/site-header.js. Behaviour: /header.js.
   Linked by src/layouts/Base.astro and stamped into every static page under public/ by scripts/sync-static-header.mjs.
   The chrome stays dark in both themes. Everything is scoped to .sfh / .sfh-drawer and resets what the static pages'
   own global CSS changes (margins, min-height on links and buttons, fonts), so the header looks the same on every page.
   Icons: one outline family, 20px at stroke 2 and 16px at stroke 2.5 (about 1.67px on screen for both). */

.sfh, .sfh *, .sfh-drawer, .sfh-drawer *, .sfh-backdrop { box-sizing: border-box; margin: 0; padding: 0; }
.sfh, .sfh-drawer { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased; color: #fff; line-height: 1.3; }
/* reset at class weight (0,1,0) via :where(), so it beats the static pages' element rules but every component rule below wins */
.sfh :where(a, button), .sfh-drawer :where(a, button) { min-height: 0; min-width: 0; font: inherit; color: inherit; text-decoration: none; background: none; border: 0; cursor: pointer; letter-spacing: normal; text-transform: none; }
.sfh :where(ul), .sfh-drawer :where(ul) { list-style: none; }

/* icons */
.sfh-i { width: 20px; height: 20px; flex: none; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sfh-i--sm { width: 16px; height: 16px; stroke-width: 2.5; }

/* bar */
.sfh { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; background: #0d0d0d; border-bottom: 1px solid rgba(255,255,255,0.08); transition: background .3s ease, box-shadow .3s ease; }
.sfh.sticky { background: #0c0c0c; box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 20px rgba(0,0,0,0.4); }
.sfh-inner { max-width: 1320px; height: 70px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 12px; }
.sfh-logo { flex: none; display: flex; align-items: center; }
.sfh-logo img { display: block; width: 170px; height: 40px; }

/* desktop nav */
.sfh-nav-wrap { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.sfh-nav { display: flex; align-items: center; }
.sfh-nav > li { position: relative; }
.sfh-top { position: relative; display: flex; align-items: center; gap: 4px; height: 70px; padding: 0 14px; font-size: 16px; font-weight: 400; color: #fff; white-space: nowrap; }
.sfh-top::after { content: ''; position: absolute; left: 50%; right: 50%; bottom: 0; height: 2px; background: #32ebe8; transition: left .25s ease, right .25s ease; }
.sfh-nav > li:hover > .sfh-top::after, .sfh-nav > li.open > .sfh-top::after, .sfh-nav > li.active > .sfh-top::after { left: 0; right: 0; }
.sfh-chev { opacity: .7; transition: transform .2s ease, opacity .2s ease; }
.sfh-nav > li:hover .sfh-chev, .sfh-nav > li.open .sfh-chev { transform: rotate(180deg); opacity: 1; }
.sfh-menu { position: absolute; top: 100%; left: 0; width: 285px; padding: 12px 8px; background: #000; border: 1px solid rgba(255,255,255,0.11); border-radius: 4px; box-shadow: 0 9px 20px rgba(0,0,0,0.5); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .2s, visibility .2s, transform .2s; z-index: 2; }
.sfh-nav > li:hover > .sfh-menu, .sfh-nav > li.open > .sfh-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.sfh-menu a { display: flex; align-items: center; gap: 6px; padding: 11px 14px; font-size: 15px; color: #cecece; border-left: 3px solid transparent; transition: color .15s, border-color .15s; }
.sfh-menu a:hover { color: #fff; border-left-color: #32ebe8; }
.sfh-menu--cols { display: flex; width: auto; min-width: 420px; padding: 0; }
.sfh-menu--wide { min-width: 680px; left: 50%; transform: translate(-50%, 6px); }
.sfh-nav > li:hover > .sfh-menu--wide, .sfh-nav > li.open > .sfh-menu--wide { transform: translate(-50%, 0); }
.sfh-col { flex: 1; padding: 12px 0; }
.sfh-col-h { display: block; padding: 8px 17px 6px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,0.45); white-space: nowrap; }

/* right side: three controls, one height */
.sfh-actions { flex: none; display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sfh-icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; border: 1px solid rgba(255,255,255,0.3); transition: color .2s, border-color .2s; }
.sfh-icon-btn:hover { color: #32ebe8; border-color: #32ebe8; }
.sfh-burger, .sfh-close { border-color: transparent; }
.sfh-burger { display: none; }
.sfh-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; font-size: 15px; font-weight: 600; white-space: nowrap; transition: color .2s, border-color .2s, opacity .2s; }
.sfh-btn--ghost { color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.sfh-btn--ghost:hover { color: #32ebe8; border-color: #32ebe8; }
.sfh-btn--primary { color: #0c0c0c; background: linear-gradient(90deg, #31e4e3, #0caecf); padding: 0 18px 0 22px; }
.sfh-btn--primary:hover { opacity: .9; }
.sfh .sfh-btn--primary, .sfh-drawer .sfh-btn--primary { color: #0c0c0c; }
.sfh-arrow { transition: transform .2s; }
.sfh-btn--primary:hover .sfh-arrow { transform: translateX(2px); }

/* theme toggle: the sun in dark mode, the moon in light mode */
.sfh-sun { display: none; }
html[data-theme="dark"] .sfh-sun { display: block; }
html[data-theme="dark"] .sfh-moon { display: none; }

/* keyboard focus */
.sfh a:focus-visible, .sfh button:focus-visible, .sfh-drawer a:focus-visible, .sfh-drawer button:focus-visible { outline: 2px solid #32ebe8; outline-offset: 2px; border-radius: 8px; }
.sfh-icon-btn:focus-visible, .sfh-btn:focus-visible { border-radius: 999px; }

/* small laptops: keep everything on one line */
/* widths measured 2026-11-19: logo 170 + nav 605 (557 at 10px padding) + buttons 445 + gaps 24 */
@media (min-width: 1260px) and (max-width: 1420px) { .sfh-top { padding: 0 10px; } }
@media (max-width: 1259px) { .sfh-btn--ghost { display: none; } }
@media (max-width: 1040px) and (min-width: 901px) { .sfh-top { padding: 0 8px; font-size: 15px; } }
@media (max-width: 900px) {
  .sfh-nav-wrap, .sfh .sfh-btn { display: none; }
  .sfh-burger { display: inline-grid; }
  .sfh-icon-btn { width: 44px; height: 44px; }
  .sfh-inner { padding: 0 12px 0 16px; }
  .sfh-logo img { width: 145px; height: 34px; }
}

/* phone drawer */
.sfh-backdrop { position: fixed; inset: 0; z-index: 10000; background: rgba(8,8,10,0.6); }
.sfh-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 10001; width: min(340px, 88vw); overflow-y: auto; background: #0c0c0c; border-left: 1px solid rgba(255,255,255,0.08); padding: 14px 0 24px; transform: translateX(0); }
.sfh-drawer[hidden], .sfh-backdrop[hidden] { display: none; }
.sfh-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sfh-drawer-head img { display: block; width: 128px; height: 30px; }
.sfh-drawer-tools { display: flex; align-items: center; gap: 4px; }
.sfh-dnav > li { border-bottom: 1px solid rgba(255,255,255,0.06); }
.sfh-dtop { display: flex; width: 100%; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 20px; font-size: 16px; color: #fff; text-align: left; }
.sfh-dtop:hover { color: #32ebe8; }
.sfh-dtoggle[aria-expanded="true"] .sfh-chev { transform: rotate(180deg); opacity: 1; }
.sfh-dsub { background: rgba(255,255,255,0.03); padding-bottom: 8px; }
.sfh-dsub[hidden] { display: none; }
.sfh-dsub a { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 20px 0 32px; font-size: 14px; color: #cecece; border-left: 3px solid transparent; }
.sfh-dsub a:hover { color: #fff; border-left-color: #32ebe8; }
.sfh-dhead { padding: 14px 20px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,0.45); }
.sfh-dctas { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.sfh-btn--block { width: 100%; height: 48px; }

/* Static pages' own "on this page" section menu (.mob-btn): it looked like a second hamburger in a white square.
   It stays where the page puts it and keeps its behaviour; it now reads as a labelled dark pill. */
.mob-btn { width: auto !important; height: 36px !important; min-height: 0 !important; padding: 0 14px !important; display: none; flex-direction: row !important; justify-content: center; align-items: center; gap: 0; border-radius: 999px !important; background: #0d0d0d !important; border: 1px solid rgba(255,255,255,0.25) !important; box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.mob-btn span { display: none !important; }
.mob-btn::after { content: 'On this page'; font: 600 13px/1 'Plus Jakarta Sans', -apple-system, sans-serif; color: #fff; }
@media (max-width: 900px) { .mob-btn { display: inline-flex; opacity: 0; pointer-events: none; transition: opacity .2s; } }
/* it appears once the reader scrolls past the hero (header.js sets the class), so it never covers the page's opening lines */
@media (max-width: 900px) { html.sfh-scrolled .mob-btn { opacity: 1; pointer-events: auto; } }
