:root {
  --paper: #ecd6c7;
  --paper-hi: #f6e8dc;
  --paper-lo: #dfc3b1;
  --ink: #5a463b;
  --ink-soft: #8b7264;
  --accent: #b39780;
  --shade: 122, 90, 72;
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --script: "Pinyon Script", "Snell Roundhand", cursive;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .32 0 0 0 0 .22 0 0 0 .075 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--noise), radial-gradient(120% 90% at 50% 40%, #dcc0ae, #c09f8a);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.35;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.defs { position: absolute; }

/* ───────── Card shell ───────── */
.card {
  position: relative;
  width: min(100vw, 460px);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  container-type: size;
  background: var(--noise), linear-gradient(160deg, #f1ddd0, var(--paper) 45%, #e5ccbc);
}
@media (min-width: 520px) and (min-height: 640px) {
  .card {
    height: min(100dvh - 40px, 900px);
    border-radius: 26px;
    box-shadow: 0 30px 70px -20px rgba(70, 45, 30, .55), 0 0 0 1px rgba(var(--shade), .25);
  }
}

.scroller {
  position: absolute;
  inset: 0;
  overflow: hidden;
  outline: none;
}

.stage {
  position: relative;
  height: 100cqh;
  overflow: hidden;
  /* swipes are read in script.js (one swipe = one page); pinch-zoom still works */
  touch-action: pinch-zoom;
}

.frame, .flora {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.frame { z-index: 1; }
.stage > .flora { z-index: 2; }
.flora-leaves { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(.5px 1.5px 1.5px rgba(var(--shade), .2)); }
/* Each bloom is its own little layer, so swaying it costs nothing to repaint. */
.bloom {
  position: absolute;
  overflow: visible;
  will-change: transform;
  filter: drop-shadow(1px 2.5px 3px rgba(var(--shade), .3));
  animation: sway var(--t) ease-in-out var(--d) infinite alternate;
}
.card:not(.is-live) .bloom { animation-play-state: paused; }
@keyframes sway {
  0% { transform: rotate(calc(var(--a) * -1)); }
  30% { transform: rotate(calc(var(--a) * .55)); }
  62% { transform: rotate(calc(var(--a) * -.35)); }
  100% { transform: rotate(var(--a)); }
}

/* ───────── Panels ───────── */
.panel {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.9cqh, 16px);
  padding: 17cqh 13cqw 15cqh;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .55s ease;
}
/* hidden panels are also `inert` (set in script.js), so they can't be focused or clicked */
.panel.is-active {
  opacity: 1;
  pointer-events: auto;
  transition: opacity .7s ease .25s;
}
.panel > * { opacity: 0; transform: translateY(12px); }
.card.is-live .panel.is-active > * { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.3s + var(--i, 0) * .11s); }
.panel > :nth-child(2) { --i: 1; }
.panel > :nth-child(3) { --i: 2; }
.panel > :nth-child(4) { --i: 3; }
.panel > :nth-child(5) { --i: 4; }
.panel > :nth-child(6) { --i: 5; }
.panel > :nth-child(7) { --i: 6; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ───────── Type ───────── */
.eyebrow, .date-line, .weekday, .count-label, .hashtag {
  font-size: clamp(11px, 3.1cqw, 13.5px);
  font-weight: 600;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
  text-wrap: balance;
}
.date-line { letter-spacing: .38em; }

.names {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 500;
  line-height: .92;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5), 0 -1px 0 rgba(var(--shade), .18);
}
.name { font-size: clamp(54px, 19.5cqw, 90px); letter-spacing: .005em; }
.ki {
  font-family: var(--script);
  font-size: clamp(34px, 11.5cqw, 54px);
  line-height: .9;
  color: var(--ink-soft);
  margin: .04em 0 -.02em;
}

.names-inline {
  font-size: clamp(30px, 9.6cqw, 44px);
  font-weight: 500;
  line-height: 1.05;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}
.names-inline em {
  font-family: var(--script);
  font-style: normal;
  font-size: .95em;
  color: var(--ink-soft);
  padding: 0 .08em;
}
.names-inline.big { font-size: clamp(36px, 11.5cqw, 52px); }

.title {
  font-size: clamp(28px, 8.6cqw, 40px);
  font-weight: 600;
  letter-spacing: .02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}

.lede { font-size: clamp(17px, 4.9cqw, 22px); font-weight: 500; font-style: italic; text-wrap: balance; }
.lede.small { font-size: clamp(15px, 4.3cqw, 19px); }
.closing { font-family: var(--script); font-size: clamp(30px, 9cqw, 42px); color: var(--ink-soft); line-height: 1; }
.address { font-size: clamp(14.5px, 4.1cqw, 18px); font-weight: 500; color: var(--ink-soft); text-wrap: balance; }

.rule { display: flex; align-items: center; justify-content: center; gap: 10px; width: min(44cqw, 190px); }
.rule span { flex: 1; height: 1px; background: rgba(var(--shade), .5); box-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.rule i { width: 6px; height: 6px; rotate: 45deg; background: var(--accent); box-shadow: 1px 1px 0 rgba(255, 255, 255, .5); }

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  margin-top: 1cqh;
}
.facts div { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px; }
.facts div + div { border-left: 1px solid rgba(var(--shade), .4); box-shadow: -1px 0 0 rgba(255, 255, 255, .45); }
.facts b { font-size: clamp(16px, 4.6cqw, 20px); font-weight: 600; }
.facts span { font-size: clamp(11px, 3cqw, 13px); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft); }

/* ───────── Embossed surfaces ───────── */
.plaque, .medallion, .countdown div, .btn, .next, .map, .field input, .choice, .stepper button {
  background: linear-gradient(150deg, var(--paper-hi), #efdccd);
  box-shadow:
    0 0 0 1px rgba(var(--shade), .16),
    2px 3px 7px rgba(var(--shade), .34),
    -1px -1px 2px rgba(255, 255, 255, .75);
}

.plaque {
  padding: .5em 1.5em;
  border-radius: 14px;
  border: 3px double rgba(var(--shade), .38);
  font-size: clamp(14px, 4cqw, 17px);
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.medallion {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(42cqw, 26cqh, 190px);
  aspect-ratio: 5 / 6;
  border-radius: 50% / 42%;
  border: 4px double rgba(var(--shade), .38);
}
.medallion-day {
  font-size: min(21cqw, 13cqh, 96px);
  font-weight: 500;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .6), 0 -1px 0 rgba(var(--shade), .2);
}
.medallion-month { margin-top: .2em; font-size: clamp(10px, 2.7cqw, 12.5px); font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--ink-soft); }

.count-label { margin-top: .6cqh; letter-spacing: .2em; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 300px; }
.countdown div { display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; border-radius: 10px; }
.countdown b { font-size: clamp(20px, 6.2cqw, 28px); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; line-height: 1.05; }
.countdown span { font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }

.map {
  display: block;
  position: relative;
  width: min(60cqw, 250px);
  height: min(29cqh, 250px);
  padding: 6px;
  border-radius: 999px 999px 18px 18px;
  cursor: pointer;
}
.map-clip {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: var(--paper-lo);
}
.map iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}
/* warm wash so the map sits in the paper palette (no CSS filter on the iframe itself) */
.map-clip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(214, 170, 140, .16);
  pointer-events: none;
}

.btn, .next {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  padding: .62em 1.5em;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  font: 600 clamp(12px, 3.3cqw, 14px)/1 var(--serif);
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn:active, .next:active { transform: translateY(1px) scale(.985); }
.btn-solid {
  background: linear-gradient(150deg, #c1a78f, #a98c74);
  color: #fff9f3;
  text-shadow: 0 1px 1px rgba(80, 55, 40, .4);
}
.text-link {
  color: var(--ink-soft);
  font-size: clamp(13px, 3.6cqw, 15px);
  font-style: italic;
  font-weight: 500;
  text-underline-offset: 4px;
  text-decoration-color: rgba(var(--shade), .5);
}
.text-link[hidden] { display: none; }

.next {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(4.5cqw + 3.6cqh);
  translate: -50% 0;
  text-transform: none;
  letter-spacing: .06em;
  font-size: clamp(13px, 3.5cqw, 15px);
  padding: .6em 1.4em;
}
.arrow { display: inline-block; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(3px); } }

/* ───────── "Aaoge na?" ───────── */
.ask, .yay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 2.2cqh, 18px);
  width: 100%;
}
.ask[hidden], .yay[hidden] { display: none; }
.ask-title {
  font-family: var(--script);
  font-size: clamp(52px, 17cqw, 78px);
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}
.ask-buttons { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 1cqh; }
.ask-buttons .btn { padding: .8em 1.8em; font-size: clamp(13px, 3.6cqw, 15px); }
/* "yes" shakes if you try to slide past without answering */
#askYes.is-shaking { animation: shake .6s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px) rotate(-1deg); }
  20%, 80% { transform: translateX(5px) rotate(1.5deg); }
  30%, 50%, 70% { transform: translateX(-9px) rotate(-2deg); }
  40%, 60% { transform: translateX(9px) rotate(2deg); }
}
/* the "no" button slips away whenever you reach for it */
#askNo { position: relative; z-index: 2; transition: transform .28s cubic-bezier(.3, 1.4, .5, 1); touch-action: none; }
.ask-tease { min-height: 1.4em; font-size: clamp(14px, 4cqw, 17px); font-style: italic; color: var(--ink-soft); }
.yay > * { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; }
.yay > :nth-child(2) { animation-delay: .1s; }
.yay > :nth-child(3) { animation-delay: .2s; }
.yay > :nth-child(4) { animation-delay: .3s; }
.yay > :nth-child(5) { animation-delay: .4s; }

/* petal shower on "yes" */
.petals { position: absolute; inset: 0; z-index: 5; overflow: hidden; pointer-events: none; }
.petals i {
  position: absolute;
  top: -6%;
  width: var(--size);
  height: calc(var(--size) * 1.35);
  border-radius: 60% 60% 55% 55% / 75% 75% 35% 35%;
  background: radial-gradient(circle at 35% 25%, #ffd0d8, var(--tone) 70%);
  box-shadow: 1px 2px 3px rgba(var(--shade), .25);
  animation: petal-fall var(--time) cubic-bezier(.3, .1, .6, 1) var(--delay) both;
}
@keyframes petal-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translate3d(var(--drift), 112cqh, 0) rotate(var(--spin)); opacity: .9; }
}

:focus-visible { outline: 2px solid var(--ink-soft); outline-offset: 3px; }

/* ───────── Entrance (scroll-scrubbed palace doors) ───────── */
.entrance {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: #6b3f20;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: ns-resize;
  will-change: opacity, transform;
}
.entrance-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  pointer-events: none;
}
.entrance video { opacity: 0; }
.entrance.has-video video { opacity: 1; }
.entrance-final { opacity: 0; transition: opacity .45s ease; }

.entrance-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26cqh 6cqw calc(4.5cqw + 3.6cqh + 62px);
  text-align: center;
  color: #fff7ee;
  background: linear-gradient(to top, rgba(38, 20, 10, .78), rgba(38, 20, 10, .42) 45%, rgba(38, 20, 10, 0));
  text-shadow: 0 2px 14px rgba(30, 14, 6, .7);
  opacity: 0;
  pointer-events: none;
}
.entrance-names { font-size: clamp(34px, 11cqw, 52px); font-weight: 500; line-height: 1.05; }
.entrance-names em { font-family: var(--script); font-style: normal; padding: 0 .06em; color: #f6dcc6; }
.entrance-date { margin-top: .5em; font-size: clamp(11px, 3.1cqw, 13.5px); font-weight: 600; letter-spacing: .34em; text-transform: uppercase; }

.entrance-hint { box-shadow: 0 6px 22px rgba(30, 14, 6, .5), 0 0 0 1px rgba(255, 255, 255, .35); }

/* ───────── Loading screen ───────── */
.loader {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--noise), linear-gradient(160deg, #f1ddd0, var(--paper) 45%, #e5ccbc);
  transition: opacity .7s ease, visibility 0s .7s;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-bloom {
  width: clamp(72px, 22cqw, 96px);
  filter: drop-shadow(1px 3px 4px rgba(var(--shade), .3));
  animation: loader-spin 7s linear infinite;
}
.loader-bloom g:nth-of-type(2) { animation: loader-spin 9s linear infinite reverse; transform-origin: 0 0; }
@keyframes loader-spin { to { transform: rotate(360deg); } }
.loader-text, .loader-pct {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-variant-numeric: lining-nums tabular-nums;
}
.loader-track {
  width: min(52cqw, 200px);
  height: 3px;
  border-radius: 3px;
  background: rgba(var(--shade), .18);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6);
  overflow: hidden;
}
.loader-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f7a5b4, #f27f9c);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .35s ease;
}

@media (prefers-reduced-motion: reduce) {
  .bloom, .loader-bloom, .loader-bloom g { animation: none; }
  .panel > *, .card.is-live .panel.is-active > * { animation: none; opacity: 1; transform: none; }
  .arrow { animation: none; }
}
