/* ===== StudyRoom documentation layout (legal pages) =====
   Reuses the brand tokens + fonts from styles.css; supports the dark theme. */
body { font-size: 16px; }
.doc-topbar {
  position: sticky; top: 0; z-index: 50; height: 60px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.doc-topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.doc-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -0.02em; color: var(--ink); }
.doc-brand .brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.doc-top-actions { display: flex; align-items: center; gap: 18px; }
.doc-back { font-weight: 600; font-size: 14.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; }
.doc-back:hover { color: var(--ink); }
.theme-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--ink-soft); display: grid; place-items: center; cursor: pointer; }
.theme-btn:hover { color: var(--ink); border-color: var(--muted); }
.theme-btn .ic-moon { display: none; }
html[data-theme="dark"] .theme-btn .ic-sun { display: none; }
html[data-theme="dark"] .theme-btn .ic-moon { display: block; }

.doc-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 56px; align-items: start; padding: 0 32px; max-width: 1180px; margin: 0 auto; }

/* table of contents */
.toc { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; padding: 28px 0; }
.toc-label { font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a { display: flex; gap: 10px; padding: 6px 12px; border-radius: 8px; font-size: 14px; line-height: 1.35; color: var(--ink-soft); font-weight: 500; border-left: 2px solid transparent; }
.toc a::before { content: counter(toc); color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; min-width: 16px; }
.toc a:hover { background: var(--surface); color: var(--ink); }
.toc a.active { color: var(--accent); border-left-color: var(--whisper); background: color-mix(in srgb, var(--whisper) 9%, transparent); }
.toc a.active::before { color: var(--whisper); }

/* article */
.doc-article { padding: 40px 0 96px; min-width: 0; max-width: 760px; }
.doc-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--whisper); }
.doc-eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--whisper); border-radius: 2px; }
.doc-h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(34px, 5vw, 46px); letter-spacing: -0.02em; line-height: 1.05; margin: 16px 0 0; color: var(--ink); }
.doc-meta { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; color: var(--muted); }
.doc-meta b { color: var(--ink-soft); font-weight: 600; }
.doc-lead { margin-top: 22px; font-size: 18.5px; line-height: 1.6; color: var(--ink-soft); }

.callout { margin-top: 28px; border: 1px solid var(--border); border-left: 3px solid var(--whisper); border-radius: var(--radius); background: color-mix(in srgb, var(--whisper) 6%, var(--card)); padding: 20px 22px; }
.callout h2 { font-family: var(--font-body); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--whisper); margin: 0 0 10px; }
.callout ul { margin: 0; padding-left: 18px; }
.callout li { margin: 6px 0; font-size: 15px; color: var(--ink-soft); line-height: 1.5; }

.doc-section { padding-top: 40px; margin-top: 40px; border-top: 1px solid var(--border); scroll-margin-top: 84px; }
.doc-section:first-of-type { border-top: none; }
.doc-section > h2 { font-family: var(--font-display); font-weight: 600; font-size: 27px; letter-spacing: -0.01em; color: var(--ink); margin: 0; display: flex; align-items: baseline; gap: 12px; }
.doc-section > h2 .num { font-size: 17px; color: var(--whisper); font-variant-numeric: tabular-nums; font-family: var(--font-body); font-weight: 700; }
.doc-section h3 { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--ink); margin: 28px 0 0; }
.doc-article p { margin-top: 14px; font-size: 16px; line-height: 1.68; color: var(--ink-soft); }
.doc-article a { color: var(--whisper); text-decoration: underline; text-underline-offset: 2px; }
.doc-article a:hover { color: var(--accent); }
.doc-article strong { color: var(--ink); font-weight: 700; }
.doc-article ul, .doc-article ol.spaced { margin: 14px 0 0; padding-left: 22px; }
.doc-article li { margin: 8px 0; font-size: 16px; line-height: 1.62; color: var(--ink-soft); }
.doc-article li strong { color: var(--ink); }

.doc-table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.doc-table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
table.doc-table th, table.doc-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--ink-soft); line-height: 1.5; }
table.doc-table thead th { background: var(--surface); color: var(--ink); font-weight: 700; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
table.doc-table tr:last-child td { border-bottom: none; }
table.doc-table td strong { color: var(--ink); }

.doc-foot { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; }
.doc-foot a { color: var(--ink-soft); font-weight: 600; }
.doc-foot a:hover { color: var(--accent); }

/* Dark mode: --accent stays near-black, so link hover would vanish on the dark
   page. Brighten to ink (near-white) instead so hovered links stay visible. */
html[data-theme="dark"] .doc-article a:hover,
html[data-theme="dark"] .doc-foot a:hover,
html[data-theme="dark"] .toc a.active { color: var(--ink); }

@media (max-width: 920px) {
  .doc-layout { grid-template-columns: 1fr; gap: 0; }
  .toc { position: static; max-height: none; overflow: visible; padding: 18px 0 0; border-bottom: 1px solid var(--border); }
  .toc-inner { columns: 2; column-gap: 24px; }
  .doc-article { padding-top: 28px; }
}
@media (max-width: 560px) { .toc-inner { columns: 1; } }
