/* Vault Notes — clean reading theme, darioamodei.com-inspired */
:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --border: #e9e7e2;
  --accent: #1d4ed8;
  --accent-soft: #eff4ff;
  --callout-bg: #f5f4f1;
  --callout-border: #d8d4cb;
  --code-bg: #f1f0ed;
  --table-head: #f6f5f2;
  --table-stripe: #faf9f7;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
}
[data-theme="dark"] {
  --bg: #101012;
  --surface: #17171a;
  --text: #e9e9ea;
  --muted: #a1a1aa;
  --border: #26262b;
  --accent: #8fb0ff;
  --accent-soft: #1c2338;
  --callout-bg: #1b1b1f;
  --callout-border: #333338;
  --code-bg: #222227;
  --table-head: #1e1e23;
  --table-stripe: #161619;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: -.01em; }
.brand span { color: var(--muted); font-weight: 400; }
.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.theme-toggle:hover { border-color: var(--muted); }

/* ---------- layout ---------- */
.layout { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; gap: 48px; }
.sidebar {
  width: 250px; flex-shrink: 0;
  position: sticky; top: 73px; align-self: flex-start;
  max-height: calc(100vh - 100px); overflow-y: auto;
  padding: 32px 0 48px; font-size: 14.5px;
}
.sidebar h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.sidebar ul { list-style: none; margin: 0 0 28px; padding: 0; }
.sidebar li { margin: 2px 0; }
.sidebar a.chapter {
  display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted);
  line-height: 1.45;
}
.sidebar a.chapter:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.sidebar a.chapter.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.subject-link {
  display: block; padding: 8px 10px; border-radius: 8px; color: var(--muted);
  border: 1px solid transparent;
}
.subject-link:hover { text-decoration: none; border-color: var(--border); color: var(--text); }
.subject-link.current { color: var(--text); font-weight: 600; border-color: var(--border); background: var(--surface); }
.subject-link .soon { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 1px 7px; margin-left: 6px; }
.article { flex: 1; min-width: 0; max-width: 760px; padding: 40px 0 120px; }
.article h1 { font-size: 2.4rem; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 8px; }
.subtitle { color: var(--muted); font-size: 17px; margin: 0 0 40px; }
.article h2 {
  font-size: 1.55rem; letter-spacing: -.015em; margin: 64px 0 16px;
  padding-top: 24px; border-top: 1px solid var(--border);
}
.article h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.article h3 { font-size: 1.2rem; margin: 36px 0 10px; letter-spacing: -.01em; }
.article p { margin: 0 0 16px; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 24px; }
.article li { margin-bottom: 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 20px 0 28px; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; background: var(--surface); }
th { background: var(--table-head); text-align: left; font-weight: 650; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: var(--table-stripe); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em; background: var(--code-bg); padding: 2px 6px; border-radius: 6px;
}
pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; overflow-x: auto; font-size: 13.5px; line-height: 1.65; margin: 20px 0;
}
pre code { background: none; padding: 0; font-size: 1em; }

/* ---------- callouts & formulas ---------- */
.callout {
  background: var(--callout-bg); border: 1px solid var(--callout-border);
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0; padding: 14px 18px; margin: 22px 0;
  font-size: 15.5px;
}
.callout strong { display: block; margin-bottom: 4px; }
.callout p { margin: 0; }
.formula {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; margin: 20px 0; text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px; box-shadow: var(--shadow); overflow-x: auto;
}
.formula .label { display: block; font-family: inherit; font-size: 13px; color: var(--muted); margin-bottom: 8px; font-family: -apple-system, "Segoe UI", sans-serif; }

/* ---------- home page cards ---------- */
.hero { max-width: 760px; margin: 0 auto; padding: 72px 24px 24px; text-align: center; }
.hero h1 { font-size: 2.6rem; letter-spacing: -.025em; margin: 0 0 12px; }
.hero p { color: var(--muted); font-size: 18px; margin: 0; }
.cards {
  max-width: 1080px; margin: 0 auto; padding: 40px 24px 120px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 26px; box-shadow: var(--shadow); display: block; color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease;
}
a.card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.card.disabled { opacity: .55; cursor: default; }
.card.disabled:hover { transform: none; box-shadow: var(--shadow); }
.card .kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.card h3 { margin: 0 0 8px; font-size: 1.25rem; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.card .meta { margin-top: 14px; font-size: 13px; color: var(--muted); }
.card .go { display: inline-block; margin-top: 12px; font-weight: 600; color: var(--accent); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; gap: 0; }
  .sidebar {
    width: 100%; position: static; max-height: none; padding: 20px 0 0;
    border-bottom: 1px solid var(--border); margin-bottom: 8px;
  }
  .sidebar .chapter-nav { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 12px; }
  .sidebar .chapter-nav li { flex-shrink: 0; }
  .article { padding-top: 28px; }
  .article h1 { font-size: 1.9rem; }
  .hero h1 { font-size: 2rem; }
}
