/* ============================================================================
   KING OF THE COURT — 1VS1 · Landing styles
   Mobile-first (base 390x844). Cinematic dark. One accent. Intentional friction.
   ============================================================================ */

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;                 /* no scroll — friction by design */
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, button, select { font-family: inherit; }
img { display: block; max-width: 100%; }

/* Visible focus everywhere (never removed) */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Screen-reader-only, but focus reveals it (keyboard slide alternative) */
.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;
}
.sr-focusable:focus,
.sr-focusable:focus-visible {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom,0px) + 96px);
  transform: translateX(-50%); width: auto; height: auto; clip: auto;
  margin: 0; white-space: normal; z-index: var(--z-form);
  padding: 14px 22px; background: var(--accent); color: var(--on-accent);
  font-weight: 600; border-radius: var(--r-pill); letter-spacing: .02em;
}

/* ---- Background system (shared preloader + hero) ------------------------- */
.bg {
  position: fixed; inset: 0; z-index: var(--z-bg); overflow: hidden;
  background: var(--c-ink);
}

/* CSS fallback (always present, beneath the photo): black + grain + green wash */
.bg__fallback {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 118%, rgba(31,225,122,0.18) 0%, rgba(31,225,122,0.04) 32%, transparent 60%),
    radial-gradient(90% 70% at 50% -10%, rgba(255,255,255,0.05) 0%, transparent 55%),
    linear-gradient(180deg, #0c0c0c 0%, #070707 100%);
}

/* The photo (if /assets/club.jpg loads). Hidden via .is-broken on error. */
.bg__photo {
  position: absolute; inset: -4%;            /* bleed for Ken Burns */
  width: 108%; height: 108%;
  object-fit: cover; object-position: 50% 38%;
  opacity: 0;
  filter: grayscale(0.35) contrast(1.08) brightness(0.62) saturate(0.9);
  transform: scale(1.16);
  transition: opacity 900ms var(--ease-expo);
  will-change: transform, opacity;
}
.bg__photo.is-loaded { opacity: 1; }
.bg__photo.is-broken { display: none; }

/* Ken Burns: slow zoom-out, runs through preloader + into hero */
.is-playing .bg__photo,
.is-playing .bg__fallback {
  animation: kenburns var(--dur-kenburns) var(--ease-expo) forwards;
}
@keyframes kenburns {
  from { transform: scale(1.16); }
  to   { transform: scale(1.0); }
}

/* Legibility scrim — heavier at the bottom where type and slide live */
.bg__scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, var(--scrim-top) 0%, rgba(10,10,10,0.20) 42%, var(--scrim-bottom) 100%),
    radial-gradient(140% 70% at 50% 120%, rgba(31,225,122,0.10) 0%, transparent 55%);
}

/* Film grain — fixed, pointer-events-none, never on a scroll container */
.grain {
  position: fixed; inset: 0; z-index: var(--z-grain);
  pointer-events: none; opacity: 0.06; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ---- Stage (preloader + hero share one composition) --------------------- */
.stage {
  position: relative; z-index: var(--z-stage);
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding:
    calc(var(--safe-top) + var(--s-6)) var(--s-5)
    calc(var(--safe-bottom) + var(--s-7));
}

/* Lockup block (centered mass) */
.lockup {
  align-self: center;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; width: 100%;
}

.lockup__king {
  font-family: var(--font-display);
  font-size: var(--t-king);
  letter-spacing: var(--tracking-king);
  text-indent: var(--tracking-king);            /* optical centering for big tracking */
  color: var(--text);
  font-weight: 400;
  line-height: 1;
}

.lockup__rule {
  width: clamp(120px, 46vw, 280px);
  height: 1px; margin: var(--s-4) 0 var(--s-3);
  background: var(--accent);
  box-shadow: 0 0 12px rgba(31,225,122,0.55);
  transform-origin: center;
}

.lockup__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-hero);
  line-height: var(--leading-none);
  letter-spacing: 0.06em;
  text-indent: 0.06em;
  color: var(--text);
  display: flex; gap: 0; justify-content: center;
}
/* per-glyph spans for stagger */
.lockup__title .g { display: inline-block; will-change: transform, opacity; }

/* ---- Hero foot (subline + slide + watermark) ---------------------------- */
.herofoot {
  align-self: end;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--s-5);
  width: 100%;
}

.subline {
  font-size: var(--t-sub);
  color: var(--text-muted);
  letter-spacing: 0.01em;
  text-align: center;
  max-width: 28ch;
}

/* Watermark — small, lower-left, never shouting the brand */
.watermark {
  position: fixed; left: var(--s-5);
  bottom: calc(var(--safe-bottom) + var(--s-4));
  z-index: var(--z-stage);
  display: flex; align-items: center; gap: 8px;
  font-size: var(--t-watermark); letter-spacing: var(--tracking-wide);
  text-transform: uppercase; color: var(--text-faint);
  pointer-events: none;
}
.watermark__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ============================================================================
   SLIDE TO UNLOCK
   ============================================================================ */
.slide {
  position: relative;
  width: min(280px, 84vw);
  height: var(--slide-h);
  border-radius: var(--r-pill);
  background: rgba(14,14,14,0.72);
  border: 1px solid var(--c-green-line);
  box-shadow: var(--shadow-lift), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  touch-action: none;            /* we own the horizontal drag */
  user-select: none; -webkit-user-select: none;
  overflow: hidden;
}

/* Green fill that grows behind the thumb as you drag */
.slide__fill {
  position: absolute; inset: 0;
  width: var(--slide-thumb);
  background: linear-gradient(90deg, rgba(31,225,122,0.0), rgba(31,225,122,0.16));
  border-radius: var(--r-pill);
  pointer-events: none;
}

.slide__label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding-left: 28px;            /* clear the thumb */
  font-size: 0.9rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap; pointer-events: none;
  /* shimmer sweep */
  background: linear-gradient(100deg, var(--c-gray-500) 36%, #ffffff 50%, var(--c-gray-500) 64%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 2.6s linear infinite;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

.slide__thumb {
  position: absolute; top: 4px; left: 4px;
  width: var(--slide-thumb); height: var(--slide-thumb);
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -4px rgba(31,225,122,0.5), inset 0 1px 0 rgba(255,255,255,0.4);
  transform: translateX(0);
  touch-action: none; will-change: transform;
}
.slide__thumb svg { width: 24px; height: 24px; }
.slide__thumb.is-resetting { transition: transform var(--dur-mid) var(--ease-spring); }
.slide.is-armed .slide__thumb { animation: thumbpulse 0.5s var(--ease-spring); }
@keyframes thumbpulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); box-shadow: 0 0 0 10px rgba(31,225,122,0.18); }
  100% { transform: scale(1); }
}

/* ============================================================================
   ENTRANCE / PRELOADER TIMELINE (driven by .is-playing on .app)
   ============================================================================ */
/* Initial hidden states */
.lockup__king,
.lockup__title .g { opacity: 0; transform: translateY(22px); }
.lockup__rule { transform: scaleX(0); opacity: 0; }
.herofoot { opacity: 0; transform: translateY(16px); }
.watermark { opacity: 0; }

.is-playing .lockup__king {
  animation: rise 700ms var(--ease-expo) 200ms forwards;
}
.is-playing .lockup__rule {
  animation: ruleIn 700ms var(--ease-expo) 420ms forwards;
}
.is-playing .lockup__title .g {
  animation: rise 760ms var(--ease-expo) forwards;
  animation-delay: calc(560ms + (var(--i, 0) * 70ms));
}
/* hero foot + watermark arrive AFTER the ~1.8s lockup beat */
.is-playing .herofoot {
  animation: rise 760ms var(--ease-expo) 1800ms forwards;
}
.is-playing .watermark {
  animation: fade 700ms var(--ease-expo) 2100ms forwards;
}

@keyframes rise   { to { opacity: 1; transform: translateY(0); } }
@keyframes fade   { to { opacity: 1; } }
@keyframes ruleIn { to { opacity: 1; transform: scaleX(1); } }

/* ============================================================================
   FORM OVERLAY (slides up over the hero on unlock)
   ============================================================================ */
.formwrap {
  position: fixed; inset: 0; z-index: var(--z-form);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(31,225,122,0.06), transparent 55%),
    linear-gradient(180deg, #0c0c0c 0%, var(--c-ink) 100%);
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-expo);
  display: flex; flex-direction: column;
  padding:
    calc(var(--safe-top) + var(--s-4)) var(--s-5)
    calc(var(--safe-bottom) + var(--s-5));
  visibility: hidden;
}
.formwrap.is-open { transform: translateY(0); visibility: visible; }

/* Top bar: progress + back/close */
.formtop {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: var(--tap-min);
}
.iconbtn {
  width: var(--tap-min); height: var(--tap-min); flex: 0 0 auto;
  display: grid; place-items: center; border-radius: var(--r-pill);
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease-expo), color var(--dur-fast);
}
.iconbtn:hover, .iconbtn:active { background: var(--surface); color: var(--text); }
.iconbtn svg { width: 22px; height: 22px; }

.progress {
  flex: 1; height: 3px; border-radius: var(--r-pill);
  background: var(--c-line); overflow: hidden;
}
.progress__bar {
  height: 100%; width: 20%; border-radius: var(--r-pill);
  background: var(--accent);
  box-shadow: 0 0 10px rgba(31,225,122,0.5);
  transition: width var(--dur-mid) var(--ease-expo);
}
.stepcount {
  font-family: var(--font-mono); font-size: var(--t-label);
  color: var(--text-faint); font-variant-numeric: tabular-nums;
  min-width: 3.2ch; text-align: right;
}

/* Step viewport */
.steps {
  flex: 1; position: relative; display: flex; align-items: center;
  overflow: hidden;
}
.step {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; gap: var(--s-5);
  padding: var(--s-2) 0 var(--s-8);
  opacity: 0; transform: translateY(28px);
  pointer-events: none;
  transition: opacity var(--dur-mid) var(--ease-expo), transform var(--dur-mid) var(--ease-expo);
}
.step.is-active { opacity: 1; transform: translateY(0); pointer-events: auto; }
.step.is-left   { transform: translateY(-28px); }

.step__eyebrow {
  font-family: var(--font-mono); font-size: var(--t-label);
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent);
}
.step__q {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--t-step-q); line-height: 1.05; letter-spacing: 0.01em;
  color: var(--text);
}
.step__hint { font-size: var(--t-label); color: var(--text-faint); margin-top: calc(var(--s-2) * -1); }

/* Inputs */
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field__label { font-size: var(--t-label); color: var(--text-muted); letter-spacing: 0.02em; }

.input {
  width: 100%; height: 60px;
  background: var(--surface); color: var(--text);
  font-size: var(--t-input); letter-spacing: 0.01em;
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 0 var(--s-4);
  transition: border-color var(--dur-fast) var(--ease-expo), background var(--dur-fast);
}
.input::placeholder { color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--accent); background: var(--c-ink-1); }
.input[aria-invalid="true"] { border-color: var(--c-danger); background: var(--c-danger-ink); }

/* Phone with fixed +57 prefix */
.phone { display: flex; align-items: stretch; gap: var(--s-2); }
.phone__prefix {
  display: grid; place-items: center; min-width: 64px; height: 60px;
  background: var(--c-ink-1); border: 1px solid var(--border); border-radius: var(--r-md);
  font-family: var(--font-mono); font-size: var(--t-input); color: var(--text);
}
.phone .input { flex: 1; }

/* Gender — two large choice buttons */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.choice {
  position: relative;
  height: clamp(120px, 34vw, 168px);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: transform var(--dur-fast) var(--ease-spring),
              border-color var(--dur-fast), background var(--dur-fast);
}
.choice__glyph {
  font-family: var(--font-display); font-size: 3.2rem; line-height: 1; color: var(--text);
}
.choice__name { font-size: var(--t-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
.choice:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.choice:active { transform: scale(0.97); }
.choice.is-selected {
  border-color: var(--accent); background: var(--c-green-ink);
}
.choice.is-selected .choice__glyph { color: var(--accent); }
.choice.is-selected .choice__name { color: var(--accent); }
.choice__check {
  position: absolute; top: 10px; right: 10px; width: 20px; height: 20px;
  color: var(--accent); opacity: 0; transform: scale(0.6);
  transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-spring);
}
.choice.is-selected .choice__check { opacity: 1; transform: scale(1); }

/* Inline error (aria-live) */
.error {
  display: flex; align-items: center; gap: 8px;
  min-height: 20px; font-size: var(--t-label); color: var(--c-danger);
}
.error:empty { min-height: 0; }
.error svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* Step footer / next button */
.step__foot { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-4); }

.btn {
  height: 56px; padding: 0 var(--s-6);
  border-radius: var(--r-pill);
  font-size: 1rem; font-weight: 600; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast), opacity var(--dur-fast);
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn--primary { background: var(--accent); color: var(--on-accent); flex: 1; }
.btn--primary:hover { background: var(--accent-press); }
.btn--primary[disabled] { opacity: 0.4; pointer-events: none; }
.btn--ghost { color: var(--text-muted); }
.btn--ghost:hover { color: var(--text); }
.btn--block { width: 100%; }
.btn--xl { height: 64px; font-size: 1.05rem; }
.btn .enterhint {
  font-family: var(--font-mono); font-size: 0.7rem; opacity: 0.7;
  border: 1px solid currentColor; border-radius: 6px; padding: 2px 6px; letter-spacing: 0;
}

/* ---- Confirm step (summary) --------------------------------------------- */
.summary { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); }
.summary__row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-4) 0; border-bottom: 1px solid var(--border);
}
.summary__k { font-size: var(--t-label); color: var(--text-faint); letter-spacing: 0.04em; text-transform: uppercase; }
.summary__v { font-size: var(--t-body); color: var(--text); text-align: right; word-break: break-word; }
.summary__edit {
  font-size: 0.72rem; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase;
}

/* ---- Success ------------------------------------------------------------- */
.success {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: var(--s-5); padding: var(--s-6);
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease-expo), transform var(--dur-slow) var(--ease-expo);
}
.success.is-on { opacity: 1; transform: translateY(0); pointer-events: auto; }
.success__mark {
  width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c-green-ink); border: 1px solid var(--accent); color: var(--accent);
}
.success__mark svg { width: 40px; height: 40px; }
.success__title {
  font-family: var(--font-display); font-size: clamp(2rem, 1.3rem + 5vw, 3rem);
  line-height: 1; letter-spacing: 0.02em;
}
.success__copy { color: var(--text-muted); max-width: 26ch; font-size: var(--t-sub); }
.success__tag {
  margin-top: var(--s-2); font-family: var(--font-display); letter-spacing: 0.06em;
  color: var(--accent); font-size: 1.1rem;
}

/* ---- Toast (network errors) --------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 24px);
  transform: translate(-50%, 140%); z-index: var(--z-toast);
  max-width: 90vw; display: flex; align-items: center; gap: 10px;
  background: var(--c-ink-2); border: 1px solid var(--c-danger);
  color: var(--text); padding: 12px 18px; border-radius: var(--r-pill);
  font-size: var(--t-label); box-shadow: var(--shadow-lift);
  transition: transform var(--dur-mid) var(--ease-spring);
}
.toast.is-on { transform: translate(-50%, 0); }
.toast svg { width: 18px; height: 18px; color: var(--c-danger); flex: 0 0 auto; }

/* ---- Submitting spinner -------------------------------------------------- */
.spin { width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(10,10,10,0.35); border-top-color: var(--on-accent);
  animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   RESPONSIVE — scale up gracefully (still single column, centered)
   ============================================================================ */
@media (min-width: 768px) {
  .stage { max-width: 720px; margin: 0 auto; }
  .formwrap {
    max-width: 560px; left: 50%; transform: translate(-50%, 100%);
    border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  }
  .formwrap.is-open { transform: translate(-50%, 0); }
  .subline { font-size: 1.25rem; }
}
@media (min-width: 1024px) {
  /* keep the monolith from overpowering wide screens */
  :root { --t-hero: clamp(8rem, 4rem + 10vw, 13rem); }
}

/* Landscape phones: tighten vertical rhythm so the slide stays reachable */
@media (max-height: 560px) and (orientation: landscape) {
  .stage { grid-template-rows: 1fr auto; padding-top: var(--s-3); padding-bottom: var(--s-3); }
  .lockup__rule { margin: var(--s-2) 0; }
  .herofoot { gap: var(--s-3); }
}

/* ============================================================================
   REDUCED MOTION — honor the OS setting (a11y)
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  /* Show everything immediately; no Ken Burns, no shimmer, no stagger */
  .lockup__king, .lockup__title .g, .herofoot, .watermark { opacity: 1 !important; transform: none !important; }
  .lockup__rule { opacity: 1 !important; transform: scaleX(1) !important; }
  .bg__photo { transform: scale(1) !important; }
  .slide__label { animation: none; -webkit-text-fill-color: var(--text-faint); }
}
