/* Matinee - styled for the Meta Ray-Ban Display (600 x 600, additive).
   Black pixels emit no light, so the page is true black and every readable
   thing sits on a bounded, lighter surface. Sizes come from the viewport, not
   from a hard-coded 600px. */

:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #15181e;
  --surface-2: #1e232b;
  --line: #343c48;
  --text: #f6f7f9;
  --muted: #b9c1cd;
  --accent: #ffb547;
  --accent-ink: #1b1200;
  --danger: #ff9a8f;
  --pad: clamp(16px, 5.2vmin, 40px);
  --fs-xs: clamp(14px, 2.9vmin, 20px);
  --fs-s: clamp(16px, 3.3vmin, 24px);
  --fs-m: clamp(18px, 3.7vmin, 27px);
  --fs-l: clamp(22px, 5vmin, 36px);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body, #app { inline-size: 100%; min-block-size: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-m)/1.25 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] { display: none !important; }


/* ---------------------------------------------------------------- focus */

:where(button, a, input):focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- layout */

/* The page itself scrolls (no scrolling box nested inside the screen). The glasses' directional
   navigation can't hop from a control outside a nested scroller to one inside it, which left focus
   stuck on the first control. The top bar simply stays pinned while the page scrolls under it. */
.screen {
  display: block;
  inline-size: 100%;
  min-block-size: 100vh;
}

.screen > .bar, .screen > .top {
  position: sticky;
  inset-block-start: 0;
  z-index: 5;
  background: var(--bg);
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(var(--pad) * 0.7) var(--pad) 10px;
  flex: none;
}

.title {
  margin: 0;
  font-size: var(--fs-l);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-inline-size: 0;
}

.logo { display: inline-flex; color: var(--accent); flex: none; }
.logo .ico { inline-size: 1.5em; block-size: 1.5em; }

/* soft fade at the bottom edge hints that there is more below */
.app-shell::after {
  content: "";
  position: fixed;
  inset: auto 0 0 0;
  block-size: 28px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  z-index: 6;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 8px var(--pad) 40px;
}

.foot { padding: 0 var(--pad) 40px; display: flex; justify-content: center; }

/* --------------------------------------------------------------- buttons */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-block-size: 46px;
  padding: 0.4em 1.1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-s);
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.big { font-size: var(--fs-m); min-block-size: 56px; padding-inline: 1.2em; }
.icon-btn { inline-size: 46px; padding: 0; flex: none; }
.ico { display: inline-flex; inline-size: 1.2em; block-size: 1.2em; }
.ico svg { inline-size: 100%; block-size: 100%; }
.btn:disabled { opacity: 0.6; }

.search-btn { margin-inline-start: auto; flex: none; }

.search {
  appearance: none;
  flex: 1 1 auto;
  min-inline-size: 0;
  min-block-size: 46px;
  padding: 0.35em 1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-s);
}
.search::placeholder { color: var(--muted); opacity: 1; }
.search::-webkit-search-cancel-button { display: none; }

/* ------------------------------------------------------------------ tiles */

.tile {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  min-block-size: clamp(84px, 17vmin, 120px);
  padding: 10px 14px 12px;
  border: 1px solid var(--line);
  border-inline-start: 5px solid var(--accent-tile, var(--accent));
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--art, none) center / cover no-repeat;
  opacity: 0;
  transition: opacity 0.4s;
}
.tile.has-art::before { opacity: 0.55; }
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.82) 100%);
}
.tile.wide { grid-column: 1 / -1; min-block-size: 0; flex-direction: row; align-items: baseline; justify-content: space-between; }
.tile.quiet { background: var(--surface); }
.tile-title { font-size: var(--fs-m); font-weight: 700; line-height: 1.15; }
.tile-blurb { color: var(--muted); font-size: var(--fs-xs); }
.tile.wide .tile-blurb { text-align: end; }

/* ------------------------------------------------------------------ chips */

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px var(--pad) 8px;
}
.chip {
  appearance: none;
  flex: none;
  min-block-size: 40px;
  padding: 0.2em 0.85em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-s);
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: #fff; border-color: #fff; color: #000; }
.chip.sort { margin-inline-start: auto; color: var(--accent); border-color: var(--accent); }
.bar .chip { min-block-size: 46px; padding-inline: 1em; }

/* ------------------------------------------------------------------ cards */

.card {
  appearance: none;
  display: block;
  inline-size: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.art {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #242a33, #12151a);
  overflow: hidden;
}
.art img { display: block; inline-size: 100%; block-size: 100%; object-fit: cover; }
.art .initial { display: none; position: absolute; inset: 0; place-items: center; font-size: 2.2em; font-weight: 700; color: var(--muted); }
.art.noimg img { display: none; }
.art.noimg .initial { display: grid; }
.card .meta { padding: 8px 10px 10px; }
.card .t {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-block-size: 2.5em;
  font-size: var(--fs-s);
  font-weight: 600;
  line-height: 1.25;
}
.card .s { margin-top: 2px; color: var(--muted); font-size: var(--fs-xs); }
.card.more { display: grid; place-items: center; min-block-size: 120px; font-size: var(--fs-s); font-weight: 600; color: var(--accent); border-style: dashed; }
.card.skeleton { pointer-events: none; }
.card.skeleton .t { block-size: 2.5em; border-radius: 6px; background: var(--surface-2); }
.card.skeleton .art { animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.55; } }

.notice {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 28px 8px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-s);
}
.notice p { margin: 0; }

/* ----------------------------------------------------------------- detail */

.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 14px; padding: 8px var(--pad) 0; align-items: center; }
.hero .art { border-radius: 12px; border: 1px solid var(--line); }
.film-title { margin: 0 0 6px; font-size: var(--fs-l); line-height: 1.12; font-weight: 700; }
.film-meta { color: var(--accent); font-size: var(--fs-s); font-weight: 600; }
.film-by { margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); }
.btn.play { display: flex; inline-size: calc(100% - var(--pad) * 2); margin: 16px var(--pad) 0; }
.desc {
  margin: 14px var(--pad) 40px;
  color: var(--muted);
  font-size: var(--fs-s);
  line-height: 1.35;
}

/* --------------------------------------------------------------- settings */

.stack { display: grid; gap: 12px; padding: 8px var(--pad) 40px; }
.section-title { margin: 8px 0 0; font-size: var(--fs-s); font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.opt {
  appearance: none;
  display: grid;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.opt[aria-pressed="true"] { border-color: #fff; background: var(--surface-2); box-shadow: inset 0 0 0 2px #fff; }
.opt-title { font-size: var(--fs-m); font-weight: 700; }
.opt-hint { color: var(--muted); font-size: var(--fs-xs); }
.opt[aria-pressed="true"] .opt-title::after { content: "  ✓"; color: var(--accent); }
.about { margin: 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; }

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

.player { position: fixed; inset: 0; z-index: 10; background: #000; overflow: hidden; }
.video { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: contain; background: #000; }

.status {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: var(--pad);
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
}
.status-title { font-size: var(--fs-l); font-weight: 700; max-inline-size: 90%; }
.status-text { color: var(--muted); font-size: var(--fs-s); }
.status.failed .status-text { color: var(--danger); }
.btnrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.spinner {
  inline-size: 44px;
  block-size: 44px;
  border: 5px solid #444;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.reveal { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; }
.reveal:focus-visible { outline: none; }

.controls {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  display: grid;
  gap: 10px;
  padding: 40px var(--pad) calc(var(--pad) * 0.8);
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.88) 45%);
}
.now { font-size: var(--fs-s); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline { block-size: 6px; border-radius: 3px; background: #3a414c; overflow: hidden; }
.fill { block-size: 100%; inline-size: 0; background: var(--accent); }
.clock { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.controls .btnrow { justify-content: space-between; flex-wrap: nowrap; }
.controls .btn { flex: 1 1 0; min-inline-size: 0; padding-inline: 0.4em; }
.controls .pp { flex-grow: 1.4; background: #fff; color: #000; border-color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
