/* Title screen v2, built from Figma "Screen / Title" (file CmD5wuS76aqLyzzpSVK2J5, node 2038:910).
   Every number below is a Figma pixel on the 2752 x 1548 design frame, multiplied by --u,
   so the whole screen scales with the 16:9 stage (1cqw = 1% of the stage width). */

#s-title {
  --u: calc(100cqw / 2752);
  --tv-gold: var(--brand-orange, #fcb24f);
  --tv-muted: #a6a6a6;
  background: #000;
}
#s-title .tv-art { position: absolute; left: 0; top: 0; width: calc(2752 * var(--u)); height: calc(1548 * var(--u)); pointer-events: none; }
#s-title .tv-art > * { position: absolute; }

/* a box that shows one part of a larger image (Figma's crop) */
.tv-crop { overflow: hidden; }
.tv-crop > img { position: absolute; display: block; max-width: none; }
.tv-px img { image-rendering: pixelated; }

/* space backgrounds */
.tv-bg1 { left: calc(1474.03 * var(--u)); top: 0; width: calc(1282.946 * var(--u)); height: calc(1548 * var(--u)); }
.tv-bg1 > img { left: -116.18%; top: 0; width: 216.18%; height: 100%; }
.tv-bg2 { left: 0; top: calc(6 * var(--u)); width: calc(1675 * var(--u)); height: calc(1536 * var(--u)); }
.tv-bg2 > img { left: 0; top: 0; width: 164.3%; height: 100%; }

/* galaxy icons: JPEGs on black, so "screen" blending drops the black into the space behind */
.tv-icon { display: flex; align-items: center; justify-content: center; mix-blend-mode: screen; }
.tv-spin { position: relative; flex: none; }
.tv-spin > .tv-base { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-spin > .tv-crop { position: absolute; inset: 0; }
.tv-purple { left: calc(881 * var(--u)); top: calc(555.63 * var(--u)); width: calc(864.823 * var(--u)); height: calc(864.823 * var(--u)); }
.tv-purple .tv-spin { width: calc(657.857 * var(--u)); height: calc(657.857 * var(--u)); rotate: -23.37deg; }
.tv-blue { left: calc(2055 * var(--u)); top: calc(427 * var(--u)); width: calc(265.392 * var(--u)); height: calc(214.349 * var(--u)); }
.tv-blue .tv-spin { width: calc(233.269 * var(--u)); height: calc(127.723 * var(--u)); rotate: 25deg; }
.tv-blue .tv-crop > img { left: 0; top: -44.05%; width: 100%; height: 182.64%; }
.tv-green { left: calc(881 * var(--u)); top: calc(55 * var(--u)); width: calc(420.614 * var(--u)); height: calc(334.956 * var(--u)); }
.tv-green .tv-spin { width: calc(367.021 * var(--u)); height: calc(237.788 * var(--u)); rotate: 17.05deg; }
.tv-green .tv-crop > img { left: 0; top: -33.7%; width: 100%; height: 154.35%; }
.tv-gold { left: calc(80 * var(--u)); top: calc(1155 * var(--u)); width: calc(369.991 * var(--u)); height: calc(369.991 * var(--u)); }
.tv-gold .tv-spin { width: calc(272 * var(--u)); height: calc(272 * var(--u)); rotate: 60.88deg; }

/* white-outline walterwakefield man */
.tv-man { left: calc(1338 * var(--u)); top: calc(222 * var(--u)); width: calc(881.812 * var(--u)); height: calc(1197.191 * var(--u)); display: flex; align-items: center; justify-content: center; }
.tv-man-clip { position: relative; flex: none; overflow: hidden; width: calc(652.699 * var(--u)); height: calc(1076.334 * var(--u)); rotate: -13.24deg; }
.tv-man-box { position: absolute; left: calc(-476.35 * var(--u)); top: 0; width: calc(1623.683 * var(--u)); height: calc(1623.683 * var(--u)); }
.tv-man-box > img { position: absolute; display: block; max-width: none; left: 12.5%; top: .32%; width: 75.11%; height: 99.6%; }

/* pixel rock piles (one sprite sheet, cropped per pile) */
.tv-rocks3 { left: calc(864 * var(--u)); top: calc(1363 * var(--u)); width: calc(396 * var(--u)); height: calc(358 * var(--u)); }
.tv-rocks3 > img { left: -405.05%; top: -207.54%; width: 505.05%; height: 311.73%; }
.tv-rocks2a { left: calc(1129 * var(--u)); top: calc(1190 * var(--u)); width: calc(906 * var(--u)); height: calc(379 * var(--u)); }
.tv-rocks2a > img { left: -67.82%; top: 0; width: 247.52%; height: 330.18%; }
.tv-rocks2b { left: calc(1825 * var(--u)); top: calc(838 * var(--u)); width: calc(606 * var(--u)); height: calc(576 * var(--u)); }
.tv-rocks2b > img { left: -193.07%; top: -90.4%; width: 480.45%; height: 281.82%; }
.tv-rockstop { left: calc(1324 * var(--u)); top: calc(-188 * var(--u)); width: calc(400 * var(--u)); height: calc(387 * var(--u)); rotate: 180deg; }
.tv-rockstop > img { left: 0; top: -188.37%; width: 500%; height: 288.37%; }

/* pixel characters */
.tv-scientist { left: calc(2188 * var(--u)); top: calc(1036 * var(--u)); width: calc(280 * var(--u)); height: calc(404 * var(--u)); }
.tv-scientist > img { left: -25.56%; top: 0; width: 279.33%; height: 193.99%; }
.tv-steampunk { left: calc(2389 * var(--u)); top: calc(1087 * var(--u)); width: calc(281 * var(--u)); height: calc(399 * var(--u)); }
.tv-steampunk > img { left: -160.51%; top: -100.59%; width: 278.94%; height: 196.46%; }

/* left column: heading, intro, menu */
.tv-title { position: absolute; z-index: 2; left: calc(150 * var(--u)); top: calc(231 * var(--u)); display: flex; flex-direction: column; gap: calc(76.444 * var(--u)); }
.tv-head { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: calc(15.289 * var(--u)); font: 300 calc(107.022 * var(--u))/1.1 'ivyora-display', var(--font-head); color: #fff; white-space: nowrap; }
.tv-logo { display: block; width: calc(822.9 * var(--u)); height: calc(85.153 * var(--u)); }
.tv-intro { display: flex; flex-direction: column; gap: calc(7.644 * var(--u)); font: 400 calc(34.4 * var(--u))/1.5 var(--font-body); }
.tv-intro p { margin: 0; white-space: nowrap; }
.tv-lead { color: #fff; }
.tv-muted { color: var(--tv-muted); }
.tv-menu { display: flex; flex-direction: column; gap: calc(26.756 * var(--u)); padding-top: calc(15.289 * var(--u)); width: calc(644 * var(--u)); }

/* "World Button": gold primary, outlined secondary, hard black shadow */
.tv-btn { display: flex; align-items: center; justify-content: center; gap: calc(15.289 * var(--u)); width: 100%; margin: 0;
  padding: calc(22.933 * var(--u)) calc(38.222 * var(--u)); border: calc(3.822 * var(--u)) solid #fff; border-radius: calc(7.644 * var(--u));
  background: transparent; color: #fff; text-decoration: none; text-transform: uppercase; white-space: nowrap;
  font: 600 calc(30.578 * var(--u))/1.3 var(--font-body); letter-spacing: calc(1.2231 * var(--u));
  filter: drop-shadow(0 calc(7.644 * var(--u)) 0 #000); transition: transform .08s, background-color .15s, filter .15s; }
.tv-btn-primary { background: var(--tv-gold); border-color: var(--tv-gold); color: #000; }
.tv-btn-primary img { display: block; width: calc(26.756 * var(--u)); height: calc(30.309 * var(--u)); }
.tv-btn:hover { background-color: rgba(255, 255, 255, .12); }
.tv-btn-primary:hover { background-color: #ffc46e; border-color: #ffc46e; }
.tv-btn:active { transform: translateY(calc(5 * var(--u))); filter: drop-shadow(0 calc(2.6 * var(--u)) 0 #000); }

/* gentle float on the galaxy icons (off when the visitor asks for less motion) */
@media (prefers-reduced-motion: no-preference) {
  .tv-icon { animation: tvFloat 7s ease-in-out infinite alternate; }
  .tv-blue { animation-duration: 5.5s; animation-delay: -2s; }
  .tv-green { animation-duration: 6.5s; animation-delay: -4s; }
  .tv-gold { animation-duration: 6s; animation-delay: -1s; }
  @keyframes tvFloat { from { translate: 0 0; } to { translate: 0 calc(-18 * var(--u)); } }
}

/* phones held upright: the 16:9 stage would be a thin strip, so the title screen uses the whole window,
   the art is sized to the window height and shifted to show the two characters between the text and the menu and the menu stacks below the text */
@media (max-aspect-ratio: 1/1) {
  body[data-screen="title"] #stage { width: 100vw; height: 100dvh; }
  #s-title .tv-art { --u: calc(100cqh / 1548); left: auto; right: calc(-40 * var(--u)); top: calc(-400 * var(--u)); }
  #s-title::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
    background: linear-gradient(to bottom, rgba(0,0,0,.8) 0%, rgba(0,0,0,.45) 30%, rgba(0,0,0,0) 42%, rgba(0,0,0,0) 66%, rgba(0,0,0,.85) 76%); }
  .tv-title { --u: calc(100cqw / 760); left: calc(40 * var(--u)); right: calc(40 * var(--u)); top: calc(80 * var(--u)); bottom: calc(60 * var(--u)); gap: calc(48 * var(--u)); }
  .tv-head { font-size: calc(96 * var(--u)); }
  .tv-logo { width: calc(680 * var(--u)); height: calc(70.37 * var(--u)); }
  .tv-intro { font-size: calc(34 * var(--u)); }
  .tv-intro p { white-space: normal; }
  .tv-menu { width: 100%; margin-top: auto; gap: calc(28 * var(--u)); }
  .tv-btn { font-size: calc(32 * var(--u)); padding: calc(28 * var(--u)) calc(30 * var(--u)); border-width: 2px; border-radius: 6px; }
}
/* v3: the brief's intro line under the Figma lines; it wraps (the Figma lines stay on one line each) */
#s-title .tv-brief { white-space: normal; max-width: calc(760 * var(--u)); margin-top: calc(10 * var(--u)); }

/* 3 Dec: Adrian and Jaimy come alive on the title: their idle animations (art/characters-anim) replace the still
   picture. Strips are one row of 64x96 frames, played with steps(). */
.tv-scientist > img, .tv-steampunk > img { visibility: hidden; }
.tv-sprite { position: absolute; left: 50%; bottom: 0; height: 100%; aspect-ratio: 64 / 96; translate: -50% 0; background: 0 0 / auto 100% no-repeat; image-rendering: pixelated; animation: tvIdle var(--d) steps(var(--n), jump-none) infinite; }
.tv-adrian { --n: 8; --d: 1.333s; background-image: url('../art/characters-anim/Adrian-idle.png'); }
.tv-jaimy { --n: 12; --d: 2s; background-image: url('../art/characters-anim/Jaimy-idle.png'); }
@keyframes tvIdle { to { background-position-x: 100%; } }
@media (prefers-reduced-motion: reduce) { .tv-sprite { animation: none; } }
