/* ============================================================
   las virkys — scroll-driven parallax wedding site
   ============================================================ */

:root {
  --black: #0a0a0a;
  --white: #fcfcfa;
  --blue: #6fc5e4;
  --coral: #e8867b;

  /* current form colours — swapped by the toggle via theme classes */
  --form-bg: var(--black);
  --form-fg: var(--white);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  background: var(--black);
  color: var(--white);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- scroll structure -------------------------------------- */
.scroll-track {
  position: relative;
  height: 880vh; /* total scroll distance — tune alongside script.js phases */
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  background: var(--black);
}

.layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  will-change: opacity, transform;
}

/* ---- wordmark --------------------------------------------- */
.wordmark {
  font-family: "Fira Sans", system-ui, sans-serif;
  font-size: clamp(0.8rem, 3.4vw, 1.05rem);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.wordmark--center {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-160%);
  text-align: center;
  color: var(--white);
}

.wordmark--corner {
  position: absolute;
  top: clamp(1.4rem, 5vw, 2.4rem);
  left: clamp(1.4rem, 6vw, 2.6rem);
  color: var(--black);
  z-index: 3;
}

.wordmark--light {
  color: var(--form-fg);
}

/* ---- layer 1: intro --------------------------------------- */
.layer--intro {
  background: var(--black);
  z-index: 1;
}

/* ---- layer 2: white wipe — the centre square, then grown -- */
/* Sized to the viewport by layoutSeeds() and scaled DOWN to a 12px dot, so
   every displayed scale is <= 1 and the square stays crisp as it grows. */
.wipe {
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  background: var(--white);
  transform: scale(1); /* baseline = the visible intro square */
  transform-origin: center center;
  z-index: 2;
  will-change: transform;
  pointer-events: none;
}

/* ---- layer 3: white text scene ---------------------------- */
.layer--text {
  justify-content: flex-start;
  padding: clamp(5rem, 22vw, 8rem) clamp(1.4rem, 6vw, 2.6rem)
    clamp(2rem, 8vw, 3rem);
  color: var(--black);
  z-index: 3;
  pointer-events: none;
}

.headline {
  font-size: clamp(1.7rem, 8vw, 2.5rem);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: -0.03em;
  max-width: 70%;
}

.corner-dot {
  position: absolute;
  top: clamp(1.5rem, 5.5vw, 2.6rem);
  right: clamp(1.5rem, 6vw, 2.6rem);
  width: 13px;
  height: 13px;
  background: var(--black);
  z-index: 3;
}

.corner-dot--light {
  background: var(--form-fg);
}

/* ---- floating photos (in front of the text scene) --------- */
.photos {
  position: absolute;
  inset: 0;
  z-index: 3; /* above text content, below the colour flood (z4) */
  overflow: hidden;
  pointer-events: none;
}

.photo {
  position: absolute;
  top: 0;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  opacity: 0;
  transform: translateY(120vh);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  background: #e9e7e2; /* tint shown before the image loads */
  will-change: transform, opacity;
}

/* ---- layer 4: colour flood (the corner square, grown) ----- */
.flood {
  position: absolute;
  top: clamp(1.5rem, 5.5vw, 2.6rem);
  right: clamp(1.5rem, 6vw, 2.6rem);
  width: 13px;
  height: 13px;
  background: var(--form-bg);
  transform: scale(0);
  transform-origin: center center;
  z-index: 4;
  will-change: transform;
  pointer-events: none;
  transition: background 0.45s var(--ease);
}

/* ---- layer 5: form ---------------------------------------- */
.layer--form {
  justify-content: flex-start;
  padding: clamp(4.5rem, 18vw, 7rem) clamp(1.4rem, 6vw, 2.6rem)
    clamp(2rem, 8vw, 3rem);
  color: var(--form-fg);
  z-index: 5;
  pointer-events: none; /* enabled by JS once the form is on-screen */
  transition: color 0.45s var(--ease);
}

.layer--form.is-interactive {
  pointer-events: auto;
}

.rsvp {
  display: flex;
  flex-direction: column;
  max-width: 30rem;
  width: 100%;
}

.form-heading {
  font-size: clamp(1.7rem, 8vw, 2.5rem);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: clamp(1.4rem, 6vw, 2.2rem);
}

/* ---- toggle ----------------------------------------------- */
.toggle {
  display: flex;
  gap: 0.6rem;
  margin-bottom: clamp(1.1rem, 5vw, 1.7rem);
}

.toggle-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: "Fira Sans", system-ui, sans-serif;
  font-size: clamp(0.85rem, 3.6vw, 1rem);
  color: var(--form-fg);
  background: transparent;
  border: 1px solid var(--form-fg);
  border-radius: 999px;
  padding: 0.65em 1.3em 0.6em;
  cursor: pointer;
  transition: background 0.35s var(--ease), color 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

.toggle-btn .check {
  display: inline-block;
  width: 0;
  overflow: hidden;
  opacity: 0;
  margin-right: 0;
  transform: translateX(-4px);
  transition: width 0.3s var(--ease), opacity 0.3s var(--ease),
    margin 0.3s var(--ease), transform 0.3s var(--ease);
}

.toggle-btn.is-selected {
  background: var(--form-fg);
  color: var(--form-bg);
}

.toggle-btn.is-selected .check {
  width: 1em;
  opacity: 1;
  margin-right: 0.4em;
  transform: translateX(0);
}

/* ---- fields ----------------------------------------------- */
.field {
  display: block;
  margin-bottom: 0.7rem;
}

.field input {
  width: 100%;
  font-family: inherit;
  font-size: clamp(0.85rem, 3.6vw, 1rem);
  color: var(--form-bg);
  background: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.7em 1.2em;
  outline: none;
}

.field input::placeholder {
  color: #9a9a9a;
}

.field input:focus-visible {
  box-shadow: 0 0 0 2px var(--form-fg);
}

/* ---- OK button -------------------------------------------- */
.ok-btn {
  align-self: flex-end;
  margin-top: clamp(0.8rem, 4vw, 1.4rem);
  font-family: "Fira Sans", system-ui, sans-serif;
  font-size: clamp(0.85rem, 3.6vw, 1rem);
  color: var(--form-bg);
  background: var(--white);
  border: none;
  border-radius: 999px;
  padding: 0.7em 1.8em 0.65em;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}

.ok-btn:active {
  transform: scale(0.96);
}

/* ---- thank-you + countdown (shown after OK) --------------- */
.thanks {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: clamp(4.5rem, 18vw, 7rem) clamp(1.4rem, 6vw, 2.6rem);
  color: var(--form-fg);
  transition: color 0.45s var(--ease);
}

.thanks[hidden] {
  display: none;
}

.thanks-text {
  font-size: clamp(1.7rem, 8vw, 2.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 500;
  max-width: 15ch;
}

/* ---- theme states (set on .stage by the toggle) ----------- */
.stage.theme-blue {
  --form-bg: var(--blue);
}
.stage.theme-coral {
  --form-bg: var(--coral);
}

.stage.theme-blue .flood,
.stage.theme-coral .flood,
.stage.theme-blue .layer--form,
.stage.theme-coral .layer--form {
  /* fg stays white on coloured backgrounds */
  --form-fg: var(--white);
}

/* ---- scroll hint ------------------------------------------ */
.scroll-hint {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  animation: hint-pulse 2.4s var(--ease) infinite;
  z-index: 20;
  transition: opacity 0.5s var(--ease);
}

.scroll-hint.is-hidden {
  opacity: 0;
}

@keyframes hint-pulse {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.55; }
  50% { transform: translateX(-50%) translateY(5px); opacity: 0.9; }
}

/* ============================================================
   Reduced motion: drop the scroll-scrub stage and render the
   scenes as plain stacked, snap-scrolled full screens.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .scroll-track {
    height: auto;
  }
  .stage {
    position: static;
    height: auto;
    overflow: visible;
    scroll-snap-type: y proximity;
  }
  .wipe,
  .flood,
  .photos {
    display: none;
  }
  .layer {
    position: static;
    min-height: 100vh;
    min-height: 100svh;
    transform: none !important;
    opacity: 1 !important;
    scroll-snap-align: start;
  }
  .layer--text {
    background: var(--white);
  }
  .layer--form {
    background: var(--form-bg);
    pointer-events: auto;
    transition: background 0.45s var(--ease), color 0.45s var(--ease);
  }
  .wordmark--center {
    transform: translateY(-50%);
  }
  .scroll-hint {
    display: none;
  }
}
