/* =============================================
   GENDER REVEAL — Elevated Romance Aesthetic
   Cormorant Garamond + Jost
   ============================================= */

/* --- Variables --- */
:root {
  --bg:           #FDFAF6;
  --blue:         #A8C5DA;
  --blue-deep:    #7AACC4;
  --blue-pale:    #E4F0F7;
  --blush:        #F2D7D5;
  --blush-deep:   #E4B5B2;
  --blush-pale:   #FAF0EF;
  --charcoal:     #2C2C2C;
  --muted:        #8A8278;
  --silver:       #C8C4BE;
  --silver-light: #E8E4DF;
  --white:        #FFFFFF;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Jost', system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --step-pad: clamp(2rem, 8vw, 5rem);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  background: var(--bg);
  color: var(--charcoal);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* --- Ambient Background --- */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
}
.bg-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #D8ECF7 0%, transparent 70%);
  top: -200px; right: -150px;
  animation: orbDrift 18s ease-in-out infinite alternate;
}
.bg-orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #F5DEDD 0%, transparent 70%);
  bottom: -180px; left: -100px;
  animation: orbDrift 22s ease-in-out infinite alternate-reverse;
}
.bg-orb-3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #EDE8E2 0%, transparent 70%);
  top: 40%; left: 30%;
  animation: orbDrift 26s ease-in-out infinite alternate;
}
@keyframes orbDrift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -40px) scale(1.08); }
}

/* --- Steps --- */
.step {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--step-pad);
}

.step-inner {
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.5rem;
}

/* Hidden / shown states */
.step.hidden {
  display: none;
}
.step.entering {
  animation: stepIn 0.7s var(--ease-out) both;
}
@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Typography --- */
.eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.step-heading {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 300;
  line-height: 1.15;
  color: var(--charcoal);
}
.step-heading em {
  font-style: italic;
  font-weight: 300;
  color: var(--blue-deep);
}

.step-sub {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.65;
}

.step-deco {
  font-size: 0.75rem;
  color: var(--silver);
  letter-spacing: 0.4em;
  margin-top: 0.5rem;
}

/* --- Forms & Inputs --- */
.form-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.input-wrap {
  width: 100%;
  max-width: 320px;
  position: relative;
}

.input-wrap input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  color: var(--charcoal);
  background: var(--white);
  border: 1px solid var(--silver-light);
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  letter-spacing: 0.04em;
}
.input-wrap input::placeholder {
  color: var(--silver);
  font-weight: 300;
}
.input-wrap input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-pale);
}

/* Shake on wrong password */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX(8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}
.input-wrap.shaking {
  animation: shake 0.45s var(--ease-in-out);
}

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--charcoal);
  border: none;
  border-radius: 6px;
  padding: 0.85rem 2rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(44,44,44,0.15);
}
.btn-primary:hover {
  background: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(44,44,44,0.2);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(44,44,44,0.12);
}

.btn-reveal {
  background: var(--blue-deep);
  box-shadow: 0 2px 8px rgba(122,172,196,0.35);
}
.btn-reveal:hover {
  background: #5f9ab6;
  box-shadow: 0 4px 16px rgba(122,172,196,0.45);
}

/* --- Error Messages --- */
.error-msg {
  font-size: 0.8rem;
  color: #c0392b;
  min-height: 1.2em;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* --- Vote Cards --- */
.vote-cards {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.vote-card {
  flex: 1 1 140px;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 2rem 1.25rem;
  border-radius: 14px;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: var(--white);
  transition:
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out),
    border-color 0.2s,
    background 0.2s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  font-family: var(--font-body);
}
.vote-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
}
.vote-card:active {
  transform: translateY(-2px);
}

.vote-card-boy {
  background: linear-gradient(160deg, var(--white) 0%, var(--blue-pale) 100%);
}
.vote-card-boy:hover,
.vote-card-boy.selected {
  border-color: var(--blue-deep);
  background: linear-gradient(160deg, var(--white) 0%, #cce5f3 100%);
  box-shadow: 0 12px 32px rgba(122,172,196,0.25), 0 0 0 3px var(--blue-pale);
}

.vote-card-girl {
  background: linear-gradient(160deg, var(--white) 0%, var(--blush-pale) 100%);
}
.vote-card-girl:hover,
.vote-card-girl.selected {
  border-color: var(--blush-deep);
  background: linear-gradient(160deg, var(--white) 0%, #f5cac8 100%);
  box-shadow: 0 12px 32px rgba(228,181,178,0.3), 0 0 0 3px var(--blush-pale);
}

.vote-card-icon {
  font-size: 2.25rem;
  line-height: 1;
}
.vote-card-label {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--charcoal);
}
.vote-card-hint {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 300;
}

/* --- Tally --- */
.tally {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tally-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tally-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.tally-label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--charcoal);
  letter-spacing: 0.02em;
}

.tally-pct {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.tally-track {
  width: 100%;
  height: 8px;
  background: var(--silver-light);
  border-radius: 99px;
  overflow: hidden;
}

.tally-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 1s var(--ease-out);
}
.tally-fill-boy  { background: linear-gradient(90deg, var(--blue) 0%, var(--blue-deep) 100%); }
.tally-fill-girl { background: linear-gradient(90deg, var(--blush) 0%, var(--blush-deep) 100%); }

.tally-count {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 300;
  letter-spacing: 0.04em;
}

/* --- Scratch Card --- */
.scratch-wrapper {
  position: relative;
  display: inline-block;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 8px 40px rgba(0,0,0,0.1),
    0 2px 8px rgba(0,0,0,0.06);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

/* Reveal text beneath the canvas */
.scratch-reveal-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--blue-pale) 0%, var(--blue) 50%, var(--blue-deep) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  pointer-events: none;
}

.reveal-text {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  font-weight: 300;
  font-style: italic;
  color: var(--white);
  text-shadow: 0 2px 16px rgba(95,154,182,0.6);
  letter-spacing: 0.02em;
  line-height: 1;
}

.reveal-emoji {
  font-size: 2.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(95,154,182,0.5));
}

#scratch-canvas {
  display: block;
  position: relative;
  z-index: 1;
  border-radius: 16px;
}

.scratch-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.4s;
  white-space: nowrap;
}
.scratch-hint.hidden { opacity: 0; }

/* --- Congrats Message --- */
.congrats-msg {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.5vw, 1.5rem);
  font-style: italic;
  font-weight: 300;
  color: var(--blue-deep);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  line-height: 1.4;
}
.congrats-msg.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Confetti Canvas --- */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .vote-cards { gap: 0.85rem; }
  .vote-card  { padding: 1.5rem 1rem; }
}
