/* ===== HEDGE - Hedge on Robinhood ===== */

/* THEMING
   The brand colour is neon lime. As a *fill* (buttons, marquee) with near-black
   text on top it works in both themes, so those tokens never change. As *text* it
   only works on a dark ground - #c6ff2e on white is ~1.3:1 - so the text accent is
   a separate token that darkens to a deep lime-olive in light mode.
   Hence the --fill / --accent split below; don't collapse them back together.

   An inline script in <head> resolves the theme (stored choice, else the OS
   setting) into data-theme before first paint, so there is exactly one dark block
   and one light block here - no duplicated palette to drift out of sync.
   With JS off, the :root defaults apply and the site stays dark, which is its
   native design. */

:root {
  /* ---- dark (default) ---- */
  color-scheme: dark;

  --bg: #05070a;
  --bg-2: #0a0f0c;
  --panel: #0e130f;
  --panel-fade: rgba(10, 15, 12, 0.5);
  --ink: #eafbe0;
  --muted: #93a892;

  --accent: #c6ff2e;            /* brand colour as TEXT / icons / borders */
  --accent-2: #a3e635;          /* quieter text accent (chips) */
  --accent-soft: #34ff6a;       /* kickers, eyebrows */
  --accent-wash: rgba(198, 255, 46, 0.05);
  --accent-glow: rgba(198, 255, 46, 0.3);

  --fill: #c6ff2e;              /* brand colour as FILL - same in both themes */
  --fill-2: #a3e635;
  --on-fill: #0a1400;           /* text on top of a fill */

  --line: rgba(198, 255, 46, 0.14);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  --shadow-color: rgba(0, 0, 0, 0.5);
  --drawer-shadow: 0 24px 40px rgba(0, 0, 0, 0.5);

  --code-bg: #060a06;
  --nav-bg: linear-gradient(180deg, rgba(5, 7, 10, 0.9), rgba(5, 7, 10, 0.55));
  --nav-bg-solid: rgba(5, 7, 10, 0.97);
  --mbar-bg: linear-gradient(180deg, rgba(5, 7, 10, 0.75), rgba(5, 7, 10, 0.97));
  --scrim: rgba(5, 7, 10, 0.72);
  --tap-highlight: rgba(198, 255, 46, 0.18);

  --hero-veil: rgba(5, 7, 10, 0.75);
  --hero-img-opacity: 0.28;
  --art-glow: 0 0 60px rgba(198, 255, 46, 0.25);
  --title-stroke: rgba(10, 20, 0, 0.4);
  --title-shadow: 0 0 40px rgba(198, 255, 46, 0.35), 6px 6px 0 rgba(0, 0, 0, 0.6);
  --hl-shadow: 0 0 22px rgba(198, 255, 46, 0.45);
  --brand-shadow: 0 0 18px rgba(198, 255, 46, 0.5);

  --body-glow-1: rgba(0, 200, 5, 0.10);
  --body-glow-2: rgba(198, 255, 46, 0.07);
  --glow-1: rgba(0, 200, 5, 0.25);
  --glow-2: rgba(198, 255, 46, 0.18);
  --grain-blend: overlay;
  --grain-opacity: 0.05;
  --scanline-opacity: 0.35;
  --disclaimer-ink: #7f8f7f;

  /* ---- non-colour tokens ---- */
  --radius: 18px;
  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 48px);
  --nav-h: 68px;        /* sticky header height */
  --mbar-h: 78px;       /* mobile action bar height (JS overwrites with the measured value) */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6ee;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-fade: rgba(255, 255, 255, 0.55);
  --ink: #0f1a0b;
  --muted: #4c5a48;             /* 6.7:1 on --bg */

  --accent: #3d6b00;            /* deep lime-olive - 5.5:1 on --bg */
  --accent-2: #3d6b00;
  --accent-soft: #0e7a24;       /* 5.0:1 on --bg */
  --accent-wash: rgba(61, 107, 0, 0.045);
  --accent-glow: rgba(61, 107, 0, 0.16);

  --fill: #c6ff2e;
  --fill-2: #a3e635;
  --on-fill: #0a1400;

  --line: rgba(15, 26, 11, 0.16);
  --shadow: 0 14px 40px rgba(30, 50, 15, 0.10);
  --shadow-color: rgba(30, 50, 15, 0.22);
  --drawer-shadow: 0 24px 40px rgba(20, 40, 10, 0.16);

  --code-bg: #f2f7e4;
  --nav-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.62));
  --nav-bg-solid: rgba(255, 255, 255, 0.97);
  --mbar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.97));
  --scrim: rgba(20, 30, 15, 0.42);
  --tap-highlight: rgba(61, 107, 0, 0.14);

  --hero-veil: rgba(244, 246, 238, 0.88);
  --hero-img-opacity: 0.11;   /* the dark cityscape reads as a smudge on a light ground */
  --art-glow: 0 10px 26px rgba(30, 50, 15, 0.12);
  /* Sticker treatment keeps the title on-brand without lime-on-white text */
  --title-stroke: #33590a;
  --title-shadow: 5px 5px 0 #33590a;
  --hl-shadow: none;
  --brand-shadow: none;

  --body-glow-1: rgba(0, 200, 5, 0.05);
  --body-glow-2: rgba(163, 230, 53, 0.08);
  --glow-1: rgba(0, 200, 5, 0.10);
  --glow-2: rgba(163, 230, 53, 0.13);
  --grain-blend: multiply;
  --grain-opacity: 0.035;
  --scanline-opacity: 0.08;
  --disclaimer-ink: #5f6b5b;    /* 4.9:1 on --bg */
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;  /* stop iOS inflating text in landscape */
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 80% -10%, var(--body-glow-1), transparent 60%),
    radial-gradient(900px 600px at 0% 20%, var(--body-glow-2), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-tap-highlight-color: var(--tap-highlight);
}
/* `clip` contains overflow without making <body> a scroll container,
   which keeps the sticky header reliable on mobile Safari. */
@supports (overflow: clip) { body { overflow-x: clip; } }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 { line-height: 1.02; margin: 0; }

.hl { color: var(--accent); text-shadow: var(--hl-shadow); }

/* keyboard focus - visible on every interactive element */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; top: -60px; left: 12px; z-index: 200;
  background: var(--fill); color: var(--on-fill); font-weight: 700;
  padding: 10px 16px; border-radius: 0 0 10px 10px; transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ===== texture overlays ===== */
.grain {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: var(--grain-blend);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  opacity: var(--scanline-opacity);
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.28) 2px 3px);
  mix-blend-mode: multiply;
}
.glow-blob { position: fixed; border-radius: 50%; filter: blur(120px); z-index: -1; opacity: 0.5; }
.blob-1 { width: 520px; height: 520px; background: var(--glow-1); top: -120px; right: -120px; }
.blob-2 { width: 460px; height: 460px; background: var(--glow-2); bottom: -160px; left: -140px; }

/* ===== buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  min-height: 48px; padding: 13px 24px; border-radius: 999px; font-weight: 700; font-size: 0.98rem;
  font-family: inherit; text-align: center;
  border: 2px solid transparent; transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s;
  letter-spacing: 0.3px;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--fill), var(--fill-2));
  color: var(--on-fill); box-shadow: 0 10px 30px rgba(163, 230, 53, 0.35);
}
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }

/* ===== nav ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 20px;
  padding: 14px max(var(--gutter), var(--safe-r)) 14px max(var(--gutter), var(--safe-l));
  -webkit-backdrop-filter: blur(14px);   /* iOS Safari < 18 needs the prefix */
  backdrop-filter: blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
}
/* Opaque fallback where blur is unsupported, so content can't bleed through */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav { background: var(--nav-bg-solid); }
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; min-height: 44px; }
.brand-img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--accent); object-fit: cover; flex: none; }
.brand-name { font-family: "Luckiest Guy", cursive; font-size: 1.5rem; letter-spacing: 2px; color: var(--accent); text-shadow: var(--brand-shadow); }
.nav-links { display: flex; gap: 26px; font-weight: 600; align-items: center; }
.nav-links a { color: var(--muted); transition: color 0.2s; }
.nav-links a.drawer-cta { color: var(--on-fill); }
.drawer-cta { display: none; }

/* ===== theme toggle ===== */
.theme-toggle {
  width: 48px; height: 48px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line); border-radius: 50%;
  color: var(--accent); cursor: pointer; padding: 0;
  transition: border-color 0.2s, background 0.2s;
}
.theme-toggle svg { width: 21px; height: 21px; display: block; }
/* The head script always resolves an explicit data-theme, so these two rules
   cover every state. Show the icon of the theme you'd switch TO. */
:root[data-theme="dark"] .icon-moon,
:root[data-theme="light"] .icon-sun { display: none; }

.menu-toggle {
  display: none; width: 48px; height: 48px; margin-right: -10px; flex: none;
  align-items: center; justify-content: center;
  background: none; border: none; color: var(--accent); cursor: pointer; padding: 0;
}
.burger, .burger::before, .burger::after {
  display: block; width: 24px; height: 2px; background: var(--accent); border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, background 0.2s ease;
}
.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -7px; }
.burger::after  { top: 7px; }
.nav.open .burger { background: transparent; }
.nav.open .burger::before { transform: translateY(7px) rotate(45deg); }
.nav.open .burger::after  { transform: translateY(-7px) rotate(-45deg); }

/* ===== hero ===== */
.hero { position: relative; overflow: hidden; padding-bottom: 0; }
.hero-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  background-image: url("assets/opt/hedge-city-480.webp");
  opacity: var(--hero-img-opacity); filter: saturate(1.2) contrast(1.05);
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 30%, transparent 100%);
}
@media (min-width: 481px) { .hero-bg { background-image: url("assets/opt/hedge-city-800.webp"); } }
@media (min-width: 801px) { .hero-bg { background-image: url("assets/opt/hedge-city-1024.webp"); } }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(80% 60% at 70% 30%, transparent, var(--hero-veil)); }
.hero-inner {
  position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center;
  padding: clamp(40px, 7vw, 90px) var(--gutter) 70px;
}
.hero-copy, .hero-art { min-width: 0; }
.eyebrow {
  display: inline-block; font-weight: 700; letter-spacing: 3px; font-size: 0.8rem;
  color: var(--accent-soft); text-transform: uppercase; margin-bottom: 14px;
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--accent-wash);
}
.hero-title {
  font-family: "Luckiest Guy", cursive; font-size: clamp(3.2rem, 16vw, 11rem);
  color: var(--fill); letter-spacing: clamp(1px, 0.5vw, 4px); line-height: 0.9;
  text-shadow: var(--title-shadow);
  -webkit-text-stroke: 2px var(--title-stroke);
}
.hero-sub { font-family: "Bangers", cursive; font-size: clamp(1.5rem, 5.5vw, 2.6rem); letter-spacing: 2px; color: var(--ink); margin: 6px 0 14px; }
.hero-lead { color: var(--muted); font-size: clamp(1rem, 3.6vw, 1.1rem); max-width: 520px; margin-bottom: 26px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.hero-tags { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { font-size: 0.78rem; font-weight: 700; letter-spacing: 1px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); color: var(--accent-2); background: var(--accent-wash); }
.hero-art { position: relative; }
.hero-art img {
  border-radius: 22px; border: 3px solid var(--accent); box-shadow: var(--art-glow), var(--shadow);
  transform: rotate(1.5deg); animation: float 6s ease-in-out infinite; width: 100%;
}
@keyframes float { 0%,100% { transform: rotate(1.5deg) translateY(0);} 50% { transform: rotate(1.5deg) translateY(-14px);} }

/* ===== marquee ===== */
/* Lime fill with near-black text - identical in both themes, so it anchors the
   brand across the switch. */
.marquee { position: relative; z-index: 3; overflow: hidden; border-top: 2px solid var(--fill); border-bottom: 2px solid var(--fill); background: var(--fill); }
.marquee-track { display: flex; white-space: nowrap; animation: scroll 22s linear infinite; will-change: transform; }
.marquee-track span { font-family: "Bangers", cursive; font-size: clamp(1.05rem, 4vw, 1.4rem); letter-spacing: 2px; color: var(--on-fill); padding: 8px 0; }
@keyframes scroll { from { transform: translateX(0);} to { transform: translateX(-50%);} }

/* ===== section shell ===== */
section { position: relative; }
.section-head { max-width: var(--maxw); margin: 0 auto; padding: clamp(48px, 8vw, 96px) var(--gutter) 8px; text-align: center; }
.kicker { display: inline-block; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; font-size: 0.78rem; color: var(--accent-soft); margin-bottom: 12px; }
.section-head h2 { font-family: "Luckiest Guy", cursive; font-size: clamp(2rem, 7vw, 4.2rem); letter-spacing: 1px; }
.section-head p { color: var(--muted); margin-top: 12px; }

/* ===== CA card ===== */
.ca-section { padding-bottom: 20px; }
.ca-card {
  max-width: 860px; margin: 30px var(--gutter) 0; padding: 30px clamp(16px, 4vw, 40px);
  border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), var(--panel-fade));
  box-shadow: var(--shadow); text-align: center;
}
@media (min-width: 924px) { .ca-card { margin-inline: auto; } }
.ca-label { display: block; color: var(--muted); font-size: 0.85rem; letter-spacing: 1px; margin-bottom: 12px; text-transform: uppercase; }
.ca-box {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border-radius: 14px; cursor: pointer; min-height: 56px;
  background: var(--code-bg); border: 1px dashed var(--accent); transition: box-shadow 0.2s, transform 0.1s;
  font-family: inherit;
}
.ca-box:active { transform: scale(0.995); }
.ca-box code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent); font-size: clamp(0.68rem, 3.1vw, 1rem); line-height: 1.5;
  word-break: break-all; text-align: left; min-width: 0;
}
.ca-copy { flex: none; font-weight: 700; color: var(--on-fill); background: var(--fill); padding: 10px 18px; border-radius: 999px; font-size: 0.85rem; }
.ca-links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 22px; }
.ca-link { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--accent-wash); transition: transform 0.15s, border-color 0.2s; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 64px; }
.ca-link strong { color: var(--ink); }
.ca-link span { color: var(--muted); font-size: 0.82rem; }

/* ===== stats ===== */
.stats {
  max-width: var(--maxw); margin: 60px auto 0; padding: 0 var(--gutter);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.stat { text-align: center; padding: 26px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), transparent); min-width: 0; }
.stat-num { display: block; font-family: "Luckiest Guy", cursive; font-size: clamp(1.35rem, 5.5vw, 2.8rem); color: var(--accent); overflow-wrap: anywhere; }
.stat-cap { color: var(--muted); font-size: clamp(0.72rem, 2.6vw, 0.85rem); letter-spacing: 0.5px; text-transform: uppercase; }

/* ===== saga ===== */
.chapter {
  max-width: var(--maxw); margin: 0 auto; padding: clamp(30px, 5vw, 56px) var(--gutter);
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 60px); align-items: center;
}
.chapter-img, .chapter-copy { min-width: 0; }
.chapter.reverse .chapter-img { order: 2; }
.chapter-img img { width: 100%; border-radius: var(--radius); border: 3px solid var(--line); box-shadow: var(--shadow); transition: transform 0.3s, border-color 0.3s; }
.chapter-no { display: inline-block; font-family: "Bangers", cursive; letter-spacing: 2px; font-size: 1.1rem; color: var(--accent-soft); margin-bottom: 8px; }
.chapter-copy h3 { font-family: "Luckiest Guy", cursive; font-size: clamp(1.65rem, 6vw, 3rem); margin-bottom: 12px; }
.chapter-copy p { color: var(--muted); font-size: clamp(1rem, 3.6vw, 1.08rem); }
.chapter-lead { color: var(--ink) !important; font-family: "Bangers", cursive; letter-spacing: 1px; font-size: clamp(1.2rem, 4.4vw, 1.35rem) !important; margin-bottom: 10px; }

/* ===== thesis closing statement ===== */
.thesis-close {
  max-width: var(--maxw); margin: 8px auto 0; padding: 0 var(--gutter) clamp(8px, 3vw, 24px);
  text-align: center;
}
.thesis-close p { color: var(--muted); font-size: clamp(1rem, 3.6vw, 1.15rem); margin: 0 0 10px; }
.thesis-close strong {
  display: block; font-family: "Luckiest Guy", cursive; letter-spacing: 2px;
  font-size: clamp(1.6rem, 6.5vw, 3rem); color: var(--accent); text-shadow: var(--hl-shadow);
}

/* ===== community ===== */
.social-grid { max-width: 980px; margin: 30px auto 0; padding: 0 var(--gutter); display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.social-card { padding: 30px 22px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), transparent); transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.social-icon { font-size: 2.4rem; line-height: 1.2; color: var(--accent); }
.social-card strong { font-size: 1.2rem; }
.social-card span { color: var(--muted); font-size: 0.9rem; }

/* ===== footer ===== */
.footer { max-width: var(--maxw); margin: 90px auto 0; padding: 50px var(--gutter) 40px; border-top: 1px solid var(--line); text-align: center; }
.footer-brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.footer-brand img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--accent); object-fit: cover; }
.footer-brand span { font-family: "Luckiest Guy", cursive; font-size: 1.6rem; color: var(--accent); letter-spacing: 2px; }
.footer-tag { font-family: "Bangers", cursive; letter-spacing: 1px; font-size: clamp(1.1rem, 4.4vw, 1.3rem); color: var(--ink); margin: 14px 0 14px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-bottom: 18px; }
.footer-links a { color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
.footer-ca { color: var(--accent); font-size: 0.82rem; word-break: break-all; margin-bottom: 18px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.disclaimer { color: var(--disclaimer-ink); font-size: 0.8rem; max-width: 720px; margin: 0 auto 16px; }
.copyright { color: var(--muted); font-size: 0.85rem; }

/* ===== toast ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%) translateY(24px);
  background: var(--fill); color: var(--on-fill); font-weight: 700; padding: 12px 22px; border-radius: 999px;
  box-shadow: 0 10px 30px var(--shadow-color); opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease; z-index: 9999;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== mobile action bar (phones only) ===== */
.mobile-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  display: none; gap: 10px;
  padding: 10px max(12px, var(--safe-r)) calc(10px + var(--safe-b)) max(12px, var(--safe-l));
  background: var(--mbar-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  transform: translateY(130%);
  transition: transform 0.28s ease;
}
.mobile-bar.show { transform: translateY(0); }
.mobile-bar .btn { flex: 1; min-width: 0; padding-inline: 12px; }
.mbar-copy { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }

/* ===== menu scrim ===== */
body.menu-open::before {
  content: ""; position: fixed; inset: 0; z-index: 96;
  background: var(--scrim);
}
/* ===== reveal on scroll ===== */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ===== hover effects - pointer devices only =====
   Gated so a tap on a phone doesn't leave an element stuck in its hover state. */
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 26px rgba(198, 255, 46, 0.6); }
  .btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
  .nav-links a:hover { color: var(--accent); }
  .theme-toggle:hover { border-color: var(--accent); background: var(--accent-wash); }
  .ca-box:hover { box-shadow: 0 0 24px var(--accent-glow); }
  .ca-link:hover { transform: translateY(-3px); border-color: var(--accent); }
  .chapter-img img:hover { transform: scale(1.02) rotate(-1deg); border-color: var(--accent); }
  .step:hover { border-color: var(--accent); }
  .social-card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: 0 0 30px var(--accent-glow); }
  .footer-links a:hover { color: var(--accent); }
}

/* ===== responsive ===== */
@media (max-width: 900px) {
  body { padding-bottom: calc(var(--mbar-h) + var(--safe-b)); }

  .nav-cta { display: none; }
  .menu-toggle { display: inline-flex; }
  .nav-links { display: none; }
  .nav.open .nav-links {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px max(18px, var(--safe-l)) 18px max(18px, var(--safe-r));
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    box-shadow: var(--drawer-shadow);
    max-height: calc(100dvh - var(--nav-h)); overflow-y: auto;
  }
  .nav.open .nav-links a { display: flex; align-items: center; min-height: 52px; font-size: 1.05rem; }
  .nav.open .drawer-cta { display: inline-flex; justify-content: center; margin-top: 10px; }

  .hero-inner { grid-template-columns: 1fr; text-align: center; gap: 28px; padding-bottom: 54px; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero-art { max-width: 340px; margin: 0 auto; width: 100%; }

  .chapter, .chapter.reverse { grid-template-columns: 1fr; }
  .chapter.reverse .chapter-img { order: 0; }
  .social-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ca-links { grid-template-columns: repeat(2, 1fr); }
  .footer { margin-top: 64px; }

  .mobile-bar { display: flex; }
  /* Lift the toast clear of the action bar instead of behind it */
  .toast { bottom: calc(var(--mbar-h) + 14px); }

  /* Fixed full-screen blend layers are expensive to recomposite while
     scrolling on phones - drop the scanlines, un-blend the grain. */
  body::after { display: none; }
  .grain { mix-blend-mode: normal; opacity: 0.035; }
  .glow-blob { filter: blur(70px); opacity: 0.4; }
  .blob-1 { width: 300px; height: 300px; top: -90px; right: -90px; }
  .blob-2 { width: 280px; height: 280px; bottom: -110px; left: -100px; }
}
/* The grain reads as dirt on a light ground once it isn't blending */
:root[data-theme="light"] .grain { opacity: 0.02; }

@media (max-width: 560px) {
  .ca-box { flex-direction: column; align-items: stretch; gap: 12px; }
  .ca-copy { align-self: stretch; text-align: center; padding: 12px 18px; }
  .ca-box code { text-align: center; }
}

@media (max-width: 400px) {
  .nav { gap: 10px; }
  .stat { padding: 18px 8px; }
  .ca-card { padding: 22px 14px; }
  .social-card { padding: 24px 16px; }
  .hero-actions { width: 100%; flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
  .mobile-bar .btn { font-size: 0.9rem; }
}

/* Landscape phones: the hero would otherwise fill several screens */
@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
  .hero-inner { grid-template-columns: 1.2fr 0.8fr; text-align: left; padding-block: 28px 36px; }
  .hero-copy { align-items: flex-start; }
  .hero-art { max-width: 200px; }
  .hero-title { font-size: clamp(2.6rem, 9vw, 5rem); }
  .mobile-bar { padding-block: 6px calc(6px + var(--safe-b)); }
  .mobile-bar .btn { min-height: 42px; }
  :root { --mbar-h: 56px; }
}

/* ===== reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .marquee-track { animation: none; }
  .hero-art img { animation: none; transform: rotate(1.5deg); }
  .reveal { opacity: 1; transform: none; }
  .mobile-bar { transition: none; }
}
