/* ============================================================
   Documentation — editorial manual aesthetic
   ============================================================ */

:root {
  --ink:        #2a6fbe;
  --ink-deep:   #2058a0;
  --ink-soft:   #e8f0fc;
  --coral:      #ff8a5c;
  --coral-deep: #e97247;
  --paper:      #f8fafb;
  --paper-2:    #f0f4f8;
  --text:       #1e2d2f;
  --muted:      #5a6d80;
  --navy:       #0e1f33;
  --navy-2:     #14283f;
  --line:       rgba(14,31,51,0.10);
  --line-soft:  rgba(14,31,51,0.06);
  --rule:       rgba(14,31,51,0.18);

  --font-display: "Instrument Serif", "DM Serif Display", Georgia, serif;
  --font-body:    "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--coral); color: #fff; }

/* Reading-progress bar */
.reading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--coral), var(--ink));
  z-index: 90;
  transition: width .12s ease-out;
}

/* ─── Nav (matches home) ─────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 80;
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  background: rgba(248, 250, 251, 0.82);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.nav.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(248, 250, 251, 0.92);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 72px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--navy);
  line-height: 1;
}
.brand img { width: 46px; height: 46px; display: block; flex-shrink: 0; }
.brand .brand-wm {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--navy);
  padding-right: 0.22em;
  line-height: 1;
}
.brand .brand-wm .strata { color: var(--coral-deep); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
  font-size: 14.5px;
  color: var(--navy-2);
}
.nav-links a:not(.btn) {
  position: relative;
  padding: 6px 0;
  transition: color .2s ease;
}
.nav-links a:not(.btn).is-current { color: var(--coral-deep); font-weight: 600; }
.nav-links a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--coral);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .3s ease;
}
.nav-links a:not(.btn):hover::after,
.nav-links a:not(.btn).is-current::after { transform: scaleX(1); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, color .2s ease, box-shadow .25s ease;
  line-height: 1;
}
.btn--ink {
  background: var(--navy);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 10px 24px -14px rgba(14,31,51,0.5);
}
.btn--ink:hover { background: var(--ink); transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--navy); }

/* ─── Atmosphere (subtle, hero-only) ─────────────────── */
.atmosphere {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 80vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.atmosphere::before, .atmosphere::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
}
.atmosphere::before {
  width: 55vw; height: 55vw;
  background: radial-gradient(circle, rgba(255,138,92,0.25) 0%, transparent 65%);
  top: -18vw; right: -12vw;
}
.atmosphere::after {
  width: 60vw; height: 60vw;
  background: radial-gradient(circle, rgba(42,111,190,0.18) 0%, transparent 65%);
  top: 12vh; left: -20vw;
}

/* ─── Hero / colophon ────────────────────────────────── */
.docs-hero {
  position: relative;
  padding: 72px 0 40px;
  overflow: hidden;
}
.docs-hero-inner { position: relative; z-index: 1; max-width: 720px; }

.docs-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--coral-deep);
  font-weight: 600;
  margin-bottom: 26px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.docs-kicker::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--coral);
}
.docs-kicker .sep { color: var(--muted); }

.docs-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 60px);
  line-height: 1;
  color: var(--navy);
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  font-weight: 400;
}
.docs-hero h1 em { color: var(--coral); font-style: italic; }
.docs-hero p {
  max-width: 56ch;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  margin: 0 0 24px;
}
.docs-hero p em {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--navy);
  font-size: 1.06em;
}

.docs-colophon {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-colophon strong { color: var(--navy); font-weight: 600; }

/* ─── Layout: TOC + content ──────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 64px;
  padding: 24px 0 96px;
  position: relative;
}

.docs-toc-col {
  position: relative;
}

.docs-toc {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(14,31,51,0.18) transparent;
}
.docs-toc::-webkit-scrollbar { width: 4px; }
.docs-toc::-webkit-scrollbar-thumb { background: rgba(14,31,51,0.18); border-radius: 2px; }

.docs-toc-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}
.docs-toc-label span:last-child { color: var(--coral-deep); }

.docs-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1px;
  counter-reset: chapter;
}
.docs-toc li { counter-increment: chapter; }
.docs-toc a {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 6px;
  padding: 7px 12px 7px 8px;
  font-size: 13px;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
  line-height: 1.35;
}
.docs-toc a::before {
  content: counter(chapter, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(14,31,51,0.35);
  letter-spacing: 0.04em;
  padding-top: 2px;
}
.docs-toc a:hover {
  color: var(--navy);
  background: rgba(14,31,51,0.025);
}
.docs-toc a.is-current {
  color: var(--coral-deep);
  border-left-color: var(--coral);
  font-weight: 600;
  background: rgba(255,138,92,0.06);
}
.docs-toc a.is-current::before { color: var(--coral-deep); }

/* ─── Content column ─────────────────────────────────── */
.docs-content {
  min-width: 0;
}

.docs-section {
  position: relative;
  padding: 56px 0 72px;
  border-top: 1px solid var(--rule);
  counter-increment: chapter-num;
}
.docs-section:first-of-type { border-top: 0; padding-top: 8px; }

.docs-numeral {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--coral-deep);
  margin-bottom: 14px;
  padding: 4px 10px 4px 0;
  border-bottom: 1px solid var(--coral);
}

.docs-section h1 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.015em;
  color: var(--navy);
  margin: 0 0 28px;
  line-height: 1.1;
  max-width: 26ch;
}

.docs-section h2 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin: 36px 0 14px;
  line-height: 1.3;
  max-width: 32ch;
  position: relative;
  padding-left: 18px;
}
.docs-section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 8px;
  height: 8px;
  background: var(--coral);
  border-radius: 2px;
}

.docs-section h2:first-of-type {
  margin-top: 8px;
}

.docs-section p,
.docs-section ul,
.docs-section ol,
.docs-section pre {
  max-width: 70ch;
}

.docs-section p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 16px;
}

.docs-section p strong {
  color: var(--navy);
  font-weight: 600;
}

.docs-section ul, .docs-section ol {
  padding-left: 22px;
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}
.docs-section ul li, .docs-section ol li {
  margin-bottom: 6px;
}
.docs-section ul {
  list-style: none;
  padding-left: 0;
}
.docs-section ul > li {
  position: relative;
  padding-left: 22px;
}
.docs-section ul > li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.66em;
  width: 6px;
  height: 1.6px;
  background: var(--ink);
  border-radius: 1px;
}

.docs-section a {
  color: var(--ink);
  border-bottom: 1px solid rgba(255,138,92,0.5);
  padding-bottom: 1px;
  transition: color .15s, border-color .15s;
}
.docs-section a:hover {
  color: var(--coral-deep);
  border-color: var(--coral);
}

.docs-section code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--ink-soft);
  color: var(--ink-deep);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

.docs-section pre {
  background: var(--navy);
  color: #c4d1de;
  padding: 18px 20px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  margin: 0 0 20px;
  border-left: 3px solid var(--coral);
}
.docs-section pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  white-space: pre;
  font-size: inherit;
}

/* "Tip" paragraphs (start with <strong>Tip:</strong> or <strong>Note:</strong>) */
.docs-section p:has(> strong:first-child) {
  /* default styling; specific tip styling applied via JS-added class below */
}
.docs-section p.is-tip,
.docs-section p.is-note {
  background: linear-gradient(180deg, var(--ink-soft), rgba(232,240,252,0.4));
  border-left: 3px solid var(--ink);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  margin-top: 24px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--navy-2);
}
.docs-section p.is-tip { border-left-color: var(--coral); background: linear-gradient(180deg, rgba(255,138,92,0.08), rgba(255,138,92,0.03)); color: #5d2a18; }
.docs-section p.is-tip strong { color: var(--coral-deep); }
.docs-section p.is-note strong { color: var(--ink-deep); }

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ─── Footer ─────────────────────────────────────────── */
footer {
  padding: 40px 0 56px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 32px;
}
.foot-grid h4 {
  color: var(--navy);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  margin-bottom: 12px;
}
.foot-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.foot-grid ul a:hover { color: var(--ink); }
.foot-grid p { max-width: 30ch; margin: 0; }
.foot-legal {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.foot-legal a { color: var(--ink); }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1080px) {
  .docs-layout { grid-template-columns: 200px 1fr; gap: 40px; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .docs-toc-col { order: -1; }
  .docs-toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
  }
  .docs-toc[open] {}
  .docs-hero { padding: 64px 0 40px; }
  .docs-hero h1 { font-size: 48px; }
  .docs-section { padding: 40px 0 56px; }
  .docs-numeral { font-size: 64px; }
  .nav-links a:not(.btn):not(.is-current) { display: none; }
  .nav-links { gap: 12px; }
  .foot-grid { grid-template-columns: 1fr; }
}

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