/* ============================================================
   CODE & CHAOS — BRAND SYSTEM v2.1 "ONYX & METAL"
   Source of truth: Vault/Code and Chaos Brand/ (BRAND.md + Application System sheet)
   Structure meets instinct. Precision creates impact. Order powers chaos.

   Palette: Onyx #0B0B0D · Bone #E7E1D7 · Crimson #8F1F28 · Graphite #3A3A40
            + Silver (structure) · Gold (premium highlights)
   Hierarchy law (from the sheet): typography leads · circuitry as structure,
   not clutter · crimson for emphasis, never a base field · gold and silver
   never mixed without hierarchy (silver = structural, gold = importance).

   Type (per Application System): Bodoni Moda (wordmark/hero) ·
   DM Serif Display (headings) · Cormorant Garamond (editorial/italic) ·
   Manrope (body & interface) · IBM Plex Mono (data/receipts)
   ============================================================ */

:root {
  --onyx: #0B0B0D;
  --onyx-raised: #121215;
  --onyx-panel: #17171B;
  --bone: #E7E1D7;
  --bone-paper: #EAE4DA;
  --bone-dim: #B8B2A6;
  --bone-faint: #7d7870;
  --crimson: #8F1F28;
  --crimson-bright: #B42935;
  --crimson-glow: rgba(194, 42, 54, 0.14);
  --graphite: #3A3A40;
  --silver: #C7C7CF;
  --silver-dim: #8E8E98;
  --gold: #B89B66;
  --gold-soft: #94794C;
  --gold-glow: rgba(184, 155, 102, 0.10);
  --hairline: rgba(231, 225, 215, 0.09);
  --hairline-strong: rgba(231, 225, 215, 0.2);
  --radius: 16px;
  --shadow: 0 18px 54px rgba(0,0,0,.38);

  --font-hero: 'Bodoni Moda', 'Didot', Georgia, serif;
  --font-heading: 'DM Serif Display', Georgia, serif;
  --font-editorial: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, monospace;

  --max-w: 1200px;
  --pad-x: clamp(20px, 5vw, 64px);
  --section-gap: clamp(96px, 14vh, 176px);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  background:
    linear-gradient(rgba(11,11,13,.975), rgba(11,11,13,.995)),
    repeating-linear-gradient(90deg, transparent 0 54px, rgba(143,31,40,.07) 55px, transparent 56px),
    var(--onyx);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain — the chaos under the order */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2000;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 14% 8%, rgba(143,31,40,.15), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(184,155,102,.07), transparent 22%);
}

::selection { background: var(--crimson); color: var(--bone); }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- Typography ---------- */
h1 {
  font-family: var(--font-hero);
  font-weight: 500;
  font-size: clamp(2.5rem, 6vw, 4.6rem);
  line-height: 1.1;
  letter-spacing: 0.005em;
  text-wrap: balance;
}
h2 {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.14;
  text-wrap: balance;
}
h1, h2, h3 { overflow-wrap: break-word; }
h3 { font-family: var(--font-heading); font-weight: 400; font-size: clamp(1.22rem, 2vw, 1.55rem); line-height: 1.25; }

.serif-italic { font-family: var(--font-editorial); font-style: italic; font-weight: 500; letter-spacing: 0.01em; }
.crimson { color: var(--crimson-bright); }
.gold { color: var(--gold); }

/* Metallic text — brushed silver, for wordmark moments */
.metallic { color: #D8D8DE; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .metallic {
    background: linear-gradient(175deg, #EEEEF2 8%, #B9B9C2 34%, #85858F 52%, #D8D8DE 72%, #9A9AA4 94%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.eyebrow::before {
  content: '';
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
  flex: none;
}

.lede {
  font-family: var(--font-editorial);
  font-size: clamp(1.18rem, 1.7vw, 1.4rem);
  line-height: 1.6;
  color: var(--bone-dim);
  max-width: 60ch;
}
.lede a { color: var(--crimson-bright); }

.mono { font-family: var(--font-mono); }

/* ---------- Layout ---------- */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--pad-x); }
section { padding-top: var(--section-gap); }
section:last-of-type { padding-bottom: var(--section-gap); }

/* Paper sections — floating raised sheets (dark, warm-rimmed; Ellie: keep the float, kill the cream) */
.paper {
  background:
    radial-gradient(circle at 85% 0%, rgba(143,31,40,0.10), transparent 42%),
    radial-gradient(circle at 8% 100%, rgba(184,155,102,0.07), transparent 40%),
    linear-gradient(180deg, #1B1B21, #131318);
  width: min(1260px, calc(100% - 28px));
  margin: var(--section-gap) auto 0;
  border-radius: calc(var(--radius) * 1.6);
  border: 1px solid rgba(184, 155, 102, 0.35);
  box-shadow: 0 30px 90px rgba(0,0,0,0.55), inset 0 1px 0 rgba(231,225,215,0.07);
  position: relative;
  overflow: hidden;
}
.paper .card { background: rgba(11,11,13,0.55); }
.paper .card:hover { background: rgba(11,11,13,0.85); }
section.paper { padding-top: calc(var(--section-gap) * 0.6); padding-bottom: calc(var(--section-gap) * 0.6); }

/* Divider — silver line, crimson diamond, gold ticks (sheet's border treatment) */
.fracture {
  position: relative;
  height: 1px;
  margin-top: var(--section-gap);
  background: linear-gradient(90deg, transparent, var(--silver-dim) 18%, var(--silver-dim) 82%, transparent);
  opacity: 0.55;
}
.fracture::before {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 9px; height: 9px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--onyx);
  border: 1.5px solid var(--crimson-bright);
}
.fracture::after {
  content: '';
  position: absolute;
  left: calc(50% - 46px); top: 50%;
  width: 92px; height: 1px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, var(--gold), transparent 38%, transparent 62%, var(--gold));
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  backdrop-filter: blur(14px);
  background: rgba(11, 11, 13, 0.84);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-hero);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-logo img { width: 34px; height: 34px; }
.nav-logo .amp { color: var(--crimson-bright); }
.nav-logo span { color: #D8D8DE; }
.nav-logo span .amp { color: var(--crimson-bright); }
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 34px);
  list-style: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav-links a { color: var(--bone-dim); transition: color 0.2s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--bone); }
.nav-links a.nav-cta {
  color: var(--bone);
  border: 1px solid var(--crimson);
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(194,42,54,0.25), rgba(143,31,40,0.12));
  transition: background 0.2s;
}
.nav-links a.nav-cta:hover { background: var(--crimson); }

.nav-burger {
  display: none;
  background: none;
  border: 1px solid var(--hairline-strong);
  color: var(--bone);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  padding: 8px 14px;
  cursor: pointer;
}

@media (max-width: 880px) {
  .nav-links {
    position: fixed;
    top: 66px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--onyx-raised);
    border-bottom: 1px solid var(--hairline-strong);
    padding: 10px 0 18px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 13px var(--pad-x); }
  .nav-links a.nav-cta { border: none; background: none; padding: 13px var(--pad-x); }
  .nav-burger { display: block; }
}

/* ---------- Buttons (sheet: glossy crimson primary, dark chip secondary) ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 40px; }
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 15px 28px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  color: var(--bone);
  background: linear-gradient(180deg, var(--onyx-panel), var(--onyx-raised));
  box-shadow: inset 0 1px 0 rgba(231,225,215,0.08);
  cursor: pointer;
  transition: border-color 0.22s, transform 0.22s, background 0.25s;
  display: inline-block;
}
.btn:hover { border-color: var(--silver-dim); transform: translateY(-1px); }
.btn.solid {
  border-color: #5e161d;
  background: linear-gradient(180deg, #A62531, var(--crimson) 55%, #6E181F);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 2px 12px rgba(143,31,40,0.35);
}
.btn.solid:hover { background: linear-gradient(180deg, #C22A36, #8F1F28 60%, #6E181F); border-color: var(--crimson-bright); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--bone-dim); }
.btn.ghost:hover { color: var(--bone); border-color: var(--bone-dim); }

/* ---------- Receipts strip ---------- */
.receipts {
  margin-top: 64px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 18px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.receipts span { display: flex; align-items: center; }
.receipts span:not(:last-child)::after {
  content: '◆';
  color: var(--crimson-bright);
  font-size: 0.5rem;
  margin: 0 clamp(12px, 2.4vw, 28px);
}
.receipts b { color: var(--gold); font-weight: 600; margin-right: 7px; }

/* ---------- Cards (sheet: framed, thin double border) ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 880px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--onyx-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: clamp(28px, 3.4vw, 44px);
  position: relative;
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
  box-shadow: var(--shadow);
}
.card:hover { background: var(--onyx-panel); border-color: rgba(184,155,102,0.35); transform: translateY(-2px); }
.card .num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--gold);
  display: block;
  margin-bottom: 18px;
}
.card h3 { margin-bottom: 14px; }
.card p { color: var(--bone-dim); font-size: 0.96rem; }
.card .card-link {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--crimson-bright);
  margin-top: 22px;
  display: inline-block;
  transition: color 0.2s;
}
.card .card-link:hover { color: var(--gold); }

/* ---------- Timeline ---------- */
.timeline { position: relative; margin-top: 70px; padding-left: 36px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 4px; bottom: 4px;
  width: 1px;
  background: linear-gradient(180deg, var(--crimson) 0%, var(--silver-dim) 55%, var(--graphite) 100%);
}
.tl-node { position: relative; padding-bottom: 46px; }
.tl-node:last-child { padding-bottom: 0; }
.tl-node::before {
  content: '';
  position: absolute;
  left: -36px; top: 7px;
  width: 11px; height: 11px;
  background: var(--onyx);
  border: 2px solid var(--crimson-bright);
  transform: rotate(45deg);
}
.tl-node:last-child::before { border-color: var(--gold); }
.tl-date {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}
.tl-node h3 { font-size: 1.3rem; margin-bottom: 8px; }
.tl-node p { color: var(--bone-dim); max-width: 58ch; font-size: 0.96rem; }

/* ---------- Panels / ladder ---------- */
.panel {
  border-radius: var(--radius);
  border: 1px solid var(--hairline-strong);
  background: var(--onyx-raised);
  padding: clamp(28px, 4vw, 52px);
}
.ladder { display: flex; flex-direction: column; border: 1px solid var(--hairline-strong); border-radius: var(--radius); overflow: hidden; margin-top: 56px; box-shadow: var(--shadow); background: var(--onyx-raised); }
.rung {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: clamp(16px, 3vw, 40px);
  align-items: baseline;
  padding: clamp(20px, 2.6vw, 30px) clamp(20px, 3vw, 40px);
  border-bottom: 1px solid var(--hairline);
  transition: background 0.2s;
}
.rung:last-child { border-bottom: none; }
.rung:hover { background: var(--onyx-raised); }
.rung .price {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  color: var(--gold);
}
.rung h3 { font-size: 1.18rem; margin-bottom: 4px; }
.rung p { color: var(--bone-dim); font-size: 0.92rem; max-width: 60ch; }
.rung .rung-cta {
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-dim);
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
  padding: 9px 16px;
  white-space: nowrap;
  transition: all 0.2s;
}
.rung .rung-cta:hover { border-color: var(--crimson); color: var(--bone); background: var(--crimson); }
.rung.apex {
  background: linear-gradient(90deg, var(--crimson-glow), transparent 65%);
  border-top: 1px solid var(--gold-soft);
}
.rung.apex h3 { color: var(--gold); }
@media (max-width: 720px) {
  .rung { grid-template-columns: 1fr; gap: 8px; }
}

/* ---------- Vesperfang teaser ---------- */
.vf {
  border-radius: var(--radius);
  border: 1px solid var(--graphite);
  box-shadow: inset 0 0 0 1px rgba(199,199,207,0.07);
  background:
    radial-gradient(ellipse 60% 90% at 80% 10%, var(--crimson-glow), transparent 60%),
    radial-gradient(ellipse 40% 60% at 15% 90%, var(--gold-glow), transparent 70%),
    var(--onyx-panel);
  padding: clamp(44px, 6vw, 84px);
  position: relative;
  overflow: hidden;
}
.vf::before {
  content: '&';
  position: absolute;
  right: -30px; bottom: -80px;
  font-family: var(--font-hero);
  font-size: 26rem;
  line-height: 1;
  color: rgba(231, 225, 215, 0.035);
  pointer-events: none;
}
.vf h2 { font-family: var(--font-hero); font-size: clamp(1.2rem, 6.5vw, 3rem); letter-spacing: clamp(0.04em, 1vw, 0.2em); white-space: nowrap; overflow-wrap: normal; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--hairline);
  margin-top: var(--section-gap);
  padding: 54px 0 42px;
}
.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
@media (max-width: 880px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
footer h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 16px;
}
footer ul { list-style: none; }
footer li { margin-bottom: 9px; }
footer a { color: var(--bone-dim); font-size: 0.92rem; transition: color 0.2s; }
footer a:hover { color: var(--bone); }
.foot-tagline { font-family: var(--font-editorial); font-style: italic; font-size: 1.08rem; color: var(--bone-dim); margin-top: 14px; max-width: 34ch; }
.foot-legal {
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--bone-faint);
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* Hero grid — words lead, emblem rides. Desktop: emblem owns the right column.
   Mobile (Ellie's spec): emblem sits small beside the headline; lede + buttons take full width. */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "eyebrow  emblem"
    "headline emblem"
    "lede     emblem"
    "btns     emblem";
  column-gap: clamp(24px, 4vw, 72px);
  row-gap: 26px;
  align-items: center;
}
.hero-emblem {
  width: clamp(180px, 24vw, 340px);
  height: auto;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 60px rgba(143,31,40,0.18);
  justify-self: end;
}
@media (max-width: 880px) {
  .hero-grid {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "eyebrow  eyebrow"
      "headline emblem"
      "lede     lede"
      "btns     btns";
    row-gap: 20px;
  }
  .hero-emblem { width: clamp(88px, 26vw, 130px); align-self: start; }
}
