/* ============ 303 Journal — shared theme tokens ============ */
:root {
  /* typography */
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --text-body: 1.0625rem;
  --text-small: 0.875rem;
  --leading-body: 1.65;
  --leading-tight: 1.25;
  --measure: 38em;

  /* layout */
  --page-max: 46rem;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 2rem;
  --space-4: 3rem;
  --border-width: 1px;
  --radius: 0px;

  /* colour: LIGHT (warm paper) */
  color-scheme: light;
  --bg: #f6f4ef;
  --ink: #1a1a1a;
  --muted: #6b675f;
  --accent: #7a4f2a;
  --line: #ddd6c9;
  --code-bg: #ece8de;
  --focus-ring: #7a4f2a;
}

/* colour: DARK (warm, paper-consistent) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16130e;
  --ink: #ece4d5;
  --muted: #a89e8d;
  --accent: #d9a066;
  --line: #3b3429;
  --code-bg: #201c15;
  --focus-ring: #d9a066;
}

/* system dark preference applies UNLESS the user forced light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #16130e;
    --ink: #ece4d5;
    --muted: #a89e8d;
    --accent: #d9a066;
    --line: #3b3429;
    --code-bg: #201c15;
    --focus-ring: #d9a066;
  }
}

/* ============ base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto;
  max-width: var(--page-max);
  padding: var(--space-3) var(--space-2) var(--space-4);
  font-family: var(--font-serif);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--ink);
  background: var(--bg);
}
header h1 { font-size: 2rem; margin-bottom: .25rem; line-height: var(--leading-tight); }
header h1 a { color: var(--ink); text-decoration: none; }
header h1 a:hover { text-decoration: underline; }
.subtitle { color: var(--muted); font-style: italic; }
nav { margin: .75rem 0 1.5rem; }
nav a { margin-right: 1rem; }
nav .breadcrumb a { margin-right: .25rem; }
.meta { color: var(--muted); font-size: var(--text-small); }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
main section { margin-bottom: var(--space-3); }
.notes { list-style: none; padding-left: 0; }
.note { border-bottom: var(--border-width) solid var(--line); padding: .75rem 0; }
.note p { margin: .25rem 0 0; color: var(--muted); }
article { max-width: var(--measure); }
article p { margin: 1rem 0; }
p.summary { color: var(--muted); font-style: italic; }
dl.meta dt { font-weight: bold; }
dl.meta dd { margin-left: 1rem; }
.id, .source {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 0.25em;
}
details.provenance {
  margin-top: var(--space-3);
  border-top: var(--border-width) solid var(--line);
  padding-top: var(--space-2);
  color: var(--muted);
  font-size: var(--text-small);
}
details.provenance summary { cursor: pointer; color: var(--muted); }
details.provenance a { color: var(--accent); }
footer {
  border-top: var(--border-width) solid var(--line);
  margin-top: var(--space-4);
  padding-top: var(--space-2);
  color: var(--muted);
  font-size: var(--text-small);
}
button#theme-toggle {
  font: inherit;
  font-size: var(--text-small);
  color: var(--muted);
  background: transparent;
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius);
  padding: 0.2em 0.6em;
  cursor: pointer;
}
button#theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
