/* One file, no build step. Two colors, huge type, hard edges.
   Original brutalist system: cream + black, grain, glitch accents. */

/* ---- 1. tokens ---- */
:root {
  --paper: #FFFBF7;
  --ink: #000000;
  --accent: #F28C28; /* the one pop color: headings, labels, keyword emphasis */
  --muted: color-mix(in srgb, var(--ink) 58%, var(--paper));
  --line: var(--ink);
  --border-w: 2px;
  --measure: 68ch;

  --step-hero: clamp(2.25rem, 9.5vw, 8.25rem);
  --step-1: clamp(2.25rem, 7vw, 4.75rem);
  --step-2: clamp(1.35rem, 3.5vw, 2rem);
  --step-3: 1.125rem;
  --step-0: 1.0625rem;
  --step--1: 0.8125rem;

  --sp-1: 0.5rem; --sp-2: 1rem; --sp-3: 1.75rem;
  --sp-4: 3rem; --sp-5: 5rem; --sp-6: 8rem;

  --font-display: "Archivo Black", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Helvetica Neue", Helvetica, Arial, ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  color-scheme: light dark;
}

/* Dark: the same language inverted — bone on near-black, still two-tone.
   Three-way switching: OS preference by default; a data-theme attribute set
   by the header toggle (persisted in localStorage) overrides it either way.
   With JS off there is no attribute and the site simply follows the OS. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0A0A0A;
    --ink: #F4EFE6;
  }
}
:root[data-theme='dark'] {
  --paper: #0A0A0A;
  --ink: #F4EFE6;
  color-scheme: dark;
}
:root[data-theme='light'] { color-scheme: light; }

/* ---- 2. display font ---- */
@font-face {
  font-family: "Archivo Black";
  src: url("/static/fonts/ArchivoBlack-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---- 3. base ---- */
* { box-sizing: border-box; }

/* 100vw full-bleed elements ignore the scrollbar width; clip the sliver */
html { overflow-x: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* grain: inline SVG turbulence, zero requests */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) body::after { opacity: 0.07; }
}
:root[data-theme='dark'] body::after { opacity: 0.07; }

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

/* keyword emphasis: write <mark>word</mark> in markdown to pop it */
mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}

/* ---- 4. layout ---- */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--sp-4) 1.25rem var(--sp-5);
}
main.compact { padding-top: var(--sp-3); }

.full-bleed { width: 100vw; margin-inline: calc(50% - 50vw); }

.boxed {
  border: var(--border-w) solid var(--ink);
  padding: var(--sp-3);
  margin-block: var(--sp-3);
}
.boxed-label {
  display: inline-block;
  font: 400 var(--step--1)/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--accent);
  color: #000000;
  padding: 0.35rem 0.6rem;
  margin: calc(-1 * var(--sp-3)) 0 var(--sp-2) calc(-1 * var(--sp-3));
}

/* ---- 5. type ---- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: 0.95;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
}
h1 { font-size: var(--step-1); }
h2 { font-size: var(--step-2); margin-top: var(--sp-5); color: var(--accent); }
/* h3/card titles: body face — a heavy display face loses legibility this small */
h3 {
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--step-3);
  margin-top: 0;
  line-height: 1.3;
}

.wordmark {
  font-size: var(--step-hero);
  line-height: 0.88;
  overflow-wrap: anywhere;
  /* margin-block only: the shorthand would clobber .full-bleed's inline margins */
  margin-block: 0 var(--sp-2);
  padding-inline: 1.25rem;
}

/* mono-caps is for one-line labels ONLY — never sentences */
.label, .card-meta, .email-label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

/* two-tone glitch: slice layers built from the same string via data-text */
.glitch { position: relative; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  clip-path: inset(0 0 100% 0);
  padding-inline: inherit;
}
.glitch::before {
  color: var(--accent);
  animation: glitch-slice 0.6s steps(2, end) 2;
}
.glitch::after { color: inherit; background: var(--paper); }
/* hover: one deliberate pass, a touch slower — replays on each fresh hover */
.glitch:hover::before, .glitch:hover::after {
  animation: glitch-slice 0.7s steps(2, end) 1;
}
/* JS ambient ticker (class held for 450ms, so effectively one cycle) */
.glitching::before, .glitching::after {
  animation: glitch-slice 0.45s steps(2, end) infinite;
}
@keyframes glitch-slice {
  0%, 100% { clip-path: inset(0 0 100% 0); transform: none; }
  15% { clip-path: inset(8% 0 62% 0); transform: translate(-0.06em, 0); }
  35% { clip-path: inset(55% 0 12% 0); transform: translate(0.05em, -0.02em); }
  60% { clip-path: inset(28% 0 41% 0); transform: translate(-0.04em, 0.01em); }
  80% { clip-path: inset(70% 0 5% 0); transform: translate(0.06em, 0); }
}

/* ---- 6. site header ---- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.25rem 1.25rem;
  border-bottom: var(--border-w) solid var(--ink);
}
/* padded to a ≥44px hit box (Apple HIG); header padding shrinks to compensate */
.site-header a {
  font: 400 var(--step--1)/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1rem 0.75rem;
}
.site-header a:hover { background: var(--ink); color: var(--paper); }
.site-header .header-right { display: flex; align-items: center; gap: var(--sp-1); }

/* theme toggle: styled as a header label, not a big CTA button */
.theme-toggle {
  font: 400 var(--step--1)/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.9rem 0.75rem;
  cursor: pointer;
  transition: none;
}
.theme-toggle:hover, .theme-toggle:focus-visible {
  background: var(--ink);
  color: var(--paper);
  translate: none;
  box-shadow: none;
}

/* ---- 7. marquee ---- */
.marquee {
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  border-block: var(--border-w) solid var(--ink);
  margin-block: var(--sp-3);
  user-select: none;
}
.marquee-track {
  display: flex;
  width: max-content;
  white-space: nowrap;
  /* ~55 px/s: measured span (travel distance) 15431px / 280s — comfortable
     ticker band is 40-80 px/s. Keep linear so speed stays constant. */
  animation: marquee 280s linear infinite;
}
/* WCAG 2.2.2 pause affordance; reduced-motion gets a static banner below */
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.55rem 0;
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---- 8. hero ---- */
/* tagline is two sentences — sentence-case body face, accent-colored */
.hero .tagline {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 var(--sp-1);
  display: block;
}
.hero .subtag { color: var(--muted); margin-top: 0; max-width: 52ch; }

/* ---- 9. forms ---- */
.signup { margin: var(--sp-3) 0 var(--sp-1); }
.email-label { display: block; margin-bottom: 0.5rem; }
.email-row { display: flex; gap: 0; flex-wrap: wrap; }
.email-row input {
  flex: 1 1 220px;
  font: inherit;
  padding: 0.75rem 0.9rem;
  border: var(--border-w) solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
}
.email-row input::placeholder { color: var(--muted); }
.email-row input:focus-visible { outline: var(--border-w) solid var(--ink); outline-offset: 3px; }

button {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1.6rem;
  border: var(--border-w) solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: translate 120ms, box-shadow 120ms;
}
button:hover, button:focus-visible {
  background: var(--paper);
  color: var(--ink);
  translate: -3px -3px;
  box-shadow: 4px 4px 0 var(--accent);
}
button:focus-visible { outline: var(--border-w) solid var(--ink); outline-offset: 3px; }
button.secondary { background: var(--paper); color: var(--ink); }
button.secondary:hover { background: var(--ink); color: var(--paper); }

/* weekly-first: the cadence line replaces the old frequency picker
   (picker CSS lives in git history for the daily/monthly relaunch) */
.cadence {
  font-size: 0.95rem;
  margin: var(--sp-2) 0 0;
}
.cadence strong { color: var(--accent); }

/* multi-sentence helper copy: sentence-case body face (all-caps hurts reading) */
.microcopy, .proof {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--muted);
}
.proof { margin-top: var(--sp-2); }

/* honeypot: offscreen, not display:none (some bots skip hidden fields) */
.hp { position: absolute; left: -9999px; top: -9999px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---- 10. index lists / cards ---- */
.index-list { counter-reset: idx; border-bottom: var(--border-w) solid var(--ink); }
.index-list .card {
  counter-increment: idx;
  position: relative;
  border-top: var(--border-w) solid var(--ink);
  padding: var(--sp-2) var(--sp-1) var(--sp-2) 3.5rem;
  transition: background 120ms, color 120ms;
}
.index-list .card::before {
  content: counter(idx, decimal-leading-zero);
  position: absolute;
  left: 0.25rem;
  top: calc(var(--sp-2) + 0.2rem);
  font: 400 var(--step--1)/1 var(--font-mono);
  letter-spacing: 0.14em;
  color: var(--accent);
}
.index-list .card:hover::before, .index-list .card:focus-within::before { color: var(--accent); }
.index-list .card:hover, .index-list .card:focus-within {
  background: var(--ink);
  color: var(--paper);
}
.index-list .card:hover *, .index-list .card:focus-within * { color: var(--paper); }
.index-list .card:hover a, .index-list .card:focus-within a { background: none; }

/* stretched link: the whole card is the click target, not just the title */
.card { position: relative; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; cursor: pointer; }
.card p { margin: 0.25rem 0 0; color: var(--muted); }
/* proximity: chips sit 8px from each other but 14px+ clear of the title */
.card-meta { color: var(--muted); margin: 0 0 0.9rem; line-height: 2; }
.tag {
  display: inline-block;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.2rem 0.55rem;
  margin-right: 0.5rem;
  line-height: 1.2;
}
.index-list .card:hover .tag, .index-list .card:focus-within .tag {
  border-color: var(--accent);
  color: var(--accent) !important;
}
/* drafts: unmistakable while writing, never rendered on public pages */
.draft-banner {
  border: 1px dashed var(--accent);
  color: var(--muted);
  padding: 0.6rem 0.8rem;
  margin: 0 0 1.5rem;
}

/* ---- 11. prose (reading stays quiet) ---- */
.prose p, .prose li { font-size: var(--step-0); }
.prose img { max-width: 100%; height: auto; border: var(--border-w) solid var(--ink); }
.prose blockquote {
  margin: var(--sp-3) 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: var(--border-w) solid var(--ink);
  color: var(--muted);
}
.prose hr { border: none; border-top: var(--border-w) solid var(--ink); margin: var(--sp-4) 0; }
.source { margin-top: var(--sp-3); }
.source-line { color: var(--accent); }

/* ---- share (article end): few targets, no counts, plain anchors ---- */
.share {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  align-items: center;
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: var(--border-w) solid var(--ink);
}
.share .label { color: var(--accent); margin-right: 0.25rem; }
.share a {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-decoration: none;
  border: 1px solid var(--ink);
  padding: 0.9rem 0.8rem;
}
.share a:hover { background: var(--ink); color: var(--paper); }
.share-url {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  user-select: all;   /* one tap selects the whole URL — the zero-JS copy */
  flex-basis: 100%;
  margin-top: 0.25rem;
}

.post-cta { margin-top: var(--sp-5); }
.post-cta h2 { margin-top: 0; font-size: var(--step-3); }

/* ---- 12. statement footer ---- */
footer {
  background: var(--ink);
  color: var(--paper);
  border-top: var(--border-w) solid var(--ink);
  padding: var(--sp-5) 1.25rem var(--sp-4);
  margin-top: var(--sp-4);
}
.footer-wordmark {
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 7rem);
  line-height: 0.88;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  margin: 0 0 var(--sp-3);
  max-width: none;
}
footer p { max-width: var(--measure); margin: 0 auto var(--sp-2); }
footer .footer-inner { max-width: var(--measure); margin: 0 auto; }
footer .colophon { color: color-mix(in srgb, var(--paper) 70%, var(--ink)); font-size: 0.9rem; }
.footer-links {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  /* cancel the link padding so the row still left-aligns with the colophon */
  margin-inline: -0.5rem;
}
.footer-links a { padding: 0.9rem 0.5rem; }
footer a { color: var(--paper); }
footer a:hover { background: var(--paper); color: var(--ink); }

/* ---- 13. reveal ---- */
@view-transition { navigation: auto; }
@keyframes rise { from { opacity: 0; transform: translateY(1.25rem); } }
main > * { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0, 1) backwards; }
main > *:nth-child(2) { animation-delay: 0.08s; }
main > *:nth-child(3) { animation-delay: 0.16s; }
main > *:nth-child(4) { animation-delay: 0.24s; }
main > *:nth-child(n + 5) { animation-delay: 0.3s; }

/* ---- 14. reduced motion: everything off, marquee becomes a static banner ---- */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; }
  .glitch::before, .glitch::after { content: none; }
  .marquee-track { width: auto; white-space: normal; flex-wrap: wrap; }
  .marquee-track span[aria-hidden] { display: none; }
  /* the full phrase list is very long — keep the static banner a banner, not a wall.
     Padding moves span → container so the overflow clip lands exactly on line 3
     (text otherwise peeks through the span's own padding-bottom). */
  .marquee-track > span {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    padding: 0;
  }
  .marquee { padding-block: 0.55rem; }
}

/* ---- 15. print ---- */
@media print {
  :root { --paper: #fff; --ink: #000; }
  body::after, .marquee, footer .footer-wordmark, .site-header { display: none; }
}

/* ---- 16. small screens ---- */
@media (max-width: 480px) {
  main { padding-top: var(--sp-3); }
  h2 { margin-top: var(--sp-4); }
  .email-row { gap: var(--sp-1); }
  .email-row button { flex: 1 1 100%; }
  .index-list .card { padding-left: 2.6rem; }
}
