/* Palette and type ported from the v0 design study. Editorial greens, browns
   and terracotta rather than the earlier red; warm rules on cool paper. */
:root {
  color-scheme: light;
  --paper: #f8faf7;
  --ink: #2d211b;
  /* muted, accent-secondary and panel are darkened/lightened from the v0 study.
     Its values put the 11px eyebrows at 3.47:1 and the panel body at 4.07:1,
     under the 4.5:1 WCAG AA floor for small text. */
  --muted: #6b5f54;
  --line: #d9cdbd;
  --panel: #e9ede1;
  --accent: #315b45;
  --accent-alt: #5f3929;
  --accent-secondary: #55633e;
  --accent-tertiary: #96522f;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #171712;
    --ink: #f1eadc;
    --muted: #aaa08e;
    --line: #403b2f;
    --panel: #23261c;
    --accent: #9ab38a;
    --accent-alt: #c89b79;
    --accent-secondary: #b8c58d;
    --accent-tertiary: #d28b68;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease, color .15s ease;
}
a:hover { color: var(--accent-alt); border-color: var(--accent-alt); }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

main { max-width: 1240px; margin: auto; padding: 0 5vw 120px; }

/* ---------- masthead and footer ---------- */

.masthead {
  max-width: 1240px;
  margin: auto;
  padding: 28px 5vw 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border-bottom: 2px solid var(--accent);
  font: 12px var(--sans);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.wordmark { display: flex; align-items: center; gap: 10px; font-weight: 700; border: 0; }
.wordmark-mark {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  background: var(--accent); color: var(--paper);
  font: italic 16px var(--serif); letter-spacing: 0;
}
.masthead nav { display: flex; gap: 25px; }

.site-footer {
  max-width: 1240px; margin: auto;
  padding: 24px 5vw 42px;
  display: flex; justify-content: space-between; gap: 20px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font: 10px var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---------- shared editorial furniture ---------- */

h1, h2, h3, p { margin-top: 0; }

.eyebrow, .aside-label, .meta-kicker {
  margin: 0 0 18px;
  color: var(--accent-secondary);
  font: 600 11px var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.section-heading {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  gap: 30px;
  margin-bottom: 36px;
}
.section-heading .eyebrow { align-self: start; }
.section-heading > p:last-child {
  margin: 0; max-width: 220px;
  color: var(--muted); font-size: 15px; line-height: 1.4;
}

h2 {
  font-size: clamp(31px, 4vw, 54px);
  font-weight: normal;
  line-height: 1;
  letter-spacing: -.04em;
  margin-bottom: 0;
}

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

.collection-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 8vw;
  padding: clamp(72px, 12vw, 160px) 0 105px;
  border-bottom: 1px solid var(--line);
}
.hero-copy { border-left: 8px solid var(--accent); padding-left: clamp(20px, 3vw, 42px); }
.hero-copy h1 {
  max-width: 720px; margin-bottom: 22px;
  font: normal clamp(68px, 10.5vw, 150px)/.82 var(--serif);
  letter-spacing: -.07em;
}
.hero-copy h1 em { color: var(--accent); font-weight: 600; font-style: normal; }
.hero-description { max-width: 390px; margin: 0; font-size: clamp(20px, 2.2vw, 29px); line-height: 1.25; }

.hero-aside {
  position: relative;
  align-self: end;
  padding: 24px 22px;
  background: var(--panel);
  border-top: 3px solid var(--accent-secondary);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.hero-aside::after {
  content: "01"; position: absolute; top: 17px; right: 18px;
  color: var(--accent-secondary); font: 10px var(--sans); letter-spacing: .12em;
}
.hero-aside strong { color: var(--ink); font: normal 37px var(--serif); }
.aside-rule { margin: 28px 0 0; padding-top: 17px; border-top: 1px solid var(--line); font-size: 13px; }

.themes-section { padding: 90px 0 0; }

.theme-table-wrap { border-top: 2px solid var(--ink); }
.theme-table { width: 100%; border-collapse: collapse; font-size: 16px; }
/* Scoped to thead deliberately. Unscoped, `.theme-table th` outranks
   `.theme-name-cell` on specificity and turns every row header into a tiny
   uppercase sans label. */
.theme-table thead th {
  padding: 12px 0; text-align: left;
  color: var(--muted); font: 10px var(--sans);
  letter-spacing: .13em; text-transform: uppercase;
}
.theme-table th:nth-child(2), .theme-table td:nth-child(2) { width: 90px; text-align: center; }
.theme-table tr { border-bottom: 1px solid var(--line); }
.theme-table td { padding: 13px 0; vertical-align: top; }
.theme-name-cell {
  width: 29%; text-align: left;
  font: normal 19px var(--serif); text-transform: none; letter-spacing: normal;
}
.row-number {
  display: inline-block; width: 32px;
  color: var(--muted); font: 10px var(--sans); vertical-align: middle;
}
.theme-count { color: var(--accent-tertiary); font: 600 20px var(--serif); }
.theme-count a { color: inherit; border: 0; display: block; padding: 2px 0; }
.theme-count a:hover { color: var(--accent-alt); }
.film-cell { color: var(--muted); line-height: 1.55; padding-right: 10px; }
.film-cell a { border: 0; }

.index-sketch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8vw;
  padding: 70px 0 0; margin-top: 90px;
  border-top: 1px solid var(--line);
}
.index-sketch h2 { max-width: 360px; }
.index-links { display: flex; flex-direction: column; border-top: 1px solid var(--ink); }
.index-links a {
  display: flex; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid var(--line); font-size: 18px;
}
.index-links span { color: var(--accent); font-weight: 600; }

/* ---------- entry ---------- */

/* No border-top here. In the v0 study the entry was one section of a long
   single page and the rule separated it; on its own page it just doubles the
   masthead's. */
.entry-page { padding: 0; }

.entry-intro {
  display: grid; grid-template-columns: 1fr minmax(320px, 540px); gap: 8vw;
  padding: 48px 0 60px;
}
.entry-intro h1 {
  margin: 0;
  font: normal clamp(55px, 8vw, 110px)/.9 var(--serif);
  letter-spacing: -.065em;
}
.entry-summary { max-width: 540px; margin: 37px 0 0; color: var(--muted); font-size: 20px; line-height: 1.38; }

.entry-layout {
  display: grid; grid-template-columns: minmax(0, 680px) 230px;
  gap: clamp(40px, 8vw, 130px); align-items: start;
}

.entry-sections { border-top: 1px solid var(--ink); }
.sections-control {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0;
  color: var(--muted); font: 10px var(--sans);
  letter-spacing: .1em; text-transform: uppercase;
}
.toggle-all {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent-alt); font: 10px var(--sans);
  letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 1px solid transparent;
}
.toggle-all:hover { border-color: var(--accent-alt); }

details { border-top: 1px solid var(--line); }
.entry-sections details:last-of-type { border-bottom: 1px solid var(--line); }
summary {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 21px 0; cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary h2 {
  display: inline; margin: 0;
  font: normal 25px var(--serif); letter-spacing: -.01em;
}

/* Plus that becomes a minus, rather than a rotating chevron. */
.summary-mark { position: relative; flex: none; width: 13px; height: 13px; }
.summary-mark::before, .summary-mark::after {
  content: ""; position: absolute; top: 6px; left: 0;
  width: 13px; height: 1px; background: var(--accent-alt);
}
.summary-mark::after { transform: rotate(90deg); transition: transform .2s ease; }
details[open] .summary-mark::after { transform: rotate(0); }

.section-body { padding: 3px 48px 42px 32px; max-width: 670px; }
.section-body p { font-size: 18px; line-height: 1.63; margin: 0 0 22px; }
.section-body h3 {
  margin: 39px 0 11px;
  color: var(--accent-tertiary);
  font: italic 600 22px/1.18 var(--serif);
  letter-spacing: -.01em;
}
.section-body h3:first-child { margin-top: 0; }
.wikilink { border-bottom: 1px dotted var(--accent-alt); }

/* Questions read as a numbered sequence. */
#questions-to-sit-with ul {
  margin: 0; padding: 0; list-style: none; counter-reset: questions;
}
#questions-to-sit-with li {
  counter-increment: questions;
  display: grid; grid-template-columns: 32px 1fr; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line);
  font-size: 19px; line-height: 1.35;
}
#questions-to-sit-with li::before {
  content: "0" counter(questions);
  color: var(--accent-secondary); font: 600 11px var(--sans); padding-top: 5px;
}

/* ---------- metadata rail ---------- */

.film-meta {
  border-top: 1px solid var(--ink); padding-top: 14px;
  color: var(--muted); font: 12px var(--sans);
}
.film-meta dl { margin: 0; }
.meta-row {
  display: grid; grid-template-columns: 68px 1fr; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.meta-row dt { color: var(--muted); }
.meta-row dd { margin: 0; color: var(--ink); }
.meta-themes { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--ink); }
.meta-themes.minor-themes { margin-top: 22px; border-top: 1px solid var(--line); }
.meta-themes p {
  margin: 0 0 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em; font-size: 10px;
}
.meta-themes div { display: flex; flex-wrap: wrap; gap: 5px 11px; line-height: 1.5; }
.meta-themes a { border: 0; color: var(--ink); }
.meta-themes a:hover { color: var(--accent-alt); }

/* ---------- hubs and indexes ---------- */

.hub { padding-top: 48px; }
.hub-group { margin-top: 48px; }
.hub-group > h2 {
  font: 600 11px var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-secondary); margin-bottom: 18px;
}

.film-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); }
.film-list li { padding: 18px 0; border-bottom: 1px solid var(--line); }
.film-list > li > a { font-size: 21px; }
.film-year { color: var(--muted); font: 11px var(--sans); letter-spacing: .08em; margin-left: 10px; }
.film-summary { margin: 6px 0 0; color: var(--muted); font-size: 16px; line-height: 1.45; max-width: 60ch; }

.theme-index { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 8vw; }
.theme-index li { break-inside: avoid; border-bottom: 1px solid var(--line); }
/* The anchor carries the whole row so name and count are one tap target. */
.theme-index a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 13px 0; font-size: 18px; border: 0;
}
.theme-index a:hover, .theme-index a:hover .theme-count-inline { color: var(--accent-alt); }
.theme-count-inline { color: var(--accent-tertiary); font: 600 15px var(--serif); }

.prose-page { max-width: 640px; padding-top: 48px; }
.prose-page p { font-size: 18px; line-height: 1.63; }

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  main { padding: 0 20px 80px; }
  .masthead { padding: 12px 20px; flex-wrap: wrap; gap: 4px 10px; }
  .masthead nav { gap: 4px; font-size: 10px; }

  /* Tap targets. Measured on a 412px Android viewport, the nav links were 14px
     tall and the table counts 27px, against a 44-48px floor. Everything
     interactive gets real height rather than relying on the text box. */
  .masthead nav a,
  .masthead .wordmark { display: flex; align-items: center; min-height: 44px; padding: 0 8px; }
  .masthead nav a:first-child { margin-left: -8px; }
  .masthead nav a:last-child { margin-right: -8px; }
  .masthead .wordmark { padding-left: 0; }
  .theme-index a { padding: 15px 0; }
  .theme-count a { padding: 11px 0; }
  .index-links a { padding: 20px 0; }
  .film-list > li > a { display: inline-block; padding: 4px 0; }
  .site-footer { padding: 24px 20px 42px; flex-direction: column; gap: 14px; }

  .collection-hero, .entry-intro, .entry-layout, .index-sketch { grid-template-columns: 1fr; }
  .collection-hero { padding: 80px 0 65px; gap: 52px; }
  .hero-copy h1 { font-size: 70px; }
  .hero-aside { max-width: 300px; }
  .themes-section { padding: 65px 0 0; }
  .section-heading { grid-template-columns: 1fr; gap: 16px; margin-bottom: 28px; }
  .section-heading > p:last-child { max-width: 290px; }

  .theme-table th:nth-child(2), .theme-table td:nth-child(2) { width: 45px; }
  .theme-name-cell { width: 35%; font-size: 16px; }
  .row-number { width: 24px; }
  .film-cell { font-size: 14px; }

  .entry-intro { padding: 38px 0 40px; gap: 25px; }
  .entry-intro h1 { font-size: 58px; }
  .entry-summary { margin: 0; font-size: 18px; }
  .section-body { padding: 0 0 30px; }
  .section-body p { font-size: 17px; }
  summary h2 { font-size: 22px; }

  /* Metadata after the reading column on a phone, not before it. */
  .film-meta { order: 2; margin-top: 40px; }
  .entry-sections { order: 1; }

  .index-sketch { gap: 32px; padding: 55px 0 0; margin-top: 55px; }
  .theme-index { columns: 1; }
}

@media (max-width: 380px) {
  .masthead nav { gap: 8px; font-size: 9px; }
  .hero-copy h1 { font-size: 58px; }
  .entry-intro h1 { font-size: 46px; }
  .theme-name-cell { width: 39%; }
  .film-cell { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
