/* =====================================================================
   Crew Balance — soft, warm, editorial.
   Serif headings (Bodoni Moda), rounded friendly body text (Nunito Sans).
   ===================================================================== */
:root {
  /* Surfaces & ink */
  --bg: #fdf8f4;
  --bg-wash: #f9e9f3;
  --card: #ffffff;
  --fg: #3b2530;          /* deep plum-brown ink */
  --muted: #8a7480;
  --line: #efe2e6;
  --accent: #5e0b15;      /* burgundy, shared with "men" so the palette stays small */
  --accent-soft: #f6e4ef;
  --focus: #d9a3cd;

  /* Gender colours */
  --woman: #f57abe;
  --woman-edge: #f57abe;
  --man: #5e0b15;
  --man-edge: #5e0b15;
  --nonbinary: #c9963b;
  --nonbinary-edge: #c9963b;
  --unknown: #d9d0c9;
  --unknown-edge: #c4b8ae;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(94, 11, 21, .04), 0 8px 28px rgba(94, 11, 21, .06);
  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --sans: "Nunito Sans", ui-rounded, system-ui, -apple-system, sans-serif;

  font-family: var(--sans);
  color-scheme: light;
}

* { box-sizing: border-box; }
/* `hidden` must always win, even over rules that set display. */
[hidden] { display: none !important; }

body {
  margin: 0; color: var(--fg); line-height: 1.55; font-size: 16px;
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--bg-wash), transparent 70%),
    radial-gradient(900px 400px at -10% 10%, #fbeee4, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  /* Column layout so the footer sits at the bottom of the screen on short pages. */
  display: flex; flex-direction: column;
}
.wrap, main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
main { padding-bottom: 120px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
/* Bodoni Moda's optical size axis (6–96): the lower the value, the sturdier the hairlines.
   Left automatic, big text gets the spindly display cut, which is hard to read on phones,
   so every serif is pinned to a small-size design: headings a little finer than body-size
   labels and numbers, and everything a notch sturdier on phones. */
:root { --opsz-head: 14; --opsz-text: 8; --opsz-num: 10; }
h1, h2, h3, .more-section h4, .more summary, .cmp-details summary {
  font-variation-settings: "opsz" var(--opsz-head);
}
.results li button strong, .film-year, .overall-grid .stat span, .minor-stats .nb, .minor-stats .unk,
.people-total, .verdict strong, .recent-title {
  font-variation-settings: "opsz" var(--opsz-text);
}
.overall-grid .stat b, .minor-stats b, .people-legend .pl b, .cmp > b, .slider-row strong {
  font-variation-settings: "opsz" var(--opsz-num);
}
h1 { margin: 0; font-size: 1.7rem; }
h1 strong { font-weight: 700; color: var(--accent); }  /* 900 closed up the c and e in Bodoni */
.home-link { color: inherit; text-decoration: none; }
.home-link:hover strong { color: #7a1320; }
h2 { margin: 0 0 6px; font-size: 1.9rem; }
h3 { margin: 0 0 6px; font-size: 1.45rem; }
.muted { color: var(--muted); }
.small { font-size: 0.87rem; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------- header ---- */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(253, 248, 244, .85);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 40px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }
.search-box { position: relative; }
/* Header search: a compact, centred field with room either side. */
.header-search-slot { flex: 0 1 440px; margin: 0 auto; }
.header-search-slot input[type=search] { padding: 9px 16px; font-size: 0.95rem; }
.header-search-slot .icon-only { width: 40px; height: 40px; }
.header-search-slot .icon-only svg { width: 18px; height: 18px; }
/* Home page: the same search box, big and centred under the welcome text. */
.hero-search-slot { max-width: 640px; margin: 34px auto 0; text-align: left; }
.hero-search-slot form { gap: 10px; }
.hero-search-slot input[type=search] { padding: 18px 26px; font-size: 1.2rem; box-shadow: var(--shadow); border-color: transparent; }
.hero-search-slot .icon-only { width: 62px; height: 62px; box-shadow: var(--shadow); }
.hero-search-slot .icon-only svg { width: 24px; height: 24px; }

form { display: flex; gap: 8px; margin: 0; }
input[type=search], select {
  font: inherit; padding: 11px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--fg); transition: border-color .15s, box-shadow .15s;
}
/* Custom chevron with proper room on the right (the native one sits against the edge). */
select {
  border-radius: var(--radius); padding: 9px 44px 9px 16px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238a7480' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center; background-size: 12px 8px;
}
input[type=search]:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px var(--accent-soft); }
form input { flex: 1; font-size: 1rem; }

button {
  font: inherit; font-weight: 600; padding: 10px 22px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; cursor: pointer; display: inline-flex; align-items: center;
  transition: transform .1s, background .15s;
}
button:hover { background: #7a1320; }
button:active { transform: translateY(1px); }

.icon-btn { background: var(--card); color: var(--fg); border: 1px solid var(--line); padding: 9px 16px; gap: 8px; font-weight: 600; }
.icon-btn:hover { background: var(--accent-soft); border-color: var(--focus); }

/* Progress line */
.progress { height: 3px; overflow: hidden; position: relative; }
.progress.on::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 3px;
  background: linear-gradient(90deg, var(--woman), var(--accent)); animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide { from { left: -35%; } to { left: 100%; } }

/* Results dropdown */
.results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); list-style: none; margin: 0;
  max-height: min(60vh, 480px); overflow-y: auto; display: grid; gap: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 48px rgba(59, 37, 48, .16); padding: 8px;
}
.results li.muted { padding: 10px 12px; }
.results li button {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; font-weight: 400;
  background: none; color: var(--fg); border: 1px solid transparent; border-radius: 12px; padding: 6px 10px;
}
.results li button.active { background: var(--accent-soft); border-color: var(--woman); }
.results li button strong { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.results img, .results .ph { width: 36px; height: 54px; object-fit: cover; border-radius: 6px; background: var(--line); flex: none; }
/* Films with no poster on TMDB get the stand-in artwork, in black and white like the main poster. */

.results kbd { margin-left: auto; font: inherit; font-size: 0.75rem; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%; display: none; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
button.busy .spinner { display: inline-block; }
/* Icon-only buttons: round, with the text kept for screen readers via .sr-only / aria-label. */
.icon-only { width: 44px; height: 44px; padding: 0; justify-content: center; flex: none; }
button.busy .icon { display: none; }
.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;
}

.loading { border-top: 1px solid var(--line); background: var(--accent-soft); font-size: 0.95rem; }
.loading .wrap { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.loading .spinner { display: inline-block; color: var(--accent); width: 18px; height: 18px; }

#report { transition: opacity .25s, filter .25s; padding-bottom: 120px; }
#report.stale { opacity: .35; filter: saturate(.3); pointer-events: none; user-select: none; }

/* ----------------------------------------------------- empty state ---- */
.empty { text-align: center; padding: 15vh 0 80px; }
.empty h2 { font-size: 2.6rem; }
.empty p { color: var(--muted); max-width: 30em; margin: 10px auto 0; font-size: 1.05rem; }

.notice { padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; }
.notice.warn { background: #fff1dc; color: #6b4300; border: 1px solid #f3dcb4; }

/* ------------------------------------------------------------ cards ---- */
.card {
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 26px 28px; margin: 22px 0;
}

/* ------------------------------------------------- main film card ---- */
.overall.card {
  display: grid; grid-template-columns: 250px 1fr; gap: 40px; align-items: start;
  margin-top: 30px; scroll-margin-top: 110px;
}
.overall-main { min-width: 0; }
.overall.card.no-poster { grid-template-columns: 1fr; }
.no-poster .poster-col { display: none; }
.film-head { margin-bottom: 18px; }
.film-head h2 { font-size: 3rem; font-weight: 800; margin: 0; }
.film-year { margin: 4px 0 0; font-family: var(--serif); font-size: 1.3rem; color: var(--muted); }

button.poster-wrap { all: unset; display: block; position: relative; border-radius: 12px; cursor: pointer; }
button.poster-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.poster-col img {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; display: block;
  box-shadow: 0 12px 32px rgba(40,20,28,.25); background: var(--line);
}
/* Tint: B&W poster with the split laid over it as bands, women left → men right. */
.poster-overlay { display: none; position: absolute; inset: 0; border-radius: 12px; overflow: hidden; }
.poster-overlay .seg { height: 100%; min-width: 0; box-shadow: none; border-radius: 0 !important; }
.tinted .poster-wrap { isolation: isolate; }
.tinted .poster-col img { filter: grayscale(1) contrast(1.08); }
.tinted .poster-overlay { display: flex; mix-blend-mode: screen; }
/* On opening a film, the colour wipes across the black-and-white poster, in step with the pie. */
.poster-overlay.reveal { animation: overlay-wipe 1s cubic-bezier(.65, 0, .35, 1) .15s both; }
@keyframes overlay-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
/* Department bars: same wipe, played as each row scrolls into view. */
.bar.wipe-pending { clip-path: inset(0 100% 0 0 round 999px); }
.bar.wipe { animation: bar-wipe .8s cubic-bezier(.65, 0, .35, 1) both; }
@keyframes bar-wipe { from { clip-path: inset(0 100% 0 0 round 999px); } to { clip-path: inset(0 0 0 0 round 999px); } }
@media (prefers-reduced-motion: reduce) {
  .poster-overlay.reveal, .bar.wipe { animation: none; }
  .bar.wipe-pending { clip-path: none; }
}

/* ------------------------------------------------------- overall ------ */
.overall-grid { display: grid; grid-template-columns: 1fr 240px 1fr; gap: 32px; align-items: center; }
.pie-fig { margin: 0; text-align: center; }
.pie svg { width: 100%; max-width: 260px; height: auto; display: block; margin: 0 auto; overflow: visible; }
button.pie { all: unset; display: block; width: 100%; max-width: 260px; margin: 0 auto; cursor: pointer; border-radius: 50%; }
button.pie:disabled { cursor: default; }
button.pie:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.pie path { transition: opacity .15s; }
.pie svg:hover path { opacity: .55; }
.pie svg:hover path:hover { opacity: 1; }

/* Headline: women vs men are the story — big, bold, in their own colours. */
.overall-grid .stat { display: flex; flex-direction: column; }
.overall-grid .stat.woman { align-items: flex-end; text-align: right; }
.overall-grid .stat.man { align-items: flex-start; text-align: left; }
.overall-grid .stat b {
  font-family: var(--serif); font-weight: 800; font-size: 5rem; line-height: .95; letter-spacing: -0.03em;
}
.overall-grid .stat span { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; margin-top: 4px; }
/* Number and label both wear the gender colour. */
.stat.woman b, .stat.woman span { color: var(--woman); }
.stat.man b, .stat.man span { color: var(--man); }
.headline { text-align: center; margin-top: 16px; }
.minor-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; align-items: baseline; }
.minor-stats .nb b { font-family: var(--serif); font-weight: 800; font-size: 1.9rem; color: var(--nonbinary); }
.minor-stats .nb, .minor-stats .unk { font-family: var(--serif); font-weight: 600; }
.minor-stats .nb { font-size: 1.15rem; color: var(--nonbinary); }
.minor-stats .unk { color: var(--muted); font-size: 0.95rem; }
/* Crew count: small, sans, tucked into the bottom-right of the headline block. */
.crew-count { text-align: right; margin: 6px 0 0; font-family: var(--sans); }
.overall .more { border-top-color: #efdfcd; }

/* Bars: 2px surface gap between segments, rounded ends. */
.bar { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; }
.bar.big { height: 26px; }
.seg { height: 100%; min-width: 3px; transition: flex-grow .3s; box-shadow: inset 0 0 0 1px var(--edge); background-color: var(--fill); }
.seg:first-child { border-radius: 999px 0 0 999px; }
.seg:last-child { border-radius: 0 999px 999px 0; }
.seg:only-child { border-radius: 999px; }
.woman { --fill: var(--woman); --edge: var(--woman-edge); --hatch: rgba(255, 255, 255, .42); }
.man { --fill: var(--man); --edge: var(--man-edge); --hatch: rgba(255, 255, 255, .38); }
.nonbinary { --fill: var(--nonbinary); --edge: var(--nonbinary-edge); --hatch: rgba(255, 255, 255, .45); }
.unknown { --fill: var(--unknown); --edge: var(--unknown-edge); --hatch: rgba(0, 0, 0, .08); }
/* Inferred = same colour with a diagonal texture, so certainty reads at a glance. */
.seg.inferred, .sw.inferred { background-image: repeating-linear-gradient(135deg, var(--hatch) 0 3px, transparent 3px 7px); }

/* "How sure are we?" — tucked away until wanted. */
.more { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.more summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--serif); font-size: 1.1rem; color: var(--accent);
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "+"; font-family: var(--sans); font-size: 1.1rem; transition: transform .2s; }
.more[open]:not(.closing) summary::after { transform: rotate(45deg); }
/* flow-root keeps child margins inside, so its measured height matches what the open/close animation uses. */
.more-body { padding-top: 6px; display: flow-root; box-sizing: border-box; }
.more-section { padding: 10px 0 6px; outline: none; }
.more-section + .more-section { border-top: 1px dashed var(--line); margin-top: 10px; }
.more-section h4 { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; margin: 6px 0 4px; }

/* Crew coverage: status line inside the details, and a small flag on the main card. */
.coverage-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; margin: 6px 0 4px !important; }
.cov-icon { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 999px; font-size: 0.75rem; color: #fff; }
.coverage-status.good .cov-icon { background: #4f8a5b; }
.coverage-status.partial .cov-icon { background: var(--nonbinary); }
.coverage-status.thin .cov-icon { background: var(--accent); }
.coverage-flag-row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; }
.share-row { display: flex; justify-content: flex-end; margin: 6px 0 0; }
.share-btn { background: none; color: var(--muted); font-size: 0.85rem; font-weight: 600; padding: 4px 2px; gap: 6px; }
.share-btn:hover { background: none; color: var(--accent); }
.share-btn:disabled { opacity: .7; cursor: progress; }
.source-notes { background: #fbf0dc; color: #7a5212; border-radius: 10px; padding: 8px 12px; }
.source-notes p { margin: 0; }
.source-notes p + p { margin-top: 6px; }
.coverage-flag {
  font-size: 0.82rem; font-weight: 600; padding: 4px 12px; gap: 6px;
  background: #fbf0dc; color: #7a5212;
}
.coverage-flag:hover { background: #f5e2bd; }
.coverage-flag.thin { background: var(--accent-soft); color: var(--accent); }
.coverage-flag.thin:hover { background: #f0d3e3; }
.more-body p { margin: 10px 0; }
/* Land below the sticky header when jumped to from "How accurate is this?". */
.footer-about { scroll-margin-top: 96px; }
.more-body p.more-footnote { border-top: 1px dashed var(--line); margin: 14px 0 4px; padding-top: 12px; color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0 0; font-size: 0.9rem; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend b { font-weight: 700; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none; background-color: var(--fill); box-shadow: inset 0 0 0 1px var(--edge); }
.certainty { font-size: 0.9rem; margin-top: 12px; }

/* Tooltip shared by pie slices and bar segments */
.tip {
  position: fixed; z-index: 50; pointer-events: none; transform: translate(-50%, calc(-100% - 12px));
  background: var(--fg); color: #fff; padding: 7px 12px; border-radius: 10px; font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(59,37,48,.25); white-space: nowrap;
}

/* ----------------------------------------------------- departments ---- */
.departments { display: grid; gap: 2px; margin-top: 14px; }
.dept {
  display: grid; grid-template-columns: 180px 1fr 90px; gap: 16px; align-items: center;
  padding: 9px 12px; border-radius: 12px; background: none; color: var(--fg);
  text-align: left; border: 0; font-weight: 400; font-size: 0.95rem;
}
.dept:hover { background: var(--bg); }
.dept.active { background: var(--accent-soft); }
.dept .chev { color: var(--muted); font-size: 0.85rem; text-align: right; white-space: nowrap; }
.dept:hover .chev { color: var(--accent); }
.dept.active .chev { color: var(--accent); font-weight: 600; }
.dept .name { font-weight: 600; }
.dept .name small { color: var(--muted); font-weight: 400; }

/* ----------------------------------------------------------- people ---- */
/* People: one department at a time, opened from the list above. */
.people-card { scroll-margin-top: 100px; outline: none; }
.people-card.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--woman), var(--shadow); } 100% { box-shadow: 0 0 0 4px transparent, var(--shadow); } }
.people-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.people-head h3 { font-size: 2rem; font-weight: 800; margin: 0; }
.people-head p { margin: 4px 0 0; }
.people-total { font-family: var(--serif); font-size: 1.3rem; color: var(--muted); }
.eyebrow { margin: 0 0 2px !important; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.people-bar { margin: 20px 0 10px; height: 16px; }
.people-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 8px; }
.people-legend .pl { font-size: 0.95rem; }
.people-legend .pl b { font-family: var(--serif); font-weight: 800; font-size: 1.5rem; margin-right: 2px; }
.pl.woman { color: var(--woman); }
.pl.man { color: var(--man); }
.pl.nonbinary { color: var(--nonbinary); }
.pl.unknown { color: var(--muted); }
.pl.unknown b { font-size: 1.15rem; }
.table-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 16px 0 8px; }
.why-cell { width: 1%; white-space: nowrap; }
.why-btn {
  font-size: 0.8rem; font-weight: 600; padding: 4px 12px; gap: 6px;
  background: var(--accent-soft); color: var(--accent);
}
.why-btn:hover { background: var(--woman); color: var(--fg); }
.why-btn[aria-expanded="true"] { background: var(--accent); color: #fff; }
/* The explanation opens as a full-width line under the person's row. */
.people tr.has-why td { border-bottom-color: transparent; }
.why-row td { padding-top: 0; }
.why-row:hover { background: none !important; }
.why { background: var(--bg); border-radius: 10px; padding: 10px 14px; font-size: 0.88rem; line-height: 1.5; }
.why .conf { margin-top: 2px; }
/* "Source" on wide screens; "More" (and the job, in the explanation) where the job column is hidden. */
.why-btn .lbl-narrow, .why-job, .why-label { display: none; }
.why-job { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px dashed var(--line); }
table.people { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.people th, .people td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.people th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .06em; }
.people tbody tr:hover { background: var(--bg); }
.people a { color: var(--fg); text-decoration-color: var(--focus); text-underline-offset: 3px; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--fill); box-shadow: inset 0 0 0 1px var(--edge); }
/* A name guess: outline only, so it never looks like a recorded gender. */
.dot.guess { background: transparent; box-shadow: inset 0 0 0 2px var(--fill); }
.conf { font-size: 0.8rem; color: var(--muted); }
.meter { display: inline-block; width: 46px; height: 6px; background: var(--line); border-radius: 3px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--focus); }

/* -------------------------------------------------------- settings ---- */
.scrim { position: fixed; inset: 0; background: rgba(59,37,48,.28); z-index: 30; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; width: min(400px, 92vw);
  background: var(--card); box-shadow: -16px 0 48px rgba(59,37,48,.18);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg); padding: 26px 28px; overflow-y: auto;
  transform: translateX(100%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s;
}
.drawer.open { transform: none; visibility: visible; transition: transform .25s ease; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { margin: 0; font-size: 1.7rem; }
.drawer-head .icon-btn { padding: 4px 12px; }
.setting { padding: 18px 0; border-top: 1px solid var(--line); }
.setting p { margin: 4px 0 12px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input { flex: 1; accent-color: var(--accent); }
.slider-row strong { font-family: var(--serif); font-size: 1.3rem; font-weight: 400; }
.scale { display: flex; justify-content: space-between; margin-top: 2px; font-size: 0.75rem; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 17px; height: 17px; }
.link-btn { background: none; color: var(--muted); padding: 8px 0; text-decoration: underline; font-weight: 400; }
.link-btn:hover { background: none; color: var(--accent); }

/* ----------------------------------------------------------- footer ---- */
/* Proper page footer: full-width band pinned to the bottom of short pages. */
.site-footer {
  margin-top: auto; border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .55); font-size: 0.87rem; color: var(--muted);
}
.footer-inner { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 32px; padding-top: 28px; padding-bottom: 32px; }
/* The two toggles stack on the left; the TMDB credit sits on the right. */
.footer-toggles { flex: 1 1 420px; display: grid; gap: 14px; justify-items: start; }
.footer-toggles .footer-about { width: 100%; }
.footer-about summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  color: var(--fg); font-weight: 600;
}
.footer-about summary::-webkit-details-marker { display: none; }
/* Same "+" as "How accurate is this?", turning into × when open. */
.footer-about summary::after { content: "+"; font-family: var(--sans); font-size: 1.1rem; color: var(--muted); transition: transform .2s; }
.footer-about[open]:not(.closing) summary::after { transform: rotate(45deg); }
.footer-about summary:hover { color: var(--accent); }
.footer-about ul { margin: 12px 0 4px; padding-left: 18px; max-width: 70ch; color: var(--fg); }
.footer-about li { margin-bottom: 8px; }
.footer-about .about-intro { margin: 12px 0 0; max-width: 70ch; color: var(--fg); }
/* flow-root keeps child margins inside, so the content measures the same during the open/close
   animation (clipped) as after it, and nothing snaps when the animation hands back to normal layout. */
.footer-about > summary + * { display: flow-root; }
.attribution { margin: 0; }
.footer-notes { flex: 0 1 360px; display: grid; gap: 10px; }
.footer-notes p { margin: 0; }
.footer-privacy p { margin: 8px 0 2px; color: var(--fg); }
.tmdb-logo { display: block; width: fit-content; margin-bottom: 6px; }
/* TMDB's logo used as a stencil, filled with the footer grey. 273.42 × 35.52 is the logo's own shape. */
.tmdb-mark {
  display: block; height: 14px; aspect-ratio: 273.42 / 35.52; background: var(--muted);
  -webkit-mask: url("/tmdb-logo.svg") center / contain no-repeat; mask: url("/tmdb-logo.svg") center / contain no-repeat;
}
.tmdb-logo:hover .tmdb-mark { background: var(--accent); }

@media (max-width: 900px) {
  .overall.card { grid-template-columns: 1fr; gap: 24px; }
  /* Poster fills the card width, with the same gap on the left, right and top. */
  .overall.card { padding: 26px; }
  .poster-col { max-width: none; margin: 0; }
  .film-head { text-align: center; }
}
@media (max-width: 720px) {
  header.top .wrap { gap: 12px; padding-left: 16px; padding-right: 16px; }
  .header-search-slot { flex: 1 1 150px; }
  .hero-search-slot input[type=search] { padding: 14px 20px; font-size: 1.05rem; }
  .hero-search-slot .icon-only { width: 52px; height: 52px; }
  .brand { flex-basis: 100%; }
  .home .brand { flex-basis: auto; }
  .film-head h2 { font-size: 2.3rem; }
  .overall-grid { grid-template-columns: 1fr 1fr; gap: 18px 24px; }
  .overall-grid .pie-fig { grid-column: 1 / -1; grid-row: 1; }
  .dept { grid-template-columns: 1fr; gap: 4px; }
  .people th:nth-child(2), .people td:nth-child(2) { display: none; }
  .why-btn .lbl-wide { display: none; }
  .why-btn .lbl-narrow { display: inline; }
  .why-job { display: block; }
  .why-label { display: inline; }
  .card { padding: 20px 18px; }
  .overall.card { padding: 20px; }
  /* Sturdier serif hairlines on small, high-density screens. */
  :root { --opsz-head: 9; --opsz-text: 6; --opsz-num: 7; }
  /* More breathing room between the headline figures and the crew count on phones. */
  .crew-count { margin-top: 28px; }
  .overall-grid .stat b { font-size: 3.6rem; }
}

/* --------------------------------------------- IMDb comparison (beta) ---- */
.source-toggle { display: inline-flex; gap: 4px; padding: 4px; margin-top: 12px; background: var(--bg); border-radius: 999px; }
.source-toggle button { background: none; color: var(--muted); font-size: 0.85rem; padding: 6px 14px; }
.source-toggle button[aria-checked="true"] { background: var(--card); color: var(--fg); box-shadow: 0 1px 4px rgba(59,37,48,.12); }
.source-toggle button:disabled { opacity: .5; cursor: progress; }
.source-toggle button:hover:not(:disabled):not([aria-checked="true"]) { color: var(--accent); background: none; }
.spinner.inline { display: inline-block; vertical-align: -3px; margin-right: 6px; color: var(--accent); }

.compare-card h3 { font-size: 1.8rem; font-weight: 800; }
.verdict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 14px 18px; border-radius: 14px; margin: 14px 0 18px; background: var(--bg); }
.verdict strong { font-family: var(--serif); font-size: 1.35rem; font-weight: 800; }
.verdict.worth { background: #fdeef6; }
.verdict.worth strong { color: var(--accent); }
.verdict.marginal { background: #fbf0dc; }
.verdict.not_worth { background: #eef4ef; }
.verdict.not_worth strong { color: #3d6b47; }
.verdict.too_small, .verdict.unknown { background: var(--bg); }
.compare-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.cmp { background: var(--bg); border-radius: 14px; padding: 14px 16px; }
.cmp .eyebrow { margin-bottom: 4px !important; }
.cmp > b { font-family: var(--serif); font-weight: 800; font-size: 2.2rem; line-height: 1; display: block; }
.cmp > span { color: var(--muted); font-size: 0.85rem; }
.cmp p { margin: 8px 0 0; }
.cmp-share { font-weight: 600; }
.cmp-details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.cmp-details summary { cursor: pointer; font-family: var(--serif); font-weight: 700; font-size: 1.05rem; color: var(--accent); }
.table-scroll { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 8px; }
.cmp-table th, .cmp-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.cmp-table th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.cmp-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cmp-table tr.notable td { background: #fdf4f9; }
.flag-dot { color: var(--woman); font-size: 0.7rem; }
@media (max-width: 720px) { .compare-grid { grid-template-columns: 1fr; } }

/* IMDb example page */
.example-banner {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  margin-top: 30px; padding: 18px 22px; border-radius: var(--radius-lg);
  background: var(--accent-soft); color: var(--fg);
}
.example-banner p { margin: 0; }
.example-banner .eyebrow { color: var(--accent); }
.example-exit { flex: none; font-weight: 700; color: var(--accent); white-space: nowrap; }
.why-list { padding-left: 18px; margin: 6px 0; }
.why-list li { margin-bottom: 6px; }
.example-link { font-weight: 700; }
@media (max-width: 720px) { .example-banner { flex-direction: column; gap: 8px; } }

/* Recently viewed (home page) */
.recent { max-width: 760px; margin: 56px auto 0; text-align: left; }
.recent-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.recent-head h3 { font-size: 1.3rem; margin: 0; }
.recent-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 16px; }
.recent-item { display: flex; flex-direction: column; gap: 4px; color: var(--fg); text-decoration: none; }
.recent-item img, .recent-item .ph {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--line);
  box-shadow: 0 6px 18px rgba(40,20,28,.18); transition: transform .15s, box-shadow .15s;
}
/* Films with no poster on TMDB get the stand-in artwork (after the rules above, which set a plain background). */
.results .ph, .recent-item .ph { background: url(poster-fallback.svg) center / cover, var(--line); }
.recent-item:hover .ph, .recent-item:focus-visible .ph { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(40,20,28,.25); }
.recent-item:hover img, .recent-item:focus-visible img { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(40,20,28,.25); }
.recent-title { font-family: var(--serif); font-weight: 700; font-size: 0.95rem; line-height: 1.2; margin-top: 6px; }
.recent-year { font-size: 0.8rem; color: var(--muted); }
