/* Movies: stats, poster wall and year in review. Tokens come from site.css. */

.movies {
  --slant: clamp(28px, 5vw, 64px);
  padding-bottom: 3rem;
}

.cap {
  font-size: 0.8125rem;
  line-height: 1.45;
  font-weight: 500;
  color: var(--ink-2);
}

.movies a:not(.btn) {
  color: var(--action);
}

/* Heading, year chips, tabs */
.mv-head {
  display: grid;
  gap: 16px;
  padding-block: 32px 8px;
}

.mv-head h1 {
  font: 400 clamp(1.8rem, 4vw, 2.6rem) / 1.1 var(--font-display);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink);
  font: 500 0.9375rem var(--font-body);
  text-decoration: none;
  transition:
    background-color var(--t-state) var(--ease),
    border-color var(--t-state) var(--ease);
}

.movies a.chip-btn {
  color: var(--ink);
}

.chip-btn:hover {
  border-color: var(--action);
}

.chip-btn[aria-current="page"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.movies a.chip-btn[aria-current="page"] {
  color: var(--bg);
}

.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 10px 0;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.mv-main {
  display: grid;
  gap: 24px;
  padding-top: 24px;
}

/* Key numbers */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.kpis > div {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 16px 18px;
  border-radius: var(--r-control);
  background: var(--surface);
}

.kpis dt {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
}

.kpis dd {
  margin: 0;
  font: 400 clamp(1.5rem, 3vw, 2rem) / 1.1 var(--font-display);
}

@media (max-width: 720px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Panels */
.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}

.panel {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  padding: 20px;
  border-radius: var(--r-control);
  background: var(--surface);
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel h2,
.rv-block h2 {
  font: 400 1.25rem / 1.2 var(--font-display);
}

.runtimes {
  display: grid;
  gap: 4px;
}

.runtimes p {
  margin: 0;
}

/* Charts */
.hbars {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hbars .row {
  display: grid;
  grid-template-columns: minmax(5rem, 9.5rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
}

.hbars .lab {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbars .bar {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}

.hbars rect {
  fill: var(--action);
}

.hbars .n {
  min-width: 2ch;
  text-align: right;
  font-weight: 600;
}

.hbars .note {
  font-weight: 400;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.vbars {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
}

.vbars rect {
  fill: var(--action);
}

.vbars text {
  fill: var(--ink-2);
  font-family: var(--font-body);
}

.vbars .v {
  fill: var(--ink);
  font-size: 7px;
  font-weight: 600;
}

.vbars .l {
  font-size: 7px;
}

.vbars .y {
  fill: var(--ink);
  font-size: 8px;
  font-weight: 600;
}

.vbars .sep {
  stroke: var(--line);
  stroke-width: 0.6;
}

/* Click a row or bar to list its films */
.hbars .row {
  padding: 4px 6px;
  border-radius: var(--r-control);
}

.hbars button.row {
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}

.hbars button.row:hover,
.hbars button.row[aria-expanded="true"] {
  background: var(--bg);
}

.hbars button.row[aria-expanded="true"] rect {
  fill: var(--accent);
}

.hbars li:has(.drill) {
  padding-bottom: 4px;
}

.vbars [role="button"] {
  cursor: pointer;
  outline: none;
}

.vbars rect.hit {
  fill: transparent;
}

.vbars [role="button"]:hover rect:not(.hit) {
  opacity: 0.8;
}

.vbars [role="button"][aria-expanded="true"] rect:not(.hit) {
  fill: var(--accent);
}

.vbars [role="button"]:focus-visible .hit {
  stroke: var(--ink);
  stroke-width: 0.8;
}

.drill {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--r-control);
  background: var(--bg);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 14px 12px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: grid;
  gap: 3px;
  align-content: start;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tile .thumb {
  display: block;
  aspect-ratio: 2 / 3;
  border-radius: var(--r-photo);
  overflow: hidden;
  background: var(--surface);
}

.tile .tt {
  margin-top: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
}

.tile .ts {
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--ink-2);
}

.tile:hover .tt,
.tile:focus-visible .tt {
  text-decoration: underline;
}

/* Poster wall */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px 16px;
  padding: 18px;
  border-radius: var(--r-control);
  background: var(--surface);
}

.field {
  display: grid;
  gap: 4px;
}

.field label {
  font-weight: 500;
  font-size: 0.9375rem;
}

.field input[type="search"] {
  background: var(--bg);
}

.select {
  position: relative;
}

.select::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 1.5px solid var(--ink-2);
  border-bottom: 1.5px solid var(--ink-2);
  transform: rotate(45deg);
  pointer-events: none;
}

.select select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 2.5rem 0.7rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-control);
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem var(--font-body);
  cursor: pointer;
}

.select select:hover {
  border-color: var(--sea);
}

.posters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.poster {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  border-radius: var(--r-photo);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--t-state) var(--ease);
}

.poster:hover {
  transform: translateY(-2px);
}

.poster img,
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.noposter {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font: 400 0.9375rem / 1.25 var(--font-display);
  text-align: center;
}

.badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--mass);
  color: var(--on-mass);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
}

.badge.re {
  left: auto;
  right: 6px;
  background: var(--amber);
  color: var(--cliff);
}

.more {
  text-align: center;
}

/* Film detail */
dialog {
  width: min(100% - 2rem, 46rem);
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: var(--r-control);
  background: var(--bg);
  color: var(--ink);
  overflow: auto;
}

dialog::backdrop {
  background: rgb(18 19 16 / 0.7);
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.detail .thumb {
  aspect-ratio: 2 / 3;
  border-radius: var(--r-photo);
  overflow: hidden;
  background: var(--surface);
}

.detail h2 {
  font: 400 1.6rem / 1.15 var(--font-display);
}

.detail .facts {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  font-size: 0.9375rem;
}

.detail .rating {
  font: 400 1.4rem / 1 var(--font-display);
  color: var(--accent);
}

.detail .close {
  position: absolute;
  top: 8px;
  right: 8px;
}

.detail .review {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail .review p + p {
  margin-top: 0.75em;
}

.detail summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--action);
}

.detail .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail .tags li {
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 0.8125rem;
}

@media (max-width: 560px) {
  .detail {
    grid-template-columns: 1fr;
  }

  .detail .thumb {
    width: 140px;
  }
}

/* Year in review */
.hero {
  clip-path: polygon(0 var(--slant), 100% 0, 100% 100%, 0 100%);
  margin-top: 16px;
  padding: calc(var(--slant) + 24px) 0 48px;
}

.hero .label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-mass-2);
}

.hero .yr {
  margin-top: 4px;
  font: 400 clamp(5rem, 22vw, 11rem) / 1 var(--font-display);
  color: var(--sand);
}

.big {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 24px;
  margin: 24px 0 0;
}

.big dt {
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--on-mass-2);
}

.big dd {
  margin: 4px 0 0;
  font: 400 clamp(1.6rem, 4vw, 2.4rem) / 1.15 var(--font-display);
  overflow-wrap: anywhere;
}

.rv-block {
  display: grid;
  gap: 16px;
  padding-top: 40px;
}

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 120px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fig {
  display: grid;
  gap: 8px;
  align-content: start;
  margin: 0;
}

.fig .thumb {
  aspect-ratio: 2 / 3;
  border-radius: var(--r-photo);
  overflow: hidden;
  background: var(--surface);
}

.bookends {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}

.bookends .fig {
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.bookends figcaption {
  display: grid;
  gap: 4px;
}

.bookends .label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
}

.share .card {
  width: min(100%, 320px);
  height: auto;
  border-radius: var(--r-photo);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
}

.mini {
  min-height: 36px;
  padding: 0.5rem 0.8rem;
  font-size: 0.8125rem;
}

.tmdb {
  padding-top: 40px;
  max-width: var(--measure);
  margin-inline: auto;
  text-align: center;
}
