/* ===== Where You Stand - module styles =====
   Identity: cosmic violet → magenta. "Your place in the world" lands
   somewhere between the analytical indigo of Bias Lab and a warmer
   pink - the same palette family but pushed further toward pink. */

:root {
  /* Per-room palette override - applies on the Where You Stand page only,
     because this CSS is only loaded here. */
  --accent: #8b5cf6;             /* violet-500 */
  --accent-dim: rgba(139,92,246,0.10);
  --accent-2: #ec4899;           /* pink/magenta-500 */
  --glow: 0 0 40px rgba(139,92,246,0.14);

  --wys-lane-1: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  --wys-lane-2: linear-gradient(90deg, var(--accent) 0%, #c084fc 100%);
  --wys-lane-3: linear-gradient(90deg, #c084fc 0%, var(--accent-2) 100%);
  --wys-card-bg: rgba(255,255,255,0.92);
  --wys-card-border: rgba(0,0,0,0.07);
  --wys-track-bg: rgba(0,0,0,0.06);
  --wys-marker-ring: #ffffff;
}
[data-theme="dark"] {
  --accent: #a78bfa;             /* violet-400 */
  --accent-dim: rgba(167,139,250,0.18);
  --accent-2: #f472b6;           /* pink-400 */
  --glow: 0 0 40px rgba(167,139,250,0.22);

  --wys-lane-1: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  --wys-lane-2: linear-gradient(90deg, var(--accent) 0%, #d8b4fe 100%);
  --wys-lane-3: linear-gradient(90deg, #d8b4fe 0%, var(--accent-2) 100%);
  --wys-card-bg: rgba(28,28,32,0.85);
  --wys-card-border: rgba(255,255,255,0.07);
  --wys-track-bg: rgba(255,255,255,0.06);
  --wys-marker-ring: #15151a;
}

#whereYouStandRoot {
  min-height: calc(100vh - var(--nav-h));
  padding: 56px 24px 96px;
  position: relative;
  isolation: isolate;
}
/* Constellation/starfield backdrop - extends the lobby tile metaphor
   (particle bell curve in a cosmos). The SVG is a tileable 800×800
   field of scattered dots in violet + magenta. Page bg sits ABOVE
   it via z-index 0 of normal content; the ::before is at -1. */
#whereYouStandRoot::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/images/where-you-stand/starfield.svg') 0 0 / 800px 800px repeat;
  opacity: 0.85;
  z-index: -1;
  pointer-events: none;
}
[data-theme="dark"] #whereYouStandRoot::before {
  /* Brighter and more saturated against near-black bg. */
  opacity: 1;
  filter: brightness(1.5) saturate(1.2);
}

/* ── Fade transition (matches Bias Lab) ── */
.is-fading {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ===================================================================
   INTRO
   =================================================================== */
.wys-intro {
  max-width: 640px;
  margin: 0 auto;
  padding: 80px 16px 64px;
  text-align: center;
}
.wys-intro h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 24px;
}
.wys-intro-lead {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 auto 16px;
  max-width: 520px;
}
.wys-intro-rules {
  font-size: 0.95rem;
  color: var(--text-tertiary);
  margin-bottom: 40px;
}
.wys-intro-cta {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  padding: 14px 32px;
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 28px rgba(139,92,246,0.30);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.wys-intro-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(139,92,246,0.36);
}

/* ===================================================================
   FORM
   =================================================================== */
.wys-stage {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px 16px;
}
.wys-form {
  background: var(--wys-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--wys-card-border);
  border-radius: 22px;
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 0 24px 60px rgba(20,16,40,0.06);
}
.wys-form-header h2 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.wys-form-sub {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.wys-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wys-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.wys-field-help {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  line-height: 1.45;
}
.wys-input {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
}
.wys-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.wys-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  padding-right: 40px;
}
[data-theme="dark"] .wys-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398989d' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
}

/* Sex toggle pills */
.wys-toggle {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 4px;
  width: max-content;
}
.wys-toggle-btn {
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  transition: background 0.2s ease, color 0.2s ease;
}
.wys-toggle-btn.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
}

.wys-form-errors {
  font-size: 0.88rem;
  color: var(--danger);
  min-height: 1.2em;
}
.wys-form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}
.wys-back {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  transition: border-color 0.18s ease, color 0.18s ease;
}
.wys-back:hover {
  color: var(--text);
  border-color: var(--border-hover);
}
.wys-submit {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 22px rgba(139,92,246,0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.wys-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(139,92,246,0.34);
}

/* ===================================================================
   RESULTS
   =================================================================== */
.wys-results {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.wys-results-header {
  text-align: center;
  padding: 8px 0 8px;
}
.wys-results-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
}
.wys-results-sub {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ── Distribution lane ── */
.wys-lane {
  background: var(--wys-card-bg);
  border: 1px solid var(--wys-card-border);
  border-radius: 20px;
  padding: 22px 24px 24px;
  box-shadow: 0 18px 40px rgba(20,16,40,0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.wys-lane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.wys-lane-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}
.wys-lane-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.wys-lane-bar {
  position: relative;
  height: 22px;
  border-radius: 11px;
  overflow: visible;
  margin-bottom: 16px;
}
.wys-lane-track {
  position: absolute;
  inset: 0;
  background: var(--wys-track-bg);
  border-radius: 11px;
}
.wys-lane-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: var(--lane-accent);
  border-radius: 11px;
  transition: width 1.1s cubic-bezier(0.22, 0.85, 0.30, 1);
}
.wys-lane-fill.is-in { width: var(--target); }
.wys-lane-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  transition: left 1.1s cubic-bezier(0.22, 0.85, 0.30, 1);
  pointer-events: none;
}
.wys-lane-marker.is-in { left: var(--target); }
/* Marker reads as a small "star on the chart" - white ring + soft
   halo (matching the starfield aesthetic) + drop shadow. */
.wys-lane-marker-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--lane-accent);
  box-shadow:
    0 0 0 4px var(--wys-marker-ring),
    0 0 18px 4px rgba(139,92,246,0.28),
    0 8px 20px rgba(139,92,246,0.45);
}
.wys-lane-marker-stem { display: none; }

.wys-lane-caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wys-lane-caption p {
  font-size: 0.98rem;
  color: var(--text);
  line-height: 1.5;
}
.wys-lane-caption-sub {
  font-size: 0.85rem !important;
  color: var(--text-tertiary) !important;
}

/* ── Notes ── (single paragraph; context, not a wall of caveats) */
.wys-notes {
  padding: 0 4px;
}
.wys-notes p {
  font-size: 0.88rem;
  color: var(--text-tertiary);
  line-height: 1.6;
  margin: 0;
  text-align: center;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
/* ── Actions ── */
.wys-results-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.wys-action {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.wys-action--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 10px 26px rgba(139,92,246,0.30);
}
.wys-action--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(139,92,246,0.36);
}
.wys-action--ghost {
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.wys-action--ghost:hover {
  color: var(--text);
  border-color: var(--border-hover);
  text-decoration: none;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 600px) {
  #whereYouStandRoot { padding: 40px 12px 72px; }
  .wys-stage { padding: 16px 8px; }
  .wys-results { padding: 16px 8px; }
  .wys-form { padding: 28px 22px 22px; }
  .wys-lane { padding: 18px 18px 20px; }
  .wys-lane-value { font-size: 1.15rem; }
  .wys-form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .wys-back, .wys-submit { width: 100%; justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .wys-lane-fill, .wys-lane-marker { transition: none; }
  .is-fading { transition: none; }
}
