/* One swappable theme: calm and plain, light and dark. System fonts only; no third-party requests. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #1c2024;
  --muted: #545b63;
  --line: #d4d8dd;
  --accent: #0a53be;
  --panel: #f5f7f9;
  --bar-bg: #fff3c4;
  --bar-text: #3d3100;
  --status-text: #17325c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --text: #e7eaee;
    --muted: #aab2bb;
    --line: #333a42;
    --accent: #8fb8f6;
    --panel: #1a1f25;
    --bar-bg: #3d3100;
    --bar-text: #ffeaa8;
    --status-text: #cfe0fb;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}
.wrap { max-width: 52rem; margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
:target { scroll-margin-top: 1rem; }

.skip { position: absolute; left: 1rem; top: -4rem; z-index: 1; padding: 0.5rem 0.75rem; background: var(--bg); border: 1px solid var(--line); }
.skip:focus { top: 0.5rem; }

.draft-bar {
  background: var(--bar-bg);
  color: var(--bar-text);
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  text-align: center;
}

.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.brand-block { display: flex; flex-direction: column; line-height: 1.15; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 0.45rem; min-height: 24px; padding: 0.15rem 0 0; }
.brand img { width: 28px; height: 28px; }
.maker { font-size: 0.75rem; color: var(--muted); padding-left: calc(28px + 0.45rem); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 0.85rem; font-size: 0.95rem; }
.site-nav a { display: inline-block; min-height: 24px; padding: 0.2rem 0; text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"], .site-nav a.here { text-decoration: underline; }
.site-nav a[aria-current="page"], .site-nav a.here { color: var(--text); font-weight: 600; }

main.wrap { padding-top: 2.25rem; padding-bottom: 2.5rem; }
h1 { font-size: clamp(1.45rem, 1.1rem + 1.4vw, 1.85rem); line-height: 1.3; margin: 0 0 1rem; font-weight: 700; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
p { margin: 0 0 0.75rem; }
/* About 75 characters a line. */
main.wrap p, main.wrap h1, .paths, .topic { max-width: 34rem; }

.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.75rem; margin: 1.5rem 0 0.5rem; }
.paths a, .topics-next a {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-weight: 600;
  text-decoration: none;
}
.paths a:hover, .topics-next a:hover { border-color: var(--accent); }
.paths a span { display: block; margin-top: 0.2rem; font-weight: 400; font-size: 0.9rem; color: var(--muted); }

.status { color: var(--status-text); font-weight: 700; }
/* A limit is part of the statement: full contrast and size, set off as its own block. */
.limit { display: block; margin-top: 0.4rem; padding-left: 0.75rem; border-left: 2px solid var(--muted); }

p[data-quote] { font-style: italic; border-left: 3px solid var(--line); padding-left: 0.75rem; }

.badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  border-left: 3px solid var(--bar-bg);
  padding-left: 0.5rem;
  margin: -0.4rem 0 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem; }
.site-footer .wrap { padding-top: 1.25rem; padding-bottom: 1.5rem; }
.site-footer p { margin: 0 0 0.4rem; }
.site-footer a { display: inline-block; min-height: 24px; padding: 0.15rem 0; }
.site-footer .contact { color: var(--text); font-weight: 600; font-size: 1rem; }
.site-footer .legal a { margin-left: 1rem; }
#contact:target { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* How it works: the article comes first in the source; wider screens put the topic list on its left. */
.topics { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.topic { grid-column: 2; grid-row: 1; }
.topic p { margin-bottom: 1rem; }
.topic p.question { margin: -0.5rem 0 1.25rem; color: var(--muted); font-size: 1.05rem; }
/* The Why / How switch: two halves of one control, the current side filled. */
.lens { display: inline-flex; margin: 0 0 1.25rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px; font-size: 0.9rem; }
.lens a { display: inline-block; min-height: 24px; padding: 0.25rem 0.85rem; border-radius: 999px; text-decoration: none; }
.lens a[aria-current="page"] { background: var(--accent); color: var(--bg); font-weight: 600; }
.ask { margin-top: 1.5rem; font-weight: 600; }
.topics-next .next-section { display: block; margin-bottom: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.topics-nav a.labels { margin-top: 0.75rem; font-size: 0.85rem; color: var(--muted); }
.topics-next { margin-top: 2rem; }
.topics-jump { display: none; margin-bottom: 1rem; font-size: 0.95rem; }
.topics-nav h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 0.4rem; padding: 0 0.5rem; }
.topics-nav { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 0.1rem; padding-right: 1rem; border-right: 1px solid var(--line); font-size: 0.95rem; }
.topics-nav a { display: block; min-height: 24px; padding: 0.3rem 0.5rem; border-radius: 6px; text-decoration: none; }
.topics-nav a:hover { background: var(--panel); }
.topics-nav a[aria-current="page"] { background: var(--panel); color: var(--text); font-weight: 600; }
@media (min-width: 52.01rem) and (min-height: 32rem) {
  .topics-nav { position: sticky; top: 1rem; }
}
@media (max-width: 52rem) {
  .topics { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .topic, .topics-nav { grid-column: 1; grid-row: auto; }
  .topics-nav { padding: 1rem 0 0; border-right: 0; border-top: 1px solid var(--line); }
  .topics-jump { display: block; }
}

@media print {
  :root { --bg: #fff; --text: #000; --muted: #333; --line: #999; --accent: #000; --panel: #fff; --status-text: #000; }
  .skip, .site-nav, .topics-nav, .topics-next, .topics-jump, .paths, .lens, .ask { display: none; }
  .topics { display: block; }
  p { break-inside: avoid; }
}
