/* =========================================================
   Getting To Know You — styles
   Palette: white / soft pink / iridescent chrome
   ========================================================= */

:root {
  --white: #ffffff;
  --pearl: #fdf7f8;
  --blush: #ffe4ea;
  --pink: #ffb6c1;
  --pink-deep: #ff69b4;
  --pink-ink: #c2305f;
  --ink: #2a1a22;
  --ink-soft: #5a4651;
  --line: rgba(42, 26, 34, 0.16);
  --line-soft: rgba(42, 26, 34, 0.08);

  --serif: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ease-spring: cubic-bezier(0.2, 0.9, 0.25, 1.2);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: relative;
  min-height: 100dvh;
}

/* =========================================================
   Background — gradient mesh + parallax layers + grain
   ========================================================= */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-mesh {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(60% 50% at 20% 30%, rgba(255, 182, 193, 0.55), transparent 60%),
    radial-gradient(55% 45% at 80% 20%, rgba(255, 228, 234, 0.85), transparent 65%),
    radial-gradient(70% 60% at 50% 90%, rgba(255, 105, 180, 0.18), transparent 70%),
    radial-gradient(40% 35% at 90% 80%, rgba(253, 247, 248, 1), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #fff5f7 60%, #ffe9ee 100%);
  filter: saturate(1.05);
  animation: meshDrift 28s ease-in-out infinite alternate;
}

@keyframes meshDrift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-2%, 1%, 0) scale(1.04); }
  100% { transform: translate3d(2%, -1%, 0) scale(1.02); }
}

.bg-layer {
  position: absolute;
  inset: -20%;
  /* No CSS transition on transform — JS rAF drives the parallax. */
}

.bg-layer-a {
  background:
    radial-gradient(40% 30% at 25% 70%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(35% 25% at 75% 30%, rgba(255, 192, 203, 0.45), transparent 60%);
  /* No mix-blend-mode — costs a full compositor pass on weak GPUs. */
}

.bg-layer-b {
  background:
    radial-gradient(20% 18% at 60% 60%, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(15% 14% at 30% 25%, rgba(255, 182, 193, 0.35), transparent 70%);
  /* Removed soft-light blend + 6px blur — both very expensive on mobile. */
}

.bg-layer-c {
  /* Iridescent light leak — kept but with a much smaller blur. */
  background:
    conic-gradient(
      from 200deg at 80% 20%,
      rgba(255, 220, 230, 0.0),
      rgba(200, 230, 255, 0.14),
      rgba(255, 200, 220, 0.18),
      rgba(255, 240, 200, 0.14),
      rgba(220, 200, 255, 0.14),
      rgba(255, 220, 230, 0.0)
    );
  filter: blur(18px);
  opacity: 0.55;
  animation: iriDrift 30s linear infinite;
}

/* Promote the layers to their own composite layer once, instead of
   thrashing it on every parallax tick. */
.bg-layer,
.bg-word {
  transform: translate3d(0, 0, 0);
}

@keyframes iriDrift {
  0%   { transform: rotate(0deg) scale(1); }
  100% { transform: rotate(360deg) scale(1); }
}

.bg-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Words of affirmation — float in background, react to gyroscope/mouse */
.bg-words {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.bg-word {
  position: absolute;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(13px, 2.4vw, 19px);
  letter-spacing: 0.02em;
  white-space: nowrap;
  user-select: none;
  color: var(--pink-ink);
  opacity: 0;
  text-shadow:
    0 0 18px rgba(255, 105, 180, 0.35),
    0 0 2px rgba(255, 255, 255, 0.6);
  will-change: transform, opacity;
  animation: wordBloom 9s ease-in-out infinite;
}

/* Stagger each word's bloom so they don't pulse in unison */
.bg-word:nth-child(1)  { animation-delay: 0.2s; }
.bg-word:nth-child(2)  { animation-delay: 1.4s; }
.bg-word:nth-child(3)  { animation-delay: 2.6s; }
.bg-word:nth-child(4)  { animation-delay: 0.7s; }
.bg-word:nth-child(5)  { animation-delay: 3.2s; }
.bg-word:nth-child(6)  { animation-delay: 1.9s; }
.bg-word:nth-child(7)  { animation-delay: 4.0s; }
.bg-word:nth-child(8)  { animation-delay: 2.2s; }
.bg-word:nth-child(9)  { animation-delay: 5.1s; }
.bg-word:nth-child(10) { animation-delay: 3.7s; }
.bg-word:nth-child(11) { animation-delay: 0.4s; }
.bg-word:nth-child(12) { animation-delay: 4.6s; }

@keyframes wordBloom {
  0%   { opacity: 0.08; }
  50%  { opacity: 0.22; }
  100% { opacity: 0.08; }
}

/* =========================================================
   Progress bar
   ========================================================= */

.progress {
  position: fixed;
  top: calc(var(--safe-top) + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 48px));
  height: 2px;
  background: rgba(42, 26, 34, 0.08);
  border-radius: 999px;
  z-index: 50;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

.progress.visible { opacity: 1; }

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink) 0%, var(--pink-deep) 100%);
  border-radius: 999px;
  transition: width 0.6s var(--ease-out);
  box-shadow: 0 0 12px rgba(255, 105, 180, 0.5);
}

/* =========================================================
   Stage + scenes (3D card flip transitions)
   ========================================================= */

.stage {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 56px) 24px calc(var(--safe-bottom) + 32px);
}

.scene {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 56px) 24px calc(var(--safe-bottom) + 32px);
  /* Transitions are driven by Web Animations API in main.js — no CSS
     transition rules here. will-change is toggled on/off in JS so we
     don't keep composite layers around forever. */
}

/* =========================================================
   Typography
   ========================================================= */

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 22px;
  font-weight: 500;
}

.display {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(30px, 6.4vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0 0 18px;
}

.subtext {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 28px;
  font-weight: 400;
}

/* =========================================================
   Landing scene
   ========================================================= */

.scene-landing { text-align: center; }

.landing-inner {
  max-width: 460px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.emblem {
  color: var(--ink);
  margin-bottom: 28px;
  opacity: 0.85;
}
.emblem svg { display: block; }
.emblem circle:first-child { animation: ringSpin 24s linear infinite; transform-origin: center; transform-box: fill-box; }

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

.dots {
  display: flex;
  gap: 8px;
  margin: 4px 0 28px;
}
.dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.35;
  animation: dotPulse 2.4s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: 0.3s; }
.dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes dotPulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.3); }
}

.footer-micro {
  margin-top: 28px;
  font-size: 10.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.7;
}

/* =========================================================
   CTA button (iridescent shimmer)
   ========================================================= */

.cta {
  appearance: none;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 16px 30px;
  min-height: 50px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--ease-spring), color 0.3s, border-color 0.3s, box-shadow 0.4s;
  isolation: isolate;
}

.cta::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  background: conic-gradient(
    from 0deg,
    #ffd1dc, #b8e0ff, #fff3b8, #f0c8ff, #ffd1dc
  );
  filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  z-index: -1;
  animation: hueRotate 4s linear infinite;
}

.cta:hover::before,
.cta:focus-visible::before { opacity: 0.55; }

.cta:hover { transform: translateY(-1px); }
.cta:active { transform: translateY(0) scale(0.98); }

.cta:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.cta-submit:not(:disabled) {
  border-color: var(--pink-deep);
  color: var(--pink-ink);
  animation: ctaPulse 2.6s ease-in-out infinite;
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 105, 180, 0); }
  50% { box-shadow: 0 0 24px rgba(255, 105, 180, 0.35), 0 0 8px rgba(255, 255, 255, 0.6); }
}

@keyframes hueRotate {
  to { filter: blur(10px) hue-rotate(360deg); }
}

/* =========================================================
   Stagger fade-up entrance
   ========================================================= */

.stagger {
  opacity: 0;
  transform: translateY(14px);
  animation: staggerIn 0.95s var(--ease-out) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes staggerIn {
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Section interstitial
   ========================================================= */

.scene-section { text-align: center; }
.section-inner {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.section-name {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
  background: linear-gradient(90deg, var(--pink-ink), var(--ink), var(--pink-ink));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmerText 3.5s linear infinite;
}

@keyframes shimmerText {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.divider {
  width: 180px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  position: relative;
}

.divider .diamond {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--pink-deep);
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 8px rgba(255, 105, 180, 0.6);
}

/* =========================================================
   Question scenes
   ========================================================= */

.scene-question { text-align: center; }

.q-inner {
  max-width: 540px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.q-eyebrow { margin-bottom: 18px; }

.q-text {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(24px, 5.4vw, 36px);
  line-height: 1.2;
  margin: 0 0 14px;
  min-height: 1.2em;
}

.q-text .caret {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  background: var(--pink-deep);
  margin-left: 4px;
  vertical-align: -0.05em;
  animation: caretBlink 0.9s steps(2) infinite;
}

@keyframes caretBlink {
  to { opacity: 0; }
}

.q-hint {
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 28px;
  font-style: italic;
  opacity: 0;
  animation: fadeIn 0.6s var(--ease-out) 0.4s forwards;
}

.q-hint:empty { display: none; }

@keyframes fadeIn {
  to { opacity: 1; }
}

.q-input {
  width: 100%;
  margin-bottom: 28px;
  opacity: 0;
  transform: translateY(8px);
  animation: inputIn 0.7s var(--ease-out) 0.45s forwards;
}

@keyframes inputIn {
  to { opacity: 1; transform: translateY(0); }
}

.q-error {
  color: var(--pink-ink);
  font-size: 12.5px;
  margin: 0 0 14px;
  min-height: 1em;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.3s;
}
.q-error.visible { opacity: 1; }

/* ---- Free text input (writes-itself underline) ---- */

.text-field {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.text-field input,
.text-field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(18px, 4.4vw, 22px);
  color: var(--ink);
  padding: 12px 4px;
  outline: none;
  text-align: center;
  resize: none;
}

.text-field textarea {
  min-height: 96px;
  text-align: left;
  line-height: 1.5;
}

.text-field input::placeholder,
.text-field textarea::placeholder {
  color: rgba(90, 70, 81, 0.4);
  font-style: italic;
}

.text-field .underline {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--pink-deep));
  border-radius: 1px;
  transition: width 0.25s var(--ease-out);
  box-shadow: 0 0 8px rgba(255, 105, 180, 0.4);
}

/* ---- Chips (single & multi select) ---- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 400;
  padding: 12px 18px;
  min-height: 48px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.3s var(--ease-spring), background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
  letter-spacing: 0.01em;
}

/* Backdrop blur is gorgeous but costly — only on capable GPUs. */
.gpu-rich .chip {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chip:hover { border-color: var(--pink); }

.chip.selected {
  background: var(--pink-deep);
  color: #fff;
  border-color: var(--pink-deep);
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(255, 105, 180, 0.35);
}

.chip:active { transform: scale(0.97); }
.chip.selected:active { transform: scale(1.02); }

/* Inline "Other" text reveal under a chip group */
.other-field {
  width: 100%;
  max-width: 360px;
  margin: 18px auto 0;
  position: relative;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease-out), opacity 0.4s var(--ease-out), margin-top 0.4s var(--ease-out);
}
.other-field.visible {
  max-height: 80px;
  opacity: 1;
}
.other-field input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(16px, 4vw, 19px);
  color: var(--ink);
  padding: 10px 4px;
  outline: none;
  text-align: center;
}
.other-field input::placeholder {
  color: rgba(90, 70, 81, 0.4);
  font-style: italic;
}
.other-field .underline {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--pink-deep));
  border-radius: 1px;
  transition: width 0.25s var(--ease-out);
  box-shadow: 0 0 8px rgba(255, 105, 180, 0.4);
}

/* =========================================================
   Thank you scene
   ========================================================= */

.scene-thanks { text-align: center; }

.scene-thanks::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(50% 40% at 50% 50%, rgba(255, 182, 193, 0.45), transparent 70%);
  animation: bloom 6s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes bloom {
  0%   { opacity: 0.5; transform: scale(0.95); }
  100% { opacity: 0.9; transform: scale(1.08); }
}

.thanks-inner {
  position: relative;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.heart {
  color: var(--pink-deep);
  margin-bottom: 28px;
}

.heart path {
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: drawHeart 1.6s var(--ease-out) 0.4s forwards,
             heartBeat 2.4s ease-in-out 2s infinite;
  transform-origin: center;
  transform-box: fill-box;
}

@keyframes drawHeart {
  to { stroke-dashoffset: 0; }
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  10% { transform: scale(1.08); }
  20% { transform: scale(1); }
  30% { transform: scale(1.05); }
  40% { transform: scale(1); }
}

.thanks-display {
  animation: staggerIn 1s var(--ease-out) 0.6s both;
}
.thanks-sub {
  animation: staggerIn 1s var(--ease-out) 0.9s both;
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

/* =========================================================
   Transition mode — set on <body> while a scene swap is
   running. Suspends *all* continuous animations underneath
   so the GPU can give the swap full headroom. The bg-words
   layer fades out entirely so the compositor isn't drawing
   12 text-shadows behind a moving card.
   ========================================================= */

body.transitioning .bg-mesh,
body.transitioning .bg-layer-c,
body.transitioning .bg-word,
body.transitioning .emblem circle:first-child,
body.transitioning .section-name,
body.transitioning .cta-submit,
body.transitioning .heart path,
body.transitioning .scene-thanks::before,
body.transitioning .dots span {
  animation-play-state: paused !important;
}

body.transitioning .bg-words {
  opacity: 0;
}

.bg-words {
  transition: opacity 0.4s ease;
}

/* =========================================================
   Low-power mode — switched on by JS feature detection.
   Disables the most expensive paint/composite work while
   keeping the visual identity recognisable.
   ========================================================= */

.low-power .bg-layer-c { display: none; }
.low-power .bg-grain { display: none; }
.low-power .bg-mesh { animation: none; }
.low-power .emblem circle:first-child { animation: none; }
.low-power .cta::before { display: none !important; }
.low-power .cta-submit:not(:disabled) { animation: none; }
.low-power .section-name { animation: none; background: none; color: var(--ink); }
.low-power .scene-thanks::before { animation: none; }
.low-power .bg-word { text-shadow: none; }
.low-power .heart path { animation: drawHeart 1.6s var(--ease-out) 0.4s forwards; }

/* =========================================================
   Reduced motion (user-requested) — collapse animations.
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.1s !important;
  }
  .stagger { opacity: 1; transform: none; }
}

/* Tiny additional optimisation: tell the browser the stage is its
   own paint container so its repaints don't reflow the page. */
.stage { contain: layout paint; }

/* =========================================================
   Tiny screens
   ========================================================= */

@media (max-width: 380px) {
  .cta { padding: 14px 24px; font-size: 12px; }
  .chip { padding: 10px 14px; font-size: 13px; }
}
