/* ====================================================================
   Design tokens
   Palette: a warm, paper-toned light theme. The signature motif is a
   soft gold "spotlight" glow, echoing the front-stage/back-stage idea
   the whole study is about. It appears in exactly two places: the
   welcome hero and a chosen photo — nowhere else — so it stays a
   signature, not decoration.
   ==================================================================== */
:root {
  --bg: #faf8f4;
  --bg-card: #ffffff;
  --bg-alt: #f1ece2;
  --ink: #1c1b19;
  --ink-soft: #6b665c;
  --ink-faint: #a7a195;
  --border: #e6e0d4;
  --front: #c9a24b; /* spotlight gold */
  --front-soft: #e8d9af;
  --back: #51626b; /* slate, the unlit half of the stage */
  --back-soft: #c3ccd1;
  --danger: #a8553f;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 8px;

  --ease-slow: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);

  --max-w: 480px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-alt);
  color: var(--ink);
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 200;
  src: url('/fonts/montserrat-latin-200-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 300;
  src: url('/fonts/montserrat-latin-300-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  src: url('/fonts/montserrat-latin-400-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500;
  src: url('/fonts/montserrat-latin-500-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  src: url('/fonts/montserrat-latin-600-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  src: url('/fonts/montserrat-latin-700-normal.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 800;
  src: url('/fonts/montserrat-latin-800-normal.woff2') format('woff2');
  font-display: swap;
}

/* ====================================================================
   App shell — always a single vertical column, even on desktop.
   ==================================================================== */
.app-shell {
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.06);
}

.screens {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 2s var(--ease-slow);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.screen[data-pos='current'] {
  transform: translateY(0);
}
.screen[data-pos='next'] {
  transform: translateY(100%);
}
.screen[data-pos='prev'] {
  transform: translateY(-100%);
}

.screen-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 40px 28px 36px;
}

/* ==================== Welcome screen ==================== */
.welcome-spotlight {
  position: absolute;
  top: -120px;
  left: 50%;
  width: 480px;
  height: 480px;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--front-soft) 0%, rgba(232, 217, 175, 0) 70%);
  opacity: 0.8;
  pointer-events: none;
}

.welcome-screen .screen-inner {
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 18px;
}

.welcome-title {
  font-size: 30px;
  font-weight: 200;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin: 0 0 22px;
}

.welcome-body {
  font-size: 15.5px;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.75;
  white-space: pre-line;
  margin: 0 0 40px;
  max-width: 360px;
}

/* ==================== Buttons ==================== */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 16px 36px;
  border-radius: 100px;
  transition: transform 0.45s var(--ease-soft), box-shadow 0.45s var(--ease-soft),
    background 0.45s var(--ease-soft), opacity 0.45s var(--ease-soft);
}
.btn-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 26px rgba(28, 27, 25, 0.18);
}
.btn-primary:disabled {
  opacity: 0.35;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-primary:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(28, 27, 25, 0.24);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--ink-soft);
}
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ==================== Selection screen ==================== */
.selection-header {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--bg);
  padding-bottom: 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.selection-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}
.selection-instruction {
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 14px;
}
.progress-track {
  height: 4px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
  margin: 0;
}
.progress-fill {
  height: 100%;
  background: var(--front);
  width: 0%;
  transition: width 0.6s var(--ease-soft);
}

.pairs {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 0 18px;
}

.pair-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 20px 16px;
}
.pair-caption {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.55;
  text-align: center;
  color: var(--ink);
  margin: 0 0 16px;
}

.pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--bg-alt);
  cursor: pointer;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.choice-img {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: grayscale(0);
  opacity: 1;
  transform: scale(1);
  transition: filter 1s ease-out, opacity 1s ease-out, transform 0.4s var(--ease-soft);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.choice.fast .choice-img {
  transition: filter 0.5s ease-out, opacity 0.5s ease-out, transform 0.3s var(--ease-soft);
}
.choice-img.bw {
  filter: grayscale(1);
  opacity: 0.5;
}
.choice.selected .choice-img {
  transform: scale(1.015);
}
.choice::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 2px var(--front), 0 14px 34px -6px rgba(201, 162, 75, 0.55);
  opacity: 0;
  transition: opacity 1s ease-out;
  pointer-events: none;
}
.choice.fast::after {
  transition: opacity 0.5s ease-out;
}
.choice.selected::after {
  opacity: 1;
}

.submit-bar {
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
}

/* ==================== Modal ==================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 27, 25, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-soft);
  z-index: 20;
  padding: 24px;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 26px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.4s var(--ease-soft);
}
.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 22px;
}

/* ==================== Reveal screen ==================== */
.reveal-screen .screen-inner {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.reveal-text {
  font-size: 25px;
  font-weight: 200;
  line-height: 1.5;
  letter-spacing: 0.005em;
  margin: 0 0 48px;
}
.char-reveal .char {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.7s var(--ease-soft), filter 0.7s var(--ease-soft);
}
.char-reveal .char.in {
  opacity: 1;
  filter: blur(0);
}
.char-reveal .accent {
  color: var(--front);
  font-weight: 600;
}
.fade-in-btn {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s var(--ease-soft), transform 0.8s var(--ease-soft);
  pointer-events: none;
}
.fade-in-btn.in {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ==================== Results screen ==================== */
.results-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 22px;
}
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 10px 18px;
  text-align: center;
}
.chart-card svg {
  width: 100%;
  height: auto;
  max-width: 160px;
  margin: 0 auto;
  display: block;
  overflow: visible;
  opacity: 0;
  transform: scale(0.85) translateY(6px);
  transition: opacity 0.9s var(--ease-soft), transform 0.9s var(--ease-soft);
}
.chart-card svg.in {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.chart-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 10px;
}
.result-text {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  margin: 0 0 18px;
}
.result-disclaimer {
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin: 0 0 30px;
}

.demographics {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.demographics-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0 0 16px;
}
.field-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 10px;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.4s var(--ease-soft), color 0.4s var(--ease-soft),
    background 0.4s var(--ease-soft);
}
.chip.active {
  border-color: var(--front);
  color: var(--ink);
  background: var(--front-soft);
}
.thank-you {
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
  opacity: 0;
  height: 0;
  transition: opacity 0.6s var(--ease-soft);
}
.thank-you.in {
  opacity: 1;
  height: auto;
  margin-top: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .choice-img,
  .reveal-text .char,
  .reveal-next {
    transition-duration: 0.01ms !important;
  }
}
