:root {
  --bg: #f4f2ee;
  --paper: #fbfaf8;
  --ink: #111111;
  --ink-2: #4a4945;
  --muted: #8a8780;
  --line: #dcd9d2;
  --line-2: #e9e6e0;
  --accent: #ff4612;
  --accent-soft: #ffe3d8;
  --land: #e4e1da;
  --display: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 3.2vw, 48px);
  --radius: 2px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 150px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
code { font-size: .9em; background: var(--line-2); padding: 1px 5px; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 24px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font: 900 20px/1 var(--display); letter-spacing: -.02em; text-decoration: none; }
.topnav { display: flex; gap: 20px; }
.topnav a { text-decoration: none; font: 500 13px/1 var(--display); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.topnav a:hover { color: var(--ink); }
.refresh { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.updated { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.btn {
  border: 1px solid var(--ink); background: transparent; padding: 9px 16px; cursor: pointer;
  font: 600 12px/1 var(--display); text-transform: uppercase; letter-spacing: .08em; border-radius: 999px;
  transition: background .15s, color .15s;
}
.btn--ink { background: var(--ink); color: var(--bg); }
.btn--ink:hover { background: var(--accent); border-color: var(--accent); }
.btn--ghost:hover { background: var(--ink); color: var(--bg); }
.btn[disabled] { opacity: .5; cursor: progress; }
.btn.is-busy::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }

/* ---------- hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--gutter);
  padding: clamp(32px, 6vw, 90px) var(--gutter) clamp(28px, 4vw, 56px);
  align-items: end;
}
.mega {
  margin: 0; font: 900 clamp(84px, 19vw, 300px)/.8 var(--display);
  letter-spacing: -.055em; text-transform: uppercase;
}
.lede { font: 500 clamp(18px, 1.8vw, 26px)/1.25 var(--display); letter-spacing: -.01em; margin: 0 0 32px; max-width: 30ch; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.stat { padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
.stat:nth-child(3n+2), .stat:nth-child(3n+3) { padding-left: 14px; border-left: 1px solid var(--line); }
.stat b { display: block; font: 800 clamp(28px, 3.4vw, 48px)/1 var(--display); letter-spacing: -.03em; }
.stat span { font: 500 11px/1 var(--display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

/* ---------- filters */
.filters {
  position: sticky; top: var(--topbar, 61px); z-index: 900;
  background: var(--bg); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line);
  padding: 12px var(--gutter);
}
.filters__row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font: 600 10px/1 var(--display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.field select, .field input {
  appearance: none; -webkit-appearance: none;
  border: 0; border-bottom: 1px solid var(--ink); background: transparent; border-radius: 0;
  padding: 6px 22px 6px 0; min-width: 130px; max-width: 220px;
  font: 600 14px/1.2 var(--display); text-transform: uppercase; letter-spacing: .02em;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 9px) 55%, calc(100% - 4px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
  cursor: pointer;
}
.field select:focus, .field input:focus { outline: none; border-bottom-color: var(--accent); }
.field--year input { min-width: 0; width: 76px; padding-right: 0; }
.field--search { flex: 1 1 160px; }
.field--search input { max-width: none; width: 100%; text-transform: none; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; }
.field--inline select { min-width: 0; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:not(:empty) { margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border-radius: 999px;
  background: var(--ink); color: var(--bg); border: 0; cursor: pointer;
  font: 600 11px/1 var(--display); text-transform: uppercase; letter-spacing: .08em;
}
.chip i { font-style: normal; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); }
.chip:hover { background: var(--accent); }

/* ---------- sections */
.section { padding: clamp(40px, 6vw, 88px) var(--gutter) 0; }
.section__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 32px; margin-bottom: 22px; border-bottom: 1px solid var(--ink); padding-bottom: 12px; }
.h2 { margin: 0; font: 900 clamp(44px, 8vw, 120px)/.85 var(--display); letter-spacing: -.05em; text-transform: uppercase; }
.h2 .count { font-size: .32em; letter-spacing: -.01em; vertical-align: top; color: var(--accent); }
.h3 { margin: 0 0 8px; font: 800 28px/1 var(--display); text-transform: uppercase; letter-spacing: -.02em; }
.section__note { margin: 0; max-width: 46ch; color: var(--ink-2); font-size: 14px; }

/* ---------- map */
.map-wrap { position: relative; height: min(calc(100vh - 230px), 720px); min-height: 420px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
#map { position: absolute; inset: 0; background: var(--paper); }
.leaflet-container { font-family: var(--body); background: var(--paper); }
.leaflet-control-zoom a { border-radius: 0 !important; color: var(--ink); }
.leaflet-tooltip.km-tip {
  background: var(--ink); color: var(--bg); border: 0; border-radius: 0; box-shadow: none;
  font: 700 12px/1.2 var(--display); text-transform: uppercase; letter-spacing: .06em; padding: 6px 9px;
}
.leaflet-tooltip.km-tip::before { display: none; }
.km-poster { border: 0; background: none; }
.km-poster div {
  width: 100%; height: 100%; background: #ccc center/cover no-repeat; box-shadow: 0 1px 4px rgba(0,0,0,.25);
  outline: 2px solid var(--paper); transition: transform .12s;
}
.km-poster:hover div { transform: scale(1.6); z-index: 2; position: relative; }
.km-label { background: none; border: 0; }
.km-label span {
  display: inline-block; transform: translate(-50%, -50%); white-space: nowrap;
  font: 800 11px/1 var(--display); text-transform: uppercase; letter-spacing: .06em; color: var(--ink);
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper);
}
.map-side {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 88%); z-index: 500;
  background: var(--paper); border-left: 1px solid var(--ink); overflow-y: auto; padding: 20px;
}
.map-side h3 { margin: 0; font: 900 40px/.9 var(--display); text-transform: uppercase; letter-spacing: -.04em; }
.map-side .side-actions { display: flex; gap: 8px; margin: 14px 0 18px; }
.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 400; background: var(--paper); padding: 8px 10px; border: 1px solid var(--line);
  font: 600 10px/1 var(--display); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2);
}
.map-legend .ramp { display: flex; margin: 6px 0 4px; }
.map-legend .ramp i { width: 22px; height: 8px; }
.map-legend .ends { display: flex; justify-content: space-between; }

/* ---------- panels */
.panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 0; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.panel { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 18px 14px; display: flex; flex-direction: column; min-height: 420px; background: var(--bg); }
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.panel__title { margin: 0; font: 900 34px/.9 var(--display); text-transform: uppercase; letter-spacing: -.04em; }
.panel__total { font: 700 12px/1 var(--display); color: var(--accent); letter-spacing: .04em; }
.panel__tools { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.panel .panel__tools { margin: 14px 0 8px; }
.panel .panel__tools input, .panel .panel__tools select {
  border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 5px 0; font: 500 13px/1.2 var(--body); border-radius: 0;
}
.panel .panel__tools input { flex: 1; min-width: 0; }
.panel .panel__tools input:focus, .panel .panel__tools select:focus { outline: none; border-bottom-color: var(--ink); }
.rows { list-style: none; margin: 0; padding: 0; flex: 1; }
.rowi {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: baseline;
  padding: 7px 0 7px; border-bottom: 1px solid var(--line-2); cursor: pointer;
}
.rowi:hover .rowi__name { color: var(--accent); }
.rowi.is-active .rowi__name { color: var(--accent); }
.rowi__name { font: 600 14px/1.2 var(--display); text-transform: uppercase; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowi__name em { font-style: normal; color: var(--muted); font-weight: 500; }
.rowi__meta { font: 500 12px/1 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.rowi__bar { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--ink); }
.panel__foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.linkbtn { border: 0; background: none; padding: 0; cursor: pointer; font: 600 11px/1 var(--display); text-transform: uppercase; letter-spacing: .1em; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--accent); }
.empty { color: var(--muted); padding: 20px 0; font-size: 14px; }

/* ---------- films */
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; font: 600 11px/1 var(--display); text-transform: uppercase; letter-spacing: .08em; }
.seg button.is-on { background: var(--ink); color: var(--bg); }
.films.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 28px 18px; }
.card { cursor: pointer; border: 0; background: none; padding: 0; text-align: left; }
.card__img { aspect-ratio: 2/3; background: var(--line) center/cover no-repeat; position: relative; overflow: hidden; }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .card__img img { transform: scale(1.04); }
.card__badge { position: absolute; top: 6px; left: 6px; background: var(--ink); color: var(--bg); font: 700 10px/1 var(--display); padding: 4px 5px; letter-spacing: .04em; }
.card__title { margin-top: 8px; font: 700 13px/1.15 var(--display); text-transform: uppercase; letter-spacing: .01em; }
.card__sub { font: 500 12px/1.3 var(--body); color: var(--muted); margin-top: 2px; }
.films.list { border-top: 1px solid var(--line); }
.lrow { display: grid; grid-template-columns: 44px minmax(0, 2.2fr) minmax(0, 1.2fr) 56px 56px 56px; gap: 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.lrow:hover .lrow__t { color: var(--accent); }
.lrow img { width: 44px; height: 66px; object-fit: cover; background: var(--line); }
.lrow__t { font: 700 15px/1.15 var(--display); text-transform: uppercase; }
.lrow__t em { font-style: normal; font-weight: 500; color: var(--muted); }
.lrow__d { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow__n { font: 700 14px/1 var(--display); text-align: right; font-variant-numeric: tabular-nums; }
.lrow__n small { display: block; font: 500 9px/1.4 var(--display); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.lhead { cursor: default; border-bottom: 1px solid var(--ink); }
.more { text-align: center; padding: 32px 0 0; }

/* ---------- modal */
.modal {
  width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 0;
  background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
.modal--small { width: min(560px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(244, 242, 238, .78); backdrop-filter: blur(4px); }
.modal__close { position: sticky; float: right; top: 0; margin: 10px 10px 0 0; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--ink); background: var(--paper); font-size: 22px; line-height: 1; cursor: pointer; }
.modal__close:hover { background: var(--ink); color: var(--paper); }
.modal__body { padding: clamp(20px, 3.4vw, 40px); }
.stack { display: grid; gap: 14px; margin: 18px 0; }
.stack .field input { max-width: none; text-transform: none; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }

.film { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); }
.film__poster { aspect-ratio: 2/3; background: var(--line) center/cover; }
.film__poster img { width: 100%; height: 100%; object-fit: cover; }
.eyebrow { font: 600 11px/1.3 var(--display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.eyebrow a { color: var(--accent); text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.film__title { margin: 6px 0 4px; font: 900 clamp(36px, 5vw, 64px)/.88 var(--display); text-transform: uppercase; letter-spacing: -.045em; }
.film__orig { font: 500 16px/1.3 var(--display); color: var(--ink-2); margin-bottom: 10px; }
.ratings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); margin: 20px 0; }
.ratings > div { padding: 10px 10px 8px 0; border-bottom: 1px solid var(--line); }
.ratings > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.ratings b { display: block; font: 800 30px/1 var(--display); letter-spacing: -.03em; }
.ratings b small { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.ratings span { font: 600 10px/1.3 var(--display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.ratings .mine b { color: var(--accent); }
.stars { color: var(--accent); letter-spacing: 1px; font-size: 13px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 16px; margin: 16px 0; font-size: 14px; }
.kv dt { font: 600 10px/1.9 var(--display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.kv dd { margin: 0; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; margin: 0 4px 4px 0; font: 600 11px/1.3 var(--display); text-transform: uppercase; letter-spacing: .06em; background: none; cursor: pointer; }
.tag:hover { border-color: var(--ink); }
.tag--accent { background: var(--accent); color: #fff; border-color: var(--accent); cursor: default; }
.plink { border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; font: inherit; }
.plink:hover { color: var(--accent); text-decoration-color: var(--accent); }
.synopsis { font: 400 16px/1.55 var(--body); max-width: 62ch; color: var(--ink-2); }
.tagline { font: 600 18px/1.3 var(--display); margin: 0 0 8px; }
.outlinks { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.outlinks a { text-decoration: none; }
.person__films { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 20px 14px; margin-top: 20px; }

/* ---------- toast + footer */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 3000;
  background: var(--ink); color: var(--bg); padding: 12px 18px; font: 600 13px/1.35 var(--display); max-width: min(560px, calc(100vw - 32px));
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.footer { padding: 120px var(--gutter) 40px; }
.footer__big { font: 900 clamp(70px, 22vw, 340px)/.78 var(--display); letter-spacing: -.06em; color: var(--line); user-select: none; }
.footer p { color: var(--muted); font-size: 13px; margin-top: 20px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .filters { position: static; }
  .film { grid-template-columns: 1fr; }
  .film__poster { max-width: 220px; }
  .ratings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ratings > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .lrow { grid-template-columns: 40px minmax(0, 1fr) 48px 48px; }
  .lrow__d, .lrow .hide-sm { display: none; }
  .filters__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
  .field select, .field input { min-width: 0; max-width: none; width: 100%; }
  .field--year input { width: 100%; }
  .field--search { grid-column: 1 / -1; }
  .panel { min-height: 0; }
  .updated { display: none; }
}
