/* site.css: shared design system for wesfryer.com.
   Three themes share one set of variable names:
     newspaper  (Newspaper, the default)  html[data-theme="newspaper"] or no attribute
     castle     (the 8-bit Castle map)    html[data-theme="castle"]
     clickwheel (the Click Wheel)         html[data-theme="clickwheel"]
   The newspaper feel (serif headlines, a masthead name, column rules) comes only from the
   "shape" variables below; Castle and Click Wheel keep the defaults.
   Every text and background pair below was checked for at least 4.5 to 1 contrast.
   No outside fonts: the font stacks use fonts already on the visitor's device. */

/* ---------- Theme variables ---------- */
:root,
html[data-theme="newspaper"] {
  --bg: #ffffff;
  --text: #161616;
  --muted: #555555;          /* 7.4:1 on white */
  --accent: #1d3fcf;         /* cobalt, 7.9:1 on white; white text on it 7.9:1 */
  --accent-soft: #eef1fd;    /* accent text on it 7.0:1 */
  --support-1: #b8400c;      /* burnt orange, 5.6:1 on white */
  --support-2: #0e6b63;      /* teal, 6.4:1 on white */
  --highlight: #fff3c4;      /* pale yellow, body text on it 16:1 */
  --on-accent: #ffffff;
  --line: #d6d6d6;
  --focus: #b8400c;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius-pill: 999px;
  --radius: 10px;
  --max: 72rem;
  --gap: clamp(1rem, 3vw, 2rem);
}

/* Shape variables: defaults (used by Castle and Click Wheel). */
:root {
  --font-headline: var(--font-sans);
  --headline-weight: 800;
  --pill-bg: var(--accent);
  --pill-text: var(--on-accent);
  --pill-shape: var(--radius-pill);
  --pill-rule: 0 solid transparent;
  --brand-font: var(--font-mono);
  --brand-size: 1.05rem;
  --header-rule: 1px solid var(--line);
  --band-rule: 2px solid var(--text);
  --column-rule: 0 solid transparent;
  --columns: 1;
}
/* Newspaper: a light newspaper feel. Serif headlines, the name as a masthead, double rules and column rules. */
html[data-theme="newspaper"] {
  --font-headline: var(--font-serif);
  --headline-weight: 700;
  --pill-bg: transparent;
  --pill-text: var(--text);
  --pill-shape: 0;
  --pill-rule: 3px double var(--text);
  --brand-font: var(--font-serif);
  --brand-size: 1.35rem;
  --header-rule: 4px double var(--text);
  --band-rule: 3px double var(--text);
  --column-rule: 1px solid var(--line);
  --columns: 2;
}

html[data-theme="castle"] {
  --bg: #1b1630;
  --text: #f4f1e8;           /* 15.4:1 */
  --muted: #d9d3c2;
  --accent: #ffcc33;         /* 11.6:1 on bg */
  --accent-soft: #2c2550;
  --support-1: #9fe3ff;      /* 12.4:1 */
  --support-2: #b6f2a0;
  --highlight: #2c2550;
  --on-accent: #1b1630;
  --line: #4a4170;
  --focus: #9fe3ff;
}

html[data-theme="clickwheel"] {
  --bg: #f2efe9;
  --text: #1d1d1f;           /* 14.7:1 */
  --muted: #4a4a4f;
  --accent: #0b5e44;         /* 6.8:1 on bg; white on it 7.8:1 */
  --accent-soft: #e2ece6;
  --support-1: #5a3b8c;      /* 7.5:1 */
  --support-2: #8a3a12;
  --highlight: #fff3c4;
  --on-accent: #ffffff;
  --line: #c9c3b8;
  --focus: #5a3b8c;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 3px; }
h1, h2, h3 { line-height: 1.2; }
h1, h2 { font-family: var(--font-headline); }
.band-label { font-family: var(--font-mono); }
h3 { font-family: var(--font-serif); font-size: 1.3rem; margin: 1.6rem 0 0.4rem; }
p, ul, ol { max-width: 68ch; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

/* Visible focus everywhere: a thick ring plus offset. */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}
a:focus-visible, button:focus-visible { box-shadow: 0 0 0 6px var(--bg); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link: hidden until focused. */
.skip-link {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 0.6rem 1rem; border-radius: var(--radius); font-weight: 700;
}
.skip-link:focus { top: 0.5rem; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: var(--header-rule);
  background: var(--bg);
}
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem;
  max-width: var(--max); margin: 0 auto; padding: 0.75rem var(--gap);
}
.brand {
  font-family: var(--brand-font); font-weight: 700; font-size: var(--brand-size);
  color: var(--text); text-decoration: none; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.brand img { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 4px; }
.menu-toggle {
  display: none; margin-left: auto;
  font: inherit; font-weight: 700; color: var(--text); background: var(--bg);
  border: 2px solid var(--text); border-radius: var(--radius-pill); padding: 0.35rem 0.9rem;
  cursor: pointer; min-height: 44px;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }
.site-nav a {
  display: inline-block; padding: 0.4rem 0.1rem; font-weight: 600; color: var(--text);
  text-decoration: none; border-bottom: 3px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--accent); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent); }

.switcher {
  margin-left: auto; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 0.85rem;
}
.switcher span { color: var(--muted); }
.switcher a {
  display: inline-block; padding: 0.2rem 0.6rem; border: 1px solid var(--line);
  border-radius: var(--radius-pill); text-decoration: none; color: var(--text); min-height: 32px;
}
.switcher a[aria-current="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Phones: menu button shows, nav folds away until opened (only when JavaScript runs). */
@media (max-width: 47.99rem) {
  .js .menu-toggle { display: inline-block; }
  .js .site-nav { display: none; width: 100%; }
  .js .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { padding: 0.6rem 0; }
  .switcher { margin-left: 0; width: 100%; }
}

/* ---------- Page layout ---------- */
main { display: block; }
.wrap-main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gap) 3rem; }

/* The big colored pill headline. */
.pill-hero { padding: clamp(1.5rem, 5vw, 3.5rem) 0 1rem; }
.pill {
  display: inline-block; margin: 0;
  background: var(--pill-bg); color: var(--pill-text);
  font-family: var(--font-headline); font-weight: var(--headline-weight); letter-spacing: -0.01em;
  font-size: clamp(1.8rem, 6vw, 4.2rem); line-height: 1.1;
  padding: 0.35em 0.8em 0.4em; border-radius: var(--pill-shape);
  border-top: var(--pill-rule); border-bottom: var(--pill-rule);
}
.pill-hero .lede {
  font-family: var(--font-serif); font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.5; max-width: 52ch; margin: 1.2rem 0 0;
}
.kicker { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.75rem; }

/* One idea per section. On wide screens the section label turns vertical in a left column. */
.band {
  display: grid; grid-template-columns: 1fr; gap: 0.5rem 2rem;
  border-top: var(--band-rule); padding: 1.75rem 0 2rem;
}
.band-label {
  margin: 0; font-family: var(--font-mono); font-size: 0.95rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--support-1);
}
.band-body > :first-child { margin-top: 0; }
.band-body h3:first-child { margin-top: 0; }
.band-title { font-family: var(--font-serif); font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 600; margin: 0 0 0.6rem; }
@media (min-width: 60rem) {
  .band { grid-template-columns: 3rem 1fr; }
  .band-label {
    writing-mode: vertical-rl; transform: rotate(180deg);
    justify-self: center; align-self: start; white-space: nowrap;
  }
}
.band:nth-of-type(3n+2) .band-label { color: var(--support-2); }
.band:nth-of-type(3n) .band-label { color: var(--accent); }

.see-more {
  display: inline-block; margin-top: 0.5rem; font-family: var(--font-mono); font-weight: 700;
  padding: 0.45rem 1rem; border: 2px solid var(--accent); border-radius: var(--radius-pill);
  text-decoration: none; min-height: 44px; line-height: 1.6;
}
.see-more:hover { background: var(--accent); color: var(--on-accent); }

/* Lists of links and cards */
.link-list { padding-left: 1.2rem; }
.link-list li { margin: 0.35rem 0; }
.cards { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); max-width: none; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem;
  background: var(--bg);
}
.card h3 { margin-top: 0; font-size: 1.15rem; }
.card p { margin: 0.4rem 0; }
.tag {
  display: inline-block; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700;
  padding: 0.05rem 0.55rem; border-radius: var(--radius-pill);
  background: var(--highlight); color: var(--text); border: 1px solid var(--line);
}
.tag-shelved { background: #fff3c4; color: #161616; }
.tag-archived { background: #ececec; color: #161616; }
.formats { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; }
.formats li { font-family: var(--font-mono); font-size: 0.85rem; border: 1px solid var(--support-2); color: var(--support-2); border-radius: var(--radius-pill); padding: 0.1rem 0.7rem; }
.note-box { background: var(--accent-soft); border-left: 6px solid var(--accent); padding: 0.8rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; max-width: 68ch; }
.todo { background: var(--highlight); border: 2px dashed var(--support-1); padding: 0.6rem 0.9rem; border-radius: var(--radius); max-width: 68ch; }
.meta { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.headshot { width: 200px; border-radius: var(--radius); float: right; margin: 0 0 1rem 1.5rem; }
@media (max-width: 30rem) { .headshot { float: none; margin: 0 0 1rem; } }
table { border-collapse: collapse; width: 100%; max-width: 68rem; }
th, td { text-align: left; vertical-align: top; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; font-weight: 600; padding: 0.3rem 0; }

/* Newspaper columns: text blocks marked .columns split in two with a column rule on wide screens. */
@media (min-width: 60rem) {
  .columns { columns: var(--columns); column-gap: 2.5rem; column-rule: var(--column-rule); max-width: none; }
  .columns > * { break-inside: avoid; }
}
/* The masthead on the Newspaper home page. */
.masthead { text-align: left; }
.masthead .pill { padding-left: 0; padding-right: 0; font-size: clamp(2.4rem, 9vw, 5.5rem); letter-spacing: 0.01em; }
.masthead .dateline { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 0.4rem; max-width: none; }
/* Bio with the pixel selfie beside it. */
.bio-with-photo { display: flow-root; }
.bio-photo { float: right; width: 192px; height: 192px; margin: 0 0 1rem 1.5rem; image-rendering: pixelated; border: 4px solid var(--text); border-radius: 8px; }
@media (max-width: 30rem) { .bio-photo { float: none; display: block; margin: 0 0 1rem; } }

/* Newsroom list (written by build-newsroom.py) */
.newsroom-list { padding-left: 2.2rem; max-width: 72ch; }
.newsroom-list li, .newsroom-short li { margin: 0.55rem 0; }
.newsroom-list .meta, .newsroom-short .meta { display: block; }
.news-source { color: var(--support-2); }

/* Latest posts lists (older build-latest.py fragments) */
.feed { margin-bottom: 1.5rem; }
.feed h3 { margin-bottom: 0.2rem; }
.feed ol { padding-left: 1.2rem; }
.feed li { margin: 0.3rem 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: var(--band-rule); margin-top: 2rem; background: var(--bg); }
.site-footer .wrap { max-width: var(--max); margin: 0 auto; padding: 1.5rem var(--gap) 2.5rem; display: grid; gap: 1rem; }
.social { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; max-width: none; }
.social a { font-weight: 600; }
.social-icons { gap: 0.6rem; }
.social-icons a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  color: var(--text); border: 2px solid var(--line); background: var(--bg);
}
.social-icons a:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.social-icons a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 50%; }
.social-icons svg { width: 22px; height: 22px; fill: currentColor; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.95rem; max-width: none; }
.site-footer p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.site-footer .footer-links a { color: var(--text); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header nav, .switcher, .menu-toggle, .skip-link { display: none !important; }
  a { color: #000; }
}

/* ---------- 404 ---------- */
.pixel-404 { display: block; width: 160px; height: 120px; margin: 0 0 1rem; image-rendering: pixelated; }
