/* ==========================================================================
   Furkan & Armina · Nikah davetiyesi
   Concept: a letterpress invitation in a lined envelope, on wine velvet,
   with Stargazer lilies drawn by hand.
   ========================================================================== */

:root {
  --wine-950: #2A040C;
  --wine-900: #3D0612;
  --wine-800: #5E0B1A;
  --wine-600: #7A1426;
  --wine-400: #A3324A;
  --blush: #E9C6C8;
  --blush-light: #F6E3E6;
  --paper: #FCF9F9;
  --paper-shade: #F4ECEC;
  --ink: #2B0A11;
  --ink-soft: #5B3A40;

  --script: "Pinyon Script", "Snell Roundhand", cursive;
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;

  --step--1: 0.9rem;
  --step-0: 1.1875rem;   /* 19px: Cormorant has a small x-height */
  --step-1: 1.4rem;
  --step-2: 1.85rem;
  --step-3: 2.5rem;
  --step-4: clamp(3.5rem, 17vw, 5rem);

  --ease-out: cubic-bezier(.22, .8, .24, 1);
  --ease-in: cubic-bezier(.55, 0, .8, .4);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--serif);
  font-size: var(--step-0);
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--wine-800);
  background-image:
    radial-gradient(120% 80% at 50% 0%, rgba(163, 50, 74, .35), transparent 60%),
    radial-gradient(100% 70% at 50% 100%, rgba(42, 4, 12, .7), transparent 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body.is-locked { overflow: hidden; }

h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--wine-400);
  outline-offset: 3px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Pinyon's own ampersand reads like a "v"; Cormorant italic's is a true flourish. */
.amp {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
}

/* Petals and dust */
.fx {
  position: fixed;
  inset: 0;
  z-index: 55;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ==========================================================================
   Line-art lilies (white strokes that draw themselves)
   ========================================================================== */

.ln {
  position: absolute;
  overflow: visible;
  fill: none;
  stroke: var(--blush-light);
  stroke-width: var(--sw, 1.3);
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: var(--o, .5);
  pointer-events: none;
}

/* ==========================================================================
   Opening: sealed envelope on velvet
   ========================================================================== */

.intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  --env-w: clamp(280px, min(82vw, 52vh), 460px);
  overflow: hidden;
  background-color: var(--wine-800);
  background-image:
    radial-gradient(70% 45% at 50% 46%, rgba(190, 70, 96, .42), transparent 70%),
    radial-gradient(120% 90% at 50% 112%, var(--wine-950), transparent 70%),
    radial-gradient(90% 60% at 50% -10%, var(--wine-900), transparent 70%);
  transition: opacity .9s ease, visibility 0s linear .9s;
}
.intro.is-done { opacity: 0; visibility: hidden; }

.intro__art { position: absolute; inset: 0; }

/* Sizes follow the viewport so wide screens are dressed as fully as phones */
.ln--tl { width: clamp(250px, 36vmin, 460px); aspect-ratio: 1; top: -70px; left: -86px; rotate: 18deg; --o: .42; }
.ln--br { width: clamp(280px, 40vmin, 500px); aspect-ratio: 1; bottom: -86px; right: -98px; --o: .42; }
.ln--tr { width: clamp(170px, 26vmin, 320px); aspect-ratio: 300 / 420; top: 18px; right: -34px; transform: scaleX(-1); --sw: 2.1; --o: .5; }
.ln--bl { width: clamp(160px, 26vmin, 320px); aspect-ratio: 300 / 420; bottom: 24px; left: -30px; --sw: 2.2; --o: .5; }
.ln--wl, .ln--wr { display: none; }
@media (min-width: 760px) {
  /* Two tall sprigs flank the envelope */
  .ln--wl, .ln--wr {
    display: block;
    width: clamp(200px, 30vmin, 340px);
    aspect-ratio: 300 / 420;
    top: calc(50% - clamp(140px, 21vmin, 238px));
    --sw: 1.9;
    --o: .4;
  }
  .ln--wl { left: calc(50% - var(--env-w) / 2 - clamp(230px, 34vmin, 390px)); rotate: -6deg; }
  .ln--wr { right: calc(50% - var(--env-w) / 2 - clamp(230px, 34vmin, 390px)); transform: scaleX(-1); rotate: 6deg; }
}
.ln--ml { width: 92px; height: 72px; top: 17%; left: 3%; rotate: -24deg; --sw: 1.9; --o: .38; }
.ln--mr { width: 84px; height: 66px; bottom: 15%; right: 30%; rotate: 20deg; --sw: 2; --o: .38; }
@media (min-width: 760px) {
  .ln--ml { top: 8%; left: 31%; width: 120px; height: 94px; }
  .ln--mr { bottom: 10%; right: 24%; width: 120px; height: 94px; }
}

/* Short phone screens: keep the corners, drop what would crowd the envelope */
@media (max-height: 720px) and (max-width: 600px) {
  .ln--ml, .ln--mr { display: none; }
  .ln--bl { width: 120px; bottom: -40px; left: -34px; }
  .ln--tr { width: 140px; top: -10px; }
  .ln--br { bottom: -120px; }
}

.intro__stage {
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.6rem;
  min-height: 100%;
  padding: 1.5rem;
}

.intro__names {
  font-family: var(--script);
  font-size: clamp(2rem, min(9vw, 6vh), 3.4rem);
  line-height: 1.2;
  color: var(--paper);
  text-shadow: 0 2px 14px rgba(42, 4, 12, .6);
  transition: opacity .4s ease;
}
.intro__names .amp { color: var(--blush); font-size: .8em; padding: 0 .08em; }

.intro__hint {
  color: var(--blush);
  font-style: italic;
  font-size: var(--step-0);
  letter-spacing: .01em;
  text-align: center;
  transition: opacity .4s ease;
}
.intro.is-opening .intro__hint,
.intro.is-opening .intro__names { opacity: 0; }

/* ---------- Envelope ---------- */

.envelope {
  position: relative;
  width: var(--env-w);
  aspect-ratio: 1.45;
  perspective: 1400px;
}
/* Soft contact shadow; a filter here would flatten the flap's 3D */
.envelope::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -9%;
  height: 22%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(20, 0, 5, .55), transparent 75%);
  z-index: -1;
  transition: opacity .6s ease 2s;
}
.intro.is-opening .envelope::after { opacity: 0; }

.envelope__back {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: url("../assets/liner.svg") 0 0 / 84px;
  box-shadow: inset 0 0 0 7px #F1E7E8, inset 0 0 0 8px rgba(94, 11, 26, .2);
  transition: translate .9s var(--ease-in) 2.05s, opacity .5s ease 2.35s;
}

.envelope__glow {
  position: absolute;
  inset: -40% -20% 20%;
  z-index: 1;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 232, 236, .55), transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease .9s;
}
.intro.is-opening .envelope__glow { opacity: 1; }

.envelope__pocket {
  position: absolute;
  inset: 0;
  z-index: 3;
  filter: drop-shadow(0 -2px 3px rgba(60, 8, 20, .16));
  transition: translate .9s var(--ease-in) 2.05s, opacity .5s ease 2.35s;
}
.pocket {
  position: absolute;
  inset: 0;
  border-radius: 6px;
}
.pocket--l { clip-path: polygon(0 0, 52% 56%, 0 100%); background: linear-gradient(100deg, #F9F4F4, #EFE6E7); }
.pocket--r { clip-path: polygon(100% 0, 48% 56%, 100% 100%); background: linear-gradient(260deg, #F7F1F1, #ECE2E3); }
.pocket--b {
  clip-path: polygon(0 100%, 50% 47%, 100% 100%);
  background: linear-gradient(0deg, #FCF9F9 40%, #F2EAEB);
}

/* Shadow the closed flap casts on the pocket (blur on the wrapper, clip on the child) */
.envelope__flap-shadow {
  position: absolute;
  inset: 0;
  z-index: 3;
  filter: blur(3px);
  transform: translateY(3px);
  pointer-events: none;
  transition: opacity .25s ease .3s;
}
.envelope__flap-shadow i {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 61%);
  background: rgba(60, 8, 20, .2);
}
.intro.is-opening .envelope__flap-shadow { opacity: 0; }

/* The flap has two faces: paper outside, lined inside */
.envelope__flap {
  position: absolute;
  inset: 0;
  z-index: 4;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  transition:
    transform .95s cubic-bezier(.45, .05, .25, 1) .3s,
    z-index 0s linear .78s,
    translate .9s var(--ease-in) 2.05s;
}
.flap {
  position: absolute;
  inset: 0;
  border-radius: 6px 6px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 60%);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: opacity .5s ease 2.35s;
}
.flap--front {
  background:
    linear-gradient(180deg, transparent 70%, rgba(94, 11, 26, .06)),
    linear-gradient(180deg, #FAF5F5, #EEE4E5);
}
.flap--back {
  transform: rotateX(180deg);
  background: url("../assets/liner.svg") 0 0 / 84px;
}

.intro.is-opening .envelope__flap { transform: rotateX(180deg); z-index: 1; translate: 0 48vh; }
.intro.is-opening .flap { opacity: 0; }
/* After the card is out, the envelope drops away and the card stays */
.intro.is-opening .envelope__back,
.intro.is-opening .envelope__pocket { translate: 0 48vh; opacity: 0; }

/* ---------- Card inside ---------- */

.envelope__card {
  position: absolute;
  z-index: 2;
  left: 6%;
  right: 6%;
  top: 6%;
  height: 88%;
  display: grid;
  justify-items: center;
  align-content: start;
  padding-top: 7%;
  background: var(--paper);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 5px var(--paper),
    inset 0 0 0 6px rgba(122, 20, 38, .35),
    0 -4px 16px rgba(42, 4, 12, .18);
  transition: transform 1.15s var(--ease-out) .95s, scale 1.1s var(--ease-out) 2.1s;
}
.intro.is-opening .envelope__card { transform: translateY(-64%); scale: 1.14; }

.envelope__card-lily { width: 30%; aspect-ratio: 1; }
.envelope__card-names {
  font-family: var(--script);
  font-size: calc(var(--env-w) * .075);
  color: var(--wine-800);
  line-height: 1.15;
}
.envelope__card-names .amp { font-size: .85em; padding: 0 .1em; }
.envelope__card-date {
  font-size: .8rem;
  letter-spacing: .08em;
  color: var(--ink-soft);
  font-variant-numeric: lining-nums;
}

/* ---------- Wax seal ---------- */

.seal {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 60%;
  width: 26%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transform: translate(-50%, -50%);
  -webkit-tap-highlight-color: transparent;
}
.seal:focus-visible { outline-color: var(--blush); outline-offset: 8px; }
/* Ripples that invite a tap */
.seal::before,
.seal::after {
  content: "";
  position: absolute;
  inset: -4%;
  border: 1.5px solid rgba(246, 227, 230, .8);
  border-radius: 50%;
  animation: ripple 2.6s ease-out infinite;
  pointer-events: none;
}
.seal::after { animation-delay: 1.3s; }
@keyframes ripple {
  from { transform: scale(.95); opacity: .9; }
  to { transform: scale(1.85); opacity: 0; }
}

.seal__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 5px 6px rgba(42, 4, 12, .5));
}
.seal__mono {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 32px;
  fill: #F0C3CB;
}
.seal__mono--shadow { fill: #2A040C; opacity: .75; }
.seal__amp { font-size: 17px; font-weight: 500; }

.seal__half {
  transform-box: fill-box;
  transition: transform 1s var(--ease-in) .05s, opacity .5s ease .5s;
}
.seal__half--l { transform-origin: 100% 100%; }
.seal__half--r { transform-origin: 0 100%; }
.intro.is-opening .seal { pointer-events: none; outline: none; }
.intro.is-opening .seal::before,
.intro.is-opening .seal::after { animation: none; opacity: 0; }
.intro.is-opening .seal__half--l { transform: translate(-22px, 90px) rotate(-38deg); opacity: 0; }
.intro.is-opening .seal__half--r { transform: translate(20px, 96px) rotate(32deg); opacity: 0; }

.seal__crumbs { position: absolute; inset: 0; pointer-events: none; }
.seal__crumbs i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--s, 6px);
  height: var(--s, 6px);
  margin: calc(var(--s, 6px) / -2);
  border-radius: 40% 60% 55% 45%;
  background: radial-gradient(circle at 30% 30%, #A3283F, #4A0814);
  opacity: 0;
}
.seal__crumbs i:nth-child(1) { --x: -38px; --y: -26px; --s: 7px; }
.seal__crumbs i:nth-child(2) { --x: 34px; --y: -30px; --s: 5px; }
.seal__crumbs i:nth-child(3) { --x: -46px; --y: 18px; --s: 6px; }
.seal__crumbs i:nth-child(4) { --x: 44px; --y: 14px; --s: 8px; }
.seal__crumbs i:nth-child(5) { --x: -14px; --y: 40px; --s: 5px; }
.seal__crumbs i:nth-child(6) { --x: 18px; --y: 44px; --s: 6px; }
.seal__crumbs i:nth-child(7) { --x: 4px; --y: -42px; --s: 4px; }
.intro.is-opening .seal__crumbs i { animation: crumb .9s var(--ease-out) forwards; }
@keyframes crumb {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  60% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 40px)) rotate(200deg) scale(.6); }
}

/* ==========================================================================
   The invitation card
   ========================================================================== */

.card {
  position: relative;
  max-width: 34rem;
  margin: 0 auto;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .37 0 0 0 0 .04 0 0 0 0 .1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  overflow: hidden;
}
@media (min-width: 36rem) {
  .card {
    margin: 4rem auto;
    border-radius: 4px;
    box-shadow: 0 30px 60px -20px rgba(20, 0, 5, .6);
  }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: grid;
  justify-items: center;
  /* The first screen should end on the date, so vertical rhythm shrinks with the
     screen height (svh: the height with the browser bars showing). */
  padding: 5.25rem 1.75rem 7.5rem;
  padding-top: clamp(2.5rem, 7.5svh, 5.25rem);
  text-align: center;
}
.hero > :not(.hero__sprig) { position: relative; z-index: 1; }
/* Printed double frame */
.hero::before {
  content: "";
  position: absolute;
  inset: .9rem;
  border: 1px solid rgba(122, 20, 38, .45);
  outline: 1px solid rgba(122, 20, 38, .25);
  outline-offset: -5px;
  pointer-events: none;
}

.hero__sprig {
  position: absolute;
  --w: clamp(150px, 38vw, 180px);
  width: var(--w);
  aspect-ratio: 300 / 380;
  pointer-events: none;
}
/* Each bloom sits whole in its corner of the card; only the stem runs off the side edge.
   After the transforms the bloom (petal reach ~.22w) is centred at (.361w, .311w) in the
   top sprig and (.723w, .905w) in the bottom one, which is where these offsets come from. */
.hero__sprig--top { top: 4px; right: calc(2px - .306 * var(--w)); transform: scaleX(-1) rotate(-8deg); }
.hero__sprig--bottom { bottom: 8px; left: calc(6px - .39 * var(--w)); transform: rotate(172deg) scaleX(-1); }

.couple {
  display: grid;
  justify-items: center;
  font-family: var(--script);
  font-weight: 400;
  font-size: var(--step-4);
  font-size: min(var(--step-4), 9.4svh);
  line-height: 1.05;
  color: var(--wine-800);
}
.couple__name { display: block; padding: 0 .15em; }
.couple__and {
  font-size: .5em;
  line-height: 1;
  margin: .02em 0 .06em;
  color: var(--wine-400);
}

.bloom-wrap {
  position: relative;
  margin: 1.2rem 0 1.3rem;
  margin-block: clamp(.4rem, 1.8svh, 1.2rem) clamp(.6rem, 2svh, 1.3rem);
}
.bloom-wrap::before {
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(201, 103, 122, .26), transparent);
  pointer-events: none;
}
.bloom {
  position: relative;
  display: block;
  width: min(60vw, 230px);
  width: min(60vw, 230px, 25svh);
  aspect-ratio: 1;
  overflow: visible;
}
/* Short phones (iPhone SE/mini with the browser bars showing): a smaller bloom leaves
   room under the date for the scroll hint. */
@media (max-height: 640px) {
  .bloom { width: min(60vw, 18svh); }
  .bloom-wrap { margin-block: .3rem .5rem; }
}
.bloom .tepal {
  transform-box: view-box;
  transform-origin: 0 0;
  transform: rotate(var(--r)) scale(var(--s));
}
.bloom__throat, .bloom__stamens { transform-box: view-box; transform-origin: 0 0; }

.families {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  max-width: 22rem;
  font-size: var(--step-0);
  line-height: 1.35;
  color: var(--ink-soft);
}
.family__name {
  display: block;
  font-family: var(--script);
  font-size: var(--step-1);
  color: var(--wine-600);
  line-height: 1.3;
}

.hero__text {
  max-width: 21rem;
  margin-top: 1.6rem;
  margin-top: clamp(.9rem, 2.4svh, 1.6rem);
  font-size: var(--step-1);
  font-style: italic;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink);
}

.when { margin-top: 2rem; margin-top: clamp(1rem, 2.8svh, 2rem); font-variant-numeric: lining-nums; }
.when time {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
}
.when__day {
  font-size: 4.2rem;
  font-size: min(4.2rem, 10svh);
  font-weight: 400;
  line-height: .9;
  color: var(--wine-800);
  padding-right: 1rem;
  border-right: 1px solid rgba(122, 20, 38, .4);
}
.when__rest {
  font-size: var(--step-0);
  line-height: 1.35;
  color: var(--ink);
}

/* ---------- Countdown ---------- */

.countdown {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .5rem;
  padding: 3.5rem 1.25rem 3.75rem;
  text-align: center;
  color: var(--paper);
  background-color: var(--wine-800);
  background-image: radial-gradient(90% 120% at 50% 0%, var(--wine-600), transparent 70%);
  overflow: hidden;
}
.countdown > :not(.ln) { position: relative; z-index: 1; }
.ln--band-l { width: 130px; aspect-ratio: 300 / 420; left: -38px; bottom: -36px; --sw: 2.4; --o: .3; }
.ln--band-r { width: 130px; aspect-ratio: 300 / 420; right: -38px; top: -24px; transform: scale(-1, -1); --sw: 2.4; --o: .3; }

.countdown__title,
.countdown__tail {
  font-family: var(--script);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.1;
  color: var(--blush);
}
.countdown__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  max-width: 24rem;
  margin: .9rem 0 .6rem;
}
.unit {
  display: grid;
  justify-items: center;
  padding: 0 .25rem;
  overflow: hidden;
}
.unit + .unit { border-left: 1px solid rgba(233, 198, 200, .3); }
.unit__num {
  font-size: clamp(2.4rem, 11vw, 3.2rem);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}
.unit__label {
  margin-top: .35rem;
  font-size: var(--step--1);
  font-style: italic;
  color: var(--blush);
}
.countdown__message {
  max-width: 20rem;
  margin: .6rem 0 .4rem;
  font-size: var(--step-1);
  font-style: italic;
}
.countdown .btn { margin-top: 1.4rem; }

/* ---------- Venue ---------- */

.venue {
  position: relative;
  display: grid;
  justify-items: center;
  padding: 4rem 1.5rem 3.5rem;
  text-align: center;
  /* A blush wash so the section isn't bare white between the bordo countdown and the footer */
  background: radial-gradient(70% 60% at 50% 45%, rgba(233, 198, 200, .28), transparent 75%);
  overflow: hidden;
}
.venue > :not(.ln) { position: relative; z-index: 1; }
/* The lily motif carries on here, drawn in wine on the paper */
.venue .ln { stroke: var(--wine-600); }
.ln--venue-mark { width: 300px; aspect-ratio: 1; left: calc(50% - 150px); top: calc(50% - 165px); --sw: 1.1; --o: .08; }
.ln--venue-l { width: 150px; aspect-ratio: 300 / 420; left: -34px; bottom: -40px; rotate: 8deg; --sw: 2.2; --o: .3; }
.ln--venue-r { width: 132px; aspect-ratio: 300 / 420; right: -30px; bottom: -36px; transform: scaleX(-1); rotate: -6deg; --sw: 2.3; --o: .26; }
.venue__pin {
  width: 46px;
  height: 60px;
  margin-bottom: 1.1rem;
  overflow: visible;
  color: var(--wine-600);
}
.venue__org {
  font-size: var(--step-0);
  color: var(--ink-soft);
}
.venue__title {
  font-family: var(--script);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.15;
  color: var(--wine-800);
  margin: .15rem 0 .1rem;
  padding: 0 .2em;
}
.venue__city {
  font-size: var(--step-1);
  font-style: italic;
  color: var(--ink);
}
.venue .btn { margin-top: 1.8rem; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: .55rem 1.9rem .65rem;
  border: 1px solid var(--wine-600);
  border-radius: 999px;
  background: var(--wine-800);
  color: var(--paper);
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background-color .2s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--wine-600); }
.btn:active { transform: scale(.97); }

.btn--light {
  background: transparent;
  border-color: rgba(233, 198, 200, .6);
  color: var(--paper);
}
.btn--light:hover { background: rgba(252, 249, 249, .1); }
.btn--light:focus-visible { outline-color: var(--blush); }

/* ---------- Closing ---------- */

.closing {
  display: grid;
  justify-items: center;
  padding: 1rem 1.5rem 6.5rem;
  text-align: center;
  border-top: 1px solid rgba(122, 20, 38, .15);
}
.closing__lily { width: 92px; height: 92px; margin-top: 2.5rem; }
.closing__names {
  font-family: var(--script);
  font-size: var(--step-2);
  color: var(--wine-800);
  line-height: 1.2;
  margin-top: .4rem;
}
.closing__names .amp { font-size: .8em; }
.closing__date {
  font-size: var(--step--1);
  color: var(--ink-soft);
  letter-spacing: .12em;
  font-variant-numeric: lining-nums;
}

/* ==========================================================================
   Bottom sheet
   ========================================================================== */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  align-items: end;
  justify-items: center;
}
.sheet[hidden] { display: none; }
.sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(42, 4, 12, .55);
  animation: fade-in .25s ease both;
}
.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 30rem;
  padding: 1.6rem 1.25rem calc(1.1rem + env(safe-area-inset-bottom));
  background: var(--paper);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(20, 0, 5, .35);
  animation: sheet-up .35s var(--ease-out) both;
}
.sheet__title {
  font-size: var(--step-1);
  font-weight: 600;
  text-align: center;
  color: var(--wine-800);
  margin-bottom: .9rem;
}
.sheet__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(122, 20, 38, .18);
}
.sheet__list li + li { border-top: 1px solid rgba(122, 20, 38, .12); }
.sheet__link {
  display: flex;
  align-items: center;
  gap: .9rem;
  min-height: 3.4rem;
  padding: .6rem 1rem;
  color: var(--ink);
  font-size: var(--step-0);
  font-weight: 600;
  text-decoration: none;
  background: #fff;
}
.sheet__link:hover { background: var(--paper-shade); }
.sheet__link:focus-visible { outline-offset: -3px; }
.sheet__link small {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  font-style: italic;
  color: var(--ink-soft);
}
.sheet__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9px;
  color: #fff;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
}
.sheet__cancel {
  display: block;
  width: 100%;
  min-height: 3.2rem;
  margin-top: .75rem;
  border: 0;
  border-radius: 12px;
  background: var(--paper-shade);
  font-size: var(--step-0);
  font-weight: 600;
  color: var(--wine-800);
  cursor: pointer;
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ==========================================================================
   Music toggle
   ========================================================================== */

.music {
  position: fixed;
  z-index: 40;
  right: calc(.85rem + env(safe-area-inset-right));
  bottom: calc(.85rem + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(122, 20, 38, .35);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 8px 20px rgba(42, 4, 12, .3);
  cursor: pointer;
  animation: fade-in .6s ease both;
}
.music[hidden] { display: none; }
.music__bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}
.music__bars i {
  width: 3px;
  height: 30%;
  border-radius: 2px;
  background: var(--wine-600);
}
.music[aria-pressed="false"]::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 1.5px;
  background: var(--wine-600);
  transform: rotate(-45deg);
}

/* Scroll hint: a small paper tab at the foot of the screen, clear enough that guests
   see there is more, quiet enough to sit under the invitation. */
.scroll-hint {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(.85rem + env(safe-area-inset-bottom));
  translate: -50% 12px;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .95rem .45rem 1.1rem;
  font: italic 400 1.05rem/1 var(--serif);
  letter-spacing: .01em;
  color: var(--wine-800);
  white-space: nowrap;
  background: rgba(252, 249, 249, .92);
  border: 1px solid rgba(122, 20, 38, .3);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(42, 4, 12, .22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .9s ease, translate .9s var(--ease-out), visibility 0s linear .9s;
}
.scroll-hint__arrow { display: block; width: .95rem; height: auto; overflow: visible; }
.scroll-hint path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.scroll-hint path + path { opacity: .45; }
.scroll-hint.is-visible { opacity: 1; translate: -50% 0; visibility: visible; transition: opacity .9s ease, translate .9s var(--ease-out); }

/* ==========================================================================
   Motion. Everything that starts hidden lives inside this block, and the
   hidden states also need the .js class, so without JavaScript the page is
   simply all there. It plays for every guest: the couple wanted the opening
   seen even with Reduce Motion on; the block after it calms that case down.
   ========================================================================== */

@media all {

  .music[aria-pressed="true"] .music__bars i { animation: bar 1s ease-in-out infinite; }
  .music[aria-pressed="true"] .music__bars i:nth-child(2) { animation-delay: -.4s; }
  .music[aria-pressed="true"] .music__bars i:nth-child(3) { animation-delay: -.7s; }
  .music[aria-pressed="true"] .music__bars i:nth-child(4) { animation-delay: -.2s; }
  @keyframes bar {
    0%, 100% { height: 25%; }
    50% { height: 100%; }
  }

  /* ---- Line art draws itself, then drifts ---- */
  .js .ln {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    opacity: 0;
  }
  .js .intro .ln {
    animation:
      ln-draw 3.6s cubic-bezier(.45, .05, .3, 1) var(--d, 0s) forwards,
      ln-drift 9s ease-in-out calc(var(--d, 0s) + 3.6s) infinite alternate;
  }
  .js .countdown.in-view .ln,
  .js .venue.in-view .ln {
    animation:
      ln-draw 3.2s cubic-bezier(.45, .05, .3, 1) .2s forwards,
      ln-drift 10s ease-in-out 3.4s infinite alternate;
  }
  @keyframes ln-draw {
    0% { stroke-dashoffset: 1; opacity: 0; }
    4% { opacity: var(--o, .5); }
    100% { stroke-dashoffset: 0; opacity: var(--o, .5); }
  }
  @keyframes ln-drift {
    from { translate: 0 0; }
    to { translate: 4px -7px; }
  }

  /* ---- Intro ---- */
  .intro__names { animation: write 2.2s cubic-bezier(.5, .1, .3, 1) .3s both; }
  .intro__hint { animation: fade-in 1s ease 1.8s both, hint-breathe 2.8s ease-in-out 2.8s infinite; }
  .intro.is-opening .intro__hint { animation: none; }
  .envelope { animation: envelope-in 1.2s var(--ease-out) .2s both; }
  @keyframes envelope-in {
    from { opacity: 0; transform: translateY(24px) scale(.96); }
  }
  @keyframes hint-breathe {
    0%, 100% { opacity: .55; }
    50% { opacity: 1; }
  }

  /* Handwriting: a soft-edged mask sweeps left to right */
  @keyframes write {
    from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
    to { -webkit-mask-position: 0 0; mask-position: 0 0; }
  }
  .intro__names,
  .js .couple__name,
  .js .venue__title {
    -webkit-mask-image: linear-gradient(90deg, #000 42%, transparent 58%);
    mask-image: linear-gradient(90deg, #000 42%, transparent 58%);
    -webkit-mask-size: 260% 100%;
    mask-size: 260% 100%;
    -webkit-mask-position: 100% 0;
    mask-position: 100% 0;
  }

  /* ---- Hero, after the envelope opens ---- */
  .is-revealed .couple__name--1 { animation: write 1.6s cubic-bezier(.5, .1, .3, 1) .2s both; }
  .is-revealed .couple__name--2 { animation: write 1.7s cubic-bezier(.5, .1, .3, 1) 1.15s both; }
  .js .couple__and { opacity: 0; }
  .is-revealed .couple__and { animation: rise .8s ease .9s both; }

  .js .bloom .tepal {
    opacity: 0;
    transform: rotate(calc(var(--r) - 35deg)) scale(.12);
  }
  .js .bloom__throat,
  .js .bloom__stamens { opacity: 0; }
  .js .bloom__stamens { transform: rotate(14deg) scale(.4); }
  .is-revealed .bloom .tepal {
    opacity: 1;
    transform: rotate(var(--r)) scale(var(--s));
    transition:
      transform 2s cubic-bezier(.2, .9, .25, 1.06) calc(var(--d) + 1.5s),
      opacity .6s ease calc(var(--d) + 1.5s);
  }
  .is-revealed .bloom__throat { opacity: 1; transition: opacity 1s ease 2.3s; }
  .is-revealed .bloom__stamens {
    opacity: 1;
    transform: rotate(14deg) scale(1);
    transition: transform 1.4s var(--ease-out) 2.4s, opacity .8s ease 2.4s;
  }
  .is-revealed .bloom { animation: sway 7s ease-in-out 4.5s infinite alternate; }
  .js .bloom-wrap::before { opacity: 0; }
  .is-revealed .bloom-wrap::before { animation: glow 5s ease-in-out 2s infinite alternate; }
  @keyframes glow {
    from { opacity: .45; transform: scale(.92); }
    to { opacity: 1; transform: scale(1.08); }
  }

  .scroll-hint.is-visible .scroll-hint__arrow { animation: hint-bob 1.6s ease-in-out infinite; }
  @keyframes hint-bob { 0%, 100% { translate: 0 -1px; } 50% { translate: 0 4px; } }

  .js .families,
  .js .hero__text,
  .js .when { opacity: 0; }
  .is-revealed .families { animation: rise 1s var(--ease-out) 3.2s both; }
  .is-revealed .hero__text { animation: rise 1s var(--ease-out) 3.5s both; }
  .is-revealed .when { animation: rise 1s var(--ease-out) 3.8s both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }

  .hero__sprig--top { animation: sway-soft 8s ease-in-out infinite alternate; }
  .hero__sprig--bottom { animation: sway-soft 9s ease-in-out -3s infinite alternate; }
  .closing__lily { animation: sway 8s ease-in-out infinite alternate; }
  @keyframes sway {
    from { rotate: -3deg; }
    to { rotate: 3deg; }
  }
  @keyframes sway-soft {
    from { rotate: -1.5deg; }
    to { rotate: 1.5deg; }
  }

  /* ---- Countdown digits roll in when they change ---- */
  .unit__num.is-rolling { animation: roll .5s var(--ease-out); }
  @keyframes roll {
    from { transform: translateY(-45%); opacity: 0; filter: blur(2px); }
  }

  /* ---- Scroll reveals ---- */
  .js .countdown .unit { opacity: 0; }
  .countdown.in-view .unit { animation: rise .9s var(--ease-out) both; }
  .countdown.in-view .unit:nth-child(2) { animation-delay: .12s; }
  .countdown.in-view .unit:nth-child(3) { animation-delay: .24s; }
  .countdown.in-view .unit:nth-child(4) { animation-delay: .36s; }

  .js .venue__pin { opacity: 0; }
  .js .venue__pin-line { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .venue.in-view .venue__pin { animation: pin-drop 1s cubic-bezier(.3, 1.5, .5, 1) both; }
  .venue.in-view .venue__pin-line { animation: pin-draw 1.4s ease .3s forwards; }
  @keyframes pin-drop {
    from { opacity: 0; transform: translateY(-36px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes pin-draw { to { stroke-dashoffset: 0; } }

  .js .venue :is(.venue__org, .venue__city, .btn) { opacity: 0; }
  .venue.in-view .venue__org { animation: rise .9s var(--ease-out) .3s both; }
  .venue.in-view .venue__title { animation: write 1.6s cubic-bezier(.5, .1, .3, 1) .5s both; }
  .venue.in-view .venue__city { animation: rise .9s var(--ease-out) 1.2s both; }
  .venue.in-view .btn { animation: rise .9s var(--ease-out) 1.4s both; }

  .js .closing :is(.closing__names, .closing__date) { opacity: 0; }
  .closing.in-view .closing__names { animation: rise 1s var(--ease-out) .2s both; }
  .closing.in-view .closing__date { animation: rise 1s var(--ease-out) .5s both; }
}

/* Reduced motion: the one-off opening still plays (fades, drawing, the envelope),
   but nothing keeps moving afterwards. Each rule keeps the reveal its element needs. */
@media (prefers-reduced-motion: reduce) {
  .music[aria-pressed="true"] .music__bars i { animation: none; height: 60%; }
  .js .intro .ln { animation: ln-draw 3.6s cubic-bezier(.45, .05, .3, 1) var(--d, 0s) forwards; }
  .js .countdown.in-view .ln,
  .js .venue.in-view .ln { animation: ln-draw 3.2s cubic-bezier(.45, .05, .3, 1) .2s forwards; }
  .intro__hint { animation: fade-in 1s ease 1.8s both; }
  .is-revealed .bloom-wrap::before { animation: fade-in 2s ease 2s both; opacity: .8; }
  .is-revealed .bloom,
  .hero__sprig--top,
  .hero__sprig--bottom,
  .closing__lily,
  .scroll-hint.is-visible .scroll-hint__arrow { animation: none; }
}
