/* benwalsham.com — style.css
   Tokens from design-system.md · accent: Burnt #C2410C (light) / #F97316 (dark)
   No JS anywhere. Dark mode = prefers-color-scheme only. */

@font-face {
  font-family: 'Newsreader';
  src: url('../assets/fonts/Newsreader-Variable.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Newsreader';
  src: url('../assets/fonts/Newsreader-Italic-Variable.woff2') format('woff2');
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #FAF4ED;
  --ink: #1C1917;
  --ink-muted: #57534E;
  --ink-faint: #6F6A64;
  --accent: #C2410C;
  --on-accent: #FFFFFF;
  --line: #EAE1D6;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  --rhythm: 80px; /* section rhythm per Ben's hero markup (between s8 and s9) */
  --card: #FFFFFF;
  --dg-input-fill: rgba(28,25,23,0.05);
  --dg-input-stroke: rgba(28,25,23,0.35);
  --dg-focal-tint: rgba(194,65,12,0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131316;
    --ink: #D4D4D8;
    --ink-heading: #E4E4E7;
    --ink-muted: #A1A1AA;
    --ink-faint: #A1A1AA; /* dark has no faint tier — muted is the floor */
    --accent: #F97316;
    --line: #27272A;
    --card: #1A1A1E;
    --dg-input-fill: rgba(250,247,242,0.08);
    --dg-input-stroke: rgba(250,247,242,0.35);
    --dg-focal-tint: rgba(249,115,22,0.10);
  }
}
html[data-theme="dark"] {
  --paper: #131316;
  --ink: #D4D4D8;
  --ink-heading: #E4E4E7;
  --ink-muted: #A1A1AA;
  --ink-faint: #A1A1AA; /* dark has no faint tier — muted is the floor */
  --accent: #F97316;
  --line: #27272A;
  --card: #1A1A1E;
  --dg-input-fill: rgba(250,247,242,0.08);
  --dg-input-stroke: rgba(250,247,242,0.35);
  --dg-focal-tint: rgba(249,115,22,0.10);
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--on-accent); }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .18s ease-out;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px;
  padding: var(--s2) var(--s3); font-size: 15px;
}
.skip:focus { left: 16px; top: 16px; z-index: 10; }

.container { max-width: 720px; margin-inline: auto; padding: 0 var(--s5); }

/* ---------- header / nav ---------- */
.site-head { padding-top: var(--s6); }
.site-head .container { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }
.wordmark {
  font-weight: 560; font-size: 20px; color: var(--ink);
  text-decoration: none; margin-right: var(--s4); letter-spacing: -0.01em;
}
.wordmark:hover { color: var(--ink); }
.site-nav { display: flex; flex-wrap: wrap; }
.site-nav a {
  font-size: 15px; color: var(--ink-muted); text-decoration: none;
  padding: var(--s3) var(--s2); /* ≥44px touch target with line-height */
  transition: color .18s ease-out;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- hero (left-justified in centred pane) ---------- */
.hero { margin-top: var(--rhythm); }
.hero-head { display: flex; align-items: center; gap: var(--s5); }
.avatar-img { width: 112px; height: 112px; flex: none; }
.hero h1 {
  font-size: clamp(34px, 6vw, 44px); line-height: 1.15;
  font-weight: 560; margin: 0; letter-spacing: -0.01em;
}
.hero .lead { font-size: 22px; line-height: 1.55; margin: var(--s5) 0 0; }
.nowline { margin-top: var(--s4); font-family: var(--font-mono); font-size: 13px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.nowline a { color: inherit; text-decoration: none; }
.nowline a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent); margin-right: var(--s2); vertical-align: 1px; }

h2 { font-size: 30px; line-height: 1.25; font-weight: 560; margin: var(--rhythm) 0 var(--s2); letter-spacing: -0.01em; }
h3 { font-size: 24px; line-height: 1.3; font-weight: 600; margin: var(--s7) 0 var(--s2); }

.section-rule { border: 0; border-top: 1px solid var(--line); margin: var(--rhythm) 0 0; }

/* ---------- link groups ---------- */
.groups { margin-top: var(--s5); }
.group { padding: var(--s4) 0; border-top: 1px solid var(--line); }
.group:last-child { border-bottom: 1px solid var(--line); }
.glabel { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: var(--s1); }
.group a {
  display: inline-block; margin: -8px var(--s5) -8px 0; padding: 8px 0; /* net-zero visual shift, ≥44px touch area */
  font-size: 19px; color: var(--ink); text-decoration: none;
  transition: color .18s ease-out;
}
.group a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.group a svg { vertical-align: -2px; margin-left: var(--s1); }

/* ---------- writing list ---------- */
.rows { border-top: 1px solid var(--line); margin-top: var(--s5); }
.row { display: grid; grid-template-columns: 96px 1fr; gap: var(--s4);
  padding: var(--s5) 0; border-bottom: 1px solid var(--line); }
.row .date { font-family: var(--font-mono); font-size: 13px; letter-spacing: .04em;
  color: var(--ink-faint); padding-top: 6px; }
.row .title { font-size: 21px; line-height: 1.3; font-weight: 560; color: var(--ink);
  text-decoration: none; transition: color .18s ease-out; }
a.row-title:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.row .show { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-faint); display: block; margin-bottom: 2px; }
.dek { color: var(--ink-muted); font-size: 15px; line-height: 1.6; margin: var(--s1) 0 0; }
.more { margin-top: var(--s4); font-size: 15px; }

/* ---------- meta / byline ---------- */
.meta { font-family: var(--font-mono); font-size: 13px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-muted); }

/* ---------- prose (articles, now, about) ---------- */
.prose { max-width: 65ch; }
.prose p { margin: var(--s4) 0; }
.prose ul, .prose ol { padding-left: 1.2em; margin: var(--s4) 0; }
.prose li { margin: var(--s1) 0; }
.prose blockquote {
  margin: var(--s5) 0; padding-left: 20px;
  border-left: 1px solid var(--accent); font-style: italic; max-width: 60ch;
}
.prose hr { border: 0; border-top: 1px solid var(--line); margin: var(--s7) 0; }
.prose code, .inline-code { font-family: var(--font-mono); font-size: .85em; }
.prose h2 { margin-top: var(--s8); }
.prose h3 { margin-top: var(--s7); }
.byline { margin: var(--s2) 0 var(--s6); }

/* ---------- footer ---------- */
.site-foot { margin-top: var(--s9); padding: var(--s5) 0 var(--s8);
  border-top: 1px solid var(--line); }
.site-foot .container { }
.site-foot .meta { display: inline; }
.site-foot a { font-size: 15px; }
.foot-note { margin-top: var(--s2); font-size: 14px; color: var(--ink-faint); }

/* ---------- 404 ---------- */
.big { font-size: clamp(48px, 10vw, 80px); font-weight: 560; line-height: 1.1; margin: var(--s8) 0 var(--s4); }

/* ---------- diagram (inline SVG, Now page) ---------- */
html, body { overflow-x: clip; } /* the full-bleed diagram band must never cause page-level scroll */
.diagram-container { margin-inline: calc(50% - 50vw); overflow-x: auto; margin-top: var(--s4); padding: var(--s2) 0; }
.diagram-container svg { width: 960px; min-width: 960px; display: block; margin-inline: auto; }
@media (min-width: 960px) {
  .diagram-container svg { width: 100%; max-width: 960px; }
}
@media print {
  .diagram-container { overflow-x: visible; margin-inline: 0; }
  .diagram-container svg { min-width: 0; width: 100%; }
}
.dg-name { font-family: var(--font-serif); font-size: 12px; font-weight: 600; fill: var(--ink); }
.dg-sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; fill: var(--ink-faint); }
.dg-legend { font-family: var(--font-serif); font-size: 8.5px; fill: var(--ink-muted); }
.dg-legend-key { font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.18em; fill: var(--ink-muted); }
.dg-node { fill: var(--card); stroke: var(--ink); stroke-width: 1; }
.dg-input { fill: var(--dg-input-fill); stroke: var(--dg-input-stroke); stroke-width: 1; }
.dg-focal { fill: var(--dg-focal-tint); stroke: var(--accent); stroke-width: 1.2; }
.dg-line { stroke: var(--ink-muted); stroke-width: 1.2; fill: none; }
.dg-line-accent { stroke: var(--accent); stroke-width: 1.4; fill: none; }
.dg-hairline { stroke: var(--line); stroke-width: 0.8; }

/* ---------- theme toggle (header, right) ---------- */
.theme-toggle {
  flex: none; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; margin-left: auto;
  transition: color .18s ease-out, border-color .18s ease-out;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-muted); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .tt-sun { display: none; }
html[data-theme="dark"] .theme-toggle .tt-sun { display: block; }
html[data-theme="dark"] .theme-toggle .tt-moon { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 480px) {
  .row { grid-template-columns: 72px 1fr; gap: 10px; }
  .avatar-img { width: 104px; height: 104px; }
  .site-head .container { gap: 0; }
}

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