:root {
  --bg: #d7ccbf;            /* taupe */
  --bg-deep: #bdae9d;
  --paper: #f3f0ea;
  --cream: #f5ecdc;          /* warm ivory panels on the taupe */
  --cream-paper: linear-gradient(rgba(245, 236, 220, .7), rgba(245, 236, 220, .7)), url(paper-invite.jpg) 0 0 / 200px auto, var(--cream);
  --burg: #6e0f18;
  --burg-ink: #8a1a26;
  --blue-ink: #56708a;      /* Omar's route: a muted slate that sits with taupe */
  --ink: #2b2522;
  --ink-soft: #5b4e46;
  --rule: rgba(43, 37, 34, .22);
  --liner: #efede8;
  --script: "Pinyon Script", "Snell Roundhand", cursive;   /* only for the hand-addressed name */
  --serif: "Sorts Mill Goudy", "Libre Baskerville", Georgia, serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --label: 500 11.5px/1.4 var(--sans);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='.1'/%3E%3C/svg%3E");
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100svh;
  background: var(--noise), var(--grain), var(--bg);
  color: var(--ink);
  font: 400 16px/1.8 var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }
button { font: inherit; }

/* Shared type: small spaced capitals for labels, the Goudy serif for headings. */
.label, .d-count, .cal-lbl, .sched-lbl, .gal-item span, .lightbox figcaption, .hint {
  font: var(--label); letter-spacing: .24em; text-transform: uppercase;
}
.section-title, .rsvp h2, .log h2, .gallery h2 {
  font-family: var(--serif); font-weight: 400; color: var(--ink);
  font-size: clamp(34px, 7vw, 46px); line-height: 1.15; letter-spacing: .01em;
}

/* ---------- stage ---------- */
.stage { position: relative; height: 100svh; min-height: 560px; overflow: hidden; cursor: pointer; transition: height .6s ease; }
.stage.opened { cursor: default; }
.scene { position: absolute; inset: 0; transform-origin: 0 0; }
.scene.enter { animation: enter 1.4s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes enter { from { opacity: 0; translate: 0 -16px; } }

/* The envelope has no transform/z-index so its parts share a stacking context with the card. */
.envelope { position: absolute; left: 0; top: 0; width: 300px; height: 204px; }
.env-back {
  position: absolute; inset: 0; z-index: 1; border-radius: 3px;
  background: var(--grain), linear-gradient(#610c15, #520a12);
  box-shadow: 0 30px 50px -28px rgba(55, 35, 25, .55), 0 3px 8px rgba(55, 35, 25, .16);
}
.env-back-liner {
  position: absolute; left: 4%; right: 4%; top: 0; bottom: 0; overflow: hidden;
  box-shadow: inset 0 2px 3px -1px rgba(60, 30, 20, .25);
  background: url(paper-invite.jpg) 0 0 / 200px auto, var(--liner); border-radius: 2px 2px 0 0;
}
/* One orchid trails from the open flap down across the fold: the same image sits on both liners, aligned at the fold. */
.orchid { position: absolute; display: block; height: auto; pointer-events: none; }
.o-back { left: 52.17%; top: -52.00%; width: 43.48%; }
.o-flap { left: 52.22%; top: 7.83%; width: 44.44%; }

.env-flap {
  position: absolute; left: 0; top: 0; width: 100%; height: 62%; z-index: 4;
  transform-origin: 50% 0; transform: perspective(1400px) rotateX(0deg);
  transform-style: preserve-3d; transition: transform 1s cubic-bezier(.45, 0, .55, 1);
}
.env-flap.open { transform: perspective(1400px) rotateX(180deg); }
.env-flap.behind { z-index: 1; }
.flap-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flap-out { filter: drop-shadow(0 3px 3px rgba(40, 4, 10, .35)); }
.flap-out::before {
  content: ""; position: absolute; inset: 0;
  clip-path: polygon(0 0, 100% 0, 54% 94%, 50% 100%, 46% 94%);
  background: var(--grain), linear-gradient(170deg, #7f1722, #6a0f19 70%);
}
.flap-in {
  transform: rotateX(180deg);
  clip-path: polygon(46% 6%, 50% 0, 54% 6%, 100% 100%, 0 100%);
  background: #650e17;
}
.flap-in-liner {
  position: absolute; left: 5%; right: 5%; top: 9%; bottom: 0; overflow: hidden;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: url(paper-invite.jpg) 0 0 / 200px auto, var(--liner);
}

.env-pocket { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.env-pocket svg { width: 100%; height: 100%; display: block; overflow: visible; }

.seal {
  position: absolute; left: 50%; top: 61%; width: 19%; aspect-ratio: 1; z-index: 5;
  transform: translate(-50%, -50%); border: 0; padding: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.seal:focus-visible { outline: 1px solid var(--paper); outline-offset: 4px; border-radius: 50%; }
.seal-wax { position: absolute; inset: -12%; display: block; }
.seal-wax svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* The seal zooms out (shrinks away into the distance) and dissolves. */
.seal.peeled { pointer-events: none; animation: dissolve .9s cubic-bezier(.3, 0, .4, 1) forwards; }
@keyframes dissolve {
  0% { opacity: 1; filter: blur(0); transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; filter: blur(3px); transform: translate(-50%, -50%) scale(.12); }
}

/* The guest's name, hand-addressed on the closed flap above the seal (it lifts away with the flap). */
.env-to {
  position: absolute; left: 0; right: 0; top: 38%; z-index: 1; margin: 0; text-align: center;
  font-family: var(--script); font-size: 22px; line-height: 1.1; color: #f1dfc4;
  text-shadow: 0 1px 1px rgba(40, 4, 10, .45);
}

/* ---------- card ---------- */
.card {
  position: absolute; left: 0; top: 0; width: 300px; height: 420px; z-index: 2;
  transform-origin: 50% 50%; will-change: transform;
  background: url(paper.jpg) 0 0 / 260px, #f2ebe1; border-radius: 2px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 30px 50px -28px rgba(55, 35, 25, .55);
  container-type: inline-size;
}
.card.out { z-index: 6; }
.card-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* The ceremony details, set over the card artwork in the card's own proportions. */
.card-text { position: absolute; left: 0; right: 0; top: 70%; text-align: center; font-family: var(--serif); }
.ct-title { font-size: 4.3cqw; line-height: 1.3; color: #a42024; letter-spacing: .02em; margin-bottom: 1.8cqw; }
.ct-line { font-size: 3.5cqw; line-height: 1.55; color: #4a4440; }
.ct-line + .ct-line { font-size: 3.1cqw; color: #7a726c; letter-spacing: .02em; }

/* ---------- cues ---------- */
.hint {
  position: absolute; left: 0; right: 0; text-align: center; pointer-events: none;
  color: var(--ink-soft); animation: pulse 3.2s ease-in-out infinite; transition: opacity .4s;
}
.hint.gone { opacity: 0; animation: none; }
.fade-up { animation: fadeUp 1.1s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
@keyframes pulse { 50% { opacity: .5; } }
.scroll-cue {
  position: fixed; left: 50%; bottom: 14px; translate: -50% 0; z-index: 10;
  border: 0; background: none; color: var(--ink-soft); padding: 8px; cursor: pointer;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(4px); } }

/* ---------- countdown + message + schedule (on the taupe) ---------- */
.countdown { padding: 36px 20px 0; text-align: center; }
.d-count { color: var(--ink-soft); }
.details { max-width: 600px; margin: 0 auto; padding: 56px 28px 0; text-align: center; }
.d-dear { font: italic 400 26px/1.3 var(--serif); color: var(--ink); margin-bottom: 18px; }
.d-msg { font-size: 16px; line-height: 1.8; color: var(--ink); white-space: pre-line; }
.d-sign { margin-top: 30px; font: italic 400 17px/1.4 var(--serif); color: var(--ink-soft); }
.d-names { display: block; width: min(220px, 58vw); height: auto; margin: 12px auto 0; }

.schedule { max-width: 520px; margin: 0 auto; padding: 72px 28px 0; text-align: center; }
.sched-lbl { color: var(--ink); margin-bottom: 26px; }
.sched-list { list-style: none; padding: 0; display: grid; gap: 14px; }
.sched-list li { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 18px; font-size: 16px; line-height: 1.5; }
.sched-list .t { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.sched-list .dash { width: 22px; height: 1px; background: var(--rule); align-self: center; }
.sched-list .e { text-align: left; color: var(--ink); }
.sched-list .e small { display: block; font-size: 13px; color: var(--ink-soft); }
.sched-note { margin-top: 26px; font: italic 400 16px/1.5 var(--serif); color: var(--ink-soft); }

/* ---------- one paper sheet: RSVP + calendar ---------- */
.sheet {
  max-width: 460px; margin: 72px auto 0; padding: 40px clamp(22px, 6vw, 40px) 42px;
  background: var(--cream-paper);
  box-shadow: 0 1px 1px rgba(55, 35, 25, .06), 0 18px 34px -26px rgba(55, 35, 25, .45);
}
@media (max-width: 680px) { .sheet { width: calc(100% - 28px); } }
.sheet > section + section::before { content: ""; display: block; width: 40px; height: 1px; margin: 0 auto 30px; background: var(--rule); }
.sheet > section { padding: 30px 0 0 !important; max-width: none; }
.sheet > section:first-child { padding-top: 0 !important; }

/* ---------- buttons: square, hairline, spaced capitals ---------- */
.btn {
  display: inline-block; padding: 13px 22px; border: 1px solid var(--ink); border-radius: 0;
  color: var(--ink); text-decoration: none; background: transparent; cursor: pointer;
  font: 500 11.5px/1.2 var(--sans); letter-spacing: .22em; text-transform: uppercase;
  transition: background .25s, color .25s;
}
.btn:hover, .btn:focus-visible { background: var(--ink); color: var(--paper); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover { background: #000; }
.btn.solid:disabled { opacity: .5; cursor: default; }
.d-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- add to calendar ---------- */
.calendar { padding: 72px 20px 0; text-align: center; }
.cal-lbl { color: var(--ink-soft); margin-bottom: 18px; }

/* ---------- RSVP ---------- */
.rsvp { max-width: 520px; margin: 0 auto; padding: 72px 20px 0; text-align: center; }
.rsvp h2 { font-size: 28px; letter-spacing: .2em; padding-left: .2em; }
.rsvp-sub { font: italic 400 15px/1.5 var(--serif); color: var(--ink-soft); margin-top: 6px; }
.rsvp form, .rsvp-done { margin-top: 22px; text-align: left; }
.rsvp label, .rsvp legend { font-size: 13px; color: var(--ink-soft); }
.rsvp-row { display: flex; gap: 8px; margin-top: 8px; }
.rsvp input[type="text"], .rsvp input[type="email"], .rsvp select, .rsvp textarea {
  width: 100%; margin-top: 6px; padding: 12px 2px; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  background: transparent; font: 400 16px var(--sans); color: var(--ink);
}
.rsvp textarea { border: 1px solid var(--rule); padding: 10px 12px; }
.rsvp-row input { margin-top: 0; }
.rsvp input:focus, .rsvp select:focus, .rsvp textarea:focus { outline: none; border-color: var(--ink); }
.rsvp-results { margin-top: 12px; display: grid; gap: 8px; }
.rsvp-results p { font-size: 14px; line-height: 1.6; color: var(--ink-soft); }
.rsvp-pick { text-align: left; padding: 12px 14px; border: 1px solid var(--rule); background: transparent; font: 16px var(--sans); color: var(--ink); cursor: pointer; }
.rsvp-pick:hover { border-color: var(--ink); }
.rsvp-hello { font: italic 400 21px/1.3 var(--serif); color: var(--ink); margin-bottom: 4px; }
.rsvp-allow { font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); margin-bottom: 12px; }
.rsvp-field { display: block; margin-bottom: 18px; }
.rsvp-field .opt { color: var(--ink-soft); font-style: italic; }
.rsvp-status { margin-top: 10px; font-size: 13px; color: var(--burg-ink); min-height: 1em; }
.rsvp-done { text-align: center; }
.rsvp-thanks { font: italic 400 17px/1.6 var(--serif); color: var(--ink); }
.rsvp-people { border: 0; padding: 0; margin: 0 0 6px; }
.rsvp-people legend { margin-bottom: 10px; }
.rsvp-person { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--rule); }
.rsvp-person .who { font-size: 16px; color: var(--ink); }
.pills { display: flex; gap: 6px; flex-shrink: 0; }
.pills input { position: absolute; opacity: 0; }
.pills span {
  display: inline-block; min-width: 64px; padding: 9px 14px; border: 1px solid var(--ink); text-align: center;
  color: var(--ink); cursor: pointer; transition: background .2s, color .2s;
  font: 500 11px/1.2 var(--sans); letter-spacing: .2em; text-transform: uppercase;
}
.pills input:checked + span { background: var(--ink); color: var(--paper); }
.pills input:focus-visible + span { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ---------- our journey ---------- */
.log {
  position: relative; max-width: 860px; margin: 88px auto 0; padding: 60px 20px 68px; text-align: center;
  background: var(--cream-paper);
  box-shadow: 0 1px 1px rgba(55, 35, 25, .06), 0 18px 34px -26px rgba(55, 35, 25, .45);
}
.log::before { content: ""; position: absolute; inset: 12px; border: 1px solid var(--rule); pointer-events: none; }
@media (max-width: 900px) { .log { margin: 72px 14px 0; padding: 48px 8px 56px; } }
.log-sub { font: italic 400 17px/1.5 var(--serif); color: var(--ink-soft); margin-top: 8px; }
.log-grid { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); row-gap: 70px; margin-top: 48px; }
.strands { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.strand { fill: none; stroke-width: 1.6; stroke-dasharray: .5 6; stroke-linecap: round; }
.strand.o { stroke: var(--blue-ink); } .strand.a { stroke: var(--burg-ink); }
.stop { position: relative; display: flex; flex-direction: column; align-items: center; align-self: start; }
.stamp {
  width: min(150px, 28vw); opacity: 0;
  transform: scale(1.2) rotate(var(--rot, 0deg)); transition: opacity .4s, transform .7s cubic-bezier(.2, 1.2, .4, 1);
}
.stop.seen .stamp { opacity: 1; transform: scale(1) rotate(var(--rot, 0deg)); }
.stamp-svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 5px 7px rgba(55, 35, 25, .14)) drop-shadow(0 1px 1px rgba(55, 35, 25, .12)); }
.st-place { font-family: var(--serif); font-size: 8.4px; letter-spacing: .6px; }
.postmark { color: #3b332e; opacity: .82; }
.pm-arc { font-family: var(--sans); font-weight: 500; font-size: 3.7px; letter-spacing: .9px; fill: currentColor; }
.pm-mid { font-family: var(--serif); font-size: 7px; fill: currentColor; }
.stop .cap {
  margin-top: 6px; max-width: 210px; padding: 2px 6px; font-size: 13.5px; line-height: 1.55; color: var(--ink-soft);
  opacity: 0; transition: opacity .6s .15s;
}
.stop.seen .cap { opacity: 1; }
.stop.big .stamp { width: min(176px, 34vw); }
/* Whose route is whose: the names sit above the first two stamps, in their route colour. */
.who-label { margin: 0 0 8px; font: italic 400 clamp(22px, 5vw, 28px)/1 var(--serif); }
.who-label.o { color: var(--blue-ink); }
.who-label.a { color: var(--burg-ink); }

/* ---------- gallery ---------- */
.gallery { max-width: 900px; margin: 0 auto; padding: 88px 16px 8px; text-align: center; }
.gallery h2 { margin-bottom: 34px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 26px 20px; align-items: start; }
.gal-item {
  display: block; width: 100%; margin: 0; padding: 8px 8px 12px; border: 0; cursor: zoom-in;
  background: var(--cream-paper); box-shadow: 0 16px 30px -22px rgba(55, 35, 25, .55), 0 1px 1px rgba(55, 35, 25, .08);
  transition: transform .4s, box-shadow .4s;
}
.gal-item:hover, .gal-item:focus-visible { transform: translateY(-3px); box-shadow: 0 22px 36px -24px rgba(55, 35, 25, .6), 0 1px 1px rgba(55, 35, 25, .08); }
.gal-item img { display: block; width: 100%; height: auto; }
.gal-item span { display: block; margin-top: 12px; font-size: 10.5px; color: var(--ink-soft); }
.gal-item.wide { grid-column: 1 / -1; justify-self: center; width: auto; max-width: 100%; }
.gal-item.wide img { width: auto; max-width: 100%; max-height: 80svh; margin: 0 auto; }
.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(30, 24, 20, .9); padding: 16px; }
.lightbox[hidden] { display: none; }
.lightbox figure { max-width: min(1100px, 100%); text-align: center; }
.lightbox img { max-width: 100%; max-height: 82svh; display: block; margin: 0 auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.lightbox figcaption { margin-top: 16px; color: #efe6dc; }
.lb-btn { position: absolute; border: 0; background: none; color: #efe6dc; font-size: 40px; line-height: 1; padding: 10px 14px; cursor: pointer; }
.lb-close { top: 8px; right: 10px; }
.lb-prev { left: 4px; top: 50%; translate: 0 -50%; }
.lb-next { right: 4px; top: 50%; translate: 0 -50%; }

/* ---------- footer ---------- */
.foot { text-align: center; padding: 56px 16px 80px; color: var(--ink); }
.foot img { display: block; margin: 0 auto 18px; width: 72px; height: auto; }
.foot .replay { margin-top: 0; }
.replay {
  margin-top: 18px; border: 0; background: none; color: var(--ink-soft); cursor: pointer;
  font: 500 11px/1.4 var(--sans); letter-spacing: .22em; text-transform: uppercase;
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 5px;
}

@media (max-width: 520px) {
  .stop .cap { font-size: 12px; }
  .stamp { width: 25vw; }
  .stop.big .stamp { width: 31vw; }
  .who-label { font-size: 21px; }
  .log-grid { margin-left: 6px; margin-right: 6px; }
  .log-grid { row-gap: 52px; }
  .schedule { padding-left: 18px; padding-right: 18px; }
  .sched-list li { grid-template-columns: 70px 14px 1fr; gap: 10px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
