/* ═══════════════════════════════════════════
   STANCE — Design System
   ═══════════════════════════════════════════ */

/* ── Design Tokens ── */

:root {
  --bg: #000000;
  --surface: #0A0A0A;
  --surface-2: #151515;
  --border: #1F1F1F;
  --border-hover: #333333;
  --text-1: #F8FAFC;
  --text-2: #94A3B8;
  --text-3: #64748B;
  --text-4: #334155;
  --accent: #2DD4BF;
  --accent-hover: #5EEAD4;
  --accent-dim: rgba(45, 212, 191, 0.10);
  --negative: #F43F5E;
  --font: 'Inter', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Reset ── */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-2);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Canvas Background ── */

#bgCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}


/* ═══ HERO ═══ */

.hero {
  position: relative;
  z-index: 10;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  transition: opacity 0.6s ease;
  overflow: hidden;
}

body.signed-up .hero {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.hero-inner {
  text-align: center;
  width: 100%;
  max-width: 960px;
  transform-style: preserve-3d;
  transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.15s ease-out;
  will-change: transform;
}

/* ── Title ── */

.title {
  display: block;
  width: min(460px, 80vw);
  height: calc(min(460px, 80vw) * 0.18);
  margin: 0 auto 16px;
  object-fit: cover;
  object-position: center bottom;
  opacity: 0;
  animation: fade-up 0.9s var(--ease) 0.15s forwards;
}

/* ── Subtitle ── */

.sub {
  font-size: clamp(15px, 2.5vw, 20px);
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0;
  animation: fade-up 0.8s ease 0.5s forwards;
}

/* ── Waitlist Count ── */

.count {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.count.visible { opacity: 1; }
.count #userCount {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Signup Form ── */

.form {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  opacity: 0;
  animation: fade-up 0.8s ease 0.9s forwards;
}

.form input {
  flex: 1;
  padding: 14px 20px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  color: var(--text-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  outline: none;
  transition: border-color 0.2s;
}
.form input::placeholder { color: var(--text-4); }
.form input:focus { border-color: var(--accent); }

.form button {
  padding: 14px 28px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}
.form button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.form button:active { transform: scale(0.97); }
.form button:disabled { opacity: 0.3; cursor: default; }

/* ── Inline Form Error ── */

.form-error {
  font-size: 14px;
  color: var(--negative);
  text-align: center;
  margin-top: 10px;
  min-height: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.form-error.visible { opacity: 1; }

/* ── Reveal Messages ── */

.reveal {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease 0.5s;
  white-space: nowrap;
  z-index: 20;
}
.reveal.show { opacity: 1; }
.reveal span {
  color: var(--text-3);
  font-size: 16px;
  font-weight: 400;
  display: block;
  margin-top: 8px;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Replacement Icons ── */

.replacements {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 28px;
  opacity: 0;
  animation: fade-up 0.8s ease 1.3s forwards;
}

body.signed-up .replacements { display: none; }

.rep-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.rep-sublabel {
  font-size: 12px;
  color: var(--text-4);
  margin-bottom: 16px;
}

.rep-row {
  display: flex;
  gap: 40px;
}

.rep-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 80px;
}

.rep-icon-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rep-icon {
  width: 26px;
  height: 26px;
  color: var(--text-4);
  opacity: 0.5;
  transition: opacity 0.25s ease;
}

.rep-icon-wrap::after {
  content: '';
  position: absolute;
  top: 50%; left: -2px; right: -2px;
  height: 1.5px;
  background: var(--negative);
  opacity: 0.45;
  transform: rotate(-20deg);
  pointer-events: none;
}

.rep-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-align: center;
  transition: opacity 0.25s ease;
  line-height: 1.2;
}

.rep-card .rep-reveal {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.rep-card.revealed .rep-icon { opacity: 0.12; }
.rep-card.revealed .rep-name { opacity: 0; }
.rep-card.revealed .rep-reveal { opacity: 1; }


/* ── Mobile Hero ── */

@media (max-width: 640px) {
  .hero { padding: 0 20px; }
  .title { width: min(280px, 75vw); margin-bottom: 12px; }
  .sub { margin-bottom: 12px; letter-spacing: 0.1em; font-size: 14px; }
  .count { font-size: 16px; margin-bottom: 10px; }
  .form { flex-direction: column; gap: 10px; max-width: 100%; }
  .form input {
    border-right: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
  }
  .form input:focus { border-color: var(--accent); }
  .form button { border-radius: 6px; padding: 16px; }
  .reveal { font-size: 18px; white-space: normal; width: 80%; text-align: center; }
  .replacements { margin-top: 20px; }
  .rep-row { gap: 24px; }
  .rep-card { width: 64px; }
  .rep-icon { width: 20px; height: 20px; }
  .rep-name { font-size: 11px; }
  .rep-card .rep-reveal { width: 100px; font-size: 10px; }
  .foot { margin-top: 16px; }
}


/* ═══ DASHBOARD ═══ */

.dash {
  display: none;
  min-height: 100vh;
  padding: 60px 24px 100px;
  position: relative;
  z-index: 10;
}

body.signed-up .dash {
  display: block;
  opacity: 0;
  animation: fade-up 0.8s var(--ease) 0.5s forwards;
}

.dash-inner {
  max-width: 520px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 8px;
  padding: 36px 28px;
  border: 1px solid var(--border);
}

.dash-header {
  text-align: center;
  margin-bottom: 40px;
}

.dash-wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.dash-pos {
  text-align: center;
  margin-bottom: 40px;
  padding: 32px 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.dash-pos-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.dash-pos-num {
  font-size: clamp(44px, 10vw, 72px);
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}

.dash-section {
  padding: 24px 0;
  border-top: 1px solid var(--border);
}
.dash-section-last { border-bottom: none; }

.dash-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.03em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-sub {
  font-size: 12px;
  color: var(--text-4);
  margin-bottom: 16px;
}

.dash-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  padding: 2px 8px;
  background: var(--accent-dim);
  border-radius: 4px;
}

.dash-link-row {
  display: flex;
  margin-bottom: 12px;
}

.dash-link-input {
  flex: 1;
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  outline: none;
  text-align: center;
}
.dash-link-input:focus { border-color: var(--accent); }

.dash-copy {
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.dash-copy:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.dash-share {
  display: flex;
  gap: 8px;
}

.dash-share-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.dash-share-btn:hover {
  color: var(--text-1);
  border-color: var(--border-hover);
  background: var(--surface);
}
.dash-share-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.dash-list { display: flex; flex-direction: column; margin-top: 12px; }

.dash-ref {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dash-ref:last-child { border-bottom: none; }
.dash-ref-email { font-size: 13px; color: var(--text-3); }
.dash-ref-date { font-size: 11px; color: var(--text-4); margin-top: 2px; }
.dash-ref-pos {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dash-lb {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.dash-lb:last-child { border-bottom: none; }
.dash-lb-rank {
  width: 24px;
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dash-lb-email { flex: 1; font-size: 12px; color: var(--text-3); padding: 0 10px; }
.dash-lb-refs { font-size: 13px; color: var(--text-2); font-weight: 600; }

.dash-empty, .dash-muted {
  padding: 24px 0;
  font-size: 12px;
  color: var(--text-4);
  text-align: center;
}

@media (max-width: 640px) {
  .dash { padding: 40px 16px 80px; }
  .dash-inner { padding: 28px 20px; }
  .dash-pos { padding: 24px 20px; margin-bottom: 32px; }
  .dash-link-row { flex-direction: column; gap: 8px; }
  .dash-link-input { border-right: 1px solid var(--border); border-radius: 6px; }
  .dash-copy { border-radius: 6px; }
  .dash-share { flex-direction: column; }
}


/* ═══ FOOTER ═══ */

.foot {
  margin-top: 24px;
  flex-shrink: 0;
  text-align: center;
  padding: 16px;
  z-index: 50;
}
.foot a {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-4);
  text-decoration: none;
  margin: 0 14px;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.foot a:hover { color: var(--text-2); }


/* ═══ REDUCED MOTION ═══ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .title, .sub, .form, .count.visible, .replacements { opacity: 1; transform: none; }
}
