/* DeFlock Fox Valley , public stylesheet. Hand-written, no framework, no reset library, and no
 * JavaScript anywhere on this site (CSP is script-src 'none', shared/http.ts), so the theme
 * follows prefers-color-scheme and there is no toggle to have.
 *
 * PALETTE RULE: every colour is a custom property on :root; the dark block redefines those same
 * names and declares nothing else. scripts/verify-css.mjs fails on a literal anywhere else.
 * docs/design.md holds the direction, the measured contrast ratios and the font download step.
 */

/* fonts , self-hosted woff2, licences and download step in docs/design.md --- */

/* Paths are relative to this file so the asset mount can move. The range is narrow on purpose:
   Latin-1 plus the punctuation we emit, including the U+2026 plain() appends. The mono role has
   no webfont; it sets metadata at 0.8rem, where a local face is close enough. */
@font-face {
  font-family: 'Public Sans';
  src: url('../fonts/public-sans-var.woff2') format('woff2');
  font-weight: 300 800; font-style: normal; font-display: swap;
  unicode-range: U+0-FF, U+2010-205E, U+20AC, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/source-serif-4-var.woff2') format('woff2');
  font-weight: 300 700; font-style: normal; font-display: swap;
  unicode-range: U+0-FF, U+2010-205E, U+20AC, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/source-serif-4-italic-var.woff2') format('woff2');
  font-weight: 300 700; font-style: italic; font-display: swap;
  unicode-range: U+0-FF, U+2010-205E, U+20AC, U+FFFD;
}

/* tokens --- */

:root {
  /* --sunk is the recessed ground: code, table heads, notes */
  --bg: #f5f5f0; --surface: #ffffff; --sunk: #edede6;
  --ink: #15171a; --mute: #565a5f; --rule: #d5d6ce;

  /* The accent, twice. --hivis is legible ONLY as a background with --on-hivis over it (14.3:1);
     as text on --bg it is 1.1:1. So --link is a darkened olive of the same hue (7.3:1) and the
     bright value is reserved for marks. The two swap roles on dark. */
  --hivis: #d8f32e; --on-hivis: #15171a; --link: #47570a; --alert: #8c2a0f;

  --sans: 'Public Sans', 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Source Serif 4', Charter, 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: 'IBM Plex Mono', 'Cascadia Mono', Consolas, 'DejaVu Sans Mono', monospace;

  --measure: 34rem;  /* prose column, about 70 characters at the body size */
  --page: 60rem;
  --gap: 1.25rem;
  --pad: clamp(1rem, 4vw, 2rem);
  color-scheme: light dark;
}

/* Dark. Token values only. The accent inverts: bright chartreuse is safe as link text here
   (14.0:1) and the olive is not, so the olive is unused. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111310; --surface: #191c18; --sunk: #22251f;
    --ink: #e8e9e2; --mute: #9da298; --rule: #2c302a;
    --hivis: #d8f32e; --on-hivis: #111310; --link: #c9ee3f; --alert: #ff9166;
  }
}

/* reset and base ---------------------------- */

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }
img { max-width: 100%; height: auto; display: block; }
table { border-collapse: collapse; }

/* Wide content scrolls inside .scroll-x or inside pre. The body never scrolls sideways. */
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg); color: var(--ink);
  font-family: var(--serif); font-size: 1.0625rem; line-height: 1.55;
}

a { color: var(--link); text-underline-offset: 0.14em; }
a:hover { text-decoration-thickness: 2px; }

/* The ring uses --link, not --hivis: on light the bright value is 1.1:1 against the page and would
   be an invisible focus indicator. That is an accessibility failure, not a style question. */
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* Skip link, the first element on every page. Off canvas rather than display:none, which would
   drop it out of the keyboard order and defeat the point. Focused, it lands top left in the
   14.3:1 accent pair, and the ring above sits outside that box on --bg where it stays legible. */
.skip-link { position: absolute; left: -999em; top: 0; z-index: 10; font-family: var(--sans); }
.skip-link:focus {
  left: 0; background: var(--hivis); color: var(--on-hivis); padding: 0.5rem 0.9rem;
}

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--pad); }
.narrow { max-width: var(--measure); }

/* masthead and footer , a nameplate and a rule, in the manner of a bulletin --- */

.mast {
  border-bottom: 3px solid var(--ink); padding: 1.1rem 0 0.6rem; margin-bottom: 1.6rem;
  display: flex; flex-wrap: wrap; gap: 0.6rem var(--gap); align-items: baseline;
}
.mast-title {
  font-family: var(--sans); font-weight: 800; font-size: clamp(1.35rem, 4vw, 1.9rem);
  letter-spacing: -0.015em; line-height: 1.1; margin-right: auto;
}
.mast-title a { color: inherit; text-decoration: none; }
/* The one place the bright value carries the brand. */
.mast-title span { background: var(--hivis); color: var(--on-hivis); padding: 0 0.15em; }

.mast nav { font-family: var(--sans); font-size: 0.9rem; }
.mast nav ul { display: flex; flex-wrap: wrap; gap: 0.9rem; list-style: none; }
.mast nav a { text-decoration: none; border-bottom: 2px solid transparent; padding-bottom: 2px; }
.mast nav a:hover, .mast nav a[aria-current] { border-bottom-color: var(--hivis); }

.foot {
  border-top: 1px solid var(--rule); margin-top: 3rem; padding: 1.2rem 0 2.5rem;
  font-family: var(--sans); font-size: 0.85rem; color: var(--mute);
}
.foot ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }

/* page furniture ---------------------------- */

.page-title {
  font-family: var(--sans); font-weight: 800; font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1.12; letter-spacing: -0.02em; max-width: 22ch; margin-bottom: 0.4rem;
}
.kicker, .meta, .where, .entries time {
  font-family: var(--mono); font-size: 0.8rem; color: var(--mute);
}
.kicker { letter-spacing: 0.09em; text-transform: uppercase; margin-bottom: 0.5rem; }
.meta { margin: 0.3rem 0 1.4rem; }

/* Marker pen. The only correct use of the bright value behind text. */
.mark { background: var(--hivis); color: var(--on-hivis); padding: 0 0.18em; }
.muted { color: var(--mute); }
.alert { color: var(--alert); font-weight: 600; }

.note {
  border-left: 3px solid var(--hivis); background: var(--sunk);
  padding: 0.7rem 0.9rem; margin: 1.4rem 0; font-size: 0.95rem;
}

/* index lists , a register of entries, ruled like a ledger --- */

.entries, .events { list-style: none; border-top: 1px solid var(--rule); }
.entries > li, .events > li { border-bottom: 1px solid var(--rule); padding: 0.9rem 0; }
.entries h2, .entries h3, .events h2, .events h3 {
  font-family: var(--sans); font-weight: 700; font-size: 1.1rem; line-height: 1.25;
}
.entries a, .events a { text-decoration: none; }
.entries a:hover, .events a:hover { text-decoration: underline; }
.entries p, .events p { font-size: 0.95rem; margin-top: 0.3rem; max-width: var(--measure); }
.entries p { color: var(--mute); }

/* events , the date is the primary axis ----- */

/* The calendar block leads in source order at a fixed width, so a run of events reads as a column
   of dates rather than a list of headlines. */
.events > li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0 var(--gap); }
.when {
  font-family: var(--mono); text-align: center; line-height: 1.15;
  border: 1px solid var(--rule); padding: 0.35rem 0.2rem; align-self: start;
}
.when .mon, .when .day, .when .dow { display: block; }
.when .day { font-family: var(--sans); font-weight: 700; font-size: 1.5rem; }
.when .mon { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); }
.when .dow { font-size: 0.68rem; color: var(--mute); }
/* Next up. One event carries the marker, so it still means something. */
.events > li.next .when { background: var(--hivis); color: var(--on-hivis); border-color: var(--hivis); }
.events > li.next .when .mon, .events > li.next .when .dow { color: var(--on-hivis); }
.where { margin-top: 0.2rem; }
/* Cancelled events are never deleted (ICS needs the row), so they must read as struck. */
.events > li.off h2, .events > li.off h3, .events > li.off .where { text-decoration: line-through; }
.events > li.off .when { border-style: dashed; }

@media (max-width: 32rem) {
  .events > li { grid-template-columns: 3.4rem 1fr; }
  .when .day { font-size: 1.25rem; }
}

/* galleries , /m/ and one photo set -------- */

/* NO CROPPING AND NO FIXED TILE RATIO, which is a decision and not an omission: a photograph of a
   plate reader is evidence of where that reader stands, and object-fit: cover would cut away the
   pole, the sign or the intersection that says so. Tiles keep their own proportions and a row can
   read ragged. min() inside minmax instead of a breakpoint, so a narrow phone gets one full-width
   column rather than a track wider than the screen. */
.photos {
  list-style: none; display: grid; gap: var(--gap); margin-top: 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
}
.photos img { width: 100%; border: 1px solid var(--rule); }
/* The caption is the alt text, rendered once, as text. Mono at the metadata size, like .meta. */
.photos figcaption {
  font-family: var(--mono); font-size: 0.8rem; color: var(--mute); margin-top: 0.35rem;
}

/* prose , the output of shared/markdown.ts ---- */

/* It emits h2 to h4, p, ul, ol, blockquote, pre/code, hr, img, strong, em, del, a, and tables in
   div.scroll-x. It has no raw-HTML branch, so that list is exhaustive by construction. */
.prose { max-width: var(--measure); }
.prose > * + *, .prose blockquote > * + * { margin-top: 1rem; }
.prose del { color: var(--mute); }
.prose h2, .prose h3, .prose h4 {
  font-family: var(--sans); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em;
  margin-top: 2rem;
}
.prose h2 { font-size: 1.4rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--rule); }
.prose h3 { font-size: 1.15rem; }
.prose h4 {
  font-size: 1rem; font-weight: 600; color: var(--mute);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose ul { list-style: square; }
.prose li + li { margin-top: 0.3rem; }
.prose blockquote {
  border-left: 3px solid var(--rule); padding-left: 0.9rem;
  color: var(--mute); font-style: italic;
}
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--sunk); padding: 0.05em 0.25em; }
.prose pre {
  font-family: var(--mono); font-size: 0.85rem; background: var(--sunk);
  border: 1px solid var(--rule); padding: 0.75rem 0.9rem; overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose img { border: 1px solid var(--rule); margin-top: 1.2rem; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

/* The renderer wraps every table in this. Wide tables scroll here, never on the body. */
.scroll-x { overflow-x: auto; max-width: 100%; }
.scroll-x table { width: 100%; font-family: var(--sans); font-size: 0.9rem; }
.scroll-x th, .scroll-x td {
  border: 1px solid var(--rule); padding: 0.35rem 0.5rem; text-align: left; vertical-align: top;
}
.scroll-x th { background: var(--sunk); font-weight: 600; white-space: nowrap; }
