:root {
  --bg: #0a0a0b;
  --bg-raised: #111113;
  --bg-card: #161618;
  --border: #222225;
  --border-hover: #333338;
  --text: #e8e8ec;
  --text-dim: #8a8a9a;
  --text-muted: #55555f;
  --accent: #e8a830;
  --accent-dim: #c48a20;
  --green: #34d399;
  --mono: "JetBrains Mono", monospace;
  --sans: "Instrument Sans", -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); }

/* ── NAV ── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 11, 0.88);
  backdrop-filter: blur(14px);
}

.nav-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  background: linear-gradient(90deg,#ff2d55,#ff9500,#ffd60a,#34c759,#32ade6,#5856d6,#ff2d55);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbowShift 8s linear infinite;
}

@keyframes rainbowShift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.nav-links a:hover { color: var(--text); }
.nav-current {
  background: var(--accent);
  color: #000;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
}

/* ── LAYOUT ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 96px 24px 80px; /* 56px nav + 40px top breathing room */
  /* prevent any child from blowing out the layout */
  min-width: 0;
  overflow-x: hidden;
}

.hero {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 20px;
}
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero p { margin: 0; color: var(--text-dim); }

.layout {
  display: grid;
  grid-template-columns: 224px 1fr;
  gap: 18px;
  align-items: start;
}

.surface {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  min-width: 0; /* prevent grid blowout */
  overflow-x: hidden;
}

/* ── SIDEBAR ── */
.sidebar { position: sticky; top: 72px; }
.sidebar h3 {
  margin: 16px 0 6px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sidebar h3:first-child { margin-top: 0; }
.sidebar ul { margin: 0 0 4px; padding: 0; list-style: none; }
.sidebar li { margin-bottom: 2px; }
.sidebar a {
  display: block;
  color: var(--text-dim);
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.sidebar a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.sidebar a.active {
  color: var(--text);
  font-weight: 600;
  background: rgba(232,168,48,0.08);
}

/* ── CONTENT ── */
.content h2 {
  margin-top: 32px;
  margin-bottom: 10px;
  font-size: 22px;
  letter-spacing: -0.01em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.content h2:first-child { margin-top: 4px; }
.content h3 {
  margin-top: 20px;
  margin-bottom: 6px;
  font-size: 17px;
  color: var(--text);
}
.content p, .content li { color: var(--text-dim); }
.content strong { color: var(--text); }
.content ul, .content ol { padding-left: 20px; }
.content li { margin-bottom: 4px; }
.content a { color: var(--accent); }
.content a:hover { color: var(--accent-dim); }

/* inline code */
.content code, .sidebar code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  background: rgba(232,168,48,0.08);
  border: 1px solid rgba(232,168,48,0.15);
  padding: 1px 5px;
  border-radius: 4px;
}

/* code blocks */
pre {
  border: 1px solid var(--border);
  background: var(--bg-raised);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 10px 0 16px;
  max-width: 100%;
  word-break: break-all;
}
pre code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

kbd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

/* tables — wrap in scroll container to avoid layout overflow */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0 16px;
}
table {
  width: 100%;
  min-width: 480px; /* allow scroll on very narrow screens */
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  padding: 10px 8px;
}
th {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}
td code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  background: rgba(232,168,48,0.08);
  border: 1px solid rgba(232,168,48,0.15);
  padding: 1px 5px;
  border-radius: 4px;
  word-break: break-all;
}

/* note callout */
.note {
  border: 1px solid var(--border);
  background: var(--bg-raised);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-dim);
  margin: 10px 0;
}
.note.tip { border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.05); }
.note.warning { border-color: rgba(232,168,48,0.3); background: rgba(232,168,48,0.05); }

/* quick-nav cards on overview page */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.nav-card {
  border: 1px solid var(--border);
  background: var(--bg-raised);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.2s;
  text-decoration: none;
  display: block;
}
.nav-card:hover { border-color: var(--border-hover); }
.nav-card-label {
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.nav-card h4 { margin: 0 0 4px; font-size: 15px; color: var(--text); }
.nav-card p { margin: 0; font-size: 13px; color: var(--text-dim); }

footer {
  border-top: 1px solid var(--border);
  margin-top: 32px;
  padding-top: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .nav-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .nav-links a:not(.nav-current):not(:last-child) { display: none; }
  main { padding: 80px 16px 64px; } /* 56px nav + 24px breathing room */
  .hero { padding: 20px 16px; }
  .hero h1 { font-size: 24px; }
  .content h2 { font-size: 19px; }
  pre { padding: 10px 12px; font-size: 12px; }
}

@media (max-width: 480px) {
  nav { padding: 0 16px; }
  main { padding-top: 76px; }
  .nav-links a:not(.nav-current) { display: none; }
  .nav-cards { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .surface { padding: 12px; }
}
