/* virtual-active.com – stream interface prototype
   Visual language derived from the online business card (figma_sources).
   Colours are tokens on :root (canvas colours: app.js THEME).
   Tokens ending in -rgb hold space-separated channels for use as rgb(var(--x-rgb) / alpha). */

@property --beam {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* Palette: dreamy indigo/violet with cyan sky light and warm highlights */
:root {
  --bg: #160c40;
  --bg-glow-a: #3b2aa0;
  --bg-glow-b: #5a2389;
  --bg-glow-c: rgb(90 210 230 / .5);
  --bg-glow-d: rgb(255 214 190 / .24);
  --vignette-rgb: 10 4 30;

  --frame-top-rgb: 70 50 170;
  --frame-bottom-rgb: 30 14 80;
  --frame-line-rgb: 190 160 255;
  --frame-inner-rgb: 140 90 255;
  --frame-edge-rgb: 14 6 40;
  --frame-glow-rgb: 140 90 255;
  --frame-glow-far-rgb: 90 60 230;
  --beam-tail-rgb: 200 160 255;

  --text: #f1eaff;
  --text-soft-rgb: 201 186 255;
  --warn: #ffc2a8;

  --accent-a-rgb: 120 225 245;
  --accent-b-rgb: 240 200 255;
  --grad-head: linear-gradient(180deg, #8fe3ff 0%, #b39dff 55%, #e7a6ff 100%);
  --grad-signal: linear-gradient(180deg, #c7d2ff 0%, #f0abfc 50%, #a5f3fc 100%);

  --pill: #ece5ff;
  --pill-rgb: 236 229 255;
  --pill-ink: #7b4fe0;
  --pill-glow-far-rgb: 170 120 255;

  --live-rgb: 120 235 245;
  --live-text: #b8f6ff;
  --logo-1: #ffc6a8;
  --logo-2: #e48ad8;
  --logo-3: #9a7cf0;
  --logo-4: #5fd4f0;
  --logo-handle: #c9b8ff;
  --logo-glow-rgb: 230 140 230;

  --card-bg: #1c1050;
  --card-shadow-rgb: 20 6 50;
  --flash-hot-rgb: 255 236 220;

  /* Derived */
  --text-soft: rgb(var(--text-soft-rgb));
  --accent-a: rgb(var(--accent-a-rgb));
  --accent-b: rgb(var(--accent-b-rgb));
  --glow-pill:
    0 0 0 1px rgb(var(--pill-rgb) / .6),
    0 0 22px 4px rgb(var(--pill-rgb) / .45),
    0 0 60px 6px rgb(var(--pill-glow-far-rgb) / .35);

  --radius-frame: 25px;
  --radius-card: 55px;
  --radius-pill: 50px;

  --frame-pad-x: clamp(20px, 6.6vw, 100px);
  --stage-gap: clamp(32px, 6vw, 110px);

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  /* Both ship a single weight (400) – keep their text at 400 to avoid faux bold */
  --font-brand: 'Psionic', sans-serif;
  --font-display: 'Poiret One', sans-serif;

  color-scheme: dark;
}

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

html,
body {
  margin: 0;
}

body {
  display: grid;
  align-content: center;
  min-height: 100dvh;
  padding-block: 24px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 58% 0%, var(--bg-glow-c) 0%, transparent 70%),
    radial-gradient(800px 560px at 74% 56%, var(--bg-glow-d) 0%, transparent 70%),
    radial-gradient(1200px 800px at 15% 0%, var(--bg-glow-a) 0%, transparent 60%),
    radial-gradient(1000px 700px at 90% 100%, var(--bg-glow-b) 0%, transparent 60%),
    var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--accent-b);
  outline-offset: 4px;
}

/* ---------- Atmosphere ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 90% at 50% 45%, transparent 45%, rgb(var(--vignette-rgb) / .75) 100%);
}

/* ---------- Frame ---------- */

.frame {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(1500px, calc(100% - 48px));
  min-height: min(calc(100dvh - 48px), 960px);
  margin: 0 auto;
  padding: clamp(22px, 2.4vw, 34px) var(--frame-pad-x) clamp(20px, 2.2vw, 30px);
  border-radius: var(--radius-frame);
  background: linear-gradient(180deg, rgb(var(--frame-top-rgb) / .32), rgb(var(--frame-bottom-rgb) / .22));
  box-shadow:
    inset 0 0 0 1px rgb(var(--frame-line-rgb) / .24),
    inset 0 0 90px rgb(var(--frame-inner-rgb) / .12),
    0 0 0 1px rgb(var(--frame-edge-rgb) / .8),
    0 0 40px rgb(var(--frame-glow-rgb) / .32),
    0 0 140px rgb(var(--frame-glow-far-rgb) / .22);
  overflow: hidden;
  isolation: isolate;
}

/* Light beam travelling along the border */
.frame::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--beam),
    transparent 0deg 250deg,
    rgb(var(--beam-tail-rgb) / 0) 270deg,
    rgb(var(--accent-b-rgb) / .95) 320deg,
    rgb(var(--beam-tail-rgb) / 0) 345deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  animation: beam 9s linear infinite;
}

.is-booting .frame {
  opacity: 0;
}

.is-ready .frame {
  animation: frame-in 1.4s var(--ease-out) .05s backwards;
}

.is-ready .frame::before {
  opacity: 1;
  transition: opacity 1.4s ease 1.2s;
}

.topbar,
.stage {
  position: relative;
  z-index: 2;
}

/* ---------- Header ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-family: var(--font-brand);
  font-style: normal;
  font-size: 20px;
  font-weight: 400;
  text-decoration: none;
  border-radius: 40px;
}

.brand__logo {
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 0 14px rgb(var(--logo-glow-rgb) / .25));
  transition: transform .9s var(--ease-out), filter .9s var(--ease-out);
}

.logo-stop-1 { stop-color: var(--logo-1); }
.logo-stop-2 { stop-color: var(--logo-2); }
.logo-stop-3 { stop-color: var(--logo-3); }
.logo-stop-4 { stop-color: var(--logo-4); }
.logo-stop-handle { stop-color: var(--logo-handle); }

.brand:hover .brand__logo {
  transform: rotate(-14deg) scale(1.06);
  filter: drop-shadow(0 0 18px rgb(var(--logo-glow-rgb) / .45));
}

.tagline {
  margin: 0;
  color: var(--text-soft);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.02;
}

/* ---------- Stage ---------- */

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 36vw, 450px);
  align-items: center;
  gap: var(--stage-gap);
  padding-block: clamp(24px, 4vh, 56px);
}

/* Intro and player share one grid cell and cross-fade */
.copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.copy > * {
  grid-area: 1 / 1;
  min-width: 0;
}

.headline {
  max-width: 17em;
  --line-gap: calc(1.24em * .9); /* 90 % of the line height between the staircase steps */
  margin: 0 0 64px;
  font-size: clamp(32px, 3.3vw, 50px);
  font-style: normal;
  font-weight: 400;
  line-height: 1.24;
  perspective: 600px;
}

.headline__line {
  display: block;
}

/* Staircase step: "to be" is short, so it steps by its centre rather than its start */
.headline__line + .headline__line {
  margin-top: var(--line-gap);
  margin-left: 4.25em;
}

.word {
  display: inline-block;
  padding-bottom: .06em;
  background: var(--grad-head);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cta {
  /* Indent like the business card CTA, but only as far as the column allows */
  padding-left: clamp(0px, calc((100% - 300px) * .45), 192px);
}

.status {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: var(--warn);
  font-size: 15px;
  font-weight: 400;
}

/* ---------- Pill button (business card CTA) ---------- */

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-width: 291px;
  height: 75px;
  white-space: nowrap;
  padding: 0 34px 0 42px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--pill);
  color: var(--pill-ink);
  font: normal 400 20px/1 var(--font-brand);
  letter-spacing: .01em;
  cursor: pointer;
  transition: box-shadow .45s var(--ease-out), transform .45s var(--ease-out);
}

/* Breathing halo inviting the click */
.pill::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: halo 2.8s var(--ease-out) 3.4s infinite;
}

.pill:hover,
.pill:focus-visible {
  box-shadow: var(--glow-pill);
  transform: translateY(-2px);
}

.pill:focus-visible {
  outline-offset: 6px;
}

.pill:active {
  transform: translateY(0) scale(.98);
}

.pill:disabled {
  cursor: progress;
}

.pill__chevron {
  flex: none;
  width: 34px;
  height: 34px;
  transition: transform .6s var(--ease-out);
}

.pill:hover .pill__chevron {
  transform: translateY(3px);
}

/* ---------- Player ---------- */

.player {
  align-self: center;
  visibility: hidden;
}

.is-live .player {
  visibility: visible;
}

body:not(.is-live) .p-reveal {
  opacity: 0;
}

.is-live .p-reveal {
  animation: rise 1s var(--ease-out) calc(.55s + var(--i) * 90ms) backwards;
}

.is-live .intro {
  pointer-events: none;
  animation: leave .8s var(--ease-in-out) forwards;
}

.player__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 14px 0 12px;
  border-radius: 30px;
  background: rgb(var(--live-rgb) / .08);
  box-shadow: inset 0 0 0 1px rgb(var(--live-rgb) / .35);
  color: var(--live-text);
  font-family: var(--font-brand);
  font-style: normal;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
  transition: color .4s, background-color .4s, box-shadow .4s;
}

.live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(var(--live-rgb));
  box-shadow: 0 0 10px rgb(var(--live-rgb));
  animation: blink 1.4s ease-in-out infinite;
}

.is-paused .live {
  background: rgb(var(--text-soft-rgb) / .08);
  box-shadow: inset 0 0 0 1px rgb(var(--text-soft-rgb) / .3);
  color: var(--text-soft);
}

.is-paused .live__dot {
  background: var(--text-soft);
  box-shadow: none;
  animation: none;
}

.eyebrow {
  color: var(--text-soft);
  font-family: var(--font-brand);
  font-style: normal;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .8;
}

.player__title {
  margin: 0;
  font-size: clamp(34px, 3.6vw, 56px);
  font-weight: 400;
  line-height: 1.1;
  background: var(--grad-head);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.player__artist {
  margin: 8px 0 26px;
  font-size: 20px;
  font-weight: 400;
  background: var(--grad-signal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.spectrum {
  display: block;
  width: 100%;
  max-width: 640px;
  height: 120px;
  margin-bottom: 26px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
}

.round {
  display: grid;
  flex: none;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: var(--pill);
  color: var(--pill-ink);
  cursor: pointer;
  transition: box-shadow .45s var(--ease-out), transform .45s var(--ease-out);
}

.round:hover,
.round:focus-visible {
  box-shadow: var(--glow-pill);
  transform: scale(1.05);
}

.round:active {
  transform: scale(.96);
}

.round svg {
  width: 28px;
  height: 28px;
}

.round .icon-play,
.is-paused .round .icon-pause {
  display: none;
}

.is-paused .round .icon-play {
  display: block;
}

.volume {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: color .3s, background-color .3s;
}

.icon-btn:hover {
  background: rgb(var(--text-soft-rgb) / .1);
  color: #fff;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.icon-muted,
.is-muted .icon-volume {
  display: none;
}

.is-muted .icon-muted {
  display: block;
}

.volume input[type='range'] {
  --val: .8;
  width: 140px;
  height: 6px;
  margin: 0;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--accent-a) 0%,
    var(--accent-b) calc(var(--val) * 100%),
    rgb(var(--text-soft-rgb) / .18) calc(var(--val) * 100%)
  );
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.volume input[type='range']::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--pill);
  box-shadow: 0 0 12px rgb(var(--pill-rgb) / .8);
  -webkit-appearance: none;
  appearance: none;
}

.volume input[type='range']::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--pill);
  box-shadow: 0 0 12px rgb(var(--pill-rgb) / .8);
}

.volume input[type='range']::-moz-range-track {
  background: transparent;
}

.is-muted .volume input[type='range'] {
  opacity: .45;
}

.timer {
  color: var(--text-soft);
  font-family: var(--font-brand);
  font-style: normal;
  font-size: 15px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.timer span {
  color: var(--text);
  font-weight: 400;
}

.signal {
  margin: 26px 0 0;
  color: rgb(var(--text-soft-rgb) / .6);
  font-size: 14px;
  font-weight: 400;
}

/* ---------- Orb card ---------- */

.orb-card {
  position: relative;
  width: 100%;
  margin: 0;
  aspect-ratio: 1;
  border-radius: var(--radius-card);
  background: var(--card-bg);
  box-shadow:
    4px 4px 4px rgba(0, 0, 0, .25),
    0 30px 80px rgb(var(--card-shadow-rgb) / .55),
    0 0 50px rgb(var(--accent-a-rgb) / .12);
  overflow: hidden;
}

.orb-card canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Hairline rim + flash overlay */
.orb-card::before,
.orb-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.orb-card::before {
  box-shadow: inset 0 0 0 1px rgb(var(--accent-b-rgb) / .12);
}

.orb-card::after {
  background: radial-gradient(circle at 50% 42%, rgb(var(--flash-hot-rgb) / .85), rgb(var(--accent-a-rgb) / .25) 45%, transparent 75%);
  opacity: 0;
}

.orb-card.is-flash::after {
  animation: flash 1.3s var(--ease-out);
}

.is-ready .orb-card {
  animation: zoom-in 1.6s var(--ease-out) .8s backwards;
}

/* ---------- Start shockwave ---------- */

.shockwave {
  position: absolute;
  z-index: 1;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--pill-rgb) / .5) 0%, rgb(var(--accent-a-rgb) / .16) 45%, transparent 70%);
  pointer-events: none;
  animation: shock 1.6s var(--ease-out) forwards;
}

.shockwave::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(var(--accent-b-rgb) / .5);
}

/* ---------- Load sequence ---------- */

.is-ready .reveal {
  animation: rise 1.1s var(--ease-out) var(--d, 0s) backwards;
}

.is-ready .word {
  animation: word-in 1s var(--ease-out) calc(.95s + var(--i) * 70ms) backwards;
}

/* ---------- Keyframes ---------- */

@keyframes frame-in {
  from {
    opacity: 0;
    transform: scale(.975);
    filter: blur(10px);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(8px);
  }
}

@keyframes word-in {
  from {
    opacity: 0;
    transform: translateY(.55em) rotateX(-50deg);
    filter: blur(10px);
  }
}

@keyframes zoom-in {
  from {
    opacity: 0;
    transform: scale(.88) rotate(-2deg);
    filter: blur(14px) brightness(1.8);
  }
}

@keyframes leave {
  to {
    opacity: 0;
    transform: translateY(-28px);
    filter: blur(12px);
    visibility: hidden;
  }
}

@keyframes beam {
  to {
    --beam: 360deg;
  }
}

@keyframes halo {
  0% {
    box-shadow: 0 0 0 0 rgb(var(--pill-rgb) / .55);
  }
  100% {
    box-shadow: 0 0 0 22px rgb(var(--pill-rgb) / 0);
  }
}

@keyframes blink {
  50% {
    opacity: .35;
  }
}

@keyframes flash {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes shock {
  from {
    transform: scale(.2);
    opacity: 1;
  }
  to {
    transform: scale(45);
    opacity: 0;
  }
}

/* ---------- Responsive ---------- */

/* Desktop: staircase of headline line 1, line 2 and the start button, which sits on the
   lower third of the stage, centred between frame edge and orb card */
@media (min-width: 961px) {
  .copy {
    align-self: stretch;
  }

  .intro {
    --pill-w: 424px; /* fits "Behind the Scenes" in Psionic */
    /* Copy column shifted by half the difference of stage gap and frame padding = centred */
    --pill-shift: calc((var(--stage-gap) - var(--frame-pad-x)) / 2);
    position: relative;
  }

  .headline {
    position: absolute;
    right: 0;
    bottom: calc(33.333% + 37.5px + var(--line-gap)); /* one step above the pill */
    left: 0;
    max-width: none;
    margin: 0;
  }

  /* Line 2 starts on the straight line from the start of line 1 to the pill's left edge;
     .48 is line 2's share of that vertical distance */
  .headline__line + .headline__line {
    margin-left: max(0px, calc((max(0px, (100% - var(--pill-w)) / 2) + var(--pill-shift)) * .48));
  }

  /* No transform here – the reveal animation owns it */
  .cta {
    position: absolute;
    top: 66.667%;
    right: calc(var(--pill-shift) * -1);
    left: var(--pill-shift);
    margin-top: -37.5px; /* centres the 75px pill on the line */
    padding-left: 0;
    text-align: center;
  }

  .pill {
    width: var(--pill-w);
  }
}

@media (max-width: 960px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .orb-card {
    --radius-card: 40px;
    order: -1;
    justify-self: center;
    width: min(100%, 380px);
  }

  .cta {
    padding-left: 0;
  }

  .tagline {
    max-width: 14em;
    font-size: 15px;
    text-align: right;
  }
}

@media (max-width: 600px) {
  body {
    padding-block: 10px;
  }

  .frame {
    width: calc(100% - 20px);
    min-height: calc(100dvh - 20px);
  }

  .tagline {
    display: none;
  }

  /* Psionic runs wide – shrink brand and button text so neither wraps nor overflows */
  .brand {
    font-size: 16px;
    white-space: nowrap;
  }

  .pill {
    width: 100%;
    min-width: 0;
    height: 64px;
    gap: 14px;
    padding: 0 24px;
    font-size: 16px;
  }

  .controls {
    gap: 14px;
  }

  .volume input[type='range'] {
    width: 110px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
