/* ============================================================
   Who What Where — waitlist page
   Design tokens mirrored from the app (src/constants/theme.ts)
   ============================================================ */

:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --gradient-end: #c026d3;
  --background: #faf8f2;
  --surface: #ffffff;
  --surface-elevated: #f3f0e8;
  --text: #1e1b4b;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --border: #e5e0d5;
  --success: #10b981;
  --accent: #f59e0b;

  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --gradient: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);

  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--background);
  /* warm radial wash echoing the brand gradient, kept subtle on cream */
  background-image:
    radial-gradient(120% 80% at 100% 0%, rgba(192, 38, 211, 0.08) 0%, transparent 55%),
    radial-gradient(100% 70% at 0% 100%, rgba(124, 58, 237, 0.07) 0%, transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Logo ---------- */

.site-logo {
  position: absolute;
  top: 24px;
  left: 24px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  z-index: 10;
}

.site-logo img {
  height: 30px;
  width: auto;
  display: block;
}

.site-logo__name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}

@media (min-width: 900px) {
  .site-logo {
    top: 32px;
    left: 40px;
  }

  .site-logo img {
    height: 34px;
  }

  .site-logo__name {
    font-size: 19px;
  }
}

/* ---------- Layout ---------- */

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
  min-height: 100vh;
}

@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 56px;
    padding: 64px 40px;
  }
}

/* ---------- Copy column ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  width: fit-content;
}

.chip__icon {
  width: 18px;
  height: 18px;
}

.headline {
  font-weight: 800;
  font-size: clamp(2.6rem, 6vw, 4.3rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 16px 0 0;
  color: var(--text);
}

.subcopy {
  margin: 22px 0 0;
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 34em;
}

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

.waitlist-form {
  margin-top: 36px;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  max-width: 520px;
  flex-wrap: nowrap;
}

.field {
  position: relative;
  flex: 1 1 200px;
  display: flex;
  align-items: center;
}

.field__icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--text-subtle);
  pointer-events: none;
}

.field__input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  padding: 14px 16px 14px 46px;
}

.field__input::placeholder {
  color: var(--text-subtle);
}

.btn-join {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  padding: 14px 26px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 8px 20px -8px rgba(124, 58, 237, 0.55);
  transition:
    transform 0.12s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.btn-join:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -8px rgba(124, 58, 237, 0.65);
}

.btn-join:active {
  transform: translateY(0);
}

.btn-join:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.btn-join__icon {
  width: 18px;
  height: 18px;
}

/* spinner state */
.btn-join.is-loading .btn-join__icon {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* On narrow screens the inline pill gets cramped — stack into a clean card:
   input on top, full-width button below. Placed after the base form/button
   rules so these overrides win. */
@media (max-width: 560px) {
  .waitlist-form {
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--radius-xl);
    gap: 8px;
    padding: 10px;
  }

  .field {
    flex: 0 0 auto;
  }

  .btn-join {
    width: 100%;
    padding: 14px;
  }
}

.form-note {
  margin: 12px 4px 0;
  font-size: 13px;
  color: var(--text-subtle);
}

.form-message {
  margin: 8px 4px 0;
  min-height: 1.2em;
  font-size: 14px;
  font-weight: 500;
}

.form-message.is-error {
  color: var(--accent);
}

.form-message.is-success {
  color: var(--success);
}

/* success replacement block */
.success-block {
  margin-top: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 520px;
  font-weight: 500;
  color: var(--text);
}

.success-block .success-block__icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.success-block .success-block__icon svg {
  width: 20px;
  height: 20px;
}

/* ============================================================
   iPhone mockup
   ============================================================ */

.hero__device {
  display: flex;
  justify-content: center;
}

.phone {
  position: relative;
  width: 300px;
  aspect-ratio: 300 / 650;
  filter: drop-shadow(0 30px 50px rgba(30, 27, 75, 0.22));
}

/* The animated game screen sits inside the CSS-drawn phone shell. */
.phone__screen {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: var(--background);
  border-radius: 40px;
  overflow: hidden;
}

.phone--css-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 52px;
  background: #15131f;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.06),
    inset 0 0 0 10px #15131f;
}

.phone--css-frame::after {
  /* dynamic island */
  content: "";
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 92px;
  height: 26px;
  background: #0a0910;
  border-radius: var(--radius-full);
  z-index: 3;
}

/* ---------- In-screen game UI ---------- */

.game {
  position: absolute;
  inset: 0;
  /* extra top padding clears the dynamic island (ends ~38px into the screen) */
  padding: 44px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Secret character card */
.secret {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg);
  padding: 8px 10px;
}

.secret__avatar {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  display: grid;
  place-items: center;
  /* blurred mystery look */
  overflow: hidden;
}

.secret__avatar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.18) 0 6px,
    transparent 6px 12px
  );
  filter: blur(3px);
}

.secret__q {
  position: relative;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.secret__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.secret__label {
  font-size: 9px;
  color: var(--text-subtle);
}

.secret__name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.secret__warn {
  font-size: 9px;
  color: var(--text-subtle);
}

/* Turn indicator */
.turn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.turn__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--success);
  animation: pulse 0.8s ease-in-out infinite alternate;
}

.turn__text {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}

.turn__round {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-subtle);
}

/* opponent turn state */
.turn.is-opponent .turn__dot {
  background: #d1d5db;
  animation: none;
}

.turn.is-opponent .turn__text {
  color: var(--text-subtle);
}

@keyframes pulse {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.4;
  }
}

/* Board */
.board-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  margin-top: 2px;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

/* Character tile with a 3D flip */
.tile {
  perspective: 600px;
  aspect-ratio: 5 / 6;
}

.tile__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.42s ease-in-out;
}

.tile.is-eliminated .tile__inner {
  transform: rotateY(180deg);
}

.tile__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.tile__avatar {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.tile__name {
  flex: 0 0 auto;
  height: 13px;
  background: #f9fafb;
  font-size: 7px;
  font-weight: 500;
  color: var(--text);
  display: grid;
  place-items: center;
  overflow: hidden;
  white-space: nowrap;
}

/* back face: dimmed, like the real eliminate state */
.tile__face--back {
  transform: rotateY(180deg);
  opacity: 0.4;
  border-color: transparent;
}

/* Waiting banner — overlays the bottom of the screen so it never
   pushes the board out of the fixed-height phone screen */
.waiting {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  text-align: center;
  background: var(--surface);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg);
  padding: 10px;
  font-size: 11px;
  color: var(--text-subtle);
  box-shadow: 0 -8px 16px -6px rgba(250, 248, 242, 0.9);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.waiting.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Reduced motion: hold a static mid-game frame ---------- */
@media (prefers-reduced-motion: reduce) {
  .tile__inner,
  .turn__dot,
  .waiting,
  .btn-join {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------------------------------------------------------------------------
   Site footer — legal links. Kept minimal so it doesn't compete with the
   hero/signup form above it.
   -------------------------------------------------------------------------*/
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2.5rem 1.25rem 2rem;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text-subtle);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-footer a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
