:root {
  --bg:         #0e0c0a;
  --bg2:        #161310;
  --bg3:        #1e1a15;
  --amber:      #e8a030;
  --amber-dim:  #a06818;
  --amber-glow: #f5c060;
  --warm:       #c8a882;
  --muted:      #6b5e4e;
  --text:       #f0e8dc;
  --text-dim:   #9a8878;
  --line:       rgba(232,160,48,0.12);
  --line2:      rgba(240,232,220,0.08);
  --serif:      'Cormorant Garamond', Georgia, serif;
  --display:    'Unbounded', -apple-system, sans-serif;
  --mono:       'DM Mono', ui-monospace, monospace;
  --sans:       -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber-glow); text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg3);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--warm);
}

pre {
  background: var(--bg3);
  padding: 16px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
}
pre code {
  background: transparent;
  padding: 0;
  color: var(--text);
}

/* ─── NAV ─────────────────────────────────────── */
nav.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14,12,10,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand img { width: 28px; height: 28px; object-fit: contain; }
.brand-wordmark {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text);
}
.brand-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 3px;
}
.nav-links {
  display: flex;
  gap: 24px;
  font-size: 13px;
}
.nav-links a {
  color: var(--text-dim);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  text-decoration: none;
}
.nav-links a:hover { color: var(--amber); }

/* ─── HERO ────────────────────────────────────── */
.hero {
  padding: 80px 32px 64px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(circle at 20% 0%, rgba(232,160,48,0.06) 0%, transparent 60%);
}
.hero-inner {
  max-width: 760px;
  margin: 0 auto;
}
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--amber);
  margin-bottom: 12px;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 900;
  margin: 0 0 20px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.hero p.lead {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.5;
  color: var(--text-dim);
  font-style: italic;
  margin: 0 0 36px;
}

/* ─── SEARCH ──────────────────────────────────── */
.search-wrap {
  position: relative;
}
.search-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 24px 18px 56px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232,160,48,0.15);
}
.search-input::placeholder { color: var(--muted); }
.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 2;
  pointer-events: none;
}
.search-result-count {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  min-height: 16px;
}

/* ─── LAYOUT ──────────────────────────────────── */
.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 32px 120px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
}

/* ─── SIDEBAR ─────────────────────────────────── */
aside.toc {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 8px;
}
.toc-title {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--amber);
  margin-bottom: 16px;
}
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--line);
}
.toc li {
  margin: 0;
}
.toc a {
  display: block;
  padding: 7px 14px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.1s, border-color 0.1s;
}
.toc a:hover {
  color: var(--text);
  border-left-color: var(--warm);
}
.toc a.active {
  color: var(--amber);
  border-left-color: var(--amber);
  font-weight: 500;
}

/* ─── ARTICLES ────────────────────────────────── */
main.content {
  min-width: 0;
}
article {
  margin-bottom: 64px;
  scroll-margin-top: 80px;
  transition: opacity 0.15s;
}
article.hidden {
  display: none;
}
article > .article-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--amber);
  margin-bottom: 8px;
}
article h2 {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 900;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
article h3 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 12px;
  letter-spacing: 0.01em;
}
article p {
  margin: 0 0 14px;
  color: var(--text);
}
article ul, article ol {
  padding-left: 22px;
  margin: 0 0 16px;
}
article li {
  margin-bottom: 6px;
}
article li::marker { color: var(--amber-dim); }

.callout {
  background: var(--bg2);
  border-left: 3px solid var(--amber);
  border-radius: 4px;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 14.5px;
  line-height: 1.6;
}
.callout strong { color: var(--amber-glow); }

/* ─── SCREENSHOTS ─────────────────────────────── */
figure.screenshot {
  margin: 24px 0;
  padding: 0;
}
figure.screenshot img {
  display: block;
  max-width: 320px;
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(232,160,48,0.05) inset;
  margin: 0 auto;
}
figure.screenshot figcaption {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  font-family: var(--serif);
  line-height: 1.4;
}
.screenshot-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin: 24px 0;
}
.screenshot-row figure.screenshot {
  margin: 0;
}
.screenshot-row figure.screenshot img {
  max-width: 100%;
}

.kbd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 7px;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--warm);
}

.no-results {
  display: none;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--text-dim);
  text-align: center;
  padding: 80px 20px;
}
.no-results.visible { display: block; }

/* ─── FOOTER ──────────────────────────────────── */
footer.bottom {
  border-top: 1px solid var(--line);
  padding: 32px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}
footer.bottom a { color: var(--text-dim); }
footer.bottom a:hover { color: var(--amber); }

/* ─── MOBILE ──────────────────────────────────── */
@media (max-width: 880px) {
  .nav-links { display: none; }
  nav.top { padding: 12px 20px; }
  .hero { padding: 56px 20px 40px; }
  .hero h1 { font-size: 38px; }
  .hero p.lead { font-size: 18px; margin-bottom: 28px; }
  .layout {
    grid-template-columns: 1fr;
    padding: 32px 20px 80px;
    gap: 32px;
  }
  aside.toc {
    position: static;
    max-height: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 20px;
    background: var(--bg2);
  }
  aside.toc details {
    margin: 0;
  }
  aside.toc summary {
    cursor: pointer;
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--amber);
    list-style: none;
  }
  aside.toc summary::after {
    content: " ↓";
  }
  aside.toc[open] summary::after {
    content: " ↑";
  }
  .toc-title { display: none; }
  .toc ul { margin-top: 14px; }
  article h2 { font-size: 26px; }
}
