:root {
  --sage: #87986a;          /* the brand olive from the invite art (decorative) */
  --sage-deep: #5d6449;     /* the deeper forest sage used for typography in the PNG */
  --sage-ink: #3f4632;      /* darkest sage, used sparingly for max-contrast */
  --cream: #fbf5db;
  --cream-soft: #f7eecb;
  --gold: #f0d361;          /* accents only */
  --gold-deep: #b99f51;     /* the actual gold tone in the invite art */
  --ink: #3f4632;
  --muted: #8b9170;

  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --script: "Allura", "Apple Chancery", cursive;

  --transition: 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background-color: var(--cream);
  /* whisper-thin paper-grain texture; data URI so no extra request */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.50  0 0 0 0 0.40  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

/* ---------- Ornaments (persistent corner frame) ---------- */
.ornament {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  user-select: none;
  display: block;
  opacity: 0;
  animation: ornament-in 700ms cubic-bezier(0.22, 0.61, 0.36, 1) 120ms forwards;
}

@keyframes ornament-in {
  from { opacity: 0; }
  to   { opacity: 0.92; } /* slight softening — reads as wash, not sticker */
}

.ornament--tr {
  top: 0;
  right: 0;
  width: clamp(220px, 32vw, 400px);
  height: auto;
  -webkit-mask-image: linear-gradient(225deg, black 25%, transparent 100%);
  mask-image: linear-gradient(225deg, black 25%, transparent 100%);
}

.ornament--bl {
  bottom: 0;
  left: 0;
  width: clamp(200px, 25vw, 320px);
  height: auto;
  animation-delay: 200ms;
  -webkit-mask-image: linear-gradient(45deg, black 25%, transparent 100%);
  mask-image: linear-gradient(45deg, black 25%, transparent 100%);
}

.ornament--br {
  bottom: 0;
  right: 0;
  width: clamp(210px, 26vw, 340px);
  height: auto;
  animation-delay: 280ms;
  -webkit-mask-image: linear-gradient(315deg, black 25%, transparent 100%);
  mask-image: linear-gradient(315deg, black 25%, transparent 100%);
}

@media (prefers-reduced-motion: reduce) {
  .ornament { animation: none; opacity: 0.92; }
}

/* ---------- Stage / screens ---------- */
.stage {
  position: relative;
  z-index: 2;
  height: 100vh;
  height: 100dvh; /* mobile-safe viewport — accounts for URL bar */
  width: 100%;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px clamp(24px, 6vw, 80px);
  padding-top: max(40px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.stage[data-screen="0"] .screen[data-index="0"],
.stage[data-screen="1"] .screen[data-index="1"],
.stage[data-screen="2"] .screen[data-index="2"],
.stage[data-screen="3"] .screen[data-index="3"],
.stage[data-screen="4"] .screen[data-index="4"] {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ---------- Welcome screen ---------- */
.eyebrow {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--sage-deep);
  margin: 0 0 18px;
  font-weight: 500;
}

.heart {
  color: var(--sage);
  margin: 0 0 22px;
  display: inline-flex;
}

.heart--filled {
  color: var(--gold);
  margin-bottom: 12px;
}

.welcome__line {
  font-family: var(--script);
  font-weight: 400;
  color: var(--sage-deep);
  font-size: clamp(38px, 5.5vw, 52px);
  line-height: 1.15;
  margin: 0 0 26px;
  letter-spacing: 0.01em;
}

.sprig {
  color: var(--sage);
  margin: 0 0 30px;
  display: inline-flex;
}

.couple {
  font-family: var(--script);
  font-weight: 400;
  color: var(--sage-deep);
  font-size: clamp(60px, 10vw, 104px);
  line-height: 1.05;
  margin: 0 0 22px;
  letter-spacing: 0.005em;
}

.dashes {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
}
.dashes .dash {
  display: block;
  width: 40px;
  height: 1px;
  background: var(--gold-deep);
  opacity: 0.75;
}
.dashes .diamond {
  display: block;
  width: 6px;
  height: 6px;
  background: var(--gold-deep);
  transform: rotate(45deg);
}

.date sup {
  font-size: 0.5em;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: lowercase;
  vertical-align: super;
  margin: 0 1px 0 0;
}

.date {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(15px, 2vw, 18px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--sage-deep);
  margin: 0 0 14px;
}

.venue {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(13px, 1.6vw, 16px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--sage-deep);
  line-height: 1.6;
  margin: 0 0 44px;
}

/* ---------- Countdown ---------- */
.countdown {
  margin: 0 0 38px;
  text-align: center;
}

.countdown__label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
}

.countdown__row {
  display: inline-flex;
  align-items: baseline;
  gap: clamp(8px, 1.5vw, 14px);
}

.cd-unit {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: clamp(44px, 5.5vw, 64px);
}

.cd-num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 3.4vw, 38px);
  color: var(--sage-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.01em;
}

.cd-label {
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 500;
}

.cd-sep {
  font-family: var(--serif);
  color: var(--gold-deep);
  font-size: clamp(22px, 2.8vw, 30px);
  line-height: 1;
  align-self: flex-start;
  margin-top: 2px;
  user-select: none;
  opacity: 0.85;
}

/* ---------- CTA button ---------- */
.cta {
  background: var(--sage);
  color: var(--cream);
  border: 1px solid var(--sage);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  padding: 16px 36px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease,
    box-shadow 0.2s ease;
  border-radius: 2px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

@media (hover: hover) {
  .cta:hover {
    background: var(--sage-deep);
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold) inset, 0 0 0 3px var(--sage-deep) inset;
  }
}

.cta:active {
  transform: translateY(1px);
}

.cta:focus { outline: none; }
.cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px rgba(135, 152, 106, 0.55);
}

.cta--ghost {
  background: transparent;
  color: var(--sage-deep);
}

@media (hover: hover) {
  .cta--ghost:hover {
    background: var(--sage);
    color: var(--cream);
    border-color: var(--sage);
    box-shadow: none;
  }
}

.hint {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
}

.hint kbd {
  font-family: var(--serif);
  font-style: normal;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--sage);
  color: var(--sage-deep);
  padding: 1px 7px;
  border-radius: 3px;
  margin: 0 1px;
}

/* ---------- Question screens ---------- */
.qmeta {
  margin: 0 0 26px;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--sage);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.qnum {
  font-weight: 500;
}
.qarrow {
  color: var(--gold);
  transform: translateY(-1px);
}

.question {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--sage-deep);
  font-size: clamp(26px, 3.6vw, 38px);
  line-height: 1.25;
  margin: 0 0 36px;
  max-width: 720px;
}

/* ---------- Text input ---------- */
.text-input {
  width: 100%;
  max-width: 560px;
  padding: 12px 4px 12px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--sage);
  font-family: var(--serif);
  font-size: clamp(20px, 2.8vw, 28px);
  color: var(--ink);
  outline: none;
  text-align: center;
  border-radius: 0;
  transition: border-color 0.2s ease;
}

.text-input::placeholder {
  color: var(--muted);
  opacity: 0.55;
  font-style: italic;
  font-size: 0.7em;
  letter-spacing: 0.04em;
}

.text-input:focus {
  border-bottom-color: var(--gold);
}

.error {
  margin: 12px 0 0;
  font-size: 13px;
  font-style: italic;
  color: #a8543a;
  min-height: 1em;
}

/* ---------- Choices ---------- */
.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0;
}

.choices--compact {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 460px;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  background: transparent;
  border: 1px solid var(--sage);
  color: var(--sage-deep);
  font-family: var(--serif);
  font-size: 17px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.18s ease;
  text-align: left;
  font-weight: 400;
}

.choices--compact .choice {
  flex: 1 1 90px;
  justify-content: center;
  text-align: center;
  padding: 18px 14px;
  font-size: 18px;
}

@media (hover: hover) {
  .choice:hover {
    border-color: var(--gold);
    color: var(--ink);
    transform: translateY(-1px);
  }
}

.choice:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.choice.is-selected {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--cream);
}

.choice.is-selected .choice__key {
  background: var(--cream);
  color: var(--sage-deep);
  border-color: var(--cream);
}

.choice__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--sage);
  color: var(--sage-deep);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  border-radius: 3px;
  flex-shrink: 0;
  transition: all 0.18s ease;
  background: transparent;
}

.choices--compact .choice__key {
  display: none;
}

.choice__text {
  flex: 1;
}

/* ---------- Thanks screen ---------- */
.couple--thanks {
  margin-bottom: 18px;
}

.thanks-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(16px, 1.8vw, 19px);
  color: var(--muted);
  margin: 0 0 32px;
  max-width: 460px;
}

.signoff {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--sage-deep);
  margin: 0;
}

/* ---------- Back button + dots ---------- */
.back {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.stage[data-screen="1"] .back,
.stage[data-screen="2"] .back,
.stage[data-screen="3"] .back {
  opacity: 1;
  pointer-events: auto;
}

.back__btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 8px;
  transition: color 0.2s ease;
}

.back__btn:hover {
  color: var(--sage-deep);
}

.back__btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

.dots {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stage[data-screen="1"] .dots,
.stage[data-screen="2"] .dots,
.stage[data-screen="3"] .dots {
  opacity: 1;
}

.dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
  opacity: 0.3;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.stage[data-screen="1"] .dot[data-for="1"],
.stage[data-screen="2"] .dot[data-for="2"],
.stage[data-screen="3"] .dot[data-for="3"] {
  opacity: 1;
  background: var(--gold);
  transform: scale(1.3);
}

/* welcome actions stack */
.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 28px;
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  /* Ornaments framed, not crowding. Bottom pair sized equally so the
     composition is balanced; button has clear cream space between them. */
  .ornament--tr {
    width: 170px;
  }
  .ornament--bl {
    width: 130px;
  }
  .ornament--br {
    width: 130px;
  }

  .screen {
    padding: 56px 22px;
    padding-top: max(56px, calc(env(safe-area-inset-top) + 32px));
    padding-bottom: max(80px, calc(env(safe-area-inset-bottom) + 56px));
    justify-content: center;
  }

  /* Welcome screen — preserve the desktop rhythm */
  .eyebrow {
    font-size: 12px;
    letter-spacing: 0.34em;
    margin-bottom: 18px;
  }
  .welcome__line {
    font-size: 36px;
    margin-bottom: 24px;
  }
  .sprig {
    margin-bottom: 26px;
  }
  .couple {
    font-size: 62px;
    line-height: 1;
    margin-bottom: 20px;
  }
  .dashes {
    margin-bottom: 16px;
  }
  .dashes span {
    width: 24px;
  }
  .date {
    font-size: 13px;
    letter-spacing: 0.28em;
    margin-bottom: 10px;
  }
  .venue {
    font-size: 11px;
    letter-spacing: 0.24em;
    margin-bottom: 28px;
  }

  /* Compact countdown on phones */
  .countdown {
    margin-bottom: 30px;
  }
  .countdown__label {
    font-size: 10px;
    letter-spacing: 0.28em;
    margin-bottom: 12px;
  }
  .countdown__row {
    gap: 6px;
  }
  .cd-unit {
    min-width: 40px;
  }
  .cd-num {
    font-size: 24px;
  }
  .cd-label {
    font-size: 8px;
    letter-spacing: 0.22em;
    margin-top: 4px;
  }
  .cd-sep {
    font-size: 20px;
  }

  /* Questions */
  .qmeta {
    margin-bottom: 20px;
    font-size: 12px;
  }
  .question {
    font-size: 24px;
    line-height: 1.3;
    margin-bottom: 30px;
    max-width: 100%;
  }

  .text-input {
    font-size: 22px;
    padding: 12px 4px;
  }

  /* Choice cards: full-width, generous tap area */
  .choices {
    max-width: 100%;
    gap: 10px;
  }
  .choice {
    padding: 16px 18px;
    font-size: 16px;
    min-height: 52px;
  }
  .choices--compact {
    gap: 10px;
  }
  .choices--compact .choice {
    flex: 1 1 calc(50% - 5px);
    padding: 18px 10px;
    font-size: 18px;
    min-height: 56px;
  }

  /* CTAs */
  .cta {
    padding: 15px 32px;
    font-size: 12px;
    letter-spacing: 0.3em;
    min-height: 50px;
  }

  .hint {
    font-size: 12px;
    margin-top: 14px;
  }
  .hint kbd {
    display: none; /* not applicable on touch */
  }

  /* Back + dots */
  .back {
    top: max(16px, env(safe-area-inset-top));
    left: 14px;
  }
  .back__btn {
    font-size: 12px;
    padding: 10px 12px;
    min-height: 44px;
    min-width: 44px;
  }

  .dots {
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  }

  /* Thanks screen */
  .couple--thanks {
    font-size: 58px;
  }
  .thanks-text {
    font-size: 16px;
  }
}

/* Very small phones (iPhone SE / 320–360 wide) */
@media (max-width: 380px) {
  .ornament--tr { width: 140px; }
  .ornament--bl { width: 95px; }
  .ornament--br { width: 95px; }
  .couple { font-size: 54px; }
  .welcome__line { font-size: 32px; }
  .question { font-size: 22px; }
}

@media (max-height: 640px) {
  .screen {
    padding-top: 30px;
    padding-bottom: 60px;
  }
  .couple {
    font-size: 54px;
  }
  .welcome__line {
    font-size: 30px;
    margin-bottom: 16px;
  }
  .venue {
    margin-bottom: 28px;
  }
}
