/* ==========================================================================
   Radio Starlight — Shared Stylesheet
   (Dark first; Light and per‑feature overrides below)
   ========================================================================== */

/* ------------------------------
   Design tokens
--------------------------------*/
:root {
  /* Surfaces / ink */
  --bg: #0a0f21;
  --bg-2: #0f1531;
  --card: #10162e;
  --text: #eef1ff;
  --muted: #a8b2d8;
  --line: rgba(255, 255, 255, 0.1);

  /* Accents */
  --accent: #8aa4ff;
  --accent-2: #7de3ff;
  --accent-3: #c6a8ff;
  --accent-4: #6be4c6;

  /* FX */
  --glass: rgba(12, 16, 36, 0.55);
  --blur: saturate(140%) blur(12px);
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --inner: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter,
    Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji;

  /* Background micro-grid */
  --bg-grid-size: 26px;
  --bg-grid-color-dark: rgba(255, 255, 255, 0.04);
  --bg-grid-color-light: rgba(10, 13, 40, 0.06);

  /* NEW: Mobile drawer sheet + scrim */
  --drawer-bg: rgba(12, 16, 36, 0.9);
  --drawer-blur: saturate(150%) blur(10px);
  --drawer-scrim: rgba(0, 0, 0, 0.42);

  /* Spacing */
  --space-section-y: 96px; /* default (landing/hero) */
  --space-section-y-compact: 26px;
}

/* Light scheme — default if user selects it or OS is light (when in Auto) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f7f9ff;
    --bg-2: #ffffff;
    --card: #ffffff;
    --text: #0a0f21;
    --muted: #3f4b76;
    --line: color-mix(in oklab, #0a0f21 20%, transparent);
    --glass: rgba(255, 255, 255, 0.65);

    /* Drawer (auto light) */
    --drawer-bg: rgba(255, 255, 255, 0.96);
    --drawer-scrim: rgba(10, 13, 40, 0.28);
  }
}
:root[data-theme="light"] {
  --bg: #f7f9ff;
  --bg-2: #ffffff;
  --card: #ffffff;
  --text: #0a0f21;
  --muted: #3f4b76;
  --line: color-mix(in oklab, #0a0f21 20%, transparent);
  --glass: rgba(255, 255, 255, 0.65);

  /* Drawer (explicit light) */
  --drawer-bg: rgba(255, 255, 255, 0.96);
  --drawer-scrim: rgba(10, 13, 40, 0.28);
}
:root[data-theme="dark"] {
  --bg: #0a0f21;
  --bg-2: #0f1531;
  --card: #10162e;
  --text: #eef1ff;
  --muted: #a8b2d8;
  --line: rgba(255, 255, 255, 0.1);
  --glass: rgba(12, 16, 36, 0.55);

  /* Drawer (explicit dark) */
  --drawer-bg: rgba(12, 16, 36, 0.9);
  --drawer-scrim: rgba(0, 0, 0, 0.42);
}

/* Compact section rhythm for docs/legal pages */
body[data-page="guide"],
body[data-page="policy"],
body[data-page="termsofuse"] {
  --space-section-y: var(--space-section-y-compact);
}

/* Optional: gently scale on very small/very large screens */
@media (max-width: 640px) {
  :root {
    --space-section-y-compact: 48px;
  }
}
@media (min-width: 1400px) {
  :root {
    --space-section-y-compact: 60px;
  } /* keep some air on wide screens */
}

/* ------------------------------
   Base
--------------------------------*/
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  position: relative;
  background: var(--bg);
  overflow-x: hidden;
}
/* Prevent background scroll when drawer is open */
body.drawer-open {
  overflow: hidden;
}

/* ------------------------------
   Global background: glow field + aurora + micro-grid
--------------------------------*/
body::before {
  content: "";
  position: fixed;
  inset: -25vmax;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(
      60rem 40rem at 10% -10%,
      rgba(138, 164, 255, 0.18),
      transparent 70%
    ),
    radial-gradient(
      48rem 28rem at 95% 0%,
      rgba(125, 227, 255, 0.14),
      transparent 70%
    ),
    radial-gradient(
      56rem 34rem at 0% 110%,
      rgba(198, 168, 255, 0.14),
      transparent 72%
    ),
    radial-gradient(
      48rem 34rem at 110% 110%,
      rgba(107, 228, 198, 0.1),
      transparent 72%
    );
  filter: blur(6px) saturate(1.05);
  transform: translate3d(0, var(--bg-parallax, 0px), 0);
}
/* 1) Explicit light theme selected by the user */
:root[data-theme="light"] body::before {
  background: radial-gradient(
      60rem 40rem at 10% -10%,
      rgba(138, 164, 255, 0.1),
      transparent 70%
    ),
    radial-gradient(
      48rem 28rem at 95% 0%,
      rgba(125, 227, 255, 0.08),
      transparent 70%
    ),
    radial-gradient(
      56rem 34rem at 0% 110%,
      rgba(198, 168, 255, 0.08),
      transparent 72%
    ),
    radial-gradient(
      48rem 34rem at 110% 110%,
      rgba(107, 228, 198, 0.06),
      transparent 72%
    );
  filter: blur(7px) saturate(1.02) brightness(1.04);
}

/* 2) Auto mode (no data-theme attr) + OS prefers light */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) body::before {
    background: radial-gradient(
        60rem 40rem at 10% -10%,
        rgba(138, 164, 255, 0.1),
        transparent 70%
      ),
      radial-gradient(
        48rem 28rem at 95% 0%,
        rgba(125, 227, 255, 0.08),
        transparent 70%
      ),
      radial-gradient(
        56rem 34rem at 0% 110%,
        rgba(198, 168, 255, 0.08),
        transparent 72%
      ),
      radial-gradient(
        48rem 34rem at 110% 110%,
        rgba(107, 228, 198, 0.06),
        transparent 72%
      );
    filter: blur(7px) saturate(1.02) brightness(1.04);
  }
}

@supports (background: color-mix(in oklab, white, black)) {
  body::before {
    background: radial-gradient(
        60rem 40rem at 10% -10%,
        color-mix(in oklab, var(--accent) 65%, transparent),
        transparent 70%
      ),
      radial-gradient(
        48rem 28rem at 95% 0%,
        color-mix(in oklab, var(--accent-2) 55%, transparent),
        transparent 70%
      ),
      radial-gradient(
        56rem 34rem at 0% 110%,
        color-mix(in oklab, var(--accent-3) 45%, transparent),
        transparent 72%
      ),
      radial-gradient(
        48rem 34rem at 110% 110%,
        color-mix(in oklab, var(--accent-4) 45%, transparent),
        transparent 72%
      );
  }
}

.aurora {
  position: fixed;
  inset: -20vmax;
  z-index: -3;
  pointer-events: none;
  background: conic-gradient(
    from var(--aurora-angle, 0deg) at var(--aurora-x, 60%) var(--aurora-y, 10%),
    rgba(138, 164, 255, 0.55),
    rgba(125, 227, 255, 0.4),
    rgba(198, 168, 255, 0.4),
    rgba(107, 228, 198, 0.3),
    rgba(138, 164, 255, 0.55)
  );
  filter: blur(42px) saturate(115%);
  opacity: 0.42;
  animation: auroraMove 22s ease-in-out infinite alternate;
  -webkit-mask-image: radial-gradient(
    1200px 900px at 50% 30%,
    #000,
    transparent 70%
  );
  mask-image: radial-gradient(1200px 900px at 50% 30%, #000, transparent 70%);
}
@keyframes auroraMove {
  0% {
    --aurora-angle: 0deg;
    --aurora-x: 70%;
    --aurora-y: -10%;
    opacity: 0.4;
  }
  50% {
    --aurora-angle: 180deg;
    --aurora-x: 35%;
    --aurora-y: 55%;
    opacity: 0.48;
  }
  100% {
    --aurora-angle: 360deg;
    --aurora-x: 55%;
    --aurora-y: 120%;
    opacity: 0.42;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aurora {
    animation: none;
    opacity: 0.28;
  }
  body::before {
    transform: none !important;
  }
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(
      circle at 1px 1px,
      var(--bg-grid-color, rgba(255, 255, 255, 0.04)) 1px,
      transparent 1.2px
    ),
    var(--noise-url, linear-gradient(transparent, transparent));
  background-size:
    var(--bg-grid-size) var(--bg-grid-size),
    180px 180px;
  -webkit-mask-image: radial-gradient(
    1200px 800px at 50% 20%,
    rgba(0, 0, 0, 0.9),
    transparent 70%
  );
  mask-image: radial-gradient(
    1200px 800px at 50% 20%,
    rgba(0, 0, 0, 0.9),
    transparent 70%
  );
}
:root[data-theme="dark"] body::after {
  --bg-grid-color: var(--bg-grid-color-dark);
}
:root[data-theme="light"] body::after {
  --bg-grid-color: var(--bg-grid-color-light);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) body::after {
    --bg-grid-color: var(--bg-grid-color-light);
  }
}

/* ------------------------------
   Typographic helpers
--------------------------------*/
a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-color: color-mix(in oklab, var(--accent), currentColor 50%);
}

.container {
  max-width: 1160px;
  margin-inline: auto;
  padding: 0 24px;
}
.section {
  padding: var(--space-section-y) 0;
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: color-mix(in oklab, var(--muted), white 10%);
}
.mini {
  font-size: 0.92rem;
  color: var(--muted);
}

/* ------------------------------
   Skip link
--------------------------------*/
.skip {
  position: absolute;
  left: -9999px;
  top: auto;
}
.skip:focus {
  left: 14px;
  top: 14px;
  z-index: 10000;
  background: var(--bg-2);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

/* ------------------------------
   Scroll progress (top)
--------------------------------*/
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: calc(var(--scroll, 0) * 100%);
  z-index: 1200;
  background: linear-gradient(
    90deg,
    var(--accent),
    var(--accent-2),
    var(--accent-3)
  );
  box-shadow: 0 0 18px rgba(138, 164, 255, 0.6);
  transition: width 0.05s linear;
}

/* ------------------------------
   Navigation (desktop + mobile)
--------------------------------*/
.nav {
  position: sticky;
  top: 0;
  z-index: 1100;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  background: linear-gradient(
    to bottom,
    color-mix(in oklab, var(--glass), transparent 40%),
    transparent
  );
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.logo {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 10px;
  object-fit: contain;
  background: transparent;
}
.brand strong {
  letter-spacing: 0.2px;
}

.menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.menu a,
.menu button.theme-toggle {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.menu a:hover,
.menu a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.menu .cta {
  margin-left: 6px;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition:
    transform 0.1s ease,
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
  outline: none;
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* CTA buttons */
.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 650;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b1020;
  border: 0;
  cursor: pointer;
  box-shadow: var(--inner), var(--shadow);
  transition:
    transform 0.12s ease,
    filter 0.15s ease,
    box-shadow 0.15s ease;
}
.cta:hover,
.cta:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.08) saturate(1.08);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  outline: none;
}
.cta:active {
  transform: translateY(0);
  filter: brightness(0.98);
  box-shadow: var(--shadow);
}
.cta.secondary {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.01)
  );
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
.nav .menu a.cta {
  background: linear-gradient(
    135deg,
    var(--accent),
    var(--accent-2)
  ) !important;
  color: #0b1020 !important;
}

/* Mobile trigger button */
.hamburger {
  display: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}
.hamburger svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* NEW: Scrim behind the mobile drawer (does not cover the sticky nav) */
.drawer-scrim {
  position: fixed;
  inset: 58px 0 0 0; /* below the sticky nav (approx. 58px high) */
  z-index: 1250;
  background: var(--drawer-scrim);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.drawer-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile drawer sheet */
.drawer {
  position: fixed;
  inset: 58px 0 0 0; /* fill viewport below the nav */
  min-height: calc(100svh - 58px);
  z-index: 1300;
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
  background: var(--drawer-bg);
  backdrop-filter: var(--drawer-blur);
  -webkit-backdrop-filter: var(--drawer-blur);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.drawer.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}
.drawer .menu-col {
  display: grid;
  gap: 10px;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  max-width: 1160px;
  margin: 0 auto;
}
.drawer a,
.drawer .theme-toggle {
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}
.drawer a:hover,
.drawer .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: color-mix(in oklab, var(--accent), var(--line) 30%);
}

/* Light-mode nav sheet + ink (AA/AAA) */
/* Light-mode nav sheet (explicit light theme) */
:root[data-theme="light"] .nav {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.92),
    rgba(255, 255, 255, 0.74)
  );
}

/* Auto mode + OS prefers light */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .nav {
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.92),
      rgba(255, 255, 255, 0.74)
    );
  }
}

:root[data-theme="light"] .nav .brand strong,
:root[data-theme="light"] .nav .menu a,
:root[data-theme="light"] .nav .theme-toggle,
:root[data-theme="light"] .nav .cta.secondary {
  color: var(--text) !important;
}
:root[data-theme="light"] .nav .menu a.active,
:root[data-theme="light"] .nav .menu a:hover,
:root[data-theme="light"] .nav .theme-toggle:hover {
  background: rgba(10, 13, 40, 0.06) !important;
  color: var(--text) !important;
  border-color: color-mix(in oklab, #0a0f21 18%, transparent) !important;
}

/* ------------------------------
   Hero (home)
--------------------------------*/
.hero {
  position: relative;
  overflow: hidden;
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 40px;
  align-items: center;
}

h1 {
  font-size: clamp(2.15rem, 4.8vw, 3.6rem);
  line-height: 1.04;
  margin: 14px 0 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: linear-gradient(180deg, #ffffff, #cfd7ff 55%, #a0b8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Subtle shimmer ONLY on the home page in dark auto/dark mode */
:root[data-theme="dark"] body[data-page="home"] h1,
:root:not([data-theme])[data-theme-auto-dark] body[data-page="home"] h1 {
  background: linear-gradient(
    90deg,
    #ffffff,
    #cfd7ff 30%,
    #a0b8ff 45%,
    #c6a8ff 60%,
    #7de3ff 80%,
    #ffffff
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 300% 100%;
  animation: titleSheen 18s ease infinite;
}
@keyframes titleSheen {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 300% 50%;
  }
}

/* Light mode: use ink (no gradient text) for readability on translucent sheets */
:root[data-theme="light"] h1 {
  color: #0d1330 !important;
  background: none !important;
  -webkit-text-fill-color: currentColor !important;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) h1 {
    color: #0d1330 !important;
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
  }
}

.sub {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 62ch;
}
.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.hero-visual {
  position: relative;
  aspect-ratio: 16/11;
  border-radius: var(--radius);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  place-items: center;
}
#starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.85;
}
.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
      120deg,
      rgba(138, 164, 255, 0.18),
      transparent 35%
    ),
    radial-gradient(
      50% 80% at 50% 120%,
      rgba(125, 227, 255, 0.14),
      transparent 60%
    );
  mix-blend-mode: screen;
}
.hero-visual picture,
.hero-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.hero-visual {
  overflow: hidden;
  clip-path: inset(0 round var(--radius));
  contain: paint;
}
.tilt-wrap {
  will-change: transform;
  transform-style: preserve-3d;
  transition: transform 0.18s ease;
}
.tilt-wrap:hover {
  transform: perspective(900px) rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg));
}

/* ------------------------------
   Grid + cards
--------------------------------*/
.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(12, 1fr);
}
.card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid color-mix(in oklab, var(--line), transparent 0%);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  position: relative;
  isolation: isolate;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    120deg,
    rgba(138, 164, 255, 0.4),
    rgba(125, 227, 255, 0.35),
    rgba(198, 168, 255, 0.3)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.35;
  pointer-events: none;
}
/* Live glow following cursor (works with .tilt JS) */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    380px 260px at var(--px, 50%) var(--py, 50%),
    rgba(138, 164, 255, 0.18),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.18s ease;
  mix-blend-mode: screen;
}
.card:hover::after {
  opacity: 1;
}
.card:hover,
.card:focus-within {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--accent), var(--line) 50%);
  box-shadow: 0 16px 54px rgba(0, 0, 0, 0.5);
}

.feature {
  grid-column: span 6;
}
.feature .icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.04)
  );
  border: 1px solid var(--line);
}
.feature h3 {
  margin: 8px 0 6px;
}
.feature p {
  color: var(--muted);
}

@media (max-width: 960px) {
  .hero .wrap {
    grid-template-columns: 1fr;
  }
  .feature {
    grid-column: span 12;
  }
  .nav-inner {
    grid-template-columns: auto auto auto;
  }
  .hamburger {
    grid-column: 3;
    justify-self: end;
    display: grid;
  }
  .menu {
    display: none;
  }
}

/* Protocol + resources layout */
.proto {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 880px) {
  .proto {
    grid-template-columns: 1fr;
  }
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.list li {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.section h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  margin: 0 0 18px;
  font-weight: 750;
  letter-spacing: 0.3px;
}

/* CTA band + footer */
.cta-band {
  margin-top: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.07),
    rgba(255, 255, 255, 0.02)
  );
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
footer {
  padding: 56px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 70px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}
.reveal.show {
  opacity: 1;
  transform: none;
}

/* Accessibility: reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cta,
  .cta.secondary,
  .theme-toggle,
  .card {
    transition: none;
  }
  .cta:hover,
  .cta:focus-visible,
  .cta.secondary:hover,
  .cta.secondary:focus-visible,
  .theme-toggle:hover,
  .theme-toggle:focus-visible,
  .card:hover,
  .card:focus-within {
    transform: none;
  }
}

/* Forced colors (high contrast) */
@media (forced-colors: active) {
  .nav,
  .drawer,
  .drawer-scrim,
  .card,
  .cta,
  .cta.secondary,
  .theme-toggle,
  .hamburger {
    forced-color-adjust: none;
  }
  .drawer {
    background: Canvas;
    border: 1px solid ButtonText;
  }
  .drawer-scrim {
    background: rgba(0, 0, 0, 0.5);
  }
  .cta {
    background: ButtonFace;
    color: ButtonText;
    border: 1px solid ButtonText;
  }
  .cta.secondary,
  .theme-toggle,
  .hamburger {
    background: Canvas;
    color: ButtonText;
    border: 1px solid ButtonText;
  }
}

/* Magnetic tilt utility */
.tilt {
  transform-style: preserve-3d;
  transition: transform 0.18s ease;
  will-change: transform;
}
.tilt:hover {
  transform: perspective(900px) rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg)) translateZ(0);
}

/* ------------------------------
   Command palette
--------------------------------*/
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: start center;
  padding-top: 12vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.cmdk[hidden] {
  display: none;
}
.cmdk-inner {
  width: min(720px, calc(100% - 24px));
  background: color-mix(in oklab, var(--bg-2), transparent 0%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cmdk-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 10px 12px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.01)
  );
}
.cmdk-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 10px 8px;
}
.cmdk-kbd {
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 8px;
  border-radius: 8px;
}
.cmdk-list {
  max-height: 48vh;
  overflow: auto;
  padding: 6px;
}
.cmdk-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.cmdk-item[aria-selected="true"],
.cmdk-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.cmdk-item .mini {
  justify-self: end;
}

/* ------------------------------
   Policy & docs layout (privacy, termsofuse, user guide)
--------------------------------*/
.policy {
  max-width: 900px;
  margin: 0 auto;
}
.policy .lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 72ch;
}
.policy h2 {
  font-size: 1.2rem;
  margin: 28px 0 10px;
  font-weight: 750;
  letter-spacing: 0.2px;
}
.policy h3 {
  font-size: 1.05rem;
  margin: 20px 0 8px;
}
.policy p {
  margin: 0 0 12px;
}
.policy ul {
  margin: 8px 0 16px 22px;
}
.policy li {
  margin: 6px 0;
}
.note {
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

/* Docs layout with sticky side menu (user_guide.html) */
.docs-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.side-menu {
  position: sticky;
  top: 76px;
  align-self: start;
}
.side-menu h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--muted), white 10%);
}
.side-nav {
  display: grid;
  gap: 8px;
}
.side-nav a {
  display: block;
  text-decoration: none;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease,
    transform 0.08s ease;
}
.side-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  transform: translateY(-1px);
}
.side-nav a.active,
.side-nav a[aria-current="page"] {
  color: var(--text);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.02)
  );
  border-color: var(--line);
  box-shadow: var(--inner);
}
@media (max-width: 960px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .side-menu {
    position: static;
  }
  .side-nav {
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .side-nav a {
    white-space: nowrap;
  }
}

/* Focus rings in light mode */
:root[data-theme="light"]
  :is(a, button, [role="button"], .theme-toggle, .cta):focus-visible {
  outline: 2px solid color-mix(in oklab, var(--accent), #0a0f21 20%);
  outline-offset: 2px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme])
    :is(a, button, [role="button"], .theme-toggle, .cta):focus-visible {
    outline: 2px solid color-mix(in oklab, var(--accent), #0a0f21 20%);
    outline-offset: 2px;
  }
}

/* --- Responsive upgrades for User Guide / docs --- */

/* Tighten the breakpoint just before the hamburger kicks in */
@media (max-width: 1140px) {
  .docs-layout {
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    gap: 20px;
  }
}

/* Collapse to a single column on tablets/phones */
@media (max-width: 960px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .side-menu {
    position: static; /* remove sticky on small screens */
    top: auto;
  }

  /* Make the side nav horizontally scrollable chips */
  .side-nav {
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .side-nav a {
    white-space: nowrap;
  }
}

/* Friendlier gutters and vertical rhythm on small phones */
@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }
}

/* --- Markdown content: prevent horizontal overflow --- */
.policy img {
  max-width: 100%;
  height: auto;
}

.policy pre {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
}

/* Long inline code shouldn’t break the layout */
.policy code {
  white-space: pre-wrap; /* allow wrapping */
  word-break: break-word; /* break long tokens */
}

/* Tables: scroll instead of blowing out the viewport */
.policy table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
}
.policy table th,
.policy table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

/* --- Mobile drawer scrim (missing styles) --- */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 1099; /* just under .nav (1100) and above page content */
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.drawer-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

/* Let policy/doc content shrink inside grid tracks (prevents page widening) */
.docs-layout > .policy,
.policy {
  min-width: 0;
}

/* Horizontal scroller used only on small screens (JS will add it conditionally) */
.policy .table-wrap {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box; /* includes border in width:100% */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  margin: 10px 0 16px;
  contain: inline-size; /* avoid intrinsic width influencing layout */
  overscroll-behavior-x: contain;
}

/* Inside the wrapper: small tables fill; wide tables trigger horizontal scroll */
.policy .table-wrap table {
  margin: 0;
  border-collapse: collapse;
  width: max-content; /* size to content so wrapper scrolls */
  min-width: 100%; /* but never smaller than wrapper */
}

/* Keep cells on a single line; rely on horizontal scroll for overflow */
.policy .table-wrap th,
.policy .table-wrap td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
  white-space: nowrap; /* ← one-line cells as you prefer */
}

/* Reset any earlier global table overrides that might force overflow */
.policy table {
  display: table;
  width: auto;
  overflow: visible;
}

/* Optional: make the wrapper keyboard-focusable visible (accessibility) */
.policy .table-wrap:focus {
  outline: 2px solid color-mix(in oklab, var(--accent), #0a0f21 20%);
  outline-offset: 2px;
}

/* ------------------------------
   Release notes layout
--------------------------------*/
.release-intro {
  max-width: 720px;
}

.release-intro .sub {
  margin-top: 1rem;
  color: var(--muted);
}

.release-groups {
  display: grid;
  gap: 3rem;
}

.release-group-header h2 {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.release-timeline {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.release-entry {
  padding: 24px;
}

.release-entry header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.release-entry .release-version {
  font-size: 1.25rem;
  font-weight: 600;
}

.release-entry time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.95rem;
}

.release-entry ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.6rem;
  color: var(--muted);
}

.release-entry li {
  line-height: 1.6;
}

.release-entry strong {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 960px) {
  .release-entry header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .release-entry time {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .release-groups {
    gap: 2.5rem;
  }

  .release-entry {
    padding: 20px;
  }
}
