/* The reader layer.
 *
 * Each card page is an animated 540x675 stage that was built to be recorded
 * for a post: the page sets `overflow:hidden` and centres the stage in the
 * viewport. This stylesheet is linked after that markup, so it reopens the
 * page for scrolling, keeps the card as the hero, and sets the article,
 * sources and navigation underneath it.
 */

:root {
  --r-paper: #fafaf6;
  --r-ink: #1b1934;
  --r-soft: #56546a;
  --r-line: #dedbd0;
  --r-accent: #2e6bff;
  --r-warn-bg: #fff6e2;
  --r-warn-line: #e3b765;
  --r-measure: 34rem;
}

html, body {
  height: auto;
  min-height: 100%;
  overflow: visible;
  background: var(--r-paper);
}

body {
  display: block;
  place-items: initial;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  color: var(--r-ink);
  -webkit-text-size-adjust: 100%;
}

/* The card keeps its own painted background; the page around it does not. */
body.reader-page .stage { background: inherit }

.sitebar {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--r-line);
  font-size: 0.875rem;
}
.sitebar a { color: var(--r-ink); text-decoration: none }
.sitebar a:hover, .sitebar a:focus-visible { text-decoration: underline }
.sitebar .wordmark { font-weight: 700; letter-spacing: -0.01em }
.sitebar nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-left: auto }

.hero {
  width: min(540px, 100vw);
  margin: 0 auto;
  overflow: hidden;
}
.hero .stage { transform-origin: top left }

.reader {
  max-width: var(--r-measure);
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2rem) 4rem;
  font-size: 1.0625rem;
  line-height: 1.6;
}
.reader .kicker {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--r-soft);
  margin-bottom: 0.5rem;
}
.reader h1 {
  font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.reader .dek { font-size: 1.1875rem; color: var(--r-soft); margin-bottom: 1.75rem }
.reader p { margin-bottom: 1.1rem }
.reader h2 {
  font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
  font-size: 1.125rem;
  margin: 2.25rem 0 0.75rem;
}

.warn {
  border: 1px solid var(--r-warn-line);
  background: var(--r-warn-bg);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin: 1.5rem 0;
}
.warn b { display: block; margin-bottom: 0.25rem }

.sources { list-style: none; counter-reset: s }
.sources li {
  counter-increment: s;
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.5rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--r-line);
  font-size: 0.9375rem;
}
.sources li::before { content: counter(s, decimal-leading-zero); color: var(--r-soft) }
.sources a { color: var(--r-accent) }
.sources .what { display: block; color: var(--r-soft); margin-top: 0.15rem }

.related { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)) }
.related a {
  display: block;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--r-line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--r-ink);
  background: #fff;
}
.related a:hover, .related a:focus-visible { border-color: var(--r-ink) }
.related small { display: block; color: var(--r-soft) }

.ask {
  margin-top: 2.5rem;
  padding: 1.25rem;
  border: 1px solid var(--r-line);
  border-radius: 12px;
  background: #fff;
}
.ask label { display: block; font-weight: 600; margin-bottom: 0.5rem }
.ask textarea {
  width: 100%;
  min-height: 6rem;
  padding: 0.6rem;
  border: 1px solid var(--r-line);
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
}
.ask button {
  margin-top: 0.75rem;
  padding: 0.6rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--r-ink);
  color: var(--r-paper);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ask button:hover { background: #000 }

.foot {
  border-top: 1px solid var(--r-line);
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem;
  font-size: 0.875rem;
  color: var(--r-soft);
}
.foot a { color: var(--r-soft) }

/* Index pages */
.index-head { max-width: 48rem; margin: 0 auto; padding: 2.5rem clamp(1rem, 4vw, 2rem) 0 }
.index-head h1 { font-family: "Bricolage Grotesque", "DM Sans", sans-serif; font-size: clamp(2rem, 7vw, 3rem); line-height: 1.05; letter-spacing: -0.02em }
.index-head p { color: var(--r-soft); margin-top: 0.75rem; font-size: 1.125rem; max-width: 34rem }
.search { max-width: 48rem; margin: 1.5rem auto 0; padding: 0 clamp(1rem, 4vw, 2rem) }
.search input { width: 100%; padding: 0.7rem 0.9rem; border: 1px solid var(--r-line); border-radius: 999px; font: inherit; font-size: 1rem; background: #fff }
.cards { max-width: 62rem; margin: 1.5rem auto 4rem; padding: 0 clamp(1rem, 4vw, 2rem); display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)) }
.cards a { display: block; padding: 1rem; border: 1px solid var(--r-line); border-radius: 12px; background: #fff; text-decoration: none; color: var(--r-ink) }
.cards a:hover, .cards a:focus-visible { border-color: var(--r-ink) }
.cards b { display: block; font-size: 1.0625rem; margin-bottom: 0.25rem }
.cards span { color: var(--r-soft); font-size: 0.9375rem }
.group-title { max-width: 62rem; margin: 2.5rem auto 0; padding: 0 clamp(1rem, 4vw, 2rem); font-family: "Bricolage Grotesque", "DM Sans", sans-serif; font-size: 1.25rem }
.empty { max-width: 62rem; margin: 1rem auto; padding: 0 clamp(1rem, 4vw, 2rem); color: var(--r-soft) }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important }
}

.ask .opt { font-weight: 400; color: var(--r-soft); font-size: 0.9375rem; margin-top: 0.75rem }
.ask input[type="email"],
.ask input[type="text"] {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--r-line);
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
}
.ask .check { display: flex; gap: 0.5rem; align-items: center }
.ask .note { margin-top: 0.75rem; color: var(--r-soft); font-size: 0.875rem }
.ask .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden }
.ask button[disabled] { opacity: 0.6; cursor: default }

.reader .origin { margin: -0.75rem 0 1.5rem; font-size: 0.9375rem; color: var(--r-soft) }
.reader .origin a { color: var(--r-accent) }

.cards .when { display: block; margin-top: 0.35rem; font-size: 0.8125rem; color: var(--r-soft) }

.cards.posters { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)) }
.cards.posters img { width: 100%; height: auto; display: block; border: 1px solid var(--r-line); border-radius: 6px; margin-bottom: 0.5rem }
.cards.posters b { font-size: 0.9375rem }

/* Where the piece lives elsewhere, and the way through the gallery. */
.reader .kicker a { color: inherit; text-decoration: none }
.reader .kicker a:hover, .reader .kicker a:focus-visible { text-decoration: underline }
.elsewhere { list-style: none; font-size: 0.9375rem }
.elsewhere li { padding: 0.5rem 0; border-top: 1px solid var(--r-line); overflow-wrap: anywhere }
.elsewhere a { color: var(--r-accent) }
.pager { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 2rem 0 0; font-size: 0.9375rem }
.pager a { color: var(--r-ink) }

/* The standard safety block, in the footer of every page.
 * Same warm paper and line colours as the warning box; text is the page ink
 * on white and its links are underlined ink, so contrast is well above AA. */
.safety {
  max-width: 40rem;
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--r-warn-line);
  border-left-width: 4px;
  border-radius: 10px;
  background: #fff;
  color: var(--r-ink);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.safety h2 {
  margin: 0 0 0.2rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--r-soft);
}
.safety p { margin: 0 }
.safety a { color: var(--r-ink); text-decoration: underline; text-underline-offset: 0.15em; overflow-wrap: anywhere }
.safety a:hover { text-decoration-thickness: 2px }
.safety a:focus-visible { outline: 2px solid var(--r-ink); outline-offset: 2px }
