/* Design: Donya's "Ari & Donya · Save the date" mockup. */
:root {
  --paper: #F8F6F0;
  --ink: #2A2D26;
  --ink-soft: #3E4537;
  --olive: #545F48;
  --leaf: #4F5A45;
  --sage: #6F7865;
  --rule: #D7D9CC;
  --rule-soft: #DAD9D2;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh; /* phones: the visible height, not counting the browser's toolbars */
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}
/* Home, sign-in and address pages: Monet's Water Lilies (1907) fills the screen behind everything, under a soft cream veil.
   It is painted on the page itself (the root background) and scrolls with it: Safari on iOS 26 only draws the page's own
   pixels under its status bar and toolbar, and fills them with a flat colour wherever a fixed layer would be.
   The tile is the painting above its own mirror image, repeated down (and up) the page, so it never runs out or shows a
   seam however long the page is or however far it's pulled. Each copy is sized to cover one screen. */
html:has(body.painted) {
  background:
    /* The painting fades into the bars' colour at the top of the page too (the bottom fade is body.painted::after). */
    linear-gradient(#BDC1BE, rgba(189, 193, 190, 0)) center top / 100% 72px no-repeat,
    radial-gradient(ellipse 55% 34% at 50% 22%, rgba(248, 246, 240, 0.8), rgba(248, 246, 240, 0) 100%) center top / 100% 100lvh no-repeat,
    linear-gradient(rgba(248, 246, 240, 0.42), rgba(248, 246, 240, 0.42)),
    url("/images/water-lilies-tile.webp") center calc(50lvh - max(52.1vw, 50lvh)) / max(100vw, 96lvh) auto repeat-y,
    #BDC1BE; /* the pond along the bottom of the first screen, through the veil: Safari fills both bars with this at the top of the page */
}
body.painted { background: transparent; }
/* At the end of the page (the footer on screen) the painting fades into that colour just above Safari's bottom toolbar,
   so there's no edge there. It fades in over the last 24px of scrolling; a page too short to scroll always has it. */
body.painted::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 72px;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(rgba(189, 193, 190, 0), #BDC1BE);
  animation: bottom-fade-in linear both;
  animation-timeline: scroll(root);
  animation-range: calc(100% - 24px) 100%;
}
@keyframes bottom-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* A soft paper-coloured glow right behind the words keeps them readable over the painting. */
body.painted :is(.hero, .film-caption, .save-date, .site-footer, .monogram, .page > h1, .page > .eyebrow, #done) {
  text-shadow: 0 0 6px rgba(248, 246, 240, 0.95), 0 0 14px rgba(248, 246, 240, 0.85), 0 0 26px rgba(248, 246, 240, 0.6);
}
body.painted :is(.film-caption, .save-date .small, .countdown .unit, .hero .small, .hero .eyebrow) { color: var(--ink); }
body.painted :is(.film-caption, .countdown .eyebrow) { font-size: 11px; font-weight: 500; }
body.painted :is(.hero .small, .save-date .small) { font-size: 14px; }
body.painted .countdown .unit { font-size: 11px; font-weight: 500; }
body.painted .site-footer p { color: var(--ink-soft); }
body.painted .rings { color: #5E6157; }
body.painted .site-header { border-bottom-color: rgba(84, 95, 72, 0.18); }
body.painted .site-footer p { border-top-color: rgba(84, 95, 72, 0.18); }
main { flex: 1 0 auto; } /* fill the leftover height so the footer sits at the bottom of short pages */
a { color: var(--olive); }
a:hover { color: var(--ink); }
p { margin: 0; }
[hidden] { display: none !important; }

/* Type */
.eyebrow { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--olive); }
.serif-italic { font-family: var(--serif); font-style: italic; color: var(--ink-soft); }
.small { font-size: 13px; color: var(--olive); }

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  align-items: center;
  min-height: 84px;
  padding: 0 64px;
  border-bottom: 1px solid var(--rule);
}
.monogram { font-family: var(--serif); font-size: 28px; letter-spacing: 0.06em; color: var(--ink); text-decoration: none; }
/* Only on pages behind the sign-in, so it shows once a guest has entered their email. */
.sign-out {
  padding: 8px 0;
  border: 0;
  background: none;
  font: 500 11px var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--olive);
  cursor: pointer;
}
.sign-out:hover { color: var(--ink); }
body.painted .sign-out { color: var(--ink); text-shadow: 0 0 6px rgba(248, 246, 240, 0.95), 0 0 14px rgba(248, 246, 240, 0.85); }

/* Hero */
.hero { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 42px 24px 38px; text-align: center; }
.hero h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(42px, 11vw, 92px); line-height: 1.1; text-wrap: balance; }
/* Hidden until the guest's name is known (index.html), then fades in. */
.hero h1 { transition: opacity 0.4s ease; }
.hero h1.pending { opacity: 0; }
.hero .serif-italic { font-size: 26px; }

/* Film: the envelope (tap the seal) and the full-screen player */
.film { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 8px 24px 0; }
.envelope-wrap { width: 560px; max-width: 100%; container-type: inline-size; }

/* Positions are fractions of the envelope artwork: a 1600 × 1040 body, its flap 880 tall (incl. lace).
   Layers back to front: back panel, photo in the pocket, Save the Date card, front flaps, top flap, bouquet, seal. */
.envelope {
  position: relative;
  aspect-ratio: 1600 / 1040;
  perspective: 2400px;
  transition: margin 1.1s cubic-bezier(0.65, 0, 0.35, 1);
}
.envelope.is-open { margin-top: 55cqw; } /* room for the opened flap above */
.env-back, .liner-pocket, .env-front { position: absolute; left: 0; top: 0; width: 100%; height: auto; pointer-events: none; }
.env-back { z-index: 0; filter: drop-shadow(0 10px 16px rgba(122, 78, 64, 0.16)); }
.liner-pocket { z-index: 1; opacity: 0; transition: opacity 0.3s ease; } /* hidden while closed: it would show through the lace */
/* Everything inside the envelope stays invisible (not just transparent) until the seal is broken. */
.bouquet, .std-card, .liner-pocket, .flap-in { visibility: hidden; }
.envelope.is-open :is(.bouquet, .std-card, .liner-pocket, .flap-in) { visibility: visible; }
.envelope.is-open .liner-pocket { opacity: 1; }
.env-front { z-index: 3; }

.flap {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  aspect-ratio: 1600 / 880;
  z-index: 5;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  /* the flap drops behind the pocket's contents halfway through turning over */
  transition: transform 1.1s cubic-bezier(0.65, 0, 0.35, 1), z-index 0s linear 0.55s;
  pointer-events: none;
}
.envelope.is-open .flap { transform: rotateX(180deg); z-index: 0; }
.flap-face { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.flap-face img { position: absolute; inset: 0; width: 100%; height: 100%; }
.flap-in { transform: rotateX(180deg); }
.flap-title, .flap-names { position: absolute; left: 0; right: 0; text-align: center; margin: 0; white-space: nowrap; }
.flap-title { top: 8.86%; font-family: "Cormorant SC", var(--serif); font-size: 3.3cqw; letter-spacing: 0.02em; color: #8F7A63; }
.flap-names { top: 15.57%; font-family: "Pinyon Script", cursive; font-size: 6.6cqw; color: #85714F; }
.flap-names .amp { font-family: var(--serif); font-style: italic; font-size: 1.05em; }

.seal {
  position: absolute;
  left: 43.25%;
  top: 51.4%;
  width: 13.5%;
  z-index: 7;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 4px 5px rgba(122, 78, 64, 0.28));
  animation: seal-breathe 2.8s ease-in-out infinite;
}
.seal img { display: block; width: 100%; height: auto; }
.seal:disabled { cursor: default; animation: none; }
.seal:not(:disabled):hover { transform: scale(1.03); }
.seal:focus-visible { outline: 2px solid var(--olive); outline-offset: 4px; }
@keyframes seal-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

/* The Save the Date card peeks out of the pocket; it is the film. It rises out, then becomes the player. */
.std-card {
  position: absolute;
  left: 34.375%;
  top: 22.1%;
  width: 31.25%;
  z-index: 2;
  aspect-ratio: 500 / 720;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0;
  filter: drop-shadow(0 3px 6px rgba(42, 45, 38, 0.16));
  transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.std-card img { display: block; width: 100%; height: 100%; }
.std-text {
  position: absolute;
  inset: 9% 0 auto;
  font-family: "Pinyon Script", cursive;
  font-size: 6.4cqw;
  line-height: 0.95;
  color: var(--ink-soft);
  text-align: center;
}
.envelope.is-open .std-card { opacity: 1; }
.envelope.card-out .std-card { transform: translateY(-72%); }
.std-card:hover { transform: translateY(-4%); }
.envelope.card-out .std-card:hover { transform: translateY(-74%); }
.envelope .std-card.lifted { visibility: hidden; }
.std-card:focus-visible { outline: 2px solid var(--olive); outline-offset: 3px; }

.bouquet {
  position: absolute;
  z-index: 6;
  left: -4%;
  top: -4%;
  width: 30%;
  height: auto;
  opacity: 0;
  transform: translateY(6%);
  transition: opacity 0.8s ease 0.3s, transform 1s cubic-bezier(0.22, 1, 0.36, 1) 0.3s;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(42, 45, 38, 0.18));
}
.envelope.is-open .bouquet { opacity: 1; transform: none; }

.player {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: var(--paper);
  transition: top 0.7s cubic-bezier(0.65, 0, 0.35, 1), left 0.7s cubic-bezier(0.65, 0, 0.35, 1),
              width 0.7s cubic-bezier(0.65, 0, 0.35, 1), height 0.7s cubic-bezier(0.65, 0, 0.35, 1), background 0.7s ease;
}
.player.full { background: #1E211C; }
/* Hidden until played, so the first frame can't give anything away before guests press play. */
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; visibility: hidden; }
.player.playing video { visibility: visible; }
.player-play { position: absolute; inset: 0; display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.player-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 246, 240, 0.5);
  border-radius: 50%;
  background: rgba(30, 33, 28, 0.4);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.player.full .player-close { opacity: 1; transition-delay: 0.5s; }
.player-close:focus-visible, .player-play:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.no-scroll { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .envelope, .flap, .std-card, .bouquet, .player, .player-close { transition-duration: 0.01s !important; transition-delay: 0s !important; }
  .seal { animation: none; }
  body .save-date:not([hidden]), .after-film :is(.written-date span, .address-ask, .cta) { animation: none; }
  .after-film .written-date span { -webkit-mask-image: none; mask-image: none; }
  .after-film .address-ask { opacity: 1; }
}

.play-button {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 1px solid rgba(248,246,240,0.85);
  background: rgba(248,246,240,0.12);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, background 0.2s ease;
}
.player-play:hover .play-button { transform: scale(1.06); background: rgba(248,246,240,0.24); }
.film-caption { width: 405px; max-width: 100%; text-align: center; letter-spacing: 0.15em; }

/* Save the date */
.save-date:not([hidden]) { animation: reveal 0.9s ease 0.8s both; }
@keyframes reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.save-date { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 56px 24px 28px; text-align: center; }
.divider { display: flex; align-items: center; gap: 44px; }
.divider span { width: 216px; max-width: 22vw; height: 2px; background: var(--rule-soft); }
.save-date .place { font-family: var(--serif); font-style: italic; font-size: clamp(26px, 6vw, 32px); line-height: 1.2; color: var(--ink); margin-bottom: -6px; }
.countdown { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 4px; }
.countdown-units { display: flex; align-items: flex-start; gap: clamp(6px, 2vw, 14px); }
.countdown-units > div { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 2ch; }
.countdown .num, .countdown .sep {
  font-family: var(--serif);
  font-size: clamp(40px, 9vw, 60px);
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}
.countdown .sep { color: var(--sage); }
.rings { color: #7C7F74; margin: 2px 0 4px; }
.countdown .unit { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--olive); }
.save-date .small { font-size: 12px; }
.invitees { display: grid; gap: 8px; }
.invitees-names { font-family: var(--serif); font-style: italic; font-size: 30px; line-height: 1.15; color: var(--ink); }
/* The date, in the same script as the names on the envelope. Its space is kept from the start so nothing moves when it
   appears; a soft-edged mask then sweeps left to right across it like a pen writing. */
.written-date { margin: -4px 0 -10px; font-family: "Pinyon Script", cursive; font-size: clamp(42px, 11vw, 72px); line-height: 1.25; white-space: nowrap; color: var(--ink-soft); }
.written-date span {
  display: inline-block;
  padding: 0 0.25em; /* room for the script's swashes, so the mask never clips them */
  -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  mask-image: linear-gradient(90deg, #000 45%, transparent 55%);
  -webkit-mask-size: 220% 100%;
  mask-size: 220% 100%;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
}
.after-film .written-date span { animation: write 1.6s cubic-bezier(0.45, 0.05, 0.4, 1) forwards; }
@keyframes write { to { -webkit-mask-position: 0 0; mask-position: 0 0; } }

/* The address ask: a pill like the forms' buttons, which rises in once the date is written and glows twice to catch the eye. */
.address-ask { display: grid; justify-items: center; gap: 16px; }
.address-ask { visibility: hidden; opacity: 0; }
.after-film .address-ask { animation: reveal 0.6s ease 1.2s both; visibility: visible; }
.cta {
  display: inline-block;
  padding: 15px 34px;
  border-radius: 999px;
  background: var(--olive);
  color: var(--paper);
  font: 500 11px var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: none;
  box-shadow: 0 6px 18px rgba(42, 45, 38, 0.14);
  transition: background 0.2s ease;
}
.cta:hover { background: var(--ink); color: var(--paper); } /* beats the site-wide a:hover, which would make the words ink too */
.cta:focus-visible { outline: 2px solid var(--olive); outline-offset: 4px; }
.address-thanks { display: none; gap: 10px; justify-items: center; }
.address-thanks .serif-italic { font-size: 22px; color: var(--ink); }
.address-thanks a { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink); text-underline-offset: 6px; }
.has-address .cta { display: none; }
.has-address .address-thanks { display: grid; }
.after-film .cta { animation: beckon 1.8s ease-out 1.9s 2; }
@keyframes beckon {
  0% { box-shadow: 0 6px 18px rgba(42, 45, 38, 0.14), 0 0 0 0 rgba(84, 95, 72, 0.45); }
  100% { box-shadow: 0 6px 18px rgba(42, 45, 38, 0.14), 0 0 0 18px rgba(84, 95, 72, 0); }
}

/* Footer */
.site-footer { width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px 24px 40px; }
.site-footer p { border-top: 1px solid var(--rule); padding-top: 24px; font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--olive); }

/* Address page */
.page { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 56px 24px 40px; text-align: center; }
.page h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 56px); line-height: 1.15; }
.page .serif-italic { font-size: 22px; }
.form { display: grid; gap: 20px; width: 100%; max-width: 420px; margin-top: 24px; text-align: left; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form label { display: grid; gap: 6px; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--olive); }
.form input {
  font: 16px var(--sans); /* 16px stops iOS zooming in on focus */
  color: var(--ink);
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
}
.form input:focus { outline: none; border-bottom-color: var(--olive); }
.form button {
  margin-top: 8px;
  padding: 14px;
  border: 0;
  background: var(--olive);
  color: var(--paper);
  font: 500 11px var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}
.form button:hover { background: var(--ink); }
.form button:disabled { opacity: 0.6; cursor: default; }
.form .note { text-align: center; font-size: 13px; color: var(--olive); }
.error { min-height: 1.2em; text-align: center; font-size: 13px; color: #9A3B2E; }
body.painted .page > .eyebrow { color: var(--ink); font-weight: 500; }
/* Sign-in and address forms: no card, just lines to write on and a small pill, with the same glow as the rest of the text. */
.open-form { max-width: 360px; justify-items: center; text-align: center; }
#address-form { max-width: 460px; }
.open-form :is(label, .row) { width: 100%; }
.open-form input { width: 100%; min-width: 0; text-align: center; font: italic 22px var(--serif); font-variant-numeric: lining-nums; padding: 10px 0; border-bottom-color: rgba(84, 95, 72, 0.45); }
.open-form input::placeholder { color: var(--olive); opacity: 0.75; }
.open-form button { margin-top: 14px; padding: 13px 38px; border-radius: 999px; box-shadow: 0 6px 18px rgba(42, 45, 38, 0.12); }
body.painted .open-form :is(p, input) {
  text-shadow: 0 0 6px rgba(248, 246, 240, 0.95), 0 0 14px rgba(248, 246, 240, 0.85), 0 0 26px rgba(248, 246, 240, 0.6);
}
body.painted .open-form input { color: var(--ink); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 640px) {
  .site-header { padding: 16px; }

  .divider { gap: 24px; }
  .form .row { grid-template-columns: 1fr; }
}
