/* WeKoded theme documentation */
:root {
  --paper: #fbfbfa;
  --panel: #f1f2ee;
  --raised: #ffffff;
  --ink: #17181c;
  --muted: #5b5d66;
  --line: #e3e2dc;
  --accent: #3b7a12;
  --accent-soft: #edf5e3;
  --brand: #74b82c;
  --ok: #1d7a4b;
  --warn: #9a5b00;
  --warn-soft: #fbf1e1;
  --code-bg: #f0f0eb;
  --radius: 10px;
  --font-body: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Bricolage Grotesque", "Figtree", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sidebar: 17rem;
  --toc: 14rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121317;
    --panel: #191a1f;
    --raised: #1e1f25;
    --ink: #ecece8;
    --muted: #a3a5ad;
    --line: #2c2d34;
    --accent: #8fcf4f;
    --accent-soft: #1f2b15;
    --brand: #8cce4a;
    --ok: #6fd3a0;
    --warn: #f0b45c;
    --warn-soft: #2e2516;
    --code-bg: #22232a;
  }
}
:root[data-theme="dark"] {
  --paper: #121317;
  --panel: #191a1f;
  --raised: #1e1f25;
  --ink: #ecece8;
  --muted: #a3a5ad;
  --line: #2c2d34;
  --accent: #8fcf4f;
  --accent-soft: #1f2b15;
  --brand: #8cce4a;
  --ok: #6fd3a0;
  --warn: #f0b45c;
  --warn-soft: #2e2516;
  --code-bg: #22232a;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
}
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; }

/* ── Top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  height: 3.75rem; padding: 0 1rem;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 0.5rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand { align-items: center; gap: 0.75rem; }
.brand__logo { display: block; height: 1.75rem; width: auto; }
.brand__logo--dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand__logo--light { display: none; }
  :root:not([data-theme="light"]) .brand__logo--dark { display: block; }
}
:root[data-theme="dark"] .brand__logo--light { display: none; }
:root[data-theme="dark"] .brand__logo--dark { display: block; }
.brand__theme { padding-left: 0.75rem; border-left: 1px solid var(--line); }
.brand__theme { font-size: 0.875rem; color: var(--muted); }
.topbar__spacer { flex: 1; }
.search { position: relative; width: min(22rem, 100%); }
.search input {
  width: 100%; height: 2.375rem; padding: 0 0.875rem 0 2.25rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--raised); color: var(--ink); font: inherit; font-size: 0.9375rem;
}
.search svg { position: absolute; left: 0.8rem; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search__results {
  position: absolute; top: calc(100% + 0.5rem); left: 0; right: 0;
  max-height: 60vh; overflow: auto; margin: 0; padding: 0.375rem; list-style: none;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.12);
}
.search__results[hidden] { display: none; }
.search__results a { display: block; padding: 0.5rem 0.625rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.search__results a:hover, .search__results a[aria-selected="true"] { background: var(--accent-soft); }
.search__results small { display: block; color: var(--muted); font-size: 0.8125rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.375rem; height: 2.375rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--raised); color: var(--ink); cursor: pointer;
}
.menu-btn { display: none; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
  max-width: 88rem; margin: 0 auto;
}
.sidebar {
  position: sticky; top: 3.75rem; align-self: start;
  height: calc(100vh - 3.75rem); overflow-y: auto;
  padding: 1.5rem 1rem 3rem 1.25rem;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.nav-group { margin-bottom: 1.5rem; }
.nav-group__title {
  margin: 0 0 0.375rem 0.625rem;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.nav-group ul { margin: 0; padding: 0; list-style: none; }
.nav-group a {
  display: block; padding: 0.3rem 0.625rem; border-radius: 6px;
  color: var(--ink); text-decoration: none; font-size: 0.9375rem; line-height: 1.4;
}
.nav-group a:hover { background: var(--panel); }
.nav-group a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.content { min-width: 0; padding: 2.5rem clamp(1rem, 4vw, 3.5rem) 5rem; }
.article { max-width: 46rem; }
.toc {
  position: sticky; top: 3.75rem; align-self: start;
  max-height: calc(100vh - 3.75rem); overflow-y: auto;
  padding: 2.5rem 1.25rem 2rem 0.5rem; font-size: 0.875rem;
}
.toc__title { margin: 0 0 0.5rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.toc ul { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 0.25rem 0 0.25rem 0.875rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); }

/* ── Type ── */
.eyebrow { margin: 0 0 0.5rem; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; letter-spacing: -0.02em; text-wrap: balance; }
h1 { margin: 0 0 0.75rem; font-size: clamp(2rem, 4vw, 2.625rem); font-weight: 700; }
h2 { margin: 2.75rem 0 0.75rem; font-size: 1.5rem; font-weight: 650; padding-top: 0.25rem; }
h3 { margin: 2rem 0 0.5rem; font-size: 1.1875rem; font-weight: 650; }
h4 { margin: 1.5rem 0 0.375rem; font-size: 1rem; font-weight: 650; }
.lead { margin: 0 0 1.75rem; font-size: 1.1875rem; color: var(--muted); line-height: 1.55; }
p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.3rem; }
li > ul, li > ol { margin: 0.3rem 0 0; }
strong { font-weight: 650; }
code { font-family: var(--font-mono); font-size: 0.85em; padding: 0.12em 0.38em; border-radius: 5px; background: var(--code-bg); }
pre { overflow-x: auto; padding: 1rem 1.125rem; border-radius: var(--radius); background: var(--code-bg); font-size: 0.875rem; line-height: 1.55; }
pre code { padding: 0; background: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
kbd { font-family: var(--font-mono); font-size: 0.8em; padding: 0.1em 0.4em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--raised); }
.path { font-weight: 600; }
.path::after { content: none; }

/* ── Components ── */
.callout {
  margin: 1.5rem 0; padding: 0.875rem 1rem 0.875rem 1.125rem;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel);
}
.callout > :last-child { margin-bottom: 0; }
.callout__title { display: block; margin-bottom: 0.25rem; font-weight: 700; font-size: 0.9375rem; }
.callout--tip { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.callout--tip .callout__title { color: var(--accent); }
.callout--warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout--warn .callout__title { color: var(--warn); }

.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { padding: 0.625rem 0.875rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--panel); font-weight: 650; font-size: 0.8125rem; letter-spacing: 0.02em; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; min-width: 11rem; }
td small { display: block; color: var(--muted); font-weight: 400; margin-top: 0.125rem; }
.opt { display: inline-block; margin: 0.125rem 0.25rem 0.125rem 0; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 0.8125rem; white-space: nowrap; }
.type { color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { position: relative; padding-left: 2.5rem; margin-bottom: 1rem; }
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0.05rem;
  display: grid; place-items: center; width: 1.75rem; height: 1.75rem;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 0.875rem;
}

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.875rem; margin: 1.25rem 0 2rem; }
.card {
  display: block; padding: 1rem 1.125rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--raised); color: var(--ink); text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); }
.card strong { display: block; margin-bottom: 0.25rem; font-family: var(--font-head); font-size: 1.0625rem; }
.card span { display: block; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

.figure { margin: 1.5rem 0; }
.figure img { display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
.figure figcaption { margin-top: 0.5rem; color: var(--muted); font-size: 0.875rem; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.pager a { display: block; max-width: 48%; padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--muted); font-size: 0.8125rem; }
.pager .next { margin-left: auto; text-align: right; }

.footer-note { margin-top: 3rem; color: var(--muted); font-size: 0.875rem; }

/* ── Landing ── */
.landing { max-width: 64rem; margin: 0 auto; padding: 4.5rem 1rem 5rem; }
.landing__logo { height: 3rem; width: auto; margin-bottom: 2rem; }
.landing h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); max-width: 18ch; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.theme-card { display: flex; flex-direction: column; gap: 0.375rem; padding: 1.5rem; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); color: var(--ink); text-decoration: none; }
.theme-card:hover { border-color: var(--accent); }
.theme-card strong { font-family: var(--font-head); font-size: 1.5rem; letter-spacing: -0.02em; }
.theme-card span { color: var(--muted); }
.theme-card em { margin-top: 0.75rem; font-style: normal; font-weight: 600; color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .layout { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; }
  .brand__theme { display: none; }
  .sidebar {
    position: fixed; inset: 3.75rem auto 0 0; z-index: 30; width: min(20rem, 85vw);
    background: var(--paper); box-shadow: 8px 0 24px rgb(0 0 0 / 0.12);
    transform: translateX(-105%); transition: transform 0.25s ease; visibility: hidden;
  }
  .sidebar.is-open { transform: none; visibility: visible; }
  .content { padding: 1.75rem 1rem 4rem; }
  .search { width: auto; flex: 1; min-width: 0; }
  .brand { min-width: 0; }
  .topbar__spacer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Phone screenshots stay phone-sized. */
.figure img[src*="mobile"] { max-width: 20rem; margin-inline: auto; }
.figure:has(img[src*="mobile"]) figcaption { text-align: center; }
