/*
 * The TV pages (layouts/tv): a 16:9 screen read from the couch and driven
 * with a remote. Everything is sized in rem, and rem scales with the
 * screen, so it looks the same at 720p and 4K. Kept inside .tv so none of
 * it reaches the phone pages, which load this file too.
 */

html.tv { font-size: min(calc(100vh / 36), calc(100vw / 64)); }
.tv-body {
  font-size: 1rem; height: 100vh; overflow: hidden;
  /* TVs can crop the edges (overscan); keep everything inside a safe frame. */
  padding: 5vh 5vw; display: grid; grid-template-rows: auto 1fr; gap: 1.2rem;
}
.tv-body > turbo-cable-stream-source { display: none; }
.tv-body h1 { font-size: 2.4rem; }
.tv-body .eyebrow { font-size: .7rem; }
.tv-body .flash { position: fixed; top: 5vh; left: 50%; transform: translateX(-50%); z-index: 10; font-size: .9rem; }
.tv-body .avatar { width: 1.5rem; height: 1.5rem; font-size: .75rem; }

.tv-top { display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: .85rem; }
.tv-brand { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 800; font-size: 1.1rem; color: var(--text); }
.tv-mark { width: 32px; height: 32px; flex: none; display: block; }
.tv-board { position: relative; min-height: 0; display: grid; }
.tv-stage { min-height: 0; }
.tv-lede { font-size: 1.15rem; color: var(--text-2); }
.tv-note { font-size: .85rem; color: var(--text-3); margin: 0; }

/* Buttons big enough to read across the room, and an unmissable focus. */
.tv-body .btn-lg { min-height: 2.6rem; padding: .55rem 1.4rem; font-size: 1.05rem; gap: .5rem; }
.tv-body .btn-lg svg { width: 1.1rem; height: 1.1rem; }
.tv-body .btn { transition: transform .15s ease-out, box-shadow .15s ease-out; }
.tv-body .btn:focus { outline: none; transform: scale(1.06); box-shadow: 0 0 0 .14rem var(--bg), 0 0 0 .3rem var(--marquee-2), 0 .6rem 1.6rem -.4rem rgba(242, 181, 68, .55); }
.tv-body .btn:not(.btn-primary):focus { background: var(--surface-3); }

/* Before the draw: the envelope, centre stage. */
.tv-sealed { display: grid; place-content: center; justify-items: center; text-align: center; gap: .6rem; }
.tv-sealed form { display: grid; justify-items: center; gap: .6rem; }
.tv-sealed h1 { margin-top: .4rem; }
.tv-sealed .tv-lede { margin: 0 0 .8rem; }
.tv-sealed .envelope { margin: 0; }
.tv-sealed .envelope-art { width: 11rem; }
.tv-empty-art { font-size: 5rem; }

/* The pick: poster on the left, everything else beside it. */
.tv-hero { display: grid; grid-template-columns: 15rem 1fr; gap: 2.5rem; align-items: center; }
.tv-hero::before { content: ""; position: fixed; inset: -10%; z-index: -2; background-image: var(--backdrop); background-size: cover; background-position: center 30%; filter: blur(48px) saturate(1.25); opacity: .55; }
.tv-hero::after { content: ""; position: fixed; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(18,15,13,.55), rgba(18,15,13,.9) 70%); }
.tv-poster img, .tv-poster .poster-empty { width: 15rem; height: 22.5rem; border-radius: .6rem; object-fit: cover; display: grid; place-items: center; font-size: 4rem; background: var(--surface-2); box-shadow: 0 1.5rem 3rem -1rem rgba(0, 0, 0, .85); }
.tv-info { display: grid; gap: .9rem; min-width: 0; }
.tv-info > * { margin: 0; }
.tv-title { font-size: 3rem !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tv-facts { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem; font-size: 1rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tv-facts .score { font-size: 1rem; }
.tv-overview { max-width: 46rem; font-size: .95rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tv-watch { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--text-2); }
.tv-watch .logos img { width: 2rem; height: 2rem; border-radius: .4rem; }
.tv-vetoes { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.tv-vetoes .veto-chip { font-size: .85rem; gap: .5rem; padding: .25rem .9rem .25rem .25rem; }
.tv-body .watched-banner { font-size: 1.1rem; padding: .7rem; border-radius: .6rem; max-width: 46rem; }
.tv-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .3rem; }
.tv-actions form { display: contents; }

/* The announcement and reveal (tv-moment), popcorn when the group commits. */
.tv-reveal-card, .tv-popcorn { display: none; }
.tv-board.reveal .tv-reveal-card {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 6; pointer-events: none;
  background: radial-gradient(closest-side, rgba(40, 30, 20, .97), rgba(18, 15, 13, .99));
  animation: announce-out .35s 1.05s ease-in forwards;
}
.tv-reveal-card p { font-family: var(--display); font-size: 3rem; font-weight: 800; color: var(--marquee-2); margin: 0; animation: announce-in .5s ease-out both; }
.tv-board.reveal .tv-poster { animation: reveal .6s 1.1s cubic-bezier(.2, .9, .3, 1.2) both; }
.tv-board.reveal .tv-title, .tv-board.reveal .tv-facts { animation: fade-up .4s 1.25s ease-out both; }
.tv-board.celebrate .tv-popcorn { display: block; position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.tv-popcorn i { position: absolute; bottom: 25%; font-style: normal; font-size: 2.2rem; opacity: 0; animation: pop 1.6s ease-out forwards; }
/* Without animation the announcement would never fade off the pick. */
@media (prefers-reduced-motion: reduce) { .tv-reveal-card, .tv-popcorn { display: none !important; } }

/* The code screen. */
.tv-pair { display: grid; grid-template-columns: auto 1fr; gap: 3rem; align-items: center; align-self: center; max-width: 52rem; margin: 0 auto; grid-row: 1 / -1; }
.tv-pair h1 { margin: .8rem 0 1rem; }
.tv-pair .tv-lede { max-width: 28rem; }
.tv-qr svg { display: block; width: 14rem; height: 14rem; border-radius: .6rem; }
.tv-code { font-size: 3.6rem; font-weight: 600; letter-spacing: .12em; color: var(--marquee-2); font-variant-numeric: tabular-nums; margin: .2rem 0 .8rem; }

/* The trailer fills most of the screen; "open on YouTube" can't work from a remote. */
.tv-body .trailer-dialog { width: 80vw; }
.tv-body .trailer-head { font-size: .9rem; }
.tv-body .trailer-foot { display: none; }

/* On a phone: the group page's list of connected TVs. */
.tv-list { list-style: none; padding: 0; margin: 0 0 .9rem; display: grid; gap: .7rem; }
.tv-list li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.tv-list li > span { display: grid; gap: .1rem; }

/* Switching lists: the list's name in the top bar opens the
   choice of the connector's lists. */
.tv-list-switch {
  display: inline-flex; align-items: baseline; gap: .4rem; color: var(--text); font-weight: 600;
  text-decoration: none; background: var(--surface-2); border-radius: var(--radius-pill); padding: .35rem .8rem;
}
.tv-list-switch small { color: var(--text-3); font-weight: 500; font-size: .75rem; }
.tv-list-switch:focus-visible, .tv-list-switch:focus { outline: none; background: var(--text); color: var(--marquee-ink); }
.tv-list-switch:focus small { color: var(--marquee-ink); }
.tv-lists { display: grid; align-content: start; gap: 1.2rem; max-width: 34rem; }
.tv-list-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.tv-list-rows form { margin: 0; }
.tv-list-row {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: .15rem 1rem; align-items: center; text-align: left;
  background: transparent; color: var(--text); border: 0; border-radius: var(--radius-sm); padding: .8rem 1rem; font: inherit; cursor: pointer;
}
.tv-list-name { font-size: 1.15rem; font-weight: 600; }
.tv-list-meta { grid-column: 1; font-size: .8rem; color: var(--text-3); }
.tv-list-tick { grid-row: 1 / 3; grid-column: 2; font-size: 1.2rem; }
.tv-list-row:focus, .tv-list-row:focus-visible { outline: none; background: var(--text); color: var(--marquee-ink); }
.tv-list-row:focus .tv-list-meta { color: var(--marquee-ink); }

/* The list: the movie the remote is on, large, above tabs and a grid of
   posters that scrolls under them. */
.tv-browse { min-height: 0; display: grid; grid-template-rows: 8rem auto 1fr; gap: .8rem; }
.tv-browse-hero { display: grid; align-content: end; gap: .45rem; min-width: 0; }
.tv-browse-hero > * { margin: 0; }
.tv-browse-title { font-size: 2.2rem !important; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-browse-hero .tv-facts { font-size: .85rem; }
.tv-where { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-2); margin: 0; }
.tv-where img { width: 1.4rem; height: 1.4rem; border-radius: .3rem; }
.tv-rent { display: inline-grid; place-items: center; padding: .1rem .45rem; border-radius: .3rem; font-size: .65rem; font-weight: 700; background: rgba(18, 15, 13, .85); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.tv-tabs { display: flex; align-items: center; gap: .4rem; }
.tv-tab { padding: .4rem .9rem; border-radius: var(--radius-pill); color: var(--text-2); font-size: .85rem; font-weight: 600; text-decoration: none; }
.tv-tab[aria-current=true] { background: var(--surface-2); color: var(--text); }
.tv-tab-count { color: var(--text-3); font-weight: 500; margin-left: .2rem; }
.tv-tab-end { margin-left: auto; background: var(--surface-2); color: var(--text); }
.tv-tab:focus { outline: none; background: var(--text); color: var(--marquee-ink); }
.tv-tab:focus .tv-tab-count { color: var(--marquee-ink); }
/* The poster the remote is on grows and gets a ring; the padding leaves
   room for both at every edge, and scroll-padding keeps a row the remote
   moves to clear of the top and bottom as it scrolls in. */
.tv-grid {
  min-height: 0; overflow-y: auto; scrollbar-width: none; display: grid; grid-template-columns: repeat(8, 1fr);
  grid-auto-rows: max-content; gap: 1rem .8rem; align-content: start; padding: 1rem .9rem 2rem; margin: -.5rem -.9rem 0;
  scroll-padding-block: 1rem;
}
.tv-tile { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: .45rem; overflow: hidden; background: var(--surface-2); transition: transform .15s ease-out, box-shadow .15s ease-out; }
.tv-tile img:not(.tv-tile-badge), .tv-tile .poster-empty { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; }
.tv-tile .poster-empty { font-size: .8rem; text-align: center; padding: .4rem; }
.tv-tile-badge { position: absolute; top: .35rem; right: .35rem; width: 1.3rem; height: 1.3rem; border-radius: .3rem; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
span.tv-tile-badge { width: auto; height: auto; }
.tv-tile:focus { outline: none; transform: scale(1.08); box-shadow: 0 0 0 .14rem var(--bg), 0 0 0 .3rem var(--text), 0 .8rem 1.6rem -.4rem rgba(0, 0, 0, .8); z-index: 1; }
.tv-empty { grid-column: 1 / -1; color: var(--text-3); font-size: 1rem; padding-top: 2rem; }
