/* Nexcard website: shared chrome for every page (tokens, type, buttons, nav, mobile menu, footer, toasts).
   Design system "Mono story": black and off-white, Fraunces display + Figtree text.
   Home adds story.css (scroll chapters); every other page adds site.css. See docs/WEBSITE.md. */
/* =========================================================
   1. TOKENS
   ========================================================= */
:root {
  --forest: #0A0A0A;
  --forest-2: #161616;
  --forest-3: #050505;
  --cream: #F4F4F2;
  --cream-2: #E4E4E2;
  --paper: #FFFFFF;
  --terra: #FFFFFF; --terra-on: #0A0A0A;  /* accent = full contrast ink for the tone */
  --terra-ink-d: #FFFFFF;
  --terra-ink-l: #0A0A0A;
  --ink-l: #0A0A0A;  --muted-l: #5C5C5A; --line-l: rgba(10,10,10,.14);
  --ink-d: #F4F4F2;  --muted-d: #A3A3A1; --line-d: rgba(244,244,242,.16);

  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-sans: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.32, .72, 0, 1);
  --gutter: clamp(20px, 6vw, 96px);
  --vh: 100svh;               /* replaced by JS with a stable px value */
  --nav-h: 76px;
}

/* =========================================================
   2. BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--forest); }
body {
  margin: 0; font-family: var(--f-sans); font-size: 17px; line-height: 1.55;
  color: var(--ink-d); background: var(--forest);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip;
}
img, svg { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--terra); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 16px; top: -60px; z-index: 50; background: var(--cream); color: var(--forest); padding: 10px 16px; border-radius: 999px; font-weight: 600; text-decoration: none; transition: transform .3s var(--ease-out); }
.skip:focus { transform: translateY(76px); }

/* Display type */
.display { font-family: var(--f-display); font-optical-sizing: auto; font-variation-settings: "SOFT" 30; letter-spacing: -.025em; line-height: .98; font-weight: 380; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
}
.eyebrow b { font-weight: 600; color: var(--terra-ink-d); }
.t-light .eyebrow b { color: var(--terra-ink-l); }
.eyebrow::after { content: ""; width: 36px; height: 1px; background: currentColor; opacity: .35; }
.h2 { font-size: clamp(2.1rem, 4.3vw, 4.6rem); margin: 18px 0 20px; text-wrap: balance; }
.lede { font-size: clamp(1rem, 1.25vw, 1.15rem); max-width: 34rem; }
.t-dark .lede, .t-dark .muted { color: var(--muted-d); }
.t-light .lede, .t-light .muted { color: var(--muted-l); }
.t-dark { color: var(--ink-d); }
.t-light { color: var(--ink-l); }
.dot { color: var(--terra); }

/* =========================================================
   3. BUTTONS (ported from Uiverse, retheme + a11y)
   ========================================================= */
/* Uiverse: https://uiverse.io/adamgiebl/new-bird-34
   Port: plain CSS, renamed .cta, forest/cream/terracotta tokens. The original grows the icon's width;
   this version sweeps a fill with transform only. Focus ring + reduced motion added. */
.cta {
  --cta-bg: var(--cream); --cta-ink: var(--forest);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; height: 54px; padding: 0 64px 0 24px;
  border-radius: 999px; background: var(--cta-bg); color: var(--cta-ink);
  font-weight: 600; font-size: 16px; letter-spacing: .01em; text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4), 0 14px 30px -14px rgba(0,0,0,.45);
  transition: transform .5s var(--ease-spring), color .45s var(--ease-out);
}
.cta::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--terra);
  transform: translateX(101%); transition: transform .6s var(--ease-spring);
}
.cta-icon {
  position: absolute; right: 6px; top: 6px; bottom: 6px; width: 42px; border-radius: 999px;
  display: grid; place-items: center; background: var(--terra); color: var(--terra-on);
  transition: transform .5s var(--ease-spring);
}
.cta-icon svg { width: 18px; height: 18px; transition: transform .5s var(--ease-spring); }
.cta:hover { color: var(--cta-bg); }
.cta:hover::before { transform: translateX(0); }
.cta:hover .cta-icon svg { transform: translate(2px, -1px); }
.cta:active { transform: scale(.98); }
.cta:focus-visible { outline: 2px solid var(--terra); outline-offset: 4px; border-radius: 999px; }
.t-light .cta { --cta-bg: var(--forest); --cta-ink: var(--cream); box-shadow: 0 14px 30px -14px rgba(10,10,10,.5); }

/* Uiverse: https://uiverse.io/cssbuttons-io/calm-tiger-42
   Port: renamed .swell, pill shape, fills rise with transform instead of animating `top`. */
.swell {
  position: relative; isolation: isolate; overflow: hidden; display: inline-flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 22px; border-radius: 999px; border: 1px solid currentColor;
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; background: transparent; cursor: pointer;
  transition: color .45s var(--ease-out), border-color .45s var(--ease-out);
}
.swell::before, .swell::after {
  content: ""; position: absolute; left: 50%; top: 0; width: 140%; height: 190%; border-radius: 50%; z-index: -1;
  transform: translate(-50%, 70%) scaleX(1.25); transition: transform .6s .05s var(--ease-spring);
}
.swell::before { background: rgba(244,244,242,.10); }
.swell::after { background: var(--terra); width: 160%; transform: translate(-50%, 100%) scaleX(1.45); }
.swell:hover { color: var(--terra-on); border-color: var(--terra); }
.swell:hover::before { transform: translate(-50%, -30%) scaleX(.9); }
.swell:hover::after { transform: translate(-50%, -26%) scaleX(.9); }
.swell svg { width: 16px; height: 16px; transition: transform .5s var(--ease-spring); }
.swell:hover svg { transform: translateX(3px); }
.swell:focus-visible { outline: 2px solid var(--terra); outline-offset: 4px; border-radius: 999px; }
.t-light .swell::before { background: rgba(10,10,10,.06); }

.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }

/* =========================================================
   4. NAV (floating island) + CHAPTER RAIL
   ========================================================= */
.nav { position: fixed; top: 14px; left: 0; right: 0; z-index: 20; display: flex; justify-content: center; padding: 0 14px; pointer-events: none; }
.nav-in {
  pointer-events: auto; display: flex; align-items: center; gap: 28px; width: min(1120px, 100%);
  height: 56px; padding: 0 8px 0 18px; border-radius: 999px;
  background: rgba(5,5,5,.55); color: var(--cream);
  box-shadow: inset 0 0 0 1px rgba(244,244,242,.12), 0 20px 40px -24px rgba(0,0,0,.5);
  -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
  transition: background-color .6s var(--ease-out), color .6s var(--ease-out), box-shadow .6s var(--ease-out);
}
.ui-light .nav-in { background: rgba(244,244,242,.62); color: var(--forest); box-shadow: inset 0 0 0 1px rgba(10,10,10,.1), 0 20px 40px -24px rgba(10,10,10,.35); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-display); font-size: 22px; letter-spacing: -.02em; font-weight: 450; }
.brand svg { width: 28px; height: 28px; }
.nav-links { display: flex; gap: 22px; font-size: 14.5px; font-weight: 500; }
.nav-links a { text-decoration: none; opacity: .8; transition: opacity .3s; }
.nav-links a:hover { opacity: 1; }
.nav-act { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-login { white-space: nowrap; font-size: 14.5px; font-weight: 500; text-decoration: none; padding: 10px 14px; opacity: .85; }
.nav-cta {
  white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 16px; border-radius: 999px;
  background: var(--cream); color: var(--forest); font-size: 14.5px; font-weight: 600; text-decoration: none;
  transition: transform .4s var(--ease-spring), background-color .5s var(--ease-out), color .5s var(--ease-out);
}
.nav-cta i { width: 28px; height: 28px; border-radius: 999px; background: var(--terra); display: grid; place-items: center; color: var(--cream); transition: transform .4s var(--ease-spring); }
.nav-cta i svg { width: 14px; height: 14px; }
.nav-cta:hover i { transform: translateX(2px) rotate(-8deg); }
.nav-cta:active { transform: scale(.97); }
.ui-light .nav-cta { background: var(--forest); color: var(--cream); }

/* B/W accent: white on dark surfaces, black on light ones */
.t-light, .ui-light .nav, .toast, .wl-group, .phone { --terra: #0A0A0A; --terra-on: #FFFFFF; }
.cta { --terra: var(--cta-ink); --terra-on: var(--cta-bg); }
.nav-cta i { background: var(--forest); }
.ui-light .nav-cta i { background: var(--cream); }
.nav-cta i svg { color: var(--cream); }
.ui-light .nav-cta i svg { color: var(--forest); }

/* Mobile menu (toggle + full-screen panel) */
.nav-toggle { display: none; margin-left: 4px; width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; place-items: center; color: inherit; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after { content: ""; display: block; width: 18px; height: 1.6px; background: currentColor; position: relative; transition: transform .4s var(--ease-spring), background-color .2s; }
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }
.nav.open .nav-toggle span { background: transparent; }
.nav.open .nav-toggle span::before { transform: translateY(6px) rotate(45deg); }
.nav.open .nav-toggle span::after { transform: translateY(-6px) rotate(-45deg); }
.nav-panel { display: none; }
@media (max-width: 1080px) {
  .nav-links { display: none; }
  .nav-toggle { display: grid; }
  .nav-panel {
    display: block; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
    padding: calc(var(--nav-h) + 24px) var(--gutter) 40px; background: var(--forest); color: var(--cream); overflow-y: auto;
    transition: opacity .4s var(--ease-out);
  }
  .nav.open .nav-panel { opacity: 1; pointer-events: auto; }
  .nav-panel ol { counter-reset: m; border-top: 1px solid var(--line-d); }
  .nav-panel li a { display: flex; align-items: baseline; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line-d); text-decoration: none;
    font-family: var(--f-display); font-size: clamp(2rem, 8vw, 2.8rem); letter-spacing: -.02em; line-height: 1.05;
    transform: translateY(14px); opacity: 0; transition: transform .6s var(--ease-spring), opacity .5s var(--ease-out); }
  .nav-panel li a::before { counter-increment: m; content: "0" counter(m); font-family: var(--f-sans); font-size: 12px; font-weight: 600; letter-spacing: .1em; color: var(--muted-d); }
  .nav.open .nav-panel li a { transform: none; opacity: 1; }
  .nav.open .nav-panel li:nth-child(2) a { transition-delay: .04s; } .nav.open .nav-panel li:nth-child(3) a { transition-delay: .08s; }
  .nav.open .nav-panel li:nth-child(4) a { transition-delay: .12s; } .nav.open .nav-panel li:nth-child(5) a { transition-delay: .16s; }
  .nav.open .nav-panel li:nth-child(6) a { transition-delay: .2s; } .nav.open .nav-panel li:nth-child(7) a { transition-delay: .24s; }
  .nav-panel .btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
  .nav-panel .swell { color: var(--cream); }
  .nav.open .nav-in { background: rgba(5,5,5,.9); color: var(--cream); box-shadow: inset 0 0 0 1px rgba(244,244,242,.12); }
  .nav.open .nav-cta { background: var(--cream); color: var(--forest); }
  .nav.open .nav-cta i { background: var(--forest); } .nav.open .nav-cta i svg { color: var(--cream); }
  body.nav-open { overflow: hidden; }
}
@media (max-width: 899px) {
  :root { --nav-h: 66px; }
  .nav { top: 10px; }
  .nav-in { height: 50px; gap: 10px; padding-left: 14px; padding-right: 6px; }
  .brand { font-size: 20px; }
  .nav-login { display: none; }
}
@media (max-width: 380px) { .nav-cta { padding: 0 6px 0 12px; font-size: 13.5px; } }

/* Footer (standalone on every page) */
.foot { position: relative; z-index: 2; background: var(--forest); color: var(--ink-d); }
.foot { border-top: 1px solid var(--line-d); padding: 64px var(--gutter) 40px; }
.foot-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 40px; }
.foot p { color: var(--muted-d); font-size: 14.5px; max-width: 18rem; margin-top: 14px; }
.foot h4 { margin: 0 0 14px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-d); }
.foot li + li { margin-top: 9px; }
.foot li a { text-decoration: none; font-size: 15px; opacity: .9; }
.foot li a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.foot-base { max-width: 1180px; margin: 56px auto 0; padding-top: 24px; border-top: 1px solid var(--line-d); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--muted-d); }
.foot-base a { color: var(--cream); }
@media (max-width: 899px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > div:first-child { grid-column: 1 / -1; } }

/* =========================================================
   11. TOASTER (shadcn sonner pattern)
   ========================================================= */
.toaster { position: fixed; right: 24px; bottom: 24px; z-index: 30; width: min(380px, calc(100vw - 32px)); }
.toaster ol { display: grid; gap: 10px; }
.toast { display: grid; grid-template-columns: 28px 1fr 28px; gap: 12px; align-items: start; padding: 16px; border-radius: 16px;
  background: var(--cream); color: var(--forest); box-shadow: 0 24px 50px -20px rgba(0,0,0,.55), inset 0 0 0 1px rgba(10,10,10,.08);
  animation: toast-in .6s var(--ease-spring) both; }
.toast.out { animation: toast-out .35s var(--ease-out) both; }
.toast .ti { width: 28px; height: 28px; border-radius: 50%; background: var(--terra); color: var(--terra-on); display: grid; place-items: center; }
.toast .ti svg { width: 14px; height: 14px; }
.toast b { display: block; font-size: 14.5px; }
.toast span { display: block; font-size: 13.5px; color: var(--muted-l); margin-top: 2px; }
.toast button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: var(--muted-l); }
.toast button:hover { background: rgba(10,10,10,.07); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

.toaster { pointer-events: none; } .toast { pointer-events: auto; }

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