/* ============================================================
   Atoll Docs — "Tidal Reef"
   Ocean-inspired documentation theme.
   Serif display + geometric sans, animated gradients,
   glassmorphism, bioluminescent accents.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Outfit:wght@300;400;450;500;600;700;800&family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

/* ─── Tokens ─── */
:root {
  --ff-display: 'Instrument Serif', 'Georgia', serif;
  --ff-body:    'Outfit', system-ui, sans-serif;
  --ff-mono:    'JetBrains Mono', ui-monospace, monospace;

  --text-xs:  0.72rem;
  --text-sm:  0.84rem;
  --text-base: 0.95rem;
  --text-md:  1.05rem;
  --text-lg:  1.2rem;
  --text-xl:  1.45rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;
  --text-5xl: 3.75rem;

  --sidebar-w: 256px;
  --toc-w:     224px;
  --header-h:  60px;
  --content-w: 740px;
  --radius:    10px;

  /* ── Light ── */
  --c-bg:         #ffffff;
  --c-bg-deep:    #f7f8fa;
  --c-bg-soft:    #f1f3f5;
  --c-bg-mute:    #e9ecef;
  --c-surface:    #ffffff;
  --c-sidebar:    #f8f9fb;

  --c-text:       #1a1a2e;
  --c-text-2:     #4a5568;
  --c-text-3:     #94a3b8;

  --c-border:     #e2e8f0;
  --c-border-2:   #cbd5e1;

  --c-brand:      #0891b2;
  --c-brand-2:    #06b6d4;
  --c-brand-3:    #22d3ee;
  --c-brand-dim:  #0e7490;
  --c-brand-soft: rgba(8,145,178,0.08);
  --c-brand-glow: rgba(6,182,212,0.25);

  --c-accent:     #6366f1;
  --c-accent-2:   #818cf8;

  --c-code-bg:    #1e293b;
  --c-code-tx:    #e2e8f0;
  --c-code-bdr:   #334155;
  --c-code-il-bg: #f0f4f8;
  --c-code-il-tx: #0e7490;

  --c-tip:        #10b981;
  --c-tip-bg:     #ecfdf5;
  --c-tip-bdr:    #a7f3d0;
  --c-warn:       #f59e0b;
  --c-warn-bg:    #fffbeb;
  --c-warn-bdr:   #fde68a;
  --c-danger:     #ef4444;
  --c-danger-bg:  #fef2f2;
  --c-danger-bdr: #fecaca;
  --c-info:       #3b82f6;
  --c-info-bg:    #eff6ff;
  --c-info-bdr:   #bfdbfe;

  --shadow-1: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-2: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-3: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 24px rgba(6,182,212,0.15);

  --grad-brand: linear-gradient(135deg, #0891b2, #06b6d4, #6366f1);
  --grad-hero:  linear-gradient(135deg, #0891b2 0%, #06b6d4 40%, #6366f1 100%);
  --grad-card:  linear-gradient(135deg, rgba(8,145,178,0.5), rgba(99,102,241,0.5));
  --grad-subtle: linear-gradient(180deg, var(--c-bg) 0%, var(--c-bg-deep) 100%);

  /* Noise texture (tiny inline SVG) */
  --noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  color-scheme: light dark;
}

/* ── Dark ── */
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg:         #0c0e16;
    --c-bg-deep:    #10121b;
    --c-bg-soft:    #161926;
    --c-bg-mute:    #1e2235;
    --c-surface:    #181b28;
    --c-sidebar:    #0f1119;

    --c-text:       #e2e8f0;
    --c-text-2:     #94a3b8;
    --c-text-3:     #64748b;

    --c-border:     #1e2235;
    --c-border-2:   #2d3348;

    --c-brand:      #22d3ee;
    --c-brand-2:    #67e8f9;
    --c-brand-3:    #a5f3fc;
    --c-brand-dim:  #06b6d4;
    --c-brand-soft: rgba(34,211,238,0.08);
    --c-brand-glow: rgba(34,211,238,0.2);

    --c-accent:     #818cf8;
    --c-accent-2:   #a5b4fc;

    --c-code-bg:    #0d1017;
    --c-code-tx:    #c9d1d9;
    --c-code-bdr:   #1e2235;
    --c-code-il-bg: rgba(110,118,129,0.12);
    --c-code-il-tx: #67e8f9;

    --c-tip-bg:     rgba(16,185,129,0.08);
    --c-tip-bdr:    rgba(16,185,129,0.25);
    --c-warn-bg:    rgba(245,158,11,0.08);
    --c-warn-bdr:   rgba(245,158,11,0.25);
    --c-danger-bg:  rgba(239,68,68,0.08);
    --c-danger-bdr: rgba(239,68,68,0.25);
    --c-info-bg:    rgba(59,130,246,0.08);
    --c-info-bdr:   rgba(59,130,246,0.25);

    --shadow-1: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-2: 0 4px 16px rgba(0,0,0,0.35);
    --shadow-3: 0 8px 30px rgba(0,0,0,0.45);
    --shadow-glow: 0 0 30px rgba(34,211,238,0.12);

    --grad-card: linear-gradient(135deg, rgba(34,211,238,0.4), rgba(129,140,248,0.4));
  }
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  font-family: var(--ff-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.7;
  color: var(--c-text);
  background: var(--c-bg);
  min-height: 100vh;
  /* Subtle atmospheric gradient */
  background:
    radial-gradient(ellipse at 0% 0%, rgba(8,145,178,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(99,102,241,0.03) 0%, transparent 60%),
    var(--c-bg);
}
@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(ellipse at 0% 0%, rgba(6,182,212,0.06) 0%, transparent 50%),
      radial-gradient(ellipse at 100% 100%, rgba(99,102,241,0.04) 0%, transparent 50%),
      var(--c-bg);
  }
}

/* Noise overlay on body for depth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--noise);
  opacity: 0.018;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: overlay;
}
@media (prefers-color-scheme: dark) {
  body::before { opacity: 0.025; }
}

::selection {
  background: var(--c-brand-soft);
  color: var(--c-brand);
}
:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); }

.skip-to-content {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 999;
  padding: 6px 16px;
  background: var(--c-brand);
  color: #fff;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
}
.skip-to-content:focus { top: 8px; }

/* ─── Links ─── */
a {
  color: var(--c-brand);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--c-brand-dim); }
@media (prefers-color-scheme: dark) {
  a:hover { color: var(--c-brand-2); }
}

/* ─── Header ─── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid var(--c-border);
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(12,14,22,0.7);
    border-color: rgba(30,34,53,0.6);
  }
}
.site-header.scrolled {
  box-shadow: var(--shadow-2);
}

.site-header > .container {
  display: flex;
  align-items: center;
  height: 100%;
  max-width: none;
  padding: 0 28px;
  gap: 12px;
}

/* Brand: serif "atoll" + sans badge "docs" */
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.brand:hover { opacity: 0.75; text-decoration: none; }

.brand-text {
  font-family: var(--ff-display);
  font-style: italic;
  font-size: 22px;
  color: var(--c-text);
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-tag {
  font-family: var(--ff-body);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-brand);
  background: var(--c-brand-soft);
  border: 1px solid rgba(8,145,178,0.15);
  padding: 2px 7px 1px;
  border-radius: 5px;
  position: relative;
  top: -1px;
}

/* Header nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.header-nav nav { display: contents; }
.header-nav .nav {
  display: flex;
  list-style: none;
  gap: 1px;
  align-items: center;
}
.header-nav .nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--c-text-2);
  padding: 6px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  position: relative;
}
.header-nav .nav a:hover {
  color: var(--c-text);
  background: var(--c-bg-soft);
  text-decoration: none;
}
.header-nav .nav a[aria-current="page"] {
  color: var(--c-brand);
  font-weight: 600;
}
/* Active indicator dot under current page */
.header-nav .nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--c-brand);
}

.admin-link {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-text-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--c-border);
  border-radius: 7px;
  text-decoration: none;
  margin-left: 12px;
  transition: all 0.15s ease;
}
.admin-link:hover {
  color: var(--c-text-2);
  border-color: var(--c-border-2);
  text-decoration: none;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--c-text);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  line-height: 0;
}
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

/* ─── Layout ─── */
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  grid-template-areas: "sidebar content toc";
  min-height: calc(100vh - var(--header-h));
  margin-top: var(--header-h);
}

main.container {
  margin-top: var(--header-h);
  max-width: var(--content-w);
  margin-inline: auto;
  padding: 48px 32px;
}
.docs-layout main.container,
.docs-layout > main {
  grid-area: content;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 48px 80px;
  width: 100%;
}

/* ─── Sidebar ─── */
.docs-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 0 40px;
  border-right: 1px solid var(--c-border);
  background: var(--c-sidebar);
  overscroll-behavior: contain;
}
.docs-sidebar::-webkit-scrollbar-thumb { background: transparent; }
.docs-sidebar:hover::-webkit-scrollbar-thumb { background: var(--c-border); }

.sidebar-section {
  margin-bottom: 20px;
}
.sidebar-section:first-child {
  margin-top: 4px;
}
.sidebar-heading {
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  padding: 0 20px 6px;
  margin-bottom: 2px;
}
.sidebar-links {
  list-style: none;
}
.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 450;
  color: var(--c-text-2);
  padding: 7px 18px 7px 20px;
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.45;
  position: relative;
}
.sidebar-links a:hover {
  color: var(--c-text);
  background: var(--c-bg-soft);
  text-decoration: none;
}
/* Active state with glow */
.sidebar-links a[aria-current="page"],
.sidebar-links a.is-active {
  color: var(--c-brand);
  font-weight: 600;
  border-left-color: var(--c-brand);
  background: var(--c-brand-soft);
  box-shadow: inset 4px 0 16px -6px var(--c-brand-glow);
}

/* ─── TOC ─── */
.docs-toc {
  grid-area: toc;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 28px 20px 40px 20px;
  border-left: 1px solid var(--c-border);
}
.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  margin-bottom: 14px;
}
.toc-list { list-style: none; }
.toc-list a {
  display: block;
  font-size: 12px;
  font-weight: 450;
  color: var(--c-text-3);
  padding: 4px 0 4px 14px;
  border-left: 1.5px solid var(--c-border);
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1.4;
}
.toc-list a:hover {
  color: var(--c-text-2);
  text-decoration: none;
}
.toc-list a.is-active {
  color: var(--c-brand);
  border-left-color: var(--c-brand);
  font-weight: 550;
}
.toc-list .toc-h3 a { padding-left: 28px; }

/* ─── Hero (Index) ─── */
.hero-docs {
  position: relative;
  padding: 56px 0 48px;
  margin-bottom: 12px;
  overflow: hidden;
}
/* Animated gradient mesh background */
.hero-docs::before {
  content: '';
  position: absolute;
  inset: -60%;
  background:
    radial-gradient(circle at 20% 40%, rgba(8,145,178,0.12) 0%, transparent 50%),
    radial-gradient(circle at 75% 30%, rgba(99,102,241,0.1) 0%, transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(6,182,212,0.08) 0%, transparent 50%);
  animation: meshDrift 20s ease-in-out infinite;
  pointer-events: none;
}
@keyframes meshDrift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%  { transform: translate(3%, -2%) rotate(2deg); }
  66%  { transform: translate(-2%, 1%) rotate(-1.5deg); }
}

.hero-docs .eyebrow {
  position: relative;
}
.hero-docs h1 {
  position: relative;
  font-family: var(--ff-display);
  font-size: var(--text-5xl);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  width: fit-content;
  margin-bottom: 16px;
}
.hero-docs .hero-copy {
  position: relative;
}

/* Hero compact (sub-pages) */
.hero-compact {
  padding: 36px 0 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--c-border);
  position: relative;
}
.hero-compact h1 {
  font-family: var(--ff-display);
  font-size: var(--text-4xl);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--c-text);
  margin-bottom: 8px;
}

.hero-copy {
  font-size: var(--text-md);
  color: var(--c-text-2);
  line-height: 1.65;
  max-width: 50ch;
}

/* Eyebrow badge */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-body);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-brand);
  margin-bottom: 20px;
}
.eyebrow::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-brand);
  animation: eyebrowPulse 2.5s ease-in-out infinite;
}
@keyframes eyebrowPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--c-brand-glow); }
  50%      { opacity: 0.7; box-shadow: 0 0 0 5px transparent; }
}

/* ─── Feature Cards ─── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin: 36px 0;
}

.feature-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 22px 22px;
  background: var(--c-bg-deep);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
}
/* Gradient top line — hidden by default, reveals on hover */
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.feature-card:hover {
  border-color: var(--c-brand);
  box-shadow: var(--shadow-2), var(--shadow-glow);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--c-brand-soft);
  color: var(--c-brand);
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.feature-card:hover .feature-icon {
  background: var(--c-brand);
  color: #fff;
  box-shadow: 0 0 20px var(--c-brand-glow);
}

.feature-card h2 {
  font-family: var(--ff-body);
  font-size: 15px;
  font-weight: 650;
  color: var(--c-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Arrow indicator on card titles */
.feature-card h2::after {
  content: '→';
  font-size: 14px;
  color: var(--c-text-3);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.25s ease;
}
.feature-card:hover h2::after {
  opacity: 1;
  transform: translateX(0);
  color: var(--c-brand);
}

.feature-card p {
  font-size: 13px;
  color: var(--c-text-2);
  line-height: 1.55;
  margin: 0;
}

/* ─── Legacy card (core fallback) ─── */
.card {
  background: var(--c-bg-deep);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
}
.card:hover {
  border-color: var(--c-brand);
  box-shadow: var(--shadow-2), var(--shadow-glow);
  transform: translateY(-2px);
}
.card__icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--c-brand-soft);
  color: var(--c-brand);
  margin-bottom: 12px;
}
.card h3 {
  font-family: var(--ff-body);
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 4px;
}
.card p {
  font-size: 13px;
  color: var(--c-text-2);
  line-height: 1.55;
}

/* doc-cards fallback (index) */
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin: 36px 0;
}
.doc-cards .card {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.doc-cards .card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.doc-cards .card:hover::before { transform: scaleX(1); }
.doc-cards .card:hover { text-decoration: none; }
.doc-cards .card h2 {
  font-family: var(--ff-body);
  font-size: 15px;
  font-weight: 650;
  color: var(--c-brand);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.doc-cards .card h2::after {
  content: '→';
  font-size: 13px;
  color: var(--c-text-3);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.25s ease;
}
.doc-cards .card:hover h2::after {
  opacity: 1;
  transform: translateX(0);
  color: var(--c-brand);
}
.doc-cards .card p {
  font-size: 13px;
  color: var(--c-text-2);
  line-height: 1.55;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* ─── Prose ─── */
.prose {
  font-size: 15px;
  line-height: 1.8;
  color: var(--c-text);
}
.prose > * + * { margin-top: 16px; }

/* ── Headings ── */
.prose h1, .prose h2, .prose h3,
.prose h4, .prose h5, .prose h6 {
  font-family: var(--ff-display);
  font-weight: 400;
  line-height: 1.25;
  color: var(--c-text);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.prose h1 {
  font-size: var(--text-3xl);
  margin-top: 48px;
  margin-bottom: 16px;
}
.prose h2 {
  font-size: var(--text-2xl);
  margin-top: 52px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  position: relative;
}
/* Gradient underline on h2 instead of full border */
.prose h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--c-border-2) 0%, var(--c-border) 40%, transparent 100%);
}
.prose h3 {
  font-family: var(--ff-body);
  font-size: var(--text-lg);
  font-weight: 650;
  margin-top: 36px;
  margin-bottom: 10px;
}
.prose h4 {
  font-family: var(--ff-body);
  font-size: var(--text-md);
  font-weight: 650;
  margin-top: 24px;
}

/* Heading anchors */
.prose .heading-anchor {
  color: var(--c-text-3);
  text-decoration: none;
  opacity: 0;
  margin-left: 6px;
  font-family: var(--ff-body);
  font-weight: 400;
  font-size: 0.75em;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor { opacity: 1; }
.prose .heading-anchor:hover { color: var(--c-brand); }

.prose p { margin-bottom: 16px; }
.prose strong, .prose b { font-weight: 650; }

/* ── Links in prose: animated underline ── */
.prose a {
  color: var(--c-brand);
  text-decoration: none;
  background-image: linear-gradient(var(--c-brand), var(--c-brand));
  background-size: 0% 1.5px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s cubic-bezier(0.16,1,0.3,1), color 0.15s ease;
  padding-bottom: 1px;
}
.prose a:hover {
  background-size: 100% 1.5px;
  color: var(--c-brand-dim);
}
@media (prefers-color-scheme: dark) {
  .prose a:hover { color: var(--c-brand-2); }
}

/* ── Lists ── */
.prose ul, .prose ol {
  padding-left: 22px;
  margin-bottom: 16px;
}
.prose li { margin-bottom: 4px; }
.prose li > ul, .prose li > ol { margin-top: 4px; margin-bottom: 0; }
.prose li::marker { color: var(--c-text-3); }

/* ── Inline code ── */
.prose code {
  font-family: var(--ff-mono);
  font-size: 0.85em;
  background: var(--c-code-il-bg);
  color: var(--c-code-il-tx);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

/* ── Code blocks ── */
.prose pre {
  position: relative;
  background: var(--c-code-bg);
  color: var(--c-code-tx);
  border: 1px solid var(--c-code-bdr);
  border-radius: var(--radius);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 28px 0;
  font-size: 13px;
  line-height: 1.75;
}
/* Gradient top accent strip */
.prose pre::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-brand);
  border-radius: var(--radius) var(--radius) 0 0;
}
.prose pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  font-weight: 400;
}

/* Copy button */
.code-block-wrapper { position: relative; }
.code-copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--ff-body);
  font-size: 10.5px;
  font-weight: 550;
  color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.code-block-wrapper:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover {
  color: rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.1);
}
.code-copy-btn.copied {
  color: var(--c-tip);
  border-color: rgba(16,185,129,0.3);
}

.code-lang {
  position: absolute;
  top: 12px;
  left: 20px;
  font-family: var(--ff-mono);
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,0.16);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  pointer-events: none;
}

/* ── Blockquotes ── */
.prose blockquote {
  border-left: 3px solid var(--c-brand);
  padding: 14px 22px;
  margin: 24px 0;
  background: var(--c-brand-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--c-text-2);
  font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* ── Tables ── */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: var(--text-sm);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: table;
}
.prose thead {
  background: var(--c-bg-soft);
}
.prose th {
  font-weight: 650;
  text-align: left;
  padding: 10px 16px;
  color: var(--c-text);
  border-bottom: 1px solid var(--c-border);
}
.prose td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
.prose tbody tr:last-child td { border-bottom: none; }
.prose tbody tr:hover { background: var(--c-bg-deep); }

.prose hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 40px 0;
}
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
}
.prose kbd {
  font-family: var(--ff-mono);
  font-size: 0.82em;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
}

/* ─── Callouts ─── */
.callout, .admonition, .prose .callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 28px 0;
  border: 1px solid;
  font-size: var(--text-sm);
  line-height: 1.65;
  position: relative;
}
.callout-title, .admonition-title {
  font-family: var(--ff-body);
  font-weight: 700;
  font-size: var(--text-sm);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.callout-info, .callout.info   { background: var(--c-info-bg); border-color: var(--c-info-bdr); }
.callout-info .callout-title   { color: var(--c-info); }
.callout-warning, .callout.warning { background: var(--c-warn-bg); border-color: var(--c-warn-bdr); }
.callout-warning .callout-title    { color: var(--c-warn); }
.callout-danger, .callout.danger   { background: var(--c-danger-bg); border-color: var(--c-danger-bdr); }
.callout-danger .callout-title     { color: var(--c-danger); }
.callout-success, .callout.success,
.callout-tip, .callout.tip        { background: var(--c-tip-bg); border-color: var(--c-tip-bdr); }
.callout-success .callout-title,
.callout-tip .callout-title        { color: var(--c-tip); }

/* ─── Blog ─── */
.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-card {
  background: var(--c-bg-deep);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
}
.post-card:hover {
  border-color: var(--c-brand);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.post-card h2 {
  font-family: var(--ff-display);
  font-size: var(--text-xl);
  margin-bottom: 4px;
}
.post-card h2 a { color: var(--c-text); text-decoration: none; }
.post-card h2 a:hover { color: var(--c-brand); }
.post-card p { color: var(--c-text-2); font-size: var(--text-sm); line-height: 1.6; }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--c-text-3);
  margin-bottom: 10px;
}
.separator {
  display: inline-block;
  width: 3px;
  height: 3px;
  background: var(--c-border-2);
  border-radius: 50%;
}
.tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-brand);
  background: var(--c-brand-soft);
  padding: 2px 8px;
  border-radius: 99px;
}
.container--narrow { max-width: var(--content-w); }
.doc-prose { max-width: var(--content-w); }

/* ─── Island / Search ─── */
.island-block {
  margin-top: 36px;
  padding-top: 32px;
  border-top: 1px solid var(--c-border);
}
.island-block h2 {
  font-family: var(--ff-body);
  font-size: var(--text-lg);
  font-weight: 650;
  margin-bottom: 14px;
}
.search-widget input,
[data-island="SearchWidget"] input {
  font-family: var(--ff-body);
  font-size: var(--text-sm);
  background: var(--c-bg-deep);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 11px 18px;
  width: 100%;
  transition: all 0.2s ease;
  outline: none;
}
.search-widget input:focus,
[data-island="SearchWidget"] input:focus {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px var(--c-brand-soft), var(--shadow-glow);
  background: var(--c-surface);
}

/* ─── Forms ─── */
input[type="text"], input[type="email"], input[type="search"],
input[type="url"], textarea, select {
  font-family: var(--ff-body);
  font-size: var(--text-sm);
  color: var(--c-text);
  background: var(--c-bg-deep);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 8px 14px;
  width: 100%;
  transition: all 0.15s ease;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px var(--c-brand-soft);
}
button, .btn {
  font-family: var(--ff-body);
  font-size: var(--text-sm);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-primary { background: var(--c-brand); color: #fff; }
.btn-primary:hover { background: var(--c-brand-dim); }

/* ─── Section ─── */
.section-heading { margin-bottom: 24px; }
.section-heading h2 {
  font-family: var(--ff-display);
  font-size: var(--text-2xl);
  margin-bottom: 4px;
}
.section-heading p { color: var(--c-text-2); max-width: 50ch; }

.hero .lead, .lead {
  font-size: var(--text-md);
  color: var(--c-text-2);
  line-height: 1.65;
  max-width: 52ch;
}

/* ─── Footer ─── */
.site-footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-bg-deep);
  margin-top: 80px;
  position: relative;
}
/* Gradient accent line above footer */
.site-footer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--c-brand) 50%, transparent 100%);
  opacity: 0.4;
}

.site-footer .container {
  max-width: calc(var(--sidebar-w) + var(--content-w) + var(--toc-w));
  margin-inline: auto;
  padding: 0 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  padding: 40px 0;
}
.footer-brand {
  font-family: var(--ff-display);
  font-style: italic;
  font-size: 18px;
  color: var(--c-text);
  margin-bottom: 6px;
}
.footer-desc { font-size: 13px; color: var(--c-text-3); line-height: 1.55; max-width: 40ch; }
.footer-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-3);
  margin-bottom: 10px;
}
.footer-links { list-style: none; }
.footer-links li + li { margin-top: 4px; }
.footer-links a { font-size: 13px; color: var(--c-text-2); text-decoration: none; }
.footer-links a:hover { color: var(--c-brand); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--c-border);
  font-size: 12px;
  color: var(--c-text-3);
}
.footer-bottom a { color: var(--c-text-2); }
.footer-bottom a:hover { color: var(--c-brand); }

/* ─── Animations ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-in { animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both; }
.animate-in:nth-child(2) { animation-delay: 60ms; }
.animate-in:nth-child(3) { animation-delay: 120ms; }
.animate-in:nth-child(4) { animation-delay: 180ms; }

.docs-layout > main {
  animation: fadeIn 0.3s ease both;
}

/* Staggered hero content */
.hero-docs .eyebrow { animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both; animation-delay: 0ms; }
.hero-docs h1       { animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both; animation-delay: 80ms; }
.hero-docs .hero-copy { animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both; animation-delay: 160ms; }
.feature-grid, .doc-cards { animation: fadeUp 0.5s cubic-bezier(0.16,1,0.3,1) both; animation-delay: 240ms; }

/* ─── Responsive ─── */
@media (max-width: 1200px) {
  :root { --toc-w: 0px; }
  .docs-layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-areas: "sidebar content";
  }
  .docs-toc { display: none; }
}

@media (max-width: 768px) {
  :root { --header-h: 52px; }

  .menu-toggle { display: block; }

  .header-nav {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0; bottom: 0;
    flex-direction: column;
    background: var(--c-bg);
    padding: 16px;
    transform: translateY(-6px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    overflow-y: auto;
    border-top: 1px solid var(--c-border);
    z-index: 90;
    backdrop-filter: blur(16px);
  }
  .header-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .header-nav .nav { flex-direction: column; gap: 0; width: 100%; }
  .header-nav .nav li { width: 100%; }
  .header-nav .nav a {
    font-size: 15px;
    padding: 10px 14px;
  }
  .header-nav .nav a[aria-current="page"]::after { display: none; }
  .admin-link { margin-top: 12px; align-self: flex-start; }

  .docs-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "content";
  }
  .docs-sidebar { display: none; }

  main.container,
  .docs-layout main.container,
  .docs-layout > main {
    padding: 24px 20px 64px;
  }

  .hero-docs h1 { font-size: var(--text-3xl); }
  .hero-compact h1 { font-size: var(--text-2xl); }
  .feature-grid, .grid-3, .doc-cards { grid-template-columns: 1fr; }

  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 6px; text-align: center; }
}

/* ═══════════════════════════════════════════════════════════
   LANDING PAGE (full-width, no sidebar)
   ═══════════════════════════════════════════════════════════ */

/* Landing needs flex layout to push footer down */
.is-landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.is-landing main {
  margin-top: var(--header-h);
  flex: 1;
}

/* ── Hero ── */
.landing-hero {
  position: relative;
  text-align: center;
  padding: 100px 24px 80px;
  overflow: hidden;
}
/* Animated gradient mesh behind hero */
.landing-hero::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(8,145,178,0.15) 0%, transparent 45%),
    radial-gradient(circle at 70% 60%, rgba(99,102,241,0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(6,182,212,0.08) 0%, transparent 40%);
  animation: heroMesh 25s ease-in-out infinite;
  pointer-events: none;
}
@keyframes heroMesh {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  33%  { transform: translate(2%, -3%) rotate(3deg) scale(1.05); }
  66%  { transform: translate(-3%, 2%) rotate(-2deg) scale(0.97); }
}

.landing-hero-inner {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.landing-title {
  font-family: var(--ff-display);
  font-size: clamp(3rem, 6vw + 1rem, 5.5rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  animation: fadeUp 0.6s cubic-bezier(0.16,1,0.3,1) both;
}

.landing-tagline {
  font-family: var(--ff-body);
  font-size: clamp(1.05rem, 1.5vw + 0.5rem, 1.35rem);
  font-weight: 400;
  color: var(--c-text-2);
  max-width: 50ch;
  margin: 0 auto 36px;
  line-height: 1.6;
  animation: fadeUp 0.6s cubic-bezier(0.16,1,0.3,1) 0.1s both;
}

.landing-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  animation: fadeUp 0.6s cubic-bezier(0.16,1,0.3,1) 0.2s both;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ff-body);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 99px;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.landing-btn:hover { text-decoration: none; }

.landing-btn--primary {
  background: var(--c-brand);
  color: #fff;
  box-shadow: 0 2px 12px rgba(8,145,178,0.25);
}
.landing-btn--primary:hover {
  background: var(--c-brand-dim);
  color: #fff;
  box-shadow: 0 4px 20px rgba(8,145,178,0.35);
  transform: translateY(-1px);
}

.landing-btn--secondary {
  background: transparent;
  color: var(--c-text-2);
  border-color: var(--c-border-2);
}
.landing-btn--secondary:hover {
  color: var(--c-text);
  border-color: var(--c-text-3);
  background: var(--c-bg-soft);
}

/* ── Features ── */
.landing-features {
  padding: 0 24px 80px;
  position: relative;
}
.landing-features::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 80%);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-border-2), transparent);
}

.landing-features-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  max-width: 880px;
  margin: 0 auto;
  padding-top: 72px;
  text-align: center;
  animation: fadeUp 0.6s cubic-bezier(0.16,1,0.3,1) 0.3s both;
}

.landing-feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--c-brand);
}

.landing-feature h3 {
  font-family: var(--ff-body);
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 8px;
}
.landing-feature p {
  font-size: 13.5px;
  color: var(--c-text-2);
  line-height: 1.6;
  max-width: 30ch;
  margin: 0 auto;
}

/* ── Docs Grid ── */
.landing-docs {
  padding: 0 24px 100px;
}
.landing-docs-inner {
  max-width: 880px;
  margin: 0 auto;
}
.landing-docs h2 {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  margin-bottom: 20px;
  text-align: center;
}
.landing-docs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* Reuse feature-card styles from main CSS */

/* Landing footer override — no excessive margin */
.is-landing .site-footer {
  margin-top: 0;
}

/* ── Landing responsive ── */
@media (max-width: 768px) {
  .landing-hero {
    padding: 64px 20px 52px;
  }
  .landing-features-inner {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 48px;
  }
  .landing-docs-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 480px) {
  .landing-actions {
    flex-direction: column;
    align-items: center;
  }
  .landing-btn {
    width: 100%;
    max-width: 260px;
    justify-content: center;
  }
}

/* ─── Print ─── */
@media print {
  .site-header, .docs-sidebar, .docs-toc, .site-footer,
  .code-copy-btn, .menu-toggle, .admin-link,
  body::before { display: none !important; }
  .docs-layout { display: block; }
  .docs-layout main, main.container { max-width: 100%; padding: 0; margin: 0; }
  body { font-size: 11pt; color: #000; background: #fff; }
  .prose pre { background: #f5f5f5; color: #333; border: 1px solid #ddd; }
  .prose pre::before { display: none; }
}
