/* Ledger dark — local study site
   Tokens locked: bg #0a0a0b, panel #111113, border #26262a,
   ivory #f2f2ee, muted #8a8a93, teal #2dd4bf, Inter. */
:root {
  --bg: #0a0a0b;
  --panel: #111113;
  --panel-2: #151517;
  --line: #26262a;
  --line-strong: #33333a;
  --text: #f2f2ee;
  --muted: #8a8a93;
  --faint: #63636b;
  --accent: #2dd4bf;
  --accent-dim: rgba(45, 212, 191, 0.09);
  --accent-text: #07110f;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --sans: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--bg);
  padding: 28px 20px 32px;
}

.brand {
  display: block;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 4px;
}
.brand:hover { text-decoration: none; }

.brand-sub {
  font-size: 0.76rem;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 26px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 7px 10px;
  border-radius: 7px;
  border-left: 2px solid transparent;
}
.nav a:hover {
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
}
.nav a[aria-current="page"] {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}

.main {
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 48px 96px;
}

/* ---------- type ---------- */
h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

h2 {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 56px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

h3 {
  font-size: 1.08rem;
  margin: 34px 0 10px;
  color: var(--text);
}

h4 { font-size: 0.98rem; margin: 26px 0 8px; color: var(--muted); }

p { margin: 12px 0; }

.kicker {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
}

.lede { color: var(--muted); font-size: 1.06rem; }

strong { color: var(--text); font-weight: 600; }
em { color: #c9c9d0; }

/* ---------- code ---------- */
code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  color: #9be8dc;
}

pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  line-height: 1.55;
  margin: 18px 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 0.86rem;
}

/* ---------- lists ---------- */
ul, ol { margin: 12px 0; padding-left: 24px; }
li { margin: 6px 0; }
li > ul, li > ol { margin: 4px 0; }
li::marker { color: var(--faint); }

/* ---------- table ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  overflow-x: auto;
}

th {
  text-align: left;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--panel);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--panel); }

/* ---------- misc blocks ---------- */
hr { border: none; border-top: 1px solid var(--line); margin: 40px 0; }

blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  border-left: 2px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #c9c9d0;
}
blockquote p { margin: 4px 0; }

details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px;
  margin: 12px 0;
}

summary {
  cursor: pointer;
  font-weight: 600;
  padding: 10px 0;
  color: var(--accent);
  font-size: 0.95rem;
}
summary:hover { color: var(--text); }

/* ---------- pagination ---------- */
.pagination {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.pagination a {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  max-width: 46%;
  color: var(--muted);
}
.pagination a:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}
.pagination .dir {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 3px;
}
.pagination .topic { font-weight: 600; }
.pagination .next { text-align: right; }

footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.8rem;
}

/* ---------- focus / motion ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 20px 20px 16px;
  }
  .brand-sub { margin-bottom: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav a { border-left: none; border-bottom: 2px solid transparent; border-radius: 6px; }
  .nav a[aria-current="page"] {
    border-bottom-color: var(--accent);
    background: var(--accent-dim);
  }
  .main { padding: 28px 20px 64px; }
  .pagination { flex-direction: column; }
  .pagination a { max-width: 100%; }
}
