/* =============================================================================
   Play@Event — landing
   Palette and contrast rules follow the Creative Spark charter:
   text on coral is always night #180018 (6.84:1); white on coral is 2.78:1 and
   never appears.
   ========================================================================== */

:root {
  --night: #180018;
  --obsidian: #300030;
  --coral: #ff6b6b;
  --coral-dark: #d94343;
  --mint: #a3ebb1;
  --canvas: #fafafa;

  --muted: #d9c6d9;
  /* Quiet grey that still clears 4.5:1 on the dark canvas -- used for the legal
     line, the footer and the language switcher. */
  --faint: #9c869c;
  --outline: #6b4a6b;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Pointer position, written by main.js; drives the spotlight. */
  --px: 50%;
  --py: 40%;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--canvas);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

/* -----------------------------------------------------------------------------
   Background: three drifting radial glows, a pointer spotlight, and grain.
   Reproduces the depth of og-image.png without a raster.
   -------------------------------------------------------------------------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 45%, #3a0a2c 0%, #240320 42%, var(--night) 100%), var(--night);
}

.bg__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}

.bg__blob--1 {
  top: -10%;
  left: 8%;
  width: 46vmax;
  height: 46vmax;
  background: radial-gradient(circle, rgba(255, 107, 107, 0.34), transparent 68%);
  animation: drift-a 26s ease-in-out infinite;
}

.bg__blob--2 {
  right: 2%;
  bottom: -14%;
  width: 40vmax;
  height: 40vmax;
  background: radial-gradient(circle, rgba(163, 235, 177, 0.14), transparent 70%);
  animation: drift-b 34s ease-in-out infinite;
}

.bg__blob--3 {
  top: 32%;
  left: 46%;
  width: 34vmax;
  height: 34vmax;
  background: radial-gradient(circle, rgba(217, 67, 67, 0.26), transparent 66%);
  animation: drift-c 22s ease-in-out infinite;
}

@keyframes drift-a {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(6vw, 5vh, 0) scale(1.12);
  }
}

@keyframes drift-b {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1.05);
  }
  50% {
    transform: translate3d(-7vw, -4vh, 0) scale(0.92);
  }
}

@keyframes drift-c {
  0%,
  100% {
    transform: translate3d(-50%, -50%, 0) scale(0.95);
  }
  50% {
    transform: translate3d(-56%, -44%, 0) scale(1.15);
  }
}

/* Follows the pointer with easing applied in JS. */
/* Size and intensity are driven by pointer speed in main.js: the page brightens
   when you move and settles when you stop. */
.bg__spot {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    var(--spot-size, 27vmax) var(--spot-size, 27vmax) at var(--px) var(--py),
    rgba(255, 107, 107, var(--spot-alpha, 0.15)),
    transparent 62%
  );
  transition: opacity 500ms ease;
}

/* Fine grain lifts the flatness out of the gradients. */
.bg__grain {
  position: absolute;
  inset: -50%;
  opacity: 0.055;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(6) infinite;
}

@keyframes grain {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-4%, 3%);
  }
  40% {
    transform: translate(3%, -4%);
  }
  60% {
    transform: translate(-3%, -2%);
  }
  80% {
    transform: translate(4%, 2%);
  }
}

.burst {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

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

.stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: max(24px, env(safe-area-inset-top)) 24px
    max(76px, calc(env(safe-area-inset-bottom) + 68px));
  text-align: center;
}

.logo {
  width: min(560px, 100%);
  height: auto;
  overflow: visible;
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}

/* --- Mark: the four brackets lock on, then the play triangle lands. ------- */

.logo__mark {
  transform-box: view-box;
  transform-origin: 64px 64px;
  transform: translate(var(--mark-px, 0px), var(--mark-py, 0px));
  animation: breathe 4.5s ease-in-out 1.6s infinite;
}

@keyframes breathe {
  0%,
  100% {
    scale: 1;
  }
  50% {
    scale: 1.022;
  }
}

.logo__corner {
  transform-box: view-box;
  transform-origin: 64px 64px;
  opacity: 0;
  animation: lock-on 780ms var(--ease-spring) forwards;
}

.logo__corner--tl {
  --dx: -30px;
  --dy: -30px;
  animation-delay: 60ms;
}
.logo__corner--tr {
  --dx: 30px;
  --dy: -30px;
  animation-delay: 130ms;
}
.logo__corner--bl {
  --dx: -30px;
  --dy: 30px;
  animation-delay: 200ms;
}
.logo__corner--br {
  --dx: 30px;
  --dy: 30px;
  animation-delay: 270ms;
}

@keyframes lock-on {
  from {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(1.25);
  }
  60% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

.logo__play {
  transform-box: view-box;
  transform-origin: 64px 64px;
  opacity: 0;
  animation: play-in 620ms var(--ease-spring) 520ms forwards;
}

@keyframes play-in {
  from {
    opacity: 0;
    transform: scale(0.2) rotate(-18deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* --- Wordmark: revealed by a wipe, the @ pulses on its own. --------------- */

.logo__wipe {
  transform-box: view-box;
  transform-origin: 150px 0;
  transform: scaleX(0);
  animation: wipe 760ms var(--ease-out) 620ms forwards;
}

@keyframes wipe {
  to {
    transform: scaleX(1);
  }
}

.logo__at {
  transform-box: fill-box;
  transform-origin: center;
  animation: at-pulse 6.5s ease-in-out 2.4s infinite;
}

@keyframes at-pulse {
  0%,
  86%,
  100% {
    transform: scale(1) rotate(0deg);
    fill: var(--coral);
  }
  91% {
    transform: scale(1.12) rotate(-7deg);
    fill: #ff8f8f;
  }
  96% {
    transform: scale(1) rotate(2deg);
  }
}

/* --- Coral rule, as on og-image.png -------------------------------------- */

.rule {
  display: block;
  width: 0;
  height: 4px;
  margin: clamp(18px, 3vh, 34px) 0 0;
  border-radius: 999px;
  background: var(--coral);
  animation: rule-in 620ms var(--ease-out) 1250ms forwards;
}

@keyframes rule-in {
  to {
    width: 78px;
  }
}

.tagline {
  margin: clamp(16px, 2.6vh, 28px) 0 0;
  font-size: clamp(0.95rem, 2.4vw, 1.35rem);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0;
  animation: rise 700ms var(--ease-out) 1400ms forwards;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -----------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */

.signup {
  width: min(520px, 100%);
  margin: clamp(28px, 5vh, 52px) 0 0;
  opacity: 0;
  animation: rise 700ms var(--ease-out) 1600ms forwards;
}

.field {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  padding: 6px;
  background: rgba(24, 0, 24, 0.62);
  border: 1px solid var(--outline);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  transition:
    border-color 240ms ease,
    box-shadow 240ms ease;
}

.field:focus-within {
  border-color: rgba(255, 107, 107, 0.4);
  box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.14);
}

/* Focus lock: four brackets close on the field, the way the mark closes on a
   target. Pure CSS, so it remains the focus indicator without JavaScript. */
.lock {
  position: absolute;
  inset: -4px;
  pointer-events: none;
}

.lock__corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--coral);
  opacity: 0;
  transition:
    opacity 200ms ease,
    transform 380ms var(--ease-spring);
}

.lock__corner--tl {
  top: 0;
  left: 0;
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: 16px 0 0 0;
  transform: translate(-10px, -10px);
}

.lock__corner--tr {
  top: 0;
  right: 0;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 16px 0 0;
  transform: translate(10px, -10px);
}

.lock__corner--bl {
  bottom: 0;
  left: 0;
  border-right-color: transparent;
  border-top-color: transparent;
  border-radius: 0 0 0 16px;
  transform: translate(-10px, 10px);
}

.lock__corner--br {
  bottom: 0;
  right: 0;
  border-left-color: transparent;
  border-top-color: transparent;
  border-radius: 0 0 16px 0;
  transform: translate(10px, 10px);
}

.field:focus-within .lock__corner {
  opacity: 1;
  transform: translate(0, 0);
}

.field:focus-within .lock__corner--tr {
  transition-delay: 45ms;
}
.field:focus-within .lock__corner--bl {
  transition-delay: 90ms;
}
.field:focus-within .lock__corner--br {
  transition-delay: 135ms;
}

.field__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--canvas);
  background: transparent;
  border: 0;
  border-radius: 12px;
  outline: none;
}

.field__input::placeholder {
  color: #a98fa9;
}

.field.is-invalid {
  border-color: var(--coral-dark);
  animation: shake 420ms ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-7px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(2px);
  }
}

/* Night on coral: 6.84:1. Never white here. */
.cta {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  padding: 14px 22px;
  font: inherit;
  font-weight: 650;
  color: var(--night);
  background: var(--coral);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 200ms var(--ease-out),
    box-shadow 200ms ease,
    background-color 200ms ease;
  will-change: transform;
}

.cta:hover {
  background: #ff8080;
  box-shadow: 0 10px 30px -8px rgba(255, 107, 107, 0.55);
}

.cta:active {
  transform: scale(0.97);
}

.cta:focus-visible {
  outline: 3px solid var(--canvas);
  outline-offset: 3px;
}

.cta[disabled] {
  cursor: progress;
  opacity: 0.75;
}

/* Sheen sweeping across the button on hover. */
.cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.42) 50%,
    transparent 62%
  );
  transform: translateX(-120%);
  transition: transform 700ms var(--ease-out);
}

.cta:hover::before {
  transform: translateX(120%);
}

.cta__label {
  position: relative;
}

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.msg {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.msg.is-ok {
  color: var(--mint);
  font-weight: 600;
}

.msg.is-error {
  color: #ff9e9e;
}

.legal {
  margin: 10px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--faint);
}

.legal a {
  color: inherit;
}

/* Success: the field collapses and the message takes its place. */
.signup.is-done .field,
.signup.is-done .legal {
  display: none;
}

.signup.is-done .msg {
  font-size: 1.1rem;
  animation: rise 520ms var(--ease-out) forwards;
}

/* -----------------------------------------------------------------------------
   Reticle: a viewfinder trailing the cursor.
   The native cursor stays visible on purpose -- hiding it hurts anyone who
   already struggles to track it, and the trailing frame reads better anyway.
   -------------------------------------------------------------------------- */

.reticle {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  width: var(--r-size, 34px);
  height: var(--r-size, 34px);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--rx, -200px), var(--ry, -200px), 0) translate(-50%, -50%)
    rotate(var(--r-rot, 0deg));
  transition:
    opacity 240ms ease,
    width 260ms var(--ease-spring),
    height 260ms var(--ease-spring);
  will-change: transform;
}

.reticle.is-visible {
  opacity: 0.9;
}

/* Tightens on the button, opens over the field, disappears once the field owns
   the lock. */
.reticle.is-tight {
  --r-size: 24px;
  opacity: 1;
}

.reticle.is-wide {
  --r-size: 52px;
}

/* Over the coral button, a coral reticle is invisible. Night reads at 6.84:1
   there -- the same rule the charter applies to text. */
.reticle.is-tight .reticle__corner {
  border-color: var(--night);
}

.reticle.is-locked {
  opacity: 0;
}

.reticle__corner {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid var(--coral);
}

.reticle__corner--tl {
  top: 0;
  left: 0;
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: 4px 0 0 0;
}

.reticle__corner--tr {
  top: 0;
  right: 0;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 4px 0 0;
}

.reticle__corner--bl {
  bottom: 0;
  left: 0;
  border-right-color: transparent;
  border-top-color: transparent;
  border-radius: 0 0 0 4px;
}

.reticle__corner--br {
  bottom: 0;
  right: 0;
  border-left-color: transparent;
  border-top-color: transparent;
  border-radius: 0 0 4px 0;
}

/* A coarse pointer has no cursor to trail; nothing here would ever be shown. */
@media (pointer: coarse) {
  .reticle {
    display: none;
  }
}

/* Ring propagating from a click, anywhere on the page. */
.wave {
  position: fixed;
  z-index: 4;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--coral);
  border-radius: 50%;
  pointer-events: none;
}

/* -----------------------------------------------------------------------------
   Language switcher — deliberately quiet
   -------------------------------------------------------------------------- */

.foot {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0 16px max(12px, env(safe-area-inset-bottom));
  text-align: center;
  opacity: 0;
  animation: rise 600ms var(--ease-out) 2000ms forwards;
}

.foot__legal {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: var(--faint);
}

.langs {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.langs__btn {
  padding: 6px 10px;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--faint);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition:
    color 200ms ease,
    background-color 200ms ease;
}

.langs__btn:hover {
  color: var(--canvas);
  background: rgba(255, 255, 255, 0.06);
}

.langs__btn[aria-current='true'] {
  color: var(--coral);
}

.langs__btn:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
   Short viewports
   -------------------------------------------------------------------------- */

@media (max-height: 560px) {
  .tagline {
    letter-spacing: 0.3em;
  }
  .signup {
    margin-top: 20px;
  }
  .rule {
    margin-top: 12px;
  }
}

@media (max-width: 520px) {
  .field {
    flex-direction: column;
  }
  .cta {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
  }
  .tagline {
    letter-spacing: 0.3em;
    font-size: 0.85rem;
  }
}

/* -----------------------------------------------------------------------------
   Motion preference. Everything above is decoration; none of it is information,
   so it all resolves to its end state at once.
   -------------------------------------------------------------------------- */

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

  .logo__corner,
  .logo__play,
  .tagline,
  .signup,
  .langs {
    opacity: 1;
  }

  .logo__wipe {
    transform: scaleX(1);
  }

  .rule {
    width: 78px;
  }

  .bg__grain,
  .bg__spot,
  .reticle,
  .wave {
    display: none;
  }

  .lock__corner {
    transform: translate(0, 0);
  }
}
