/* ==========================================================================
   Stupid Political Ideas — shared brand layer
   --------------------------------------------------------------------------
   Every topic page inherits this file. Adding a topic should never require
   editing it. See docs/PRD.md §4 for the brand rationale.

   Direction: "mimeograph" — cool copier stock, ditto-machine violet, the
   visual vernacular of civic documents and classroom handouts.
   Violet is deliberate: it is the one serious accent that signals neither
   US political party.
   ========================================================================== */

/* --- Foundations --------------------------------------------------------- */

:root {
  /* Color */
  --paper:        #eeeff1;
  --paper-edge:   #e4e6e9;
  --surface:      #f8f9fa;
  --ink:          #17181e;
  --ink-muted:    #5a5e6b;   /* 5.6:1 on paper */
  --ink-faint:    #636773;   /* 4.9:1 — still AA; nothing on this site is
                                allowed to fall below it, including 11px labels */
  --rule:         #d9dbe0;
  --accent:       #443a8f;
  --accent-deep:  #2f2866;
  --accent-soft:  #e3e1ef;
  --flag:         #8a3324;  /* content notes only — never decorative */

  /* Type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, serif;
  --mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* Scale — a 1.25 ratio, but the take deliberately sits BELOW body size.
     The narrator is the smallest voice on the page. That is the thesis. */
  --t-take:    0.9375rem;   /* 15px — Rob's own words, quietest thing here */
  --t-body:    1.0625rem;   /* 17px — floor for anything read at length */
  --t-lead:    1.25rem;
  --t-title:   1.5rem;
  --t-display: clamp(2.75rem, 9vw, 4.5rem);

  /* Space */
  --s-1: 0.375rem;
  --s-2: 0.75rem;
  --s-3: 1.25rem;
  --s-4: 2rem;
  --s-5: 3.25rem;
  --s-6: 5rem;

  --measure: 34rem;   /* ~68ch at body size */
  --shell:   46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #14151a;
    --paper-edge:  #101116;
    --surface:     #1b1d23;
    --ink:         #e8e9ec;
    --ink-muted:   #a0a4b0;
    --ink-faint:   #8a8f9c;   /* 5.6:1 on dark paper */
    --rule:        #2b2e36;
    --accent:      #a99df0;
    --accent-deep: #c4bbf7;
    --accent-soft: #262340;
    --flag:        #e0917f;
  }
}

/* --- Reset --------------------------------------------------------------- */

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

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

body {
  margin: 0;
  padding: 0 var(--s-3);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-deep); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Shell --------------------------------------------------------------- */

.shell {
  max-width: var(--shell);
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: var(--s-3);
  top: var(--s-3);
  z-index: 10;
  padding: var(--s-2) var(--s-3);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* --- Masthead ------------------------------------------------------------ */

.masthead {
  padding: var(--s-4) 0 var(--s-6);
}

.masthead__mark {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  display: inline-block;
}
.masthead__mark:hover { color: var(--accent); }

/* The rule under the wordmark is a printer's registration mark, not a border:
   it is short and offset, the way a ditto master sits slightly off-square. */
.masthead__mark::after {
  content: "";
  display: block;
  width: 2.25rem;
  height: 2px;
  margin-top: var(--s-2);
  background: var(--accent);
}

/* --- Page head ----------------------------------------------------------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 var(--s-3);
}

.display {
  font-family: var(--serif);
  font-size: var(--t-display);
  line-height: 1.02;
  letter-spacing: -0.022em;
  font-weight: 400;
  margin: 0 0 var(--s-4);
  max-width: 15ch;
}

/* --- The take ------------------------------------------------------------
   Deliberately the smallest, quietest type on the page. Set narrow and
   indented like a margin note. This is the design's whole argument: the
   author's opinion is the least authoritative thing here. */

.take {
  max-width: 30rem;
  margin: 0 0 var(--s-6);
  padding-left: var(--s-3);
  border-left: 2px solid var(--rule);
  color: var(--ink-muted);
  font-size: var(--t-take);
  line-height: 1.72;
}

.take > p { margin: 0 0 var(--s-3); }
.take > p:last-child { margin-bottom: 0; }

.take__sig {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* --- Attention ledger ----------------------------------------------------
   The page states its cost up front. */

.ledger {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  align-items: baseline;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s-6);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.ledger__label {
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}

.ledger__cost { color: var(--ink); }

/* --- Resource list -------------------------------------------------------
   An ordered list because the order is real: the sequence goes
   evidence -> the argument made warmly -> the argument made bluntly. */

.resources {
  list-style: none;
  margin: 0 0 var(--s-6);
  padding: 0;
  counter-reset: resource;
}

.resource {
  counter-increment: resource;
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0 var(--s-3);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--rule);
}

.resource::before {
  content: counter(resource, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
  padding-top: 0.5rem;
  letter-spacing: 0.04em;
}

.resource__body { min-width: 0; }

.resource__kind {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 var(--s-2);
}

.resource__title {
  font-size: var(--t-title);
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.012em;
  margin: 0 0 var(--s-1);
}

.resource__byline {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ink-muted);
  margin: 0 0 var(--s-3);
}

.resource__why {
  max-width: var(--measure);
  margin: 0 0 var(--s-3);
}

/* Content note — sits BEFORE the links, never after. */
.note {
  display: block;
  max-width: var(--measure);
  margin: 0 0 var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-left: 2px solid var(--flag);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--ink-muted);
}

.note b { color: var(--flag); font-weight: 400; }

/* --- Parts (the ledger rows) --------------------------------------------- */

.parts {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--measure);
  border-top: 1px solid var(--rule);
}

.part { border-bottom: 1px solid var(--rule); }

.part__link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-3);
  align-items: baseline;
  padding: var(--s-2) var(--s-1);
  text-decoration: none;
  color: var(--ink);
  transition: background-color 120ms ease, padding-left 120ms ease;
}

.part__link:hover,
.part__link:focus-visible {
  background: var(--accent-soft);
  padding-left: var(--s-2);
  color: var(--ink);
}

.part__name { font-size: 1rem; }

.part__name::before {
  content: "→";
  color: var(--accent);
  margin-right: var(--s-2);
  font-family: var(--mono);
}

.part__time {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* A single link, where there are no parts to enumerate. */
.link-out {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  margin-right: var(--s-3);
}

/* --- Topic index (home) -------------------------------------------------- */

.topics {
  list-style: none;
  margin: 0 0 var(--s-6);
  padding: 0;
}

.topic { border-top: 1px solid var(--rule); }

.topic__link {
  display: block;
  padding: var(--s-4) var(--s-1);
  text-decoration: none;
  color: var(--ink);
  transition: background-color 120ms ease, padding-left 120ms ease;
}

.topic__link:hover,
.topic__link:focus-visible {
  background: var(--accent-soft);
  padding-left: var(--s-2);
}

.topic__name {
  font-size: var(--t-lead);
  line-height: 1.25;
  margin: 0 0 var(--s-1);
}

.topic__link:hover .topic__name { color: var(--accent-deep); }

.topic__meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin: 0;
}

.topic--soon {
  color: var(--ink-faint);
  padding: var(--s-4) var(--s-1);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

/* --- Footer -------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule);
  padding: var(--s-4) 0 var(--s-5);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  line-height: 1.9;
  color: var(--ink-faint);
}

.footer a { color: var(--ink-muted); text-decoration: none; }
.footer a:hover { color: var(--accent); text-decoration: underline; }

.footer__sep { margin: 0 var(--s-2); color: var(--ink-faint); }

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 34rem) {
  .resource {
    grid-template-columns: 1fr;
    gap: var(--s-2) 0;
  }
  .resource::before { padding-top: 0; }
  .take { padding-left: var(--s-2); }
}

/* --- Motion -------------------------------------------------------------- */

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

/* --- Print ---------------------------------------------------------------
   Someone printing this wants the reading list, not the chrome. */

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .masthead, .footer { display: none; }
  .part__link { color: #000; }
  .part__link::after { content: " (" attr(href) ")"; font-size: 8pt; }
}
