/* ═══════════════════════════════════════════════════════
   Engineering Handbook — Global Stylesheet
   Shared across index.html and all pages/*.html
═══════════════════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
  --bg:         #080b11;
  --bg2:        #0c1018;
  --panel:      #0f1520;
  --surface:    #131927;
  --surface-h:  #18202f;
  --border:     rgba(255,255,255,.06);
  --border-med: rgba(255,255,255,.10);
  --border-hi:  rgba(255,255,255,.16);

  --text-1: #f0f4ff;
  --text-2: #8e9ab5;
  --text-3: #4d5a75;

  --blue:   #4d91ff;
  --purple: #9b7dff;
  --teal:   #2dd9b0;
  --amber:  #f5a623;
  --sky:    #38c8f5;
  --rose:   #ff6b81;

  --mono:  'JetBrains Mono', monospace;
  --serif: 'Fraunces', serif;
  --sans:  'DM Sans', sans-serif;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --sidebar-w: 252px;
  --nav-h:     52px;

  --ease: cubic-bezier(.16,1,.3,1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
svg { display: block; flex-shrink: 0; }

/* ── BACKGROUND TEXTURE ── */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 70% 0%, rgba(77,145,255,.055) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 0% 60%, rgba(155,125,255,.04) 0%, transparent 60%);
}
body::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ══════════════════════════════════════
   TOP NAV
══════════════════════════════════════ */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(8,11,17,.85);
  backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex; align-items: center; gap: .75rem;
  text-decoration: none;
}

.brand-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px rgba(77,145,255,.25);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.05rem; font-weight: 600;
  color: var(--text-1); letter-spacing: -.01em;
}

.nav-sep { width: 1px; height: 18px; background: var(--border-med); margin: 0 .25rem; }

.nav-tag {
  font-family: var(--mono); font-size: .68rem;
  color: var(--text-3); letter-spacing: .04em;
}

/* Search bar */
.nav-search {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface); border: 1px solid var(--border-med);
  border-radius: var(--radius-sm); padding: .35rem .75rem;
  width: 240px; cursor: text;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
}
.nav-search:focus-within {
  border-color: rgba(77,145,255,.4);
  box-shadow: 0 0 0 3px rgba(77,145,255,.08);
}

.nav-search input {
  background: none; border: none; outline: none;
  font-family: var(--mono); font-size: .75rem;
  color: var(--text-1); flex: 1; width: 100%;
}
.nav-search input::placeholder { color: var(--text-3); }

.kbd {
  font-family: var(--mono); font-size: .62rem; color: var(--text-3);
  background: var(--panel); border: 1px solid var(--border-med);
  border-radius: 4px; padding: .1rem .35rem; white-space: nowrap;
}

/* Search results dropdown */
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--border-med);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  z-index: 300; display: none;
}
.search-results.visible { display: block; }

.search-result-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .9rem;
  transition: background .15s; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-h); }

.sri-icon {
  width: 26px; height: 26px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sri-text { flex: 1; }
.sri-name { font-family: var(--mono); font-size: .73rem; color: var(--text-1); }
.sri-phase { font-family: var(--mono); font-size: .62rem; color: var(--text-3); margin-top: .05rem; }
.sri-mark { font-family: var(--mono); font-size: .65rem; color: var(--text-3); }
.sri-empty { font-family: var(--mono); font-size: .75rem; color: var(--text-3); padding: 1rem .9rem; }

.nav-right { display: flex; align-items: center; gap: 1.25rem; }

.nav-link {
  font-family: var(--mono); font-size: .72rem; color: var(--text-2);
  letter-spacing: .04em; transition: color .15s;
  display: flex; align-items: center; gap: .35rem;
}
.nav-link:hover { color: var(--text-1); }

.nav-gh {
  display: flex; align-items: center; gap: .4rem;
  background: var(--surface); border: 1px solid var(--border-med);
  border-radius: var(--radius-sm); padding: .3rem .7rem;
  font-family: var(--mono); font-size: .72rem; color: var(--text-2);
  transition: border-color .2s, color .2s;
}
.nav-gh:hover { border-color: var(--border-hi); color: var(--text-1); }

/* ══════════════════════════════════════
   LAYOUT SHELL
══════════════════════════════════════ */
.shell {
  display: flex;
  padding-top: var(--nav-h);
  min-height: 100vh;
  position: relative; z-index: 1;
}

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto; overflow-x: hidden;
  padding: 1.75rem 0;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  scrollbar-width: thin; scrollbar-color: var(--surface-h) transparent;
}

.sidebar-section { margin-bottom: 1.75rem; }

.sidebar-label {
  font-family: var(--mono); font-size: .62rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
  padding: 0 1.25rem; margin-bottom: .5rem;
}

.sidebar-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .38rem 1.25rem;
  font-family: var(--mono); font-size: .73rem; color: var(--text-2);
  cursor: pointer; transition: color .15s, background .15s; position: relative;
}
.sidebar-item:hover { color: var(--text-1); background: rgba(255,255,255,.03); }

.sidebar-item.active {
  color: var(--blue); background: rgba(77,145,255,.07);
}
.sidebar-item.active::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 2px; background: var(--blue); border-radius: 0 2px 2px 0;
}

.sidebar-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ══════════════════════════════════════
   MAIN CONTENT AREA
══════════════════════════════════════ */
.main-content {
  flex: 1; min-width: 0;
  padding: 3.5rem 3rem 6rem;
  max-width: 900px;
}

/* ══════════════════════════════════════
   HERO (index)
══════════════════════════════════════ */
.hero { margin-bottom: 4rem; animation: rise .6s var(--ease) both; }

.hero-breadcrumb {
  display: flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .7rem; color: var(--text-3);
  margin-bottom: 1.75rem;
}
.hero-breadcrumb .sep { opacity: .4; }
.hero-breadcrumb .current { color: var(--text-2); }

.hero-badge {
  display: inline-flex; align-items: center; gap: .45rem;
  background: rgba(77,145,255,.08); border: 1px solid rgba(77,145,255,.2);
  border-radius: var(--radius-sm); padding: .3rem .75rem;
  font-family: var(--mono); font-size: .68rem; color: var(--blue);
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 1.1rem;
}

.live-dot {
  width: 5px; height: 5px; background: var(--teal); border-radius: 50%;
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 700; line-height: 1.1;
  letter-spacing: -.03em; color: var(--text-1); margin-bottom: 1rem;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: .95rem; color: var(--text-2);
  max-width: 560px; line-height: 1.8; margin-bottom: 2rem;
}

.hero-meta { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }

.meta-item {
  display: flex; align-items: center; gap: .45rem;
  font-family: var(--mono); font-size: .72rem; color: var(--text-3);
}
.meta-item strong { color: var(--text-2); font-weight: 500; }
.meta-sep { width: 1px; height: 14px; background: var(--border-med); }

/* ══════════════════════════════════════
   PHASE SECTIONS (index)
══════════════════════════════════════ */
.phase { margin-bottom: 3.5rem; animation: rise .55s var(--ease) both; }
.phase:nth-child(1){animation-delay:.08s} .phase:nth-child(2){animation-delay:.15s}
.phase:nth-child(3){animation-delay:.22s} .phase:nth-child(4){animation-delay:.29s}
.phase:nth-child(5){animation-delay:.36s} .phase:nth-child(6){animation-delay:.43s}

.phase-header {
  display: flex; align-items: flex-start; gap: 1rem;
  margin-bottom: 1.25rem; padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.phase-icon-wrap {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}

.phase-meta-info { flex: 1; }
.phase-label { font-family: var(--mono); font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .2rem; }
.phase-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--text-1); letter-spacing: -.02em; margin-bottom: .2rem; }
.phase-desc { font-size: .82rem; color: var(--text-3); line-height: 1.6; }

.phase-count {
  font-family: var(--mono); font-size: .65rem; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: .15rem .5rem; align-self: center; flex-shrink: 0;
}

/* ══════════════════════════════════════
   TOPIC CARDS (index grid)
══════════════════════════════════════ */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .65rem;
}

.topic-card {
  position: relative; display: flex; align-items: center; gap: .75rem;
  padding: .9rem 1rem; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .22s var(--ease), background .22s var(--ease),
              transform .18s var(--ease), box-shadow .22s var(--ease);
}
.topic-card::after {
  content: ''; position: absolute; inset: 0;
  opacity: 0; transition: opacity .3s; border-radius: inherit; pointer-events: none;
}
.topic-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.topic-card:hover::after { opacity: 1; }

.card-icon-box {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-body { flex: 1; min-width: 0; }
.card-name { font-family: var(--mono); font-size: .73rem; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-slug { font-family: var(--mono); font-size: .6rem; color: var(--text-3); margin-top: .1rem; }

.card-chevron {
  color: var(--text-3); opacity: 0; transform: translateX(-4px);
  transition: opacity .2s, transform .2s var(--ease); flex-shrink: 0;
}
.topic-card:hover .card-chevron { opacity: 1; transform: translateX(0); }

/* Phase color themes */
.p1 .phase-icon-wrap  { background: rgba(77,145,255,.1); }
.p1 .phase-label      { color: var(--blue); }
.p1 .topic-card:hover { border-color: rgba(77,145,255,.35); background: rgba(77,145,255,.05); }
.p1 .topic-card::after{ background: radial-gradient(ellipse at top left, rgba(77,145,255,.07), transparent 70%); }
.p1 .card-icon-box    { background: rgba(77,145,255,.1); }

.p2 .phase-icon-wrap  { background: rgba(155,125,255,.1); }
.p2 .phase-label      { color: var(--purple); }
.p2 .topic-card:hover { border-color: rgba(155,125,255,.35); background: rgba(155,125,255,.05); }
.p2 .topic-card::after{ background: radial-gradient(ellipse at top left, rgba(155,125,255,.07), transparent 70%); }
.p2 .card-icon-box    { background: rgba(155,125,255,.1); }

.p3 .phase-icon-wrap  { background: rgba(45,217,176,.1); }
.p3 .phase-label      { color: var(--teal); }
.p3 .topic-card:hover { border-color: rgba(45,217,176,.35); background: rgba(45,217,176,.04); }
.p3 .topic-card::after{ background: radial-gradient(ellipse at top left, rgba(45,217,176,.06), transparent 70%); }
.p3 .card-icon-box    { background: rgba(45,217,176,.09); }

.p4 .phase-icon-wrap  { background: rgba(245,166,35,.1); }
.p4 .phase-label      { color: var(--amber); }
.p4 .topic-card:hover { border-color: rgba(245,166,35,.35); background: rgba(245,166,35,.04); }
.p4 .topic-card::after{ background: radial-gradient(ellipse at top left, rgba(245,166,35,.06), transparent 70%); }
.p4 .card-icon-box    { background: rgba(245,166,35,.09); }

.p5 .phase-icon-wrap  { background: rgba(56,200,245,.1); }
.p5 .phase-label      { color: var(--sky); }
.p5 .topic-card:hover { border-color: rgba(56,200,245,.35); background: rgba(56,200,245,.04); }
.p5 .topic-card::after{ background: radial-gradient(ellipse at top left, rgba(56,200,245,.06), transparent 70%); }
.p5 .card-icon-box    { background: rgba(56,200,245,.09); }

.p6 .phase-icon-wrap  { background: rgba(255,107,129,.1); }
.p6 .phase-label      { color: var(--rose); }
.p6 .topic-card:hover { border-color: rgba(255,107,129,.35); background: rgba(255,107,129,.04); }
.p6 .topic-card::after{ background: radial-gradient(ellipse at top left, rgba(255,107,129,.06), transparent 70%); }
.p6 .card-icon-box    { background: rgba(255,107,129,.09); }

/* ══════════════════════════════════════
   DOC PAGE — Article layout
══════════════════════════════════════ */
.doc-header { margin-bottom: 2.5rem; animation: rise .5s var(--ease) both; }

.doc-breadcrumb {
  display: flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .7rem; color: var(--text-3);
  margin-bottom: 1.5rem;
}
.doc-breadcrumb .sep { opacity: .4; }
.doc-breadcrumb a { color: var(--text-2); transition: color .15s; }
.doc-breadcrumb a:hover { color: var(--text-1); }
.doc-breadcrumb .current { color: var(--text-2); }

.doc-phase-tag {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .65rem; letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: .75rem;
  padding: .2rem .6rem; border-radius: 4px;
}

.doc-title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700; line-height: 1.1;
  letter-spacing: -.03em; color: var(--text-1); margin-bottom: .9rem;
}

.doc-subtitle {
  font-size: .95rem; color: var(--text-2);
  line-height: 1.75; max-width: 560px; margin-bottom: 1.5rem;
}

.doc-meta {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: .9rem 1.1rem;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 2.5rem;
}
.doc-meta-item {
  display: flex; align-items: center; gap: .4rem;
  font-family: var(--mono); font-size: .7rem; color: var(--text-3);
}
.doc-meta-item strong { color: var(--text-2); font-weight: 500; }
.doc-meta-sep { width: 1px; height: 12px; background: var(--border-med); }

/* Article prose */
.doc-body { animation: rise .5s var(--ease) .08s both; }

.doc-section { margin-bottom: 2.75rem; }

.doc-section h2 {
  font-family: var(--serif);
  font-size: 1.3rem; font-weight: 600;
  color: var(--text-1); letter-spacing: -.02em;
  margin-bottom: .75rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}

.doc-section h3 {
  font-family: var(--serif);
  font-size: 1.05rem; font-weight: 600;
  color: var(--text-1); letter-spacing: -.01em;
  margin-bottom: .5rem; margin-top: 1.4rem;
}

.doc-section p {
  font-size: .92rem; color: var(--text-2); line-height: 1.8;
  margin-bottom: .85rem;
}

.doc-section ul, .doc-section ol {
  padding-left: 1.4rem; margin-bottom: .85rem;
}
.doc-section li {
  font-size: .92rem; color: var(--text-2); line-height: 1.75;
  margin-bottom: .3rem;
}
.doc-section li strong { color: var(--text-1); font-weight: 500; }

/* Code blocks */
.code-block {
  background: var(--panel); border: 1px solid var(--border-med);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem;
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 1rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.code-lang {
  font-family: var(--mono); font-size: .65rem; color: var(--text-3);
  letter-spacing: .08em; text-transform: uppercase;
}
.code-copy {
  font-family: var(--mono); font-size: .65rem; color: var(--text-3);
  background: none; border: 1px solid var(--border); border-radius: 4px;
  padding: .15rem .5rem; cursor: pointer; transition: color .15s, border-color .15s;
}
.code-copy:hover { color: var(--text-2); border-color: var(--border-med); }
.code-copy.copied { color: var(--teal); border-color: rgba(45,217,176,.3); }

.code-block pre {
  padding: 1.1rem 1.25rem; overflow-x: auto;
  font-family: var(--mono); font-size: .8rem; line-height: 1.7;
  color: var(--text-2);
}
/* Syntax colours */
.kw { color: #7c9fff; }
.fn { color: #82d9a8; }
.str { color: #f5a623; }
.cm { color: var(--text-3); font-style: italic; }
.num { color: #ff8fa3; }
.tp { color: #c4b5fd; }

/* Callout boxes */
.callout {
  display: flex; gap: .75rem;
  padding: .9rem 1.1rem;
  border-radius: var(--radius); border: 1px solid;
  margin-bottom: 1.25rem;
}
.callout-icon { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }
.callout-body { flex: 1; }
.callout-title { font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .05em; margin-bottom: .25rem; }
.callout-text { font-size: .85rem; color: var(--text-2); line-height: 1.65; }

.callout-info { background: rgba(77,145,255,.06); border-color: rgba(77,145,255,.2); }
.callout-info .callout-title { color: var(--blue); }

.callout-tip { background: rgba(45,217,176,.05); border-color: rgba(45,217,176,.2); }
.callout-tip .callout-title { color: var(--teal); }

.callout-warn { background: rgba(245,166,35,.05); border-color: rgba(245,166,35,.2); }
.callout-warn .callout-title { color: var(--amber); }

/* Complexity table */
.complexity-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: .75rem;
  margin-bottom: 1.25rem;
}
.complexity-table th {
  text-align: left; padding: .55rem .8rem;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-3); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; font-size: .65rem;
}
.complexity-table td {
  padding: .5rem .8rem; border: 1px solid var(--border);
  color: var(--text-2);
}
.complexity-table tr:hover td { background: rgba(255,255,255,.02); }
.tc-green { color: var(--teal); }
.tc-amber { color: var(--amber); }
.tc-red   { color: var(--rose); }

/* Navigation buttons prev/next */
.doc-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.doc-nav-btn {
  display: flex; align-items: center; gap: .6rem;
  padding: .75rem 1.1rem;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); transition: border-color .2s, background .2s;
  flex: 1; max-width: 240px;
}
.doc-nav-btn:hover { border-color: var(--border-hi); background: var(--surface); }
.doc-nav-btn.next { justify-content: flex-end; text-align: right; }
.doc-nav-label { font-family: var(--mono); font-size: .62rem; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .15rem; }
.doc-nav-title { font-family: var(--mono); font-size: .75rem; color: var(--text-1); }

/* ══════════════════════════════════════
   RIGHT RAIL — TOC
══════════════════════════════════════ */
.toc-rail {
  width: 200px; flex-shrink: 0;
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto; padding: 2rem 1.25rem;
  border-left: 1px solid var(--border);
}

.toc-label {
  font-family: var(--mono); font-size: .62rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
  margin-bottom: .75rem;
}
.toc-item {
  display: flex; align-items: center; gap: .45rem;
  font-family: var(--mono); font-size: .68rem; color: var(--text-3);
  padding: .28rem 0; transition: color .15s; cursor: pointer;
}
.toc-item:hover { color: var(--text-2); }
.toc-phase-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.toc-divider { height: 1px; background: var(--border); margin: .75rem 0; }

/* ══════════════════════════════════════
   FOOTER
══════════════════════════════════════ */
footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border);
  padding: 1.5rem 3rem 1.5rem calc(var(--sidebar-w) + 3rem);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
}
.footer-l { display: flex; align-items: center; gap: .75rem; font-family: var(--mono); font-size: .7rem; color: var(--text-3); }
.footer-r { display: flex; align-items: center; gap: 1.5rem; }
.footer-r a { display: flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: .7rem; color: var(--text-3); transition: color .15s; }
.footer-r a:hover { color: var(--text-2); }

/* ══════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════ */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1200px) { .toc-rail { display: none; } }

@media (max-width: 800px) {
  .sidebar { display: none; }
  .main-content { padding: 2rem 1.25rem 4rem; }
  footer { padding: 1.25rem; }
  .nav-search { display: none; }
}

@media (max-width: 480px) {
  .topic-grid { grid-template-columns: 1fr; }
  .doc-nav { flex-direction: column; }
  .doc-nav-btn { max-width: 100%; }
}
