/* Chakra Petch by Cadson Demak — SIL Open Font License, see assets/fonts/CHAKRAPETCH-OFL.txt */
@font-face {
  font-family: "Chakra Petch";
  src: url("assets/fonts/ChakraPetch-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Ion Nova — hero
   The character (TV head + body + cables) is rendered in WebGL by main.js.
   This file styles the page chrome around it.
   ========================================================================== */

:root {
  --gutter: 40px;
  --ink: #000;
  --paper: #fff;
  --font: "Chakra Petch", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  background-color: #b9b9ba;
  background-image:
    radial-gradient(ellipse 60% 75% at 50% 42%, #ececed 0%, #d8d8d9 36%, #bfbfc0 68%, #a6a6a7 100%);
}
body.is-hovering-head { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--gutter);
}
.header__logo { display: block; line-height: 0; }
.header__logo img { height: 34px; width: auto; display: block; }
/* ---------- Stage ---------- */
.stage {
  position: fixed;
  inset: 0;
}
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition: opacity 1.2s ease, transform 1.4s cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Conversation ---------- */
.say {
  position: absolute;
  z-index: 10;
  right: 32px;
  top: 84px;
  width: min(400px, 30vw);
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}
.say p { margin: 0; }
.say__line { text-wrap: balance; } /* even line lengths, no lonely last word */

.say__choices {
  display: flex;
  flex-direction: column; /* "Join the team", then the email underneath */
  align-items: flex-start;
  gap: 5px;
  max-width: 340px;
  margin-top: 22px;
}
.chip {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font: 400 13px/1 var(--font);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  text-decoration: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s cubic-bezier(.2, .7, .2, 1), background .2s, color .2s;
}
.chip.is-in { opacity: 1; transform: none; }
.chip:hover,
.chip:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.chip--ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .28);
}
.chip--ghost svg { vertical-align: -2px; margin-left: 6px; }

/* ---------- Bottom controls ---------- */
.ctrl {
  position: fixed;
  z-index: 20;
  bottom: 24px;
}
.ctrl--reset {
  left: var(--gutter);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: transform .3s cubic-bezier(.2, .7, .2, 1);
}
.ctrl--reset:hover { transform: rotate(-45deg); }
.ctrl--sound {
  right: var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--ink);
}
.sound-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.sound-btn.is-active { background: var(--paper); color: var(--ink); }

.loader {
  position: fixed;
  z-index: 30;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  pointer-events: none;
}
.loader span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
}
.is-loading .loader span { animation: load 1.1s cubic-bezier(.6, 0, .2, 1) forwards; }
.is-ready .loader span { transform: scaleX(1); transform-origin: right; transition: transform .7s cubic-bezier(.7, 0, .2, 1); }
.is-ready.is-loaded .loader span { transform: scaleX(0); }
@keyframes load { to { transform: scaleX(1); } }

/* ---------- Intro states ---------- */
.is-loading .scene { opacity: 0; transform: translateY(3%); }
.is-loading .say { opacity: 0; transform: translateY(10px); }

/* ---------- Small screens / portrait ---------- */
@media (max-width: 900px), (orientation: portrait) {
  :root { --gutter: 16px; }
  .header__logo img { height: 28px; }
  .say {
    top: 84px;
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    max-width: 520px;
    font-size: 26px;
  }
  /* phones: just the headline, no buttons */
  .say__choices { display: none; }
  .ctrl { bottom: 16px; }
}

/* ---------- Intro: static → logo → CRT switch-off → roll up ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  overflow: hidden;
  cursor: pointer;
  transition: transform .95s cubic-bezier(.75, 0, .2, 1);
}
.intro.is-gone { transform: translateY(-100%); pointer-events: none; }
.intro.is-fade { opacity: 0; transition: opacity .5s ease; pointer-events: none; }

/* the "picture": everything that collapses when the set switches off */
.intro__screen {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
}
.intro__static {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  opacity: .9;
  transition: opacity .7s ease;
}
.intro.is-tuned .intro__static { opacity: .26; }

/* scanlines + curved-glass vignette over the picture */
.intro__screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 75% 70% at 50% 50%, transparent 55%, rgba(0, 0, 0, .75) 100%),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px);
}
/* white flash used by the switch-off */
.intro__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.intro__logo {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  height: clamp(56px, 15vw, 116px);
  display: flex;
  align-items: stretch;
  transform: translate(-50%, -50%);
  opacity: 0;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, .45)) drop-shadow(0 0 28px rgba(160, 190, 255, .25));
}
.intro.is-tuned .intro__logo { animation: intro-tune .9s steps(1, end) forwards; }
.intro__logo img { height: 100%; width: auto; display: block; }
.intro__word {
  display: block;
  width: 0;
  overflow: hidden;
  transition: width 1s cubic-bezier(.7, 0, .2, 1);
}
.intro__word img { max-width: none; }

/* signal locking on: a few flickers and horizontal tears, then steady */
@keyframes intro-tune {
  0%   { opacity: .0; transform: translate(-50%, -50%); }
  8%   { opacity: .8; transform: translate(calc(-50% + 14px), -50%) skewX(-8deg); }
  14%  { opacity: .1; transform: translate(-50%, -50%); }
  24%  { opacity: 1;  transform: translate(calc(-50% - 9px), -50%) skewX(6deg); }
  32%  { opacity: .35; transform: translate(-50%, -50%); }
  44%  { opacity: 1;  transform: translate(calc(-50% + 4px), -50%); }
  52%  { opacity: .7; transform: translate(-50%, -50%); }
  62%, 100% { opacity: 1; transform: translate(-50%, -50%); }
}

/* CRT switch-off: squash to a bright line, pinch to a dot, fade */
.intro.is-off .intro__screen { animation: crt-off .62s cubic-bezier(.55, 0, .45, 1) forwards; }
.intro.is-off .intro__screen::after { animation: crt-flash .62s ease-out forwards; }
.intro.is-off .intro__static { opacity: .9; transition: none; }
@keyframes crt-off {
  0%   { transform: scale(1, 1); }
  40%  { transform: scale(1, .006); }
  72%  { transform: scale(.004, .006); }
  100% { transform: scale(0, 0); }
}
@keyframes crt-flash {
  0%   { opacity: 0; }
  30%  { opacity: .85; }
  100% { opacity: 1; }
}
/* the lingering phosphor dot */
.intro__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px 4px rgba(255, 255, 255, .8), 0 0 40px 12px rgba(170, 200, 255, .35);
  opacity: 0;
}
.intro.is-off .intro__dot { animation: crt-dot .7s ease-out .4s forwards; }
@keyframes crt-dot {
  0%   { opacity: 1; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(.4); }
}
