/* The big screen's stage (engine/tv/): laid out at 1920x1080 and scaled to the TV (mode.js), read from ten feet.
   Body text 34px or more, labels 24px or more, names 48px or more; a scene's own things are the theme's page pieces
   at twice their size (.tv-big). Layout and motion only: colors, type and pictures come from the theme (its variables
   and its own classes). One thing moves at a time; transforms, clips and opacity only; reduce motion and a slow TV
   (html[data-flat]) get the still version. */

/* ---- the ground: the theme's page ground, over the header in scenes that stand on it ---- */
.tv-ground{position:absolute; inset:0; opacity:0; transition:opacity .8s ease}
#tv:is([data-place="ground"], [data-takeover]) .tv-ground{opacity:1}
/* the header stops drawing once the ground covers it (a slow TV needs the time), and is back at once for the welcome */
html[data-tv-place="ground"] body > .hero{visibility:hidden; transition:visibility 0s .8s}
.tv-stage{z-index:1}
.tv-scenes{position:absolute; inset:0; transition:opacity .6s ease}
.tv-scene{position:absolute; inset:0}
#tv[data-takeover] .tv-scenes{opacity:0}

/* ---- the welcome: the header behind, the names on the theme's card, big in the middle of the stage so the room reads
   them from across it (the blind test's P8: at the top and a third of the screen it read small); it stops short of the
   join card's corner ---- */
.tv-welcome-wrap{position:absolute; inset:0}
#tv .tv-welcome{position:absolute; left:50%; top:50%; width:1240px; max-height:960px; margin:0; padding:56px 72px 62px; box-sizing:border-box; text-align:center;
  transform:translate(-50%, -54%)}
/* her own pictures over the words (a school logo, a mascot): the script gives them room */
.tv-logos{display:flex; justify-content:center; align-items:center; gap:56px; margin:-8px 0 22px}
.tv-logos img{display:block; height:170px; width:auto; max-width:440px; object-fit:contain}
.tv-logos ~ .script{font-size:144px}
.tv-welcome .caps{margin:0; font-size:46px}
.tv-welcome .script{margin:18px 0 12px; font-size:172px; line-height:1.02; overflow-wrap:anywhere}

/* ---- a section's place: its heading, its things at twice their page size, the rail (its column holds the join card
   too, so the things never run under that card) ---- */
.tv-stage{--tv-join:236px}
.tv-place{position:absolute; inset:0; display:grid; grid-template-columns:minmax(0, 1fr) 440px; grid-template-rows:auto minmax(0, 1fr);
  gap:24px 56px; padding:52px 56px 52px 80px; box-sizing:border-box}
.tv-head{grid-column:1 / -1; min-width:0; display:flex; align-items:center; gap:30px}
.tv-head .sec-title{min-width:0}
/* the heading on the theme's own card, like a section's (tv.title "card"): as wide as its words */
#tv .tv-label{display:flex; align-items:center; gap:26px; min-width:0; max-width:100%; width:auto; margin:0; padding:16px 44px 18px; box-sizing:border-box}
#tv .tv-label .sec-title{text-shadow:none}
#tv .tv-label .tv-title-art{height:120px; margin:-14px 0}
/* the theme's piece beside the heading, and its loose things on the ground behind the cards (decor.js) */
.tv-title-art{flex:none; width:auto; max-width:240px; height:150px; margin:-22px 0; object-fit:contain;
  filter:drop-shadow(0 6px 6px color-mix(in srgb, var(--shadow, CanvasText) 22%, transparent))}
.tv-place > :not(.tv-decor){position:relative; z-index:1}
.tv-decor{position:absolute; inset:0; z-index:0; overflow:hidden; pointer-events:none}
.tv-decor-thing{position:absolute; height:auto;
  filter:drop-shadow(0 6px 6px color-mix(in srgb, var(--shadow, CanvasText) 24%, transparent)) drop-shadow(0 20px 24px color-mix(in srgb, var(--shadow, CanvasText) 16%, transparent))}
#tv .tv-head .sec-title{margin:0; padding:0 .1em; font-size:100px; line-height:1.15; text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  text-shadow:0 0 3px var(--card, Canvas), 0 0 16px var(--card, Canvas), 0 0 34px var(--card, Canvas)}   /* a halo, so a dark ground still reads */
.tv-main{grid-column:1; grid-row:2; min-height:0; overflow:hidden; display:flex; flex-direction:column; justify-content:center}
.tv-big{zoom:2}
.tv-big > *{margin-top:0}
#tv .tv-side{grid-column:2; grid-row:2; align-self:start; max-height:calc(100% - var(--tv-join) - 28px); overflow:hidden; margin:0; padding:30px 36px 34px; box-sizing:border-box; text-align:left}
.tv-side-count{margin:0 0 14px; font-size:64px; line-height:1.05}
.tv-side-head{margin:0 0 8px; font-size:24px}
.tv-side-list{list-style:none; margin:0; padding:0; font-size:44px; line-height:1.3}
.tv-side-list li{white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.tv-side-more{margin:8px 0 0; font-size:30px; color:var(--soft, var(--ink))}

/* ---- the join point, on through every scene: the code alone, on a small square of the theme's card (a theme's frame
   adds to it, never takes from the code); join.js tells the rail how tall it came out (--tv-join) ---- */
#tv .tv-join{position:absolute; right:56px; bottom:52px; z-index:2; display:block; width:auto; margin:0; padding:18px; box-sizing:border-box; transition:opacity .4s}
#tv .tv-join svg{display:block; width:184px; height:184px}
#tv .tv-join-art{background:center / 100% 100% no-repeat; padding:34px}
:where(.tv-stage) > :where(.tv-join, .tv-side), :where(.tv-place) > .tv-side, :where(.tv-place .tv-main) .card, :where(.tv-place) .tv-label, .tv-welcome, :where(.tv-arrive-thing, .tv-takeover) > :where(.card){background:var(--card, var(--paper, Canvas)); box-shadow:0 22px 50px -24px var(--shadow, CanvasText)}
.tv-join-art{background-color:transparent; box-shadow:none}
/* the footer's line at the stage's body size, like every other word on it (the blind test's P8: 24px read small) */
.tv-made{position:absolute; left:56px; bottom:44px; z-index:2; margin:0; padding:8px 24px; border-radius:999px; font-size:34px;
  background:color-mix(in srgb, var(--card, var(--paper, Canvas)) 85%, transparent); color:var(--soft, var(--ink)); transition:opacity .4s}
#tv[data-takeover] :is(.tv-join, .tv-made), #tv[data-hello] .tv-made{opacity:0}

/* ---- arrivals (arrive.js): the new thing big over the scene, one at a time ---- */
.tv-arrivals, .tv-takeovers{position:absolute; inset:0; z-index:3; pointer-events:none}
.tv-arrive{position:absolute; inset:0; display:grid; place-items:center}
.tv-arrive::before{content:""; position:absolute; inset:-60%; background:color-mix(in srgb, var(--shadow, CanvasText) 42%, transparent); animation:tv-fade .5s ease both}
.tv-arrive-thing{position:relative; zoom:2.4; max-width:620px}
.tv-arrive-thing > *{margin:0}
.tv-arrive-drop .tv-arrive-thing{transform-origin:50% 0; animation:tv-drop 1.1s cubic-bezier(.2, .8, .3, 1.1) both}
.tv-arrive-print .tv-arrive-thing{animation:tv-print 1.4s steps(14) both}
.tv-arrive-chalk .tv-arrive-thing{animation:tv-chalk 1.6s ease-out both}
.tv-arrive-stamp .tv-arrive-thing{animation:tv-stamp .5s cubic-bezier(.3, 1.4, .5, 1) both}
.tv-arrive-out{animation:tv-fade .6s ease reverse both}
/* a check-in's "Welcome in" over the header: on the theme's card, or lit in its lettering over the header dimmed */
.tv-arrive:is(.tv-arrive-hello-card, .tv-arrive-hello-glow) .tv-arrive-thing{zoom:1; max-width:1500px; animation:tv-rise .9s ease both}
.tv-arrive-hello-glow::before{background:color-mix(in srgb, var(--ink-deep, var(--ink)) 62%, transparent)}
.tv-hello{text-align:center}
.tv-arrive-hello-card .tv-arrive-thing > .card{margin:0; padding:48px 80px 54px; box-shadow:0 30px 70px -30px var(--shadow, CanvasText)}
.tv-hello-lead{margin:0; font-size:96px; line-height:1}
.tv-hello-name{margin:10px 0 0; font-size:200px; line-height:1; overflow-wrap:anywhere}
.tv-hello-line{margin:28px 0 0; font-size:40px}
.tv-arrive-hello-glow .tv-hello{color:var(--card, Canvas)}
.tv-arrive-hello-glow .tv-hello :is(.tv-hello-lead, .tv-hello-name){text-shadow:0 0 6px var(--card, Canvas), 0 0 26px var(--accent, var(--ink)), 0 0 70px var(--accent, var(--ink))}
.tv-arrive-hello-glow .tv-hello-name{color:var(--girlSoft, var(--card, Canvas))}
.tv-arrive-hello-glow .tv-hello-line{color:var(--card, Canvas)}

/* ---- takeovers (takeover.js): the big moment fills the screen on the ground ---- */
.tv-takeover{position:absolute; inset:0; display:grid; place-items:center}
.tv-takeover > *{zoom:2.2; max-width:760px; margin:0}
.tv-takeover-rise > *{animation:tv-rise 1s ease both}
.tv-takeover-spin > *{animation:tv-spin 1.3s cubic-bezier(.2, .7, .3, 1) both}
.tv-takeover-unfold > *{transform-origin:50% 0; animation:tv-unfold 1.1s ease both}
.tv-takeover-out{animation:tv-fade .8s ease reverse both}
/* a game's winner (winner.js): the name huge in the theme's lettering on its card */
.tv-winner{box-sizing:border-box; min-width:520px; padding:30px 44px 34px; text-align:center}
.tv-winner-lead{margin:0; font-size:20px; letter-spacing:.2em}
.tv-winner-name{margin:8px 0 0; font-size:92px; line-height:1.05; overflow-wrap:anywhere}
.tv-winner-tie{font-size:60px}
.tv-winner-line{margin:12px 0 0; font-size:24px; color:var(--soft, inherit)}

/* ---- the scenes' own pieces, at page size (the place shows them twice as big, an arrival 2.4 times) ---- */
.tv-race{position:relative; zoom:1.3; padding:6px 4px 0}
.tv-race .race{margin:0 150px 0 0}
.tv-race .lane{--racer-size:68px}
.tv-landmark{position:absolute; right:0; bottom:44px; width:130px; height:auto}
.tv-race-count{margin:14px 0 0; font-size:19px}
.tv-notes{display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:26px; align-items:start; font-size:18px}
.tv-notes.tv-one{grid-template-columns:minmax(0, 440px); justify-content:center}
.tv-notes .note{margin:0}
.tv-notes .note p{font-size:18px; line-height:1.4}
.tv-names{display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:0 28px; font-size:24px}
.tv-names .name-list li{font-size:24px}
.tv-names .heart{display:inline-flex; gap:3px; align-items:center; margin-left:8px; font-size:18px}
.tv-names .heart svg{width:16px; height:16px}
/* an arrival's own card: a vote, a guess, a name */
#tv :is(.tv-vote-in, .tv-guess-in){min-width:300px; padding:22px 30px 24px; text-align:center}   /* over a theme's own .card padding */
.tv-vote-in .lane{position:relative; height:76px; margin:0 auto 6px; border:0; background:none; --racer-size:76px}
.tv-vote-in .lane .boat{left:50%; transform:translateX(-50%)}
.tv-in-name{margin:0; font-size:40px; line-height:1.1}
.tv-in-line{margin:8px 0 0; font-size:18px}
.tv-name-in{display:block; min-width:280px}
.tv-name-in .name-list li{font-size:30px}
.tv-in-by{margin:8px 0 0; font-size:17px; text-align:center}
#tv .tv-card{margin:0; padding:22px 26px}

/* a photo swapping in on the wall */
.tv-fresh{animation:tv-fade 1.2s ease both}

@keyframes tv-fade{from{opacity:0}}
@keyframes tv-rise{from{opacity:0; transform:translateY(60px)}}
@keyframes tv-drop{0%{opacity:0; transform:translateY(-110%) rotate(-5deg)} 25%{opacity:1} 75%{transform:translateY(2%) rotate(1deg)} 100%{transform:none}}
@keyframes tv-print{from{clip-path:inset(0 0 100% 0); transform:translateY(-30%)} to{clip-path:inset(0 0 0 0); transform:none}}
@keyframes tv-chalk{from{clip-path:inset(0 100% 0 0)} to{clip-path:inset(0 0 0 0)}}
@keyframes tv-stamp{from{opacity:0; transform:scale(1.6)}}
@keyframes tv-spin{from{opacity:0; transform:rotate(-540deg) scale(.1)}}
@keyframes tv-unfold{from{transform:scaleY(.02); opacity:.4}}

/* ---- when nothing's happening, the header drifts a little, so the screen never looks frozen ---- */
@supports (translate:1px){
  html:has(#tv[data-idle]:not([data-arriving]):not([data-takeover])) body > .hero [aria-hidden="true"]{animation:tv-drift 46s ease-in-out infinite alternate}
}
@keyframes tv-drift{from{translate:-8px 0; scale:1.005} to{translate:8px -6px; scale:1.02}}

@media (prefers-reduced-motion: reduce){
  .tv-ground, .tv-scenes, .tv-join, .tv-made{transition:none}
  .tv-arrive::before, .tv-arrive-thing, .tv-arrive-out, .tv-fresh, .tv-takeover > *, .tv-takeover-out, body > .hero [aria-hidden="true"]{animation:none !important}
}
html[data-flat] :is(.tv-arrive::before, .tv-arrive-thing, .tv-takeover > *, .tv-arrive-out, .tv-takeover-out){animation:none}
