/* Shared across pages: base, nav, mode chip, footer letters. Uses system/tokens.css. */
  * { box-sizing: border-box; }
  body { overflow-x: hidden; }
  a { color: inherit; text-decoration: none; }
  :focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; border-radius: 4px; }

  /* ---------- nav: identical on every page; 40px side space on desktop ---------- */
  :root { --nav-gutter: 40px; }
  @media (max-width: 768px) { :root { --nav-gutter: 24px; } }
  .nav {
    position: absolute; inset: 0 0 auto 0; z-index: 3;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    padding: 52px var(--nav-gutter) 0; color: var(--fg);
  }
  .nav a { position: relative; justify-self: start; }
  .nav a:last-child { justify-self: end; }
  .nav .wordmark { justify-self: center; }
  .nav .current::after {            /* the 4px dot under the current page */
    content: ""; position: absolute; left: 50%; top: calc(100% + 8px); width: 4px; height: 4px;
    margin-left: -2px; border-radius: 50%; background: currentColor;
  }
  @media (max-width: 768px) { .nav { padding-top: 30px; } }

  /* ---------- mode chip (bottom-left, tap to cycle GM → GN → BTC) ---------- */
  .mode {
    all: unset; box-sizing: border-box; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
    display: inline-flex; align-items: center; gap: 6px;
    position: fixed; z-index: 10; left: var(--nav-gutter); bottom: max(24px, env(safe-area-inset-bottom));
    padding: 8px 12px; border-radius: var(--radius-lg);
    background: var(--chip-bg); color: var(--chip-fg);
    font: var(--fw-medium) var(--text-xs)/var(--lh-xs) var(--font-body);
    transition: transform var(--dur-fast) var(--ease-spring), var(--theme-transition);
  }
  html[data-mode="light"] .mode { color: var(--tag-gold); }
  html[data-mode="btc"] .mode { background: var(--black); color: var(--white); }   /* matches the black header text on green / red */
  html[data-mode="btc"][data-theme="btc-up"] .mode { color: var(--btc-up); }       /* green on black when BTC is up */
  html[data-mode="btc"][data-theme="btc-down"] .mode { color: var(--btc-down); }   /* red on black when it's down */
  .mode svg { display: block; flex: none; }
  .mode:active { transform: scale(.92); }
  .mode:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

  /* ---------- Book a call: centred above the footer letters (Cal.com popup, js/book-call.js) ---------- */
  :root { --book-gap: 160px; }
  @media (max-width: 768px) { :root { --book-gap: 96px; } }
  .book { display: flex; justify-content: center; margin-bottom: var(--book-gap); }
  .book a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 226px; height: 55px; padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm); background: var(--footer-bg); color: var(--footer-fg);
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--dur-fast) var(--ease-spring), var(--theme-transition);
  }
  .book a:active { transform: scale(.96); }
  /* hover: letters roll up one after another (js/book-call.js splits the text) */
  .roll-text { display: inline-flex; }
  .rc { display: inline-block; height: var(--lh-sm); overflow: hidden; }
  .rs {
    display: flex; flex-direction: column;
    transition: transform 700ms cubic-bezier(.2, .9, .25, 1.12) calc(var(--i) * 22ms);
  }
  .rs i { font-style: normal; display: block; height: var(--lh-sm); }
  @media (hover: hover) { .book a:hover .rs { transform: translateY(-50%); } }
  .book a:focus-visible .rs { transform: translateY(-50%); }
  @media (prefers-reduced-motion: reduce) { .rs { transition: none; } }

  /* ---------- footer: the NAÏM letters ---------- */
  footer { margin: var(--book-gap) 8px 8px; }
  #footer-stage {
    display: block; width: 100%; aspect-ratio: 1682 / 953;
    touch-action: pan-y; user-select: none; cursor: none;
  }
  @media (max-width: 768px), (hover: none) { #footer-stage { cursor: auto; } }
  @media (max-width: 768px) { #footer-stage { aspect-ratio: 3 / 4; } }
  #footer-stage .body { fill: var(--footer-bg); fill-rule: evenodd; transition: fill var(--dur-slow) var(--ease-out); }
  #footer-dot-fill { fill: var(--footer-bg); }
  #footer-dot-cut { fill: var(--bg); fill-rule: evenodd; }
  #footer-cursor { opacity: 0; transition: opacity .35s; pointer-events: none; }
  #footer-stage.dot-on #footer-cursor { opacity: 1; }
  @media (hover: none) { #footer-cursor { display: none; } }

/* ---------- page transitions: quick fade + lift between pages (cross-document View Transitions) ---------- */
@view-transition { navigation: auto; }
.mode { view-transition-name: mode; }                 /* the chip stays put while the page changes */
.nav { view-transition-name: nav; }                   /* so does the header: it must not lift or fade with the page */
::view-transition-group(nav) { animation: none; }
::view-transition-old(nav) { display: none; }
::view-transition-new(nav) { animation: none; }
::view-transition-old(root) { animation: vt-out 160ms cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vt-in 320ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ---------- title intro (js/intro.js): letters rise from behind each line's edge, then the rest follows ---------- */
:root { --intro-ease: cubic-bezier(.16, 1, .3, 1); --intro-after: 1.1s; }   /* --intro-after: when the follow-ons start */
.intro [data-intro]:not(.split) { visibility: hidden; }
[data-intro] { position: relative; }
[data-intro].intro-run { -webkit-text-fill-color: transparent; }   /* the real text holds its place, unseen */
.intro-layer { position: absolute; inset: 0; pointer-events: none; -webkit-text-fill-color: currentColor; }
.intro-layer .ln { position: absolute; overflow: hidden; }        /* each line's edge the letters rise from */
.intro-layer .c { position: absolute; top: 0; overflow: hidden; transform: translateY(110%);
  animation: intro-rise 1s var(--intro-ease) forwards; animation-delay: calc(.15s + var(--i) * .014s); }
.intro-layer .t { position: absolute; white-space: pre; }
.intro.intro-nav .nav { opacity: 0; animation: intro-fade 1s var(--intro-ease) var(--intro-after) forwards; }
.intro [data-intro-follow] { opacity: 0; animation: intro-in 1s var(--intro-ease) forwards;
  animation-delay: calc(var(--intro-after) + var(--follow, 1) * .12s); }
@keyframes intro-rise { to { transform: none; } }
@keyframes intro-fade { to { opacity: 1; } }
@keyframes intro-in   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
