/* Watch's pages, after player.css: the hero, the rows of tiles, the player, My List and the trailer
   button; a title's own page is title.css. Tokens are in app.css; the art sits on the stage
   tokens, dark in both themes. */

/* ---------- The hero ---------- */

/* Full width over the page's padding, art behind, the words lower left on a fade to the stage.
   Inside it the page's tokens take the stage's values, so buttons and focus rings read on it. */
.hero {
  --text: var(--stage-text);
  --muted: var(--stage-muted);
  --line-strong: var(--stage-line);
  --surface-raised: var(--stage-raised);
  --accent: var(--stage-accent);
  --accent-ink: var(--stage-accent-ink);
  color-scheme: dark;
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  min-height: min(34rem, 72vh);
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) 0;
  overflow: hidden;
  color: var(--text);
  background: var(--stage);
}
.hero-art { position: absolute; inset: 0; z-index: -1; }
.hero-picture { width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.hero-picture.shown { opacity: 1; }
/* A pick's trailer over its backdrop, under the scrim; never a target of its own. */
.hero-trailer-picture { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; pointer-events: none; }
.hero-trailer { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.hero-trailer[hidden] { display: none; }
.hero-trailer-button { gap: var(--space-2); min-height: 2rem; padding-block: 0; font-size: var(--step--1); }
.hero-trailer-button svg { width: 1rem; height: 1rem; fill: currentColor; }
/* A scrim, so the words keep their contrast over any art. */
.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, var(--stage) 0%, color-mix(in srgb, var(--stage) 72%, transparent) 38%, transparent 72%), /* check-ui: ignore a scrim for the words over art, not decoration */
    linear-gradient(to top, var(--stage) 0%, transparent 55%); /* check-ui: ignore a scrim for the words over art, not decoration */
}
.hero-body {
  display: grid;
  justify-items: start;
  gap: var(--space-3);
  width: min(100%, 38rem);
  padding: var(--space-8) var(--space-5) var(--space-5);
}
.hero-kicker { margin: 0; color: var(--muted); font-size: var(--step--1); font-weight: 600; }
.hero-kicker:empty { display: none; }
.hero-title { font-size: var(--step-4); line-height: 1.05; overflow-wrap: anywhere; }
.hero-logo { max-width: min(22rem, 100%); max-height: 7.5rem; object-fit: contain; object-position: left bottom; }
.hero-facts { margin: 0; color: var(--muted); font-size: var(--step--1); }
.hero-logline {
  margin: 0;
  max-width: 34rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero .actions { gap: var(--space-2); }
.hero-placeholder { min-height: min(34rem, 72vh); margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-5); border-radius: 0; }

/* Buttons with an icon before their words: Play, My List. */
.hero-play, .my-list { gap: var(--space-2); }
.hero-play svg, .my-list svg { width: 1.125rem; height: 1.125rem; fill: currentColor; }
.my-list svg.lines { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.my-list .mark { display: inline-flex; }
.my-list[aria-pressed="true"] { border-color: var(--accent); }
.hero-play[aria-disabled="true"] { opacity: 0.6; cursor: progress; }

/* Stepping between picks: previous, a dot each (the current one longer as well as brass), next,
   and Pause. */
.hero-steps { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); margin-block-start: var(--space-2); }
.hero-dots { display: flex; }
.hero-dot { min-height: 0; width: 1.75rem; height: 1.75rem; padding: 0; background: none; border: 0; }
.hero-dot span { display: block; width: 1.125rem; height: 3px; margin-inline: auto; border-radius: 2px; background: var(--line-strong); }
.hero-dot[aria-current="true"] span { width: 1.5rem; height: 5px; background: var(--accent); }
.hero-step svg { width: 1.25rem; height: 1.25rem; }
.hero-pause { min-height: 2rem; padding-block: 0; margin-inline-start: var(--space-2); font-size: var(--step--1); }
.hero-pause[aria-pressed="true"] { border-color: var(--accent); }

/* ---------- Rows of tiles ---------- */

.watch-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); margin-block-start: var(--space-5); }
.watch-row + .watch-row { margin-block-start: 0; }
.watch-row .section-head { margin-block-end: var(--space-1); }
.watch-row h2 { font-size: var(--step-1); }
/* One row each, scrolled sideways; the room above lets a lifted tile show whole. */
.watch-shelf {
  list-style: none;
  margin: 0;
  padding: var(--space-2) var(--space-1) var(--space-3);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(9.5rem, 38vw);
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--space-1);
}
.watch-shelf.wide { grid-auto-columns: min(17rem, 72vw); }
.watch-shelf > li { min-width: 0; scroll-snap-align: start; }

.tile { position: relative; display: grid; gap: var(--space-2); color: inherit; text-decoration: none; border-radius: var(--radius-m); }
/* Hover and focus lift a tile a little; it never grows, so nothing beside it moves. */
.tile:hover, .tile:focus-visible { translate: 0 calc(-1 * var(--space-1)); }
.tile:hover .clip { text-decoration: underline; }
@media (prefers-reduced-motion: no-preference) {
  .tile { transition: translate 0.15s ease; }
  .hero-picture { transition: opacity 0.4s ease; }
}
.tile-art {
  display: grid;
  align-items: end;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}
.tile-art.wide { aspect-ratio: 16 / 9; }
.tile-art img { width: 100%; height: 100%; object-fit: cover; }
.tile-fallback { padding: var(--space-3); font-weight: 600; overflow-wrap: anywhere; }
/* One badge a tile, an opaque chip so it reads over any art. */
.tile-badge {
  position: absolute;
  inset: var(--space-2) auto auto var(--space-2);
  padding: 0 var(--space-2);
  border-radius: 999px;
  background: var(--stage);
  color: var(--stage-text);
  font-size: var(--step--1);
  font-weight: 600;
}
/* A grid's cards wear it over their poster's corner too. */
.card { position: relative; }
/* The hero's, at the end of its facts: brass, as the stage is the chip's own colour. */
.hero-facts .hero-badge {
  padding: 0 var(--space-2);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
/* How far through: the bar on its track, so the end shows. */
.tile-progress { display: block; height: 4px; margin-block-start: calc(-1 * var(--space-1)); border-radius: 2px; overflow: hidden; background: var(--line); }
.tile-progress span { display: block; height: 100%; background: var(--accent); }
.tile > .clip, .tile-caption { font-size: var(--step--1); }
.tile-caption { display: flex; justify-content: space-between; gap: var(--space-2); min-width: 0; }
.tile-caption > .clip:first-child { flex: 1; }
.tile-caption > .clip + .clip { max-width: 45%; color: var(--muted); }
.tile-note { flex: none; color: var(--muted); }
/* Under a tile that plays: its title's page, small and quiet, with room for a finger. */
.tile-open { display: inline-block; margin-block-start: var(--space-1); min-height: 24px; color: var(--muted); font-size: var(--step--1); }
.tile-open:hover { color: inherit; }
/* Why the AI picked it: three lines at most, all of it on hover. */
.tile-reason {
  color: var(--muted);
  font-size: var(--step--1);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.more-like-this { margin-block-start: var(--space-6); }
.more-like-this:empty { display: none; }

@media (max-width: 40rem) {
  .hero, .hero-placeholder { margin-inline: calc(-1 * var(--space-4)); margin-block-start: calc(-1 * var(--space-4)); }
  .hero { min-height: 30rem; }
  .hero-body { padding: var(--space-7) var(--space-4) var(--space-4); }
  .hero-title { font-size: var(--step-3); }
  .hero-logo { max-height: 5rem; }
  .hero-art::after { background: linear-gradient(to top, var(--stage) 0%, color-mix(in srgb, var(--stage) 80%, transparent) 45%, transparent 85%); } /* check-ui: ignore a scrim for the words over art, not decoration */
}

/* ---------- Shows, Anime and Movies ---------- */

/* The whole list, after the rows. */
.watch-rows + .everything, .hero + .everything { margin-block-start: var(--space-7); }
.everything > h2 { font-size: var(--step-2); }

/* ---------- The player ---------- */

/* What floats over the picture, in full screen too: Skip at the lower right, above the
   controls, and the next episode's card beside it. Only the buttons take clicks. */
.stage { position: relative; overflow: hidden; background: var(--stage); }
.stage video { display: block; }
.stage:fullscreen { display: grid; place-items: center; border-radius: 0; }
.stage:fullscreen video { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
/* Text subtitles at the size chosen in the Subtitles panel, against the browser's own (Medium);
   styled ones are scaled as they're drawn. */
.stage video[data-subtitle-size="small"]::cue { font-size: 75%; }
.stage video[data-subtitle-size="large"]::cue { font-size: 130%; }
.stage video[data-subtitle-size="extra-large"]::cue { font-size: 160%; }
.stage-over {
  position: absolute;
  inset: auto var(--space-4) 7rem auto;
  transition: bottom 0.2s ease;
  display: grid;
  justify-items: end;
  gap: var(--space-3);
  max-width: calc(100% - 2 * var(--space-4));
  pointer-events: none;
}
.stage-over > * { pointer-events: auto; }
.stage .skip-parts { margin: 0; min-height: 0; }
.skip-parts button {
  background: var(--stage-text);
  color: var(--stage);
  border-color: var(--stage-text);
  box-shadow: var(--shadow);
}
.up-next-card {
  --text: var(--stage-text);
  --muted: var(--stage-muted);
  --line-strong: var(--stage-line);
  --surface-raised: var(--stage-raised);
  --accent: var(--stage-accent);
  --accent-ink: var(--stage-accent-ink);
  width: min(22rem, 100%);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  background: var(--stage);
  border: 1px solid var(--stage-line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow);
}
.up-next-card p { margin: 0; }
.up-next-label { color: var(--muted); font-size: var(--step--1); }
.up-next-card .up-next-title { font-weight: 600; margin-block: var(--space-1) var(--space-3); overflow-wrap: anywhere; }
.up-next-card .actions { gap: var(--space-2); }

/* Melete's own controls over the picture: a scrim along the bottom with the seek bar and a row
   of buttons, a play button in the middle while paused, and a spinner while waiting. They fade
   while the video plays and nothing happens (.idle), and Skip comes down with them. */
.player-chrome { --text: var(--stage-text); --muted: var(--stage-muted); color: var(--stage-text); }
.control-bar {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--space-7) var(--space-3) var(--space-2);
  background: linear-gradient(to top, color-mix(in srgb, var(--stage) 88%, transparent), transparent); /* check-ui: ignore a scrim so the controls read over any picture */
  transition: opacity 0.2s ease;
}
.control-bar .scrub-wrap { margin: 0 var(--space-1) var(--space-1); }
.control-row { display: flex; align-items: center; gap: var(--space-1); }
.control-gap { flex: 1; }
button.control {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--stage-text);
  border: 0;
  border-radius: var(--radius-s);
}
button.control:hover, button.control[aria-expanded="true"] { background: var(--stage-raised); }
button.control svg { width: 1.5rem; height: 1.5rem; }
.volume { width: 6rem; accent-color: var(--stage-accent); }
.control-time { padding-inline: var(--space-2); font-size: var(--step--1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage-play {
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  width: 4.5rem;
  height: 4.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--stage-text);
  background: color-mix(in srgb, var(--stage) 70%, transparent);
  border: 1px solid var(--stage-line);
  border-radius: 50%;
}
.stage-play svg { width: 2.25rem; height: 2.25rem; fill: currentColor; }
.stage-waiting {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 3rem;
  height: 3rem;
  margin: -1.5rem 0 0 -1.5rem;
  border: 3px solid var(--stage-line);
  border-top-color: var(--stage-accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  display: none;
}
.stage.waiting .stage-waiting { display: block; }
.stage.waiting .stage-play { display: none; }
@keyframes spin { to { rotate: 1turn; } }
.stage.idle { cursor: none; }
.stage.idle .control-bar { opacity: 0; pointer-events: none; }
.stage.idle .stage-over { bottom: var(--space-6); }

/* A panel opens above the bar's right end: the page's own pickers, on the stage's colours. */
.control-panels { position: absolute; inset: auto var(--space-3) calc(100% - var(--space-5)) auto; }
.control-panel {
  --text: var(--stage-text);
  --muted: var(--stage-muted);
  --line-strong: var(--stage-line);
  --surface-raised: var(--stage-raised);
  /* Its pickers on the stage's raised grey, so their light text reads. */
  --surface: var(--stage-raised);
  --accent: var(--stage-accent);
  --accent-ink: var(--stage-accent-ink);
  width: min(20rem, calc(100vw - 2 * var(--space-4)));
  max-height: min(60vh, 24rem);
  overflow-y: auto;
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  background: var(--stage);
  border: 1px solid var(--stage-line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow);
}
/* Never past the top of the picture, which would cut it off: the stage is its video's 16:9 (or
   less on a short window), and the panel starts 7.5rem above its foot. Past that it scrolls. */
.stage { container-type: inline-size; }
.control-panel { max-height: min(60vh, 24rem, calc(min(56.25cqi, 100vh - 18rem) - 8rem)); }
.stage:fullscreen .control-panel { max-height: min(60vh, 24rem); }
.control-panel-title { margin: 0; font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.control-panel label { display: block; margin-block-end: var(--space-1); }
.control-panel select { width: 100%; }
.control-panel .subtitle-chips { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .control-bar, .stage-over { transition: none; }
  .stage-waiting { animation-duration: 3s; }
}
@media (max-width: 40rem) {
  .volume, button.control.control-wide { display: none; }
  .stage-play { width: 3.25rem; height: 3.25rem; }
  .stage-play svg { width: 1.6rem; height: 1.6rem; }
  .control-bar { padding-inline: var(--space-1); }
  .control-time { padding-inline: var(--space-1); }
}

/* The seek bar's track carries a tick at each chapter and the credits as a band. */
.scrub-track { position: relative; }
.scrub-marks { position: absolute; inset: 0; pointer-events: none; }
.scrub-tick { position: absolute; top: 15%; bottom: 15%; width: 2px; margin-inline-start: -1px; background: var(--text); opacity: 0.7; }
.scrub-credits { position: absolute; top: 35%; bottom: 35%; background: var(--state-coming); opacity: 0.6; border-radius: 2px; }
.scrub-preview { min-width: 4rem; }

/* Subtitle chips under the seek bar: the one showing pressed, filled brass. */
.subtitle-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block: var(--space-2) 0; }
.chip {
  min-height: 2rem;
  padding: 0 var(--space-3);
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: var(--step--1);
  font-weight: 400;
}
.chip:hover { background: var(--surface-raised); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.player-end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

@media (max-width: 40rem) {
  .stage-over { inset: auto var(--space-2) 6rem auto; }
  .up-next-card { padding: var(--space-2) var(--space-3); }
}

/* ---------- My List ---------- */

/* Each title with Remove under it, always shown, so it's there for touch and keys too. */
.my-list-item { display: grid; gap: var(--space-2); align-content: start; }
.my-list-item > button { justify-self: start; min-height: 2rem; padding: 0 var(--space-3); font-size: var(--step--1); }
.my-list-grid + .empty-state, .tabs + .status { margin-block-start: var(--space-4); }

/* ---------- Play trailer ---------- */

/* The button sits among the title's actions as they are. */
.trailer-box { display: contents; }

/* ---------- A grid's spotlight ---------- */

/* Beside All shows, All anime, All movies and My List on wide screens: a panel on the stage that
   stays in view as the grid scrolls (grid-spotlight.js). Narrower, there's no room, so none. */
.grid-spotlight { display: none; }
@media (min-width: 75rem) {
  .spotlit { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: var(--space-5); align-items: start; }
  .grid-spotlight {
    --text: var(--stage-text);
    --muted: var(--stage-muted);
    color-scheme: dark;
    display: block;
    position: sticky;
    top: 5rem;
    overflow: hidden;
    border-radius: var(--radius-m);
    /* The page's line, so the panel keeps its edge on the dark theme's ground too. */
    border: 1px solid var(--line);
    background: var(--stage);
    color: var(--text);
  }
}
.spotlight-art { position: relative; aspect-ratio: 16 / 9; background: var(--stage-raised); }
.grid-spotlight.no-art .spotlight-art { display: none; }
.spotlight-picture { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.spotlight-picture.shown { opacity: 1; }
/* The words keep their contrast where the art meets them. */
.spotlight-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--stage) 0%, transparent 45%); /* check-ui: ignore a scrim for the words under art, not decoration */
}
.spotlight-body { display: grid; gap: var(--space-2); padding: var(--space-4); }
.spotlight-title { margin: 0; font-size: var(--step-2); line-height: 1.15; overflow-wrap: anywhere; }
.spotlight-title:empty { display: none; }
.spotlight-logo { max-width: 100%; max-height: 4.5rem; object-fit: contain; object-position: left bottom; }
.spotlight-facts { margin: 0; color: var(--muted); font-size: var(--step--1); }
.spotlight-logline { margin: 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.spotlight-hint { margin: 0; color: var(--muted); font-size: var(--step--1); }
@media (prefers-reduced-motion: no-preference) {
  .spotlight-picture { transition: opacity 0.3s ease; }
}
