/* Card stunt sign in. Dark only, laid out on the tvOS 1920 by 1080 point canvas and filling the
   whole screen. On a landscape screen 1rem is 10 design points of the largest 16:9 box the screen
   holds, so a 16:9 TV gets exactly the tvOS sizes: title 57, headline 38, body 29, caption 25,
   safe insets 80 sides and 60 top and bottom, and other shapes keep those proportions. A screen
   held upright gets its own centered layout, with 1rem near 10 CSS pixels on a phone.
   Colors are a grey ramp and the red record light of the AK47 mark. */

@font-face {
  font-family: "Inter";
  src: url("inter-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: block;
}

:root {
  color-scheme: dark;
  --gray-50: #f3f3f3;
  --gray-100: #dedede;
  --gray-300: #a7a7a7;
  --gray-1000: #0f0f0f;
  --rec: #ff4d3d;
  --text-strong: var(--gray-50);
  --text-body: var(--gray-100);
  --text-muted: var(--gray-300);
  --scrim: 0 0 0;
  --safe-x: 8rem;
  --safe-y: 6rem;
  /* Where the centered heading block centers, as a share of the stage height: its heading in
     the sky between the lamp heads, its subheading just below them. */
  --sky-middle: 23.2%;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --enter: 0.7s;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}
html {
  font-size: calc(100vh / 108);
  background: #000;
}
body {
  position: relative;
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: #000;
  color: var(--text-body);
  font-family: var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

/* The stage fills the screen. The stadium behind it covers any shape, see web/framing.ts. */
.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}
@supports (width: min(1px, 2px)) {
  html {
    font-size: calc(min(100vh, 100vw * 9 / 16) / 108);
  }
}
@supports (height: 100dvh) and (width: min(1px, 2px)) {
  html {
    font-size: calc(min(100dvh, 100vw * 9 / 16) / 108);
  }
  body {
    height: 100dvh;
  }
}
.stunt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* The live stadium's canvas fades in on its first frame, rather than cutting in from black
   after its shaders compile, in 0.3 s: long enough to read as a fade, short enough not to hold
   the picture back. The frames it times at load stay out of sight. */
[data-style="stadium3d"] .stunt {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
[data-style="stadium3d"][data-drawn] .stunt {
  opacity: 1;
}

/* Scrims sit only behind the copy. The sky is already dark, and the lamps must stay the
   brightest thing in the frame, so nothing darkens the whole picture. */
.grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
[data-layout="centered"] .grade {
  background:
    linear-gradient(to bottom, rgb(var(--scrim) / 0.5), transparent 34%), linear-gradient(to top, rgb(var(--scrim) / 0.8), transparent 16%);
}
/* Split: a straight fade in from the right edge, dark behind the column, clear by the stands. */
[data-layout="split"] .grade {
  background: linear-gradient(
    to left,
    rgb(var(--scrim) / 0.88) 0%,
    rgb(var(--scrim) / 0.78) 26%,
    rgb(var(--scrim) / 0.42) 42%,
    rgb(var(--scrim) / 0.12) 52%,
    transparent 60%
  );
}

/* The logo at the left end of the header, and at the right end Sign in, or Sign out once signed in. */
.masthead {
  position: absolute;
  top: var(--safe-y);
  left: var(--safe-x);
  right: var(--safe-x);
  z-index: 1; /* above the centered copy, which spans the stage from the top */
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-action {
  height: 4.6rem;
  padding: 0 2.6rem;
  border: 0.15rem solid rgb(255 255 255 / 0.18); /* three times the fill's opacity */
  border-radius: 1.2rem;
  background: rgb(255 255 255 / 0.06);
  color: var(--text-strong);
  font: 600 2.2rem / 1 var(--font);
  cursor: pointer;
  transition:
    transform 0.25s var(--ease-out),
    background-color 0.25s var(--ease-out);
}
/* tvOS style focus: the focused control lifts toward the viewer and fills in. */
.header-action:focus-visible,
.header-action:hover {
  outline: none;
  transform: scale(1.06);
  background: var(--gray-50);
  color: var(--gray-1000);
}
.logo {
  display: block;
  height: 4.4rem; /* the AK47 caps fill 31 of the mark's 40 units, so they stand 3.4rem tall */
  width: auto;
}
[data-brand="fox"] .logo {
  height: 3.6rem; /* the FOX One wordmark fills its own box */
}

.copy {
  position: absolute;
  display: flex;
  flex-direction: column;
}
.head,
.foot {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}
.title {
  margin: 0;
  font-size: 5.7rem;
  line-height: 1.08;
  font-weight: 680;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  text-wrap: balance;
}
.title span {
  display: block;
}
.lede {
  margin: 0;
  font-size: 2.9rem;
  line-height: 1.35;
  color: var(--text-muted);
}
.code {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.code-label {
  font-size: 2.5rem;
  color: var(--text-muted);
}
.code-value {
  font-size: 5.2rem;
  font-weight: 720;
  letter-spacing: 0.08em;
  color: var(--text-strong);
}
.primary {
  align-self: flex-start;
  height: 6.6rem;
  padding: 0 4rem;
  border: 0;
  border-radius: 1.2rem;
  background: var(--gray-50);
  color: var(--gray-1000);
  font: 600 2.9rem / 1 var(--font);
  box-shadow: 0 1.2rem 3rem rgb(var(--scrim) / 0.4);
  transition:
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out);
}
/* tvOS style focus: the focused control lifts toward the viewer. */
.primary:focus-visible,
.primary:focus {
  outline: none;
  transform: scale(1.06);
  box-shadow: 0 1.6rem 4rem rgb(var(--scrim) / 0.6);
}

/* Centered: a one line heading in the sky between the light standards, the code line under it
   as its subheading, and Start watching on the dark face of the front wall above the ribbon. */
[data-layout="centered"] .copy {
  inset: 0 var(--safe-x) 9.6rem;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
}
[data-layout="centered"] .head {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--sky-middle);
  align-items: center;
  gap: 1.2rem;
  transform: translateY(-50%);
}
[data-layout="centered"] .title {
  font-size: 4rem;
  white-space: nowrap;
}
/* The start heading is the longest line, so it runs smaller: 42rem wide, with about 4rem of sky
   to each light standard's head; the welcome line keeps the full size. */
[data-layout="centered"] .title [data-layout-copy="centered"] {
  font-size: 3.4rem;
}
[data-layout="centered"] .lede {
  font-size: 2.2rem;
}
[data-layout="centered"] .code {
  flex-direction: row;
  align-items: baseline;
  gap: 1.6rem;
}
[data-layout="centered"] .code-label {
  font-size: 2.2rem;
}
[data-layout="centered"] .code-value {
  font-size: 2.8rem;
}
[data-layout="centered"] .primary {
  align-self: center;
}

/* Split: the stands sit in the middle of the left space, the copy holds a column on the right. */
[data-layout="split"] .copy {
  top: 50%;
  right: var(--safe-x);
  width: 66rem;
  gap: 2.4rem;
  transform: translateY(-50%);
}
[data-layout="split"] .foot {
  padding-top: 2.4rem;
  border-top: 0.2rem solid rgb(255 255 255 / 0.12);
}

/* Copy written for one layout: the centered heading is a shorter line, and its code line moves
   up under it. */
[data-layout="centered"] [data-layout-copy="split"],
[data-layout="split"] [data-layout-copy="centered"] {
  display: none;
}

/* Phase visibility. A phased element lists the phases it shows in. Only these rules touch
   display, so a visible element keeps its own display and its layout rules. */
[data-phase="preparing"] [data-show]:not([data-show~="preparing"]),
[data-phase="waiting"] [data-show]:not([data-show~="waiting"]),
[data-phase="success"] [data-show]:not([data-show~="success"]),
[data-phase="plain"] [data-show]:not([data-show~="plain"]) {
  display: none;
}

/* The fallback code, where the stunt would stand. */
.plain-code {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.plain-code svg {
  width: 44rem;
  border-radius: 1.6rem;
}
[data-layout="split"] .plain-code {
  justify-content: flex-start;
  padding-left: calc(30.5% - 22rem);
}

/* An element that appears rises into place, in reading order. The stage swaps the success copy
   in once the HI has started to light, so it follows the stunt instead of racing it. */
.copy {
  --enter-at: 0s;
}
[data-show] {
  animation: enter var(--enter) var(--ease-out) both;
  animation-delay: var(--enter-at);
}
.title [data-show] {
  animation-delay: calc(var(--enter-at) + 0.08s);
}
.lede[data-show],
.head .code[data-show] {
  animation-delay: calc(var(--enter-at) + 0.16s);
}
.foot [data-show] {
  animation-delay: calc(var(--enter-at) + 0.26s);
}

/* Review controls, not part of the product screen: the build on the left, the layout on the right.
   They take the header action's corners and its stroke at three times the fill's opacity, and
   the tab in use reads in white on a brighter fill. */
.switch {
  position: absolute;
  bottom: 2rem;
  display: flex;
  gap: 0.8rem;
}
.switch-style {
  left: 2rem;
}
.switch-layout {
  right: 2rem;
}
.switch a,
.switch button {
  font: 500 1.4rem / 1 var(--font);
  color: var(--text-body);
  text-decoration: none;
  background: rgb(255 255 255 / 0.1);
  border: 0.1rem solid rgb(255 255 255 / 0.3);
  border-radius: 1.2rem;
  padding: 0.8rem 1.4rem;
  cursor: pointer;
}
.switch a:focus-visible,
.switch button:focus-visible {
  outline: 0.2rem solid var(--text-strong);
  outline-offset: 0.2rem;
}
[data-layout="centered"] [data-layout-switch="centered"],
[data-layout="split"] [data-layout-switch="split"],
[data-style="stadium"] [data-style-link="stadium"],
[data-style="stadium3d"] [data-style-link="stadium3d"],
[data-style="line"] [data-style-link="line"] {
  color: var(--text-strong);
  background: rgb(255 255 255 / 0.22);
}

/* Why a review of Stadium V2 shows V1: the live stadium handed the screen over, see stadium3d/main.ts. */
.handoff {
  position: absolute;
  left: 2rem;
  bottom: 6rem;
  margin: 0;
  padding: 0.8rem 1.2rem;
  border-radius: 0.8rem;
  background: rgb(var(--scrim) / 0.7);
  font: 500 1.4rem / 1.3 var(--font);
  color: var(--text-body);
  animation: handoff-out 0.6s ease-in 8s forwards;
}
@keyframes handoff-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.bench {
  position: absolute;
  left: 2rem;
  bottom: 6rem;
  margin: 0;
  padding: 0.8rem 1.2rem;
  border-radius: 0.8rem;
  background: rgb(var(--scrim) / 0.7);
  font-size: 1.6rem;
  color: var(--text-body);
}

/* A screen held upright: the stage is always centered (see web/stage.ts), the heading and its code
   sit in the sky above the stunt, and everything is sized for a phone in the hand, 1rem near 10
   CSS pixels on a 390 pixel wide phone and no more than 14 on a tablet. */
@media (orientation: portrait) {
  html {
    font-size: clamp(8px, 100vw / 39, 14px);
  }
  :root {
    --safe-x: 2rem;
    --safe-y: 2rem;
    --sky-middle: 18%;
  }
  .logo {
    height: 2.6rem;
  }
  [data-brand="fox"] .logo {
    height: 2.2rem;
  }
  .header-action {
    height: 3.6rem;
    padding: 0 1.6rem;
    border-radius: 1rem;
    font-size: 1.5rem;
  }
  [data-layout="centered"] .copy {
    inset: 0 var(--safe-x) 9rem;
  }
  [data-layout="centered"] .title {
    max-width: 32rem;
    font-size: 2.8rem;
    white-space: normal;
  }
  [data-layout="centered"] .title [data-layout-copy="centered"] {
    font-size: 2.6rem;
  }
  [data-layout="centered"] .lede {
    font-size: 1.5rem;
  }
  [data-layout="centered"] .code {
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
  }
  [data-layout="centered"] .code-label {
    font-size: 1.4rem;
  }
  [data-layout="centered"] .code-value {
    font-size: 2.4rem;
  }
  .primary {
    height: 4.8rem;
    padding: 0 2.8rem;
    font-size: 1.8rem;
  }
  .plain-code svg {
    width: 28rem;
  }
  .switch-layout {
    display: none;
  }
  .switch {
    bottom: 1.2rem;
  }
  .switch-style {
    left: 1.2rem;
  }
  .switch a {
    padding: 0.6rem 1.1rem;
    font-size: 1.2rem;
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(1.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-show] {
    animation: none;
  }
  [data-style="stadium3d"] .stunt {
    transition: none;
  }
}
