/* It's Been Tried
   A thermal-paper receipt on a counter. No web fonts, no JavaScript. */

:root {
  --bg: #ece7dc;
  --text: #1c1a17;
  --muted: #5d584f;
  --line: #d3ccbe;
  --paper: #fffdf7;
  --ink: #201e1a;
  --ink-faint: #7d776c;
  --stamp: #b3311c;
  --pill-bg: #1c1a17;
  --pill-text: #f6f2e9;
  --shadow: rgb(60 45 20 / 0.22);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;

  --measure: 40rem;
  --receipt-w: 25rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --text: #ece8df;
    --muted: #a59f94;
    --line: #34312c;
    --paper: #f6f2e8;
    --stamp: #f0745d;
    --pill-bg: #ece8df;
    --pill-text: #161513;
    --shadow: rgb(0 0 0 / 0.55);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--stamp); }
a:focus-visible { outline: 3px solid var(--stamp); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }

/* ------------------------------------------------------------ chrome */

.preview-bar {
  background: #f5d76e;
  color: #1c1a17;
  font: 600 13px/1.4 var(--mono);
  text-align: center;
  padding: 0.45rem 1rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
}

.wordmark {
  font: 800 1rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav { display: flex; gap: 1.1rem; font-size: 0.95rem; }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover { color: var(--stamp); }

main { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem 4rem; }

.site-footer {
  border-top: 1px solid var(--line);
  max-width: 68rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer p { max-width: var(--measure); }
.signoff { font: 800 1.05rem/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); }
.credit { font-size: 0.85rem; }

.kicker {
  font: 700 0.85rem/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 0.6rem;
}
.kicker-date { color: var(--muted); letter-spacing: 0.04em; }

.pill {
  display: inline-block;
  background: var(--pill-bg);
  color: var(--pill-text);
  font: 600 0.9rem/1 var(--sans);
  padding: 0.6rem 0.95rem;
  border-radius: 999px;
  text-decoration: none;
}
.pill:hover { color: var(--pill-text); opacity: 0.85; }

.draft-flag {
  display: inline-block;
  font: 700 0.75rem/1 var(--mono);
  letter-spacing: 0.1em;
  background: #f5d76e;
  color: #1c1a17;
  padding: 0.35rem 0.55rem;
  margin-bottom: 0.8rem;
}

/* ------------------------------------------------------------ receipt */

.receipt-wrap {
  filter: drop-shadow(0 10px 18px var(--shadow));
  max-width: var(--receipt-w);
  margin: 0 auto;
}

.receipt {
  --tooth: 14px;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--mono);
  padding: calc(var(--tooth) + 1.1rem) 1.35rem calc(var(--tooth) + 1.25rem);
  /* Torn-paper zigzag along the top and bottom edges */
  -webkit-mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--tooth) 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--tooth) 51% repeat-x;
  mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--tooth) 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--tooth) 51% repeat-x;
}

.receipt a { color: var(--ink); }
.receipt a:hover { color: #b3311c; }

.receipt-head { text-align: center; }
.receipt-brand { font-weight: 800; letter-spacing: 0.14em; margin: 0 0 0.15rem; }
.receipt-title { font: 700 1em/1.35 var(--mono); letter-spacing: 0.04em; }

.receipt-rule {
  border: 0;
  border-top: 2px dashed var(--ink-faint);
  margin: 0.85rem 0;
  opacity: 0.7;
}

.receipt-section h3 { font: 700 1em/1.4 var(--mono); margin-bottom: 0.15rem; }
.receipt dl { margin: 0; }

.receipt-row {
  display: flex;
  align-items: baseline;
  gap: 0.5ch;
  padding-left: 2ch;
}
.receipt-row dt {
  display: flex;
  align-items: baseline;
  flex: 1 1 auto;
  min-width: 0;
}
.receipt-row dt::after {
  /* dot leaders */
  content: "";
  flex: 1 0 2ch;
  margin-left: 0.6ch;
  border-bottom: 2px dotted var(--ink-faint);
  transform: translateY(-0.28em);
}
.receipt-row dd { margin: 0; font-weight: 700; text-align: right; white-space: nowrap; }

.receipt-total { font-weight: 800; margin: 0; display: flex; gap: 1ch; }
.receipt-total-label { flex: none; }

.receipt-foot { text-align: center; font-size: 0.86em; letter-spacing: 0.04em; }
.receipt-foot p { margin: 0 0 0.2rem; }
.receipt-slogan { font-weight: 800; margin-top: 0.5rem !important; }

.barcode {
  height: 46px;
  width: 78%;
  margin: 0.9rem auto 0;
  background:
    repeating-linear-gradient(90deg,
      var(--ink) 0 2px, transparent 2px 4px,
      var(--ink) 4px 5px, transparent 5px 8px,
      var(--ink) 8px 11px, transparent 11px 12px,
      var(--ink) 12px 13px, transparent 13px 16px,
      var(--ink) 16px 17px, transparent 17px 18px,
      var(--ink) 18px 21px, transparent 21px 24px,
      var(--ink) 24px 25px, transparent 25px 27px);
}

/* ------------------------------------------------------------ episode */

.ep-head { max-width: var(--measure); margin: 1.5rem auto 2.25rem; text-align: center; }
.ep-head h1 { font-size: clamp(2.1rem, 7vw, 3.4rem); font-weight: 850; letter-spacing: -0.025em; margin-bottom: 0.7rem; }
.question { font-size: 1.2rem; color: var(--muted); margin: 0; }

.ep-grid { display: grid; gap: 3rem; }
.ep-body { min-width: 0; }

.fine-print, .sources { max-width: var(--measure); margin: 3.25rem auto 0; }

.stamp {
  display: inline-block;
  font: 800 1.05rem/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stamp);
  border: 3px solid currentColor;
  border-radius: 4px;
  padding: 0.45rem 0.7rem 0.4rem;
  transform: rotate(-2.5deg);
  margin: 0 0 1.25rem;
}

.fine-print ul { margin: 0; padding-left: 1.2rem; }
.fine-print li { margin-bottom: 0.65rem; }
.fine-print li::marker { color: var(--stamp); }

.sources h2 { font-size: 1.75rem; font-weight: 850; letter-spacing: -0.015em; margin-bottom: 0.3rem; }
.section-note { color: var(--muted); margin-bottom: 1.4rem; }

.sources ol { list-style: none; counter-reset: src; margin: 0; padding: 0; }
.sources li {
  counter-increment: src;
  position: relative;
  padding: 0.95rem 0 0.95rem 2.6rem;
  border-top: 1px solid var(--line);
}
.sources li:last-child { border-bottom: 1px solid var(--line); }
.sources li::before {
  content: counter(src, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.05rem;
  font: 700 0.85rem/1.4 var(--mono);
  color: var(--muted);
}
.source-claim { font-weight: 700; margin: 0 0 0.2rem; }
.source-cite { margin: 0; overflow-wrap: anywhere; }
.source-host { display: inline-block; margin-left: 0.4rem; font: 0.8rem/1.4 var(--mono); color: var(--muted); }
.source-note { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }

.watch { text-align: center; }
.watch-video {
  display: block;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 9 / 16;
  margin: 0 auto 1rem;
  background: #000;
  border-radius: 14px;
}
.watch-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.6rem; color: var(--muted); }

.ep-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: var(--measure);
  margin: 3.5rem auto 0;
}
.ep-nav a { text-decoration: none; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; line-height: 1.35; }
.ep-nav a span { display: block; font: 700 0.8rem/1.4 var(--mono); color: var(--muted); letter-spacing: 0.06em; margin-bottom: 0.2rem; }
.ep-nav-next { grid-column: 2; text-align: right; }

@media (min-width: 60rem) {
  .ep-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .episode.no-watch .ep-grid { grid-template-columns: minmax(0, 1fr); }
  .ep-watch { position: sticky; top: 1.5rem; }
  .receipt { font-size: 16px; }
}

/* --------------------------------------------------------------- home */

.hero { display: grid; gap: 2.5rem; margin: 2rem 0 4rem; align-items: center; }
.hero-text { max-width: var(--measure); }
.hero.no-watch .hero-text { margin: 0 auto; }
.hero h1 {
  font-size: clamp(2.5rem, 9vw, 4.6rem);
  font-weight: 880;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin-bottom: 1.6rem;
}
.hero h1 span { color: var(--stamp); }
.hero-text p { font-size: 1.1rem; }
.hero-text p:first-of-type { font-size: 1.25rem; }
.hero-watch-label {
  max-width: 340px;
  margin: 0 auto 0.75rem;
  text-align: center;
  font: 700 0.85rem/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-watch-label span { color: var(--stamp); }

@media (min-width: 60rem) {
  .hero:not(.no-watch) { grid-template-columns: minmax(0, 1fr) 340px; }
}

.receipt-index { font-size: 15px; }
.index-list { list-style: none; margin: 0; padding: 0; }
.index-list li { margin-bottom: 0.75rem; }
.index-list a { display: flex; align-items: baseline; gap: 1ch; text-decoration: none; }
.index-list a:hover .index-title { text-decoration: underline; }
.index-num { flex: none; font-weight: 800; }
.index-title { flex: 1 1 auto; font-weight: 700; display: flex; align-items: baseline; }
.index-title::after { content: ""; flex: 1 0 2ch; margin-left: 0.6ch; border-bottom: 2px dotted var(--ink-faint); transform: translateY(-0.28em); }
.index-go { flex: none; color: var(--ink-faint); }
.index-q { margin: 0.1rem 0 0 4ch; font-size: 0.86em; color: var(--ink-faint); line-height: 1.4; }
.draft-tag { font-style: normal; font-size: 0.75em; background: #f5d76e; padding: 0 0.4ch; margin-left: 0.6ch; }
.receipt-empty { text-align: center; font-weight: 700; margin: 0.5rem 0; }
.receipt-index .receipt-row { padding-left: 0; }
.receipt-index .receipt-total { margin-top: 0.5rem; }

/* -------------------------------------------------------------- error */

.error-page { max-width: var(--measure); margin: 4rem auto; text-align: center; }
.error-page h1 { font-size: clamp(2rem, 6vw, 3rem); font-weight: 850; letter-spacing: -0.02em; margin-bottom: 0.8rem; }
.error-page pre { text-align: left; white-space: pre-wrap; background: var(--paper); color: var(--ink); padding: 1rem; border-radius: 8px; font: 14px/1.5 var(--mono); }

@media (prefers-reduced-motion: no-preference) {
  .ep-nav a, .pill { transition: opacity 0.15s, border-color 0.15s, color 0.15s; }
}

@media print {
  .site-header nav, .watch, .ep-nav, .preview-bar { display: none; }
  .receipt-wrap { filter: none; }
}
