/* The Books site. Loaded after css/base.css and css/map.css, which
   draw everything from the colors set here.

   The palette is the one on the channel's banner and the content card:
   cream, plum ink, violet, and yellow. The dark theme is the same page at
   night: the map becomes yellow stars on a violet-black sky.

   tests/channel-client.test.mjs measures every pair below in both themes.
   Colors that have to be measured are plain six-digit hex for that reason. */

:root {
  color-scheme: light;

  --bg:      #FAF5EC;
  --bg-2:    #F3EBDD;
  --surface: #FFFDF8;

  --ink:   #292437;
  --ink-2: #4E4760;
  --muted: #655D77;
  --line:  rgba(41, 36, 55, .16);

  --accent:        #5B21B6;
  --accent-strong: #7C3AED;
  --on-accent:     #FFFFFF;
  --mark:    #FACC15;
  --on-mark: #292437;
  --focus:   #5B21B6;

  --stage:    #1E1535;
  --on-stage: #F4EEFF;

  --map-work:    #7C3AED;
  --map-on-work: #FFFFFF;
  --map-person:  #A16207;
  --map-event:   #C026D3;
  --map-edge:    #8B7BC8;
  --map-guide:   rgba(124, 58, 237, .5);

  --glow-a: rgba(196, 181, 253, .6);
  --glow-b: rgba(253, 230, 138, .65);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-read:    'Fraunces', Georgia, 'Times New Roman', serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:      #140C2B;
  --bg-2:    #1B1238;
  --surface: #221646;

  --ink:   #F4EEFF;
  --ink-2: #CFC4EC;
  --muted: #A99BCF;
  --line:  rgba(196, 181, 253, .24);

  --accent:        #C4B5FD;
  --accent-strong: #A78BFA;
  --on-accent:     #140C2B;
  --mark:    #FACC15;
  --on-mark: #1B1238;
  --focus:   #FACC15;

  --stage:    #0B061A;
  --on-stage: #F4EEFF;

  --map-work:    #A78BFA;
  --map-on-work: #140C2B;
  --map-person:  #FACC15;
  --map-event:   #F472B6;
  --map-edge:    #7A68B8;
  --map-guide:   rgba(196, 181, 253, .45);

  --glow-a: rgba(124, 58, 237, .38);
  --glow-b: rgba(250, 204, 21, .1);
}

/* One cloth color per book, for the card that stands in for a book with no
   cover. The same in both themes: a book does not change color when the
   lights go out. */
.tone-1 { --tone: #7C3AED; --on-tone: #FFFFFF; }
.tone-2 { --tone: #FACC15; --on-tone: #292437; }
.tone-3 { --tone: #5B21B6; --on-tone: #FFFFFF; }
.tone-4 { --tone: #A21CAF; --on-tone: #FFFFFF; }
.tone-5 { --tone: #292437; --on-tone: #FDE68A; }
.tone-6 { --tone: #C4B5FD; --on-tone: #292437; }
.tone-7 { --tone: #854D0E; --on-tone: #FFFFFF; }

/* Fraunces at 600 is the heaviest file the site ships. */
h1, h2, h3, h4 { font-weight: 600; }

/* ── home: the hero, then the tier list ─────────────────────── */
.hero {
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.5rem);
  background:
    radial-gradient(60rem 28rem at 88% -10%, var(--glow-a), transparent 62%),
    radial-gradient(44rem 24rem at -6% 110%, var(--glow-b), transparent 60%);
}
.hero__title { font-size: var(--step-5); letter-spacing: -.03em; line-height: 1; max-width: 14ch; }
.hero .lede { margin-top: 1.25rem; }
/* Over the glows the page color shifts toward violet and yellow, and the
   quietest gray falls under 4.5:1 at their strongest. Small text in the two
   headers that have a glow uses the next gray up.
   tests/channel-client.test.mjs works out the glows' strongest mix and
   measures against it. */
.hero .meta, .book__head .meta { color: var(--ink-2); }
.hero__more { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: .75rem; }

/* The featured book: text first on a phone, then the book as a row (cover
   left, words right); beside the text on a wide screen, the cover on top. */
.hero__grid { display: grid; gap: 2rem; }
.feature { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.feature__art { position: relative; }
.feature .cover { height: auto; box-shadow: 0 6px 18px rgba(20, 12, 43, .28); }
.feature .cover--card { padding: .6rem .5rem .6rem .8rem; justify-content: flex-start; box-shadow: inset 6px 0 0 rgba(0, 0, 0, .14), 0 6px 18px rgba(20, 12, 43, .28); }
.feature .cover__title { font-size: var(--step-0); overflow-wrap: anywhere; }
.feature .cover__by { display: none; }
/* The grade, stuck on the cover's lower left corner. */
.feature__grade {
  position: absolute; left: -.6rem; bottom: -.6rem;
  width: 3rem; height: 3rem; border-radius: 6px; font-size: 1.6rem;
  transform: rotate(-6deg);
  box-shadow: inset 0 -4px 0 rgba(41, 36, 55, .14), 0 4px 10px rgba(20, 12, 43, .35);
}
.feature__label { color: var(--ink-2); font-size: .95rem; font-weight: 600; }
.feature__title { margin-top: .2rem; font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); line-height: 1.2; overflow-wrap: anywhere; }
.feature__by { margin-top: .2rem; color: var(--ink-2); font-size: .95rem; }
.feature__verdict { margin-top: .6rem; font-family: var(--font-read); }
.feature__go { margin-top: .9rem; }
@media (min-width: 760px) {
  .hero__grid--feature { grid-template-columns: minmax(0, 1fr) auto; gap: 3.5rem; align-items: center; }
  .feature { grid-template-columns: 15rem; gap: 1.5rem; }
  .feature__art { width: 13rem; }
  .feature .cover--card { padding: 1.1rem .9rem 1.1rem 1.3rem; }
  .feature .cover__title { font-size: var(--step-2); }
  .feature__grade { left: -.9rem; bottom: -.9rem; width: 4.5rem; height: 4.5rem; border-radius: 8px; font-size: 2.4rem; }
}

.universe { padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2.5rem, 6vw, 4.5rem); }
.universe .sect__head h2 { font-size: var(--step-2); }
/* On a phone the drawing runs edge to edge, so its 360 units get every
   pixel the screen has. */
@media (max-width: 480px) {
  .universe .umap__svg--spine { width: calc(100% + 2 * var(--gutter)); max-width: none; margin-inline: calc(-1 * var(--gutter)); }
}

.shelfbtn { min-height: 44px; padding: .35rem .9rem; font-size: .92rem; border-width: 1.5px; }
/* The pressed state is the fill, the check mark, and aria-pressed: never
   the color alone. */
.shelfbtn[aria-pressed="true"] { border-color: var(--ink); }
.shelfbtn[aria-pressed="true"]::before { content: '\2713'; font-weight: 700; }
:root[data-theme="dark"] .shelfbtn[aria-pressed="true"] { border-color: var(--mark); }

/* ── a book ─────────────────────────────────────────────────── */
.book__head {
  padding-block: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
  background: radial-gradient(52rem 24rem at 92% -20%, var(--glow-a), transparent 62%);
}
.book__title { margin-top: .6rem; }
.book__sub {
  display: block; margin-top: .5rem;
  font-size: var(--step-2); font-style: italic; font-weight: 400; letter-spacing: 0; line-height: 1.25;
  color: var(--ink-2);
}
.book__by { margin-top: 1rem; color: var(--ink-2); font-size: var(--step-1); }
.guide h1 + .lede { margin-top: 1.25rem; }

.book__grid { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 860px) {
  .book__grid { grid-template-columns: minmax(200px, 270px) minmax(0, 1fr); gap: 3rem; }
}
.book__side { display: grid; gap: 1rem; max-width: 270px; }
/* The sections run long beside it, so the cover stays in view. */
@media (min-width: 860px) { .book__side { position: sticky; top: 1.5rem; } }
.book__shelf { display: flex; flex-wrap: wrap; gap: .5rem; }
/* Empty, and so no taller than nothing, unless a mark could not be saved. */
.book__shelfnote { font-size: var(--step--1); color: var(--ink-2); }
.book__shelfnote:not(:empty) { margin-top: .6rem; }
.book__main { display: grid; gap: 1.75rem; }
.book__main h2 { font-family: var(--font-ui); font-size: var(--step-1); font-weight: 700; letter-spacing: 0; }
.book__main > section > * + * { margin-top: .75rem; }
.book__airs { font-size: var(--step-1); }
.book__edition { max-width: 56ch; }

/* The real cover, or the card that stands in for it. */
.cover { width: 100%; aspect-ratio: 2 / 3; border-radius: 3px 10px 10px 3px; }
img.cover { object-fit: contain; object-position: left top; }
.cover--card {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 1.6rem 1.25rem 1.4rem 1.75rem;
  background: var(--tone); color: var(--on-tone);
  box-shadow: inset 12px 0 0 rgba(0, 0, 0, .14);
}
.cover__title { font-family: var(--font-display); font-weight: 600; font-size: var(--step-3); line-height: 1.05; letter-spacing: -.02em; }
.cover__by { font-size: .95rem; }

.wrap--read > .lede { font-family: var(--font-read); color: var(--ink); }
.book__head h1 + .lede, .who__tags + .lede { margin-top: 1rem; }
.who__tags { margin-top: .75rem; }

/* ── a book's sections, in the order of the video ───────────── */
.hook { font-family: var(--font-read); font-size: var(--step-2); line-height: 1.35; max-width: 40ch; }
.book__main .lede { font-family: var(--font-read); color: var(--ink); }

.quote { margin-top: 1.75rem; padding-left: 1.25rem; border-left: 5px solid var(--mark); }
.quote blockquote { font-family: var(--font-read); font-style: italic; font-size: var(--step-2); line-height: 1.35; }
.quote figcaption { margin-top: .6rem; color: var(--ink-2); font-size: .95rem; }

/* The grade: the letter on a tile like a spine label, the tier's meaning
   beside it. The letter is the information; the yellow is decoration. */
.grade__tile {
  display: inline-grid; place-items: center; flex: none;
  width: 3.5rem; height: 3.5rem; border-radius: 6px;
  background: var(--mark); color: var(--on-mark);
  box-shadow: inset 0 -4px 0 rgba(41, 36, 55, .14);
  font-family: var(--font-display); font-size: 1.9rem; font-style: normal; font-weight: 600; line-height: 1; letter-spacing: -.03em;
}
.grade { display: flex; align-items: center; gap: 1.1rem; }
.grade .grade__tile { width: 6rem; height: 6rem; border-radius: 10px; font-size: 3.4rem; }
.grade__means { font-family: var(--font-read); font-size: var(--step-2); line-height: 1.3; max-width: 28ch; }

/* A grade in a list. */
.chip {
  display: inline-block; padding: .05rem .5rem; border-radius: 4px;
  background: var(--mark); color: var(--on-mark);
  font-family: var(--font-mono); font-size: .8rem; font-weight: 700; line-height: 1.5; white-space: nowrap;
}

/* What Gene's county library said when he checked. */
.libcheck {
  max-width: 60ch; padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line); border-left: 6px solid var(--accent-strong); border-radius: var(--r);
}

.cast__head { margin-top: 1.5rem; font-family: var(--font-ui); font-size: var(--step-0); font-weight: 700; letter-spacing: 0; color: var(--ink-2); }
.cast__head + .ties { margin-top: .25rem; }
.tag--recurring { background: var(--mark); border-color: var(--mark); color: var(--on-mark); }
.ties__back { color: var(--ink-2); }

/* ── the tier list (home) and Tiers Defined: one row per letter ─ */
.tiers { display: grid; gap: .6rem; padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2.5rem, 6vw, 4rem); }
.tiers__key { margin-bottom: .4rem; }

/* Also on this site, then the About strip. */
.also { display: grid; gap: 1.5rem 2rem; margin-top: 1rem; }
.also > li { padding-top: .9rem; border-top: 1px solid var(--line); }
.also__head { font-size: var(--step-1); }
.also p { margin-top: .4rem; max-width: 36ch; color: var(--ink-2); }
@media (min-width: 600px) { .also { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .also { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Episodes: a single column of rows, a small cover on the left, ruled apart. */
.eplist__rows { max-width: 44rem; margin-top: 1rem; }
.eprow { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 1rem; padding-block: 1rem; border-top: 1px solid var(--line); }
.eprow:last-child { border-bottom: 1px solid var(--line); }
.eprow__title { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); line-height: 1.2; overflow-wrap: anywhere; }
/* A one-letter title is still a target 24 px wide (WCAG 2.5.8). */
.eprow__title a { display: inline-block; min-width: 1.5rem; }
/* The same for a link that stands alone above a page's title. */
.book__where a { display: inline-block; min-height: 1.5rem; }
.eprow__by, .eprow__when { margin-top: .2rem; color: var(--ink-2); font-size: .95rem; }
.eprow__grade { margin-top: .4rem; }
.eprow__links { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
/* A book with no cover picture: a plain drawn book. Its title is beside it. */
.eprow .cover--card { padding: 0; box-shadow: inset 5px 0 0 rgba(0, 0, 0, .14); }
.eprow .cover__title { display: none; }
.about { padding-block: clamp(1.25rem, 3vw, 2rem); }
.about p { max-width: 60ch; color: var(--ink-2); }
.tier {
  display: grid; gap: .75rem 1.25rem; padding: .9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px 12px 12px 4px;
}
.tier__head { display: flex; align-items: center; gap: 1rem; font-family: var(--font-read); font-size: var(--step-1); font-weight: 400; letter-spacing: 0; line-height: 1.3; }
.tier__means { font-style: italic; }
.tier__none { color: var(--ink-2); font-size: .95rem; align-self: center; }
/* On a wider screen the letter cell sits to the left of its row of books. */
@media (min-width: 640px) {
  .tier { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
}

/* A book in a row: one link, the cover, then its name, author, and grade
   or air date. About three to a row on a phone. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 1rem .75rem; }
h2 + .tiles { margin-block-start: 1rem; }
.tile { display: grid; gap: .3rem; align-content: start; text-decoration: none; color: var(--ink); }
.tile__cover { display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 2px 6px 6px 2px; }
img.tile__cover { object-fit: contain; object-position: left bottom; }
.tile .cover--card { padding: .5rem .45rem .5rem .7rem; box-shadow: inset 6px 0 0 rgba(0, 0, 0, .14); }
.tile .cover__title { font-size: .85rem; overflow-wrap: anywhere; }
.tile__title { font-family: var(--font-display); font-weight: 600; font-size: .95rem; line-height: 1.2; overflow-wrap: anywhere; }
.tile__by { color: var(--ink-2); font-size: .8rem; line-height: 1.3; }
.tile__when { color: var(--ink-2); font-size: .8rem; line-height: 1.3; }
.tile .chip { justify-self: start; }
.tile:hover .tile__title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .15em; }

/* ── the map page's index of names ──────────────────────────── */
.index__head { margin-top: 1.75rem; font-family: var(--font-ui); font-size: var(--step-1); font-weight: 700; letter-spacing: 0; }
.sect__head + .index__head { margin-top: 0; }
.index { margin-top: .5rem; columns: 15rem; column-gap: 2.5rem; }
.index li { break-inside: avoid; padding-block: .15rem; }

.pager { display: grid; gap: .75rem; margin-top: clamp(2rem, 5vw, 3.5rem); }
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager__link {
  display: grid; gap: .2rem; padding: 1rem 1.2rem; min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); line-height: 1.2;
  text-decoration: none;
  transition: border-color .15s;
}
.pager__link:hover { border-color: var(--accent-strong); }
.pager__link--next { text-align: right; }
@media (min-width: 640px) { .pager__link--next:first-child { grid-column: 2; } }

.guide .prose { padding-top: clamp(1rem, 3vw, 2rem); }
.guide .prose h2 { font-weight: 600; }
