/* ==========================================================================
   Front Porch AI — frontporchai.app design system
   Theme: "the porch at dusk" — warm charcoal night, amber porch-light,
   fireflies, cream text, a breath of teal. No purple, ever.
   ========================================================================== */

/* ---- Fonts (self-hosted; no third-party requests) ---- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/assets/fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/assets/fonts/fraunces-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Tokens ---- */
:root {
  /* night porch */
  --bg-0: #0e0c09;
  --bg-1: #14110d;
  --bg-2: #1a1611;
  --card: #191510;
  --card-2: #201a13;
  --border: #2c251b;
  --border-hi: #3f3522;

  /* porch light */
  --amber: #f5a623;
  --amber-hi: #ffc44d;
  --amber-deep: #c97f16;
  --amber-soft: rgba(245, 166, 35, 0.12);
  --ember: #e8833a;

  /* dusk accents (clearly blue/green — never violet) */
  --teal: #4cb8a4;
  --teal-hi: #74d6c2;
  --teal-soft: rgba(76, 184, 164, 0.12);
  --dusk: #5f9ec7;

  /* text */
  --cream: #f3ecdd;
  --cream-2: #cfc5b0;
  --mute: #9a8f76;
  --faint: #6e654f;

  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino', Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono',
    Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px rgba(0, 0, 0, 0.35);
  --glow-amber: 0 0 40px rgba(245, 166, 35, 0.18), 0 0 120px rgba(245, 166, 35, 0.07);
  --maxw: 1160px;
}

/* ---- Reset-ish ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html:focus-within { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--cream);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-hi); text-decoration: none; }
a:hover { color: var(--amber-hi); }
::selection { background: rgba(245, 166, 35, 0.28); color: var(--cream); }

/* subtle film grain for warmth */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 2000;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

/* ---- Sky / dusk backdrop ---- */
.sky {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 90% 55% at 50% -18%, rgba(245, 166, 35, 0.09), transparent 60%),
    radial-gradient(ellipse 70% 45% at 85% 4%, rgba(95, 158, 199, 0.055), transparent 65%),
    radial-gradient(ellipse 60% 50% at 12% 92%, rgba(232, 131, 58, 0.05), transparent 60%),
    linear-gradient(180deg, #0c0a08 0%, var(--bg-0) 45%, #0f0d09 100%);
}

/* fireflies (populated by JS; hidden when reduced motion) */
.flies { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.fly {
  position: absolute;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--amber-hi);
  box-shadow: 0 0 6px 2px rgba(255, 196, 77, 0.55), 0 0 18px 6px rgba(245, 166, 35, 0.18);
  opacity: 0;
  animation:
    fly-drift var(--dur, 22s) ease-in-out var(--delay, 0s) infinite alternate,
    fly-glow calc(var(--dur, 22s) / 4) ease-in-out var(--delay, 0s) infinite;
}
@keyframes fly-drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(var(--dx, 60px), var(--dy, -80px)); }
}
@keyframes fly-glow {
  0%, 100% { opacity: 0; }
  35%      { opacity: var(--peak, 0.85); }
  55%      { opacity: 0.15; }
  70%      { opacity: var(--peak, 0.7); }
}

/* ---- Nav ---- */
.nav-wrap {
  position: sticky; top: 0; z-index: 100;
  background: rgba(14, 12, 9, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(44, 37, 27, 0.7);
}
nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
nav .logo {
  display: flex; align-items: center; gap: 11px;
  color: var(--cream); font-weight: 650; font-size: 1.04rem;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}
nav .logo img { width: 34px; height: 34px; border-radius: 8px; }
nav .links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
nav .links a {
  color: var(--cream-2); font-size: 0.92rem; padding: 8px 13px;
  border-radius: 8px; transition: color 0.18s, background 0.18s;
}
nav .links a:hover { color: var(--cream); background: rgba(255, 255, 255, 0.045); }
nav .links a.active { color: var(--amber-hi); }
nav .links a.cta {
  color: #1a1102; background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  font-weight: 600; margin-left: 6px;
  box-shadow: 0 2px 14px rgba(245, 166, 35, 0.25);
}
nav .links a.cta:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--amber-hi), var(--amber)); }

/* mobile nav */
.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--cream-2); border-radius: 8px; padding: 7px 11px; font-size: 1rem; cursor: pointer; }
@media (max-width: 780px) {
  .nav-toggle { display: block; }
  nav .links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: rgba(14, 12, 9, 0.97);
    border-bottom: 1px solid var(--border);
    padding: 10px 18px 16px;
  }
  nav .links.open { display: flex; }
  nav .links a { padding: 11px 12px; }
}

/* ---- Shared section bits ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.eyebrow {
  display: inline-block;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 14px;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 560; letter-spacing: -0.015em; line-height: 1.16; }
.section-title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); color: var(--cream); margin-bottom: 10px; }
.section-sub { color: var(--mute); max-width: 640px; font-size: 1.02rem; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 26px; border-radius: 12px; font-weight: 650; font-size: 1rem;
  transition: transform 0.16s, box-shadow 0.16s, filter 0.16s;
}
.btn:active { transform: translateY(1px); }
.btn-amber {
  color: #201302;
  background: linear-gradient(180deg, var(--amber-hi) 0%, var(--amber) 100%);
  box-shadow: 0 4px 22px rgba(245, 166, 35, 0.3);
}
.btn-amber:hover { color: #201302; filter: brightness(1.07); box-shadow: 0 6px 30px rgba(245, 166, 35, 0.42); }
.btn-ghost {
  color: var(--cream); border: 1px solid var(--border-hi);
  background: rgba(255, 255, 255, 0.03);
}
.btn-ghost:hover { color: var(--amber-hi); border-color: var(--amber-deep); background: rgba(245, 166, 35, 0.06); }

/* scroll-reveal */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ==========================================================================
   LANDING
   ========================================================================== */

.hero { text-align: center; padding: 92px 24px 40px; position: relative; }
.hero-lamp {
  position: relative; width: 112px; height: 112px; margin: 0 auto 30px;
}
.hero-lamp img { width: 112px; height: 112px; border-radius: 26px; position: relative; z-index: 1; }
.hero-lamp::before {
  content: ''; position: absolute; inset: -55%;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.32), rgba(245, 166, 35, 0.06) 55%, transparent 72%);
  animation: lamp 5.5s ease-in-out infinite;
}
@keyframes lamp { 0%, 100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }

.hero h1 {
  font-size: clamp(2.6rem, 6.2vw, 4.15rem);
  font-weight: 590;
  color: var(--cream);
  margin: 0 auto 18px;
  max-width: 900px;
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  font-weight: 480;
  background: linear-gradient(100deg, var(--amber-hi) 10%, var(--ember) 55%, var(--amber) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .tagline {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  color: var(--cream-2); max-width: 660px; margin: 0 auto 30px;
}
.hero .tagline strong { color: var(--cream); }
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.hero-meta { color: var(--faint); font-size: 0.86rem; }
.hero-meta a { color: var(--mute); text-decoration: underline; text-underline-offset: 3px; }
.hero-meta a:hover { color: var(--amber-hi); }

/* framed app screenshot */
.porthole { max-width: 1060px; margin: 54px auto 0; padding: 0 24px; position: relative; }
.porthole::before {
  content: ''; position: absolute; left: 12%; right: 12%; top: 8%; bottom: -4%;
  background: radial-gradient(ellipse 60% 55% at 50% 40%, rgba(245, 166, 35, 0.14), transparent 70%);
  filter: blur(30px); z-index: 0;
}
.porthole .frame {
  position: relative; z-index: 1;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--border-hi);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), var(--glow-amber);
  background: var(--bg-2);
}
.porthole .frame::before {
  content: ''; display: block; height: 34px;
  background: linear-gradient(180deg, #241e15, #1b1610);
  border-bottom: 1px solid var(--border);
  background-image: radial-gradient(circle at 20px 17px, #e8833a 5px, transparent 6px),
    radial-gradient(circle at 42px 17px, var(--amber) 5px, transparent 6px),
    radial-gradient(circle at 64px 17px, var(--teal) 5px, transparent 6px),
    linear-gradient(180deg, #241e15, #1b1610);
}

/* trust strip */
.trust { display: flex; gap: 12px 30px; justify-content: center; flex-wrap: wrap; padding: 44px 20px 8px; color: var(--mute); font-size: 0.92rem; }
.trust span { display: inline-flex; align-items: center; gap: 8px; }
.trust b { color: var(--cream-2); font-weight: 600; }

/* ---- Channels (download cards) ---- */
.channels-section { padding: 86px 0 30px; }
.channels-section .head { text-align: center; margin-bottom: 40px; }
.channels-section .head .section-sub { margin: 0 auto; }
.os-hint {
  display: none; margin: 16px auto 0; width: fit-content;
  padding: 7px 16px; border-radius: 999px; font-size: 0.88rem;
  color: var(--teal-hi); background: var(--teal-soft); border: 1px solid rgba(76, 184, 164, 0.3);
}
.os-hint.show { display: block; }

.channels { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; max-width: 980px; margin: 0 auto; padding: 0 28px; }
@media (max-width: 860px) { .channels { grid-template-columns: 1fr; } }

.channel {
  border-radius: var(--radius); padding: 30px 30px 26px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.channel:hover { transform: translateY(-3px); }
.channel-stable:hover { border-color: var(--amber-deep); box-shadow: var(--shadow-card), 0 0 34px rgba(245, 166, 35, 0.1); }
.channel-nightly:hover { border-color: rgba(76, 184, 164, 0.5); box-shadow: var(--shadow-card), 0 0 34px rgba(76, 184, 164, 0.08); }
.channel .chead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.channel h3 { font-size: 1.42rem; color: var(--cream); }
.badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}
.badge-stable { color: #241502; background: linear-gradient(180deg, var(--amber-hi), var(--amber)); }
.badge-nightly { color: var(--teal-hi); background: var(--teal-soft); border: 1px solid rgba(76, 184, 164, 0.35); }
.channel .ver { color: var(--mute); font-size: 0.88rem; margin-bottom: 16px; }
.channel .ver code { color: var(--cream-2); background: rgba(255,255,255,0.05); padding: 2px 7px; border-radius: 6px; font-family: var(--font-mono); font-size: 0.82rem; }
.channel ul { list-style: none; margin: 0 0 22px; display: grid; gap: 10px; }
.channel li { color: var(--cream-2); font-size: 0.94rem; padding-left: 2px; }
.channel li strong { color: var(--cream); }
.channel .btn { justify-content: center; margin-top: auto; }
.channel .foot { text-align: center; margin-top: 12px; font-size: 0.84rem; color: var(--faint); }
.channel .foot a { color: var(--mute); }
.channel .foot a:hover { color: var(--amber-hi); }
.btn-teal {
  color: #06201b; background: linear-gradient(180deg, var(--teal-hi), var(--teal));
  box-shadow: 0 4px 22px rgba(76, 184, 164, 0.22);
}
.btn-teal:hover { color: #06201b; filter: brightness(1.06); }

/* linux one-liner */
.linux-line { max-width: 980px; margin: 22px auto 0; padding: 0 28px; }
.linux-line .box {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px dashed var(--border-hi); border-radius: var(--radius-sm);
  padding: 14px 18px; color: var(--mute); font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.016);
}
.linux-line code { font-family: var(--font-mono); color: var(--teal-hi); font-size: 0.85rem; }
.linux-line a { white-space: nowrap; }

/* ---- Stoop spotlight ---- */
.stoop { padding: 90px 0; }
.stoop .inner {
  max-width: 1020px; margin: 0 auto; padding: 0 28px;
}
.stoop .panel {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 52px 54px;
  border: 1px solid rgba(245, 166, 35, 0.22);
  background:
    radial-gradient(ellipse 75% 90% at 8% 0%, rgba(245, 166, 35, 0.1), transparent 55%),
    radial-gradient(ellipse 60% 80% at 100% 100%, rgba(232, 131, 58, 0.07), transparent 60%),
    linear-gradient(180deg, #1e1810, #17120c);
  box-shadow: var(--shadow-card), 0 0 60px rgba(245, 166, 35, 0.05);
}
/* porch boards */
.stoop .panel::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background: repeating-linear-gradient(90deg, transparent 0 119px, rgba(0, 0, 0, 0.22) 119px 121px);
}
.stoop h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--cream); margin-bottom: 16px; }
.stoop p.lead { color: var(--cream-2); font-size: 1.04rem; max-width: 700px; margin-bottom: 24px; }
.stoop .chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.stoop .chip {
  font-size: 0.84rem; color: var(--cream-2);
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border-hi); background: rgba(0, 0, 0, 0.25);
}
.stoop .chip strong { color: var(--amber-hi); font-weight: 650; }
@media (max-width: 640px) { .stoop .panel { padding: 36px 26px; } }

/* ---- Features grid ---- */
.features { padding: 60px 0 40px; }
.features .head { text-align: center; margin-bottom: 44px; }
.features .head .section-sub { margin: 0 auto; }
.fgrid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
}
@media (max-width: 980px) { .fgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .fgrid { grid-template-columns: 1fr; } }
.fcard {
  border-radius: var(--radius); padding: 26px 24px;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.fcard:hover { transform: translateY(-3px); border-color: var(--amber-deep); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35), 0 0 26px rgba(245, 166, 35, 0.07); }
.fcard .ic {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.35rem; margin-bottom: 16px;
  background: var(--amber-soft); border: 1px solid rgba(245, 166, 35, 0.2);
}
.fcard:nth-child(3n) .ic { background: var(--teal-soft); border-color: rgba(76, 184, 164, 0.25); }
.fcard h3 { font-size: 1.08rem; color: var(--cream); margin-bottom: 8px; font-weight: 600; }
.fcard p { color: var(--mute); font-size: 0.92rem; }

/* ---- privacy strip ---- */
.privacy-strip { padding: 70px 0; text-align: center; }
.privacy-strip .inner { max-width: 760px; margin: 0 auto; padding: 0 28px; }
.privacy-strip h2 { font-size: clamp(1.5rem, 2.8vw, 2rem); color: var(--cream); margin-bottom: 14px; }
.privacy-strip p { color: var(--mute); font-size: 1rem; margin-bottom: 8px; }
.privacy-strip .answer {
  font-family: var(--font-display); font-style: italic; font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  color: var(--amber-hi); margin: 18px 0;
}

/* ---- gallery strip ---- */
.gallery { padding: 20px 0 70px; }
.gallery .row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
  max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
}
@media (max-width: 780px) { .gallery .row { grid-template-columns: 1fr; } }
.shot {
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}
.shot:hover { transform: translateY(-3px) scale(1.01); border-color: var(--amber-deep); }
.shot img { width: 100%; height: 240px; object-fit: cover; object-position: center top; filter: brightness(1.12); }
.shot span {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 14px 10px; font-size: 0.85rem; color: var(--cream);
  background: linear-gradient(180deg, transparent, rgba(10, 8, 5, 0.82));
}

/* ---- docs grid on landing ---- */
.docs-links { padding: 40px 0 90px; }
.docs-links .head { text-align: center; margin-bottom: 34px; }
.dgrid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  max-width: 980px; margin: 0 auto; padding: 0 28px;
}
@media (max-width: 900px) { .dgrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .dgrid { grid-template-columns: 1fr; } }
.dgrid a {
  padding: 16px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card);
  color: var(--cream-2); font-size: 0.94rem; font-weight: 550;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.dgrid a:hover { border-color: var(--amber-deep); color: var(--cream); background: var(--card-2); }
.dgrid a small { display: block; color: var(--faint); font-weight: 400; font-size: 0.8rem; margin-top: 3px; }

/* ---- footer ---- */
footer { border-top: 1px solid var(--border); padding: 40px 28px 46px; }
footer .cols {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  color: var(--mute); font-size: 0.9rem;
}
footer .brand { display: flex; align-items: center; gap: 10px; color: var(--cream-2); font-family: var(--font-display); font-weight: 600; }
footer .brand img { width: 28px; height: 28px; border-radius: 7px; }
footer .links { display: flex; gap: 20px; flex-wrap: wrap; }
footer .links a { color: var(--mute); }
footer .links a:hover { color: var(--amber-hi); }
footer .fine { max-width: var(--maxw); margin: 18px auto 0; color: var(--faint); font-size: 0.8rem; }
footer .fine a { color: var(--mute); }

/* ==========================================================================
   DOCS SHELL
   ========================================================================== */

.docs-layout {
  max-width: 1380px; margin: 0 auto;
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px;
  gap: 48px; padding: 34px 28px 90px;
}
@media (max-width: 1180px) { .docs-layout { grid-template-columns: 240px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 880px) { .docs-layout { grid-template-columns: 1fr; gap: 20px; padding-top: 18px; } }

/* sidebar */
.side { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; padding-right: 6px; }
.side::-webkit-scrollbar { width: 4px; }
.side::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }
.side .group { margin-bottom: 22px; }
.side .group-name {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 8px; padding-left: 12px;
}
.side a {
  display: block; padding: 7px 12px; border-radius: 8px;
  color: var(--cream-2); font-size: 0.92rem;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
}
.side a:hover { color: var(--cream); background: rgba(255, 255, 255, 0.04); }
.side a.current {
  color: var(--amber-hi); background: var(--amber-soft);
  border-left-color: var(--amber); border-radius: 0 8px 8px 0;
  font-weight: 600;
}
@media (max-width: 880px) {
  .side { position: static; max-height: none; }
  .side details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); padding: 4px 10px; }
  .side summary { cursor: pointer; padding: 9px 4px; color: var(--cream-2); font-weight: 600; font-size: 0.95rem; list-style: none; }
  .side summary::before { content: '☰  '; color: var(--amber); }
}
@media (min-width: 881px) {
  .side details { display: contents; }
  .side summary { display: none; }
}

/* article */
.doc { min-width: 0; }
.doc-head { margin-bottom: 8px; }
.doc-head .crumb { font-size: 0.84rem; color: var(--faint); margin-bottom: 4px; }
.doc-head .crumb a { color: var(--mute); }
.doc-head .crumb a:hover { color: var(--amber-hi); }

.prose { font-size: 1.02rem; color: var(--cream-2); max-width: 760px; }
.prose > *:first-child { margin-top: 0; }
.prose h1 {
  font-size: clamp(2rem, 4vw, 2.7rem); color: var(--cream);
  margin: 0.4em 0 0.5em; font-weight: 580;
}
.prose h2 {
  font-size: 1.55rem; color: var(--cream); font-weight: 580;
  margin: 2em 0 0.7em;
}
.prose h3 { font-size: 1.18rem; color: var(--cream); margin: 1.8em 0 0.6em; font-weight: 600; }
.prose h4 { font-size: 1.02rem; color: var(--cream); margin: 1.5em 0 0.5em; font-family: var(--font-body); font-weight: 650; }
.prose p { margin: 0 0 1.05em; }
.prose strong { color: var(--cream); font-weight: 640; }
.prose em { color: inherit; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.5em; }
.prose li { margin-bottom: 0.45em; }
.prose li::marker { color: var(--amber-deep); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.4em 0; }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(76, 184, 164, 0.4); }
.prose a:hover { text-decoration-color: currentColor; }

/* headings: anchor links */
.prose .hlink { text-decoration: none; color: inherit; }
.prose .hlink:hover::after { content: ' #'; color: var(--amber-deep); font-weight: 400; }

/* inline code + blocks */
.prose code {
  font-family: var(--font-mono); font-size: 0.86em;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0.13em 0.42em; border-radius: 6px; color: var(--teal-hi);
}
.prose pre {
  margin: 0; padding: 18px 20px; overflow-x: auto;
  background: #12100b; font-size: 0.87rem; line-height: 1.6;
}
.prose pre code { background: none; border: none; padding: 0; color: var(--cream-2); }
.codeblock { position: relative; margin: 0 0 1.3em; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #12100b; }
.codeblock .copy {
  position: absolute; top: 8px; right: 8px;
  font-size: 0.74rem; font-family: var(--font-body); font-weight: 600;
  color: var(--mute); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-hi); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; opacity: 0; transition: opacity 0.15s, color 0.15s;
}
.codeblock:hover .copy { opacity: 1; }
.codeblock .copy:hover { color: var(--amber-hi); }
.codeblock .copy.ok { color: var(--teal-hi); opacity: 1; }

/* tables */
.table-scroll { overflow-x: auto; margin: 0 0 1.3em; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.prose th {
  text-align: left; padding: 11px 14px; color: var(--cream);
  background: var(--card-2); font-weight: 640; white-space: nowrap;
  border-bottom: 1px solid var(--border-hi);
}
.prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tr:last-child td { border-bottom: none; }
.prose tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* images */
.prose img {
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  margin: 0.4em 0 1.2em; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* callouts (transformed blockquotes) */
.prose blockquote, .callout {
  margin: 0 0 1.3em; padding: 15px 19px;
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--amber-soft);
  color: var(--cream-2); font-size: 0.95rem;
}
.prose blockquote p:last-child, .callout p:last-child { margin-bottom: 0; }
.callout-tip { border-left-color: var(--teal); background: var(--teal-soft); }
.callout-warn { border-left-color: var(--ember); background: rgba(232, 131, 58, 0.1); }
.callout-info { border-left-color: var(--dusk); background: rgba(95, 158, 199, 0.09); }

/* nightly badge */
.badge-inline {
  display: inline-block; vertical-align: 2px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--teal-hi); background: var(--teal-soft);
  border: 1px solid rgba(76, 184, 164, 0.35);
  border-radius: 999px; padding: 2px 9px; margin-left: 6px;
}

/* prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 54px; max-width: 760px; }
.pager a {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 18px; color: var(--cream-2);
  transition: border-color 0.18s, color 0.18s;
}
.pager a:hover { border-color: var(--amber-deep); color: var(--cream); }
.pager a small { display: block; color: var(--faint); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; }
.pager a.next { text-align: right; grid-column: 2; }

/* right toc */
.toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; font-size: 0.85rem; }
.toc .toc-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 10px;
}
.toc a {
  display: block; padding: 4px 0 4px 12px; color: var(--mute);
  border-left: 2px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.toc a.h3 { padding-left: 26px; font-size: 0.8rem; }
.toc a:hover { color: var(--cream); }
.toc a.active { color: var(--amber-hi); border-left-color: var(--amber); }

/* ---- plain page (privacy, 404) ---- */
.page-plain { max-width: 780px; margin: 0 auto; padding: 50px 28px 90px; }

.err { text-align: center; padding: 120px 24px 140px; }
.err h1 { font-size: clamp(3rem, 9vw, 5.5rem); color: var(--amber); margin-bottom: 8px; }
.err p { color: var(--mute); margin-bottom: 28px; }

/* ---- motion safety ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .fly { display: none; }
  .reveal { opacity: 1; transform: none; }
}
