/* Palettes: sage is the default; preview others with ?palette=navy|blush|noir */
:root {
  --paper: #f6f6f1;
  --intro-bg: #2b362e; --card: #fcfcf8; --linen: #e2e6dc;
  --ink: #2e3b32; --ink-rgb: 46 59 50; --ink-soft: #4f5e53; --muted: #84908a;
  --gold: #a8915f; --gold-rgb: 168 145 95;
  --shade: 45 62 50;
  --map-filter: saturate(0.75);
}
:root[data-palette="navy"] {
  --intro-bg: #151c2c;
  --paper: #f7f6f2; --card: #fdfcf9; --linen: #e1e3e8;
  --ink: #1f2b45; --ink-rgb: 31 43 69; --ink-soft: #3f4a63; --muted: #7d859a;
  --gold: #b0915a; --gold-rgb: 176 145 90;
  --shade: 28 38 62;
  --map-filter: saturate(0.75);
}
:root[data-palette="blush"] {
  --intro-bg: #46333a;
  --paper: #fbf7f5; --card: #fffdfc; --linen: #eee4e1;
  --ink: #3b3436; --ink-rgb: 59 52 54; --ink-soft: #5d5355; --muted: #998c8e;
  --gold: #bf918c; --gold-rgb: 191 145 140;
  --shade: 90 62 62;
  --map-filter: saturate(0.75);
}
:root[data-palette="noir"] {
  --intro-bg: #1b1b1c;
  --paper: #f9f8f5; --card: #fefdfb; --linen: #e6e4df;
  --ink: #1e1e1e; --ink-rgb: 30 30 30; --ink-soft: #464646; --muted: #8a8884;
  --gold: #b0976a; --gold-rgb: 176 151 106;
  --shade: 30 30 30;
  --map-filter: grayscale(0.35);
}

:root {
  --line: rgb(var(--gold-rgb) / 0.42);

  --hebrew: "Frank Ruhl Libre", "Cormorant Garamond", Georgia, serif;
  --serif: "Cormorant Garamond", "Frank Ruhl Libre", Georgia, serif;
  --script: "Pinyon Script", cursive;

  --ornament: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 16'%3E%3Cg fill='none' stroke='%23b08c58' stroke-width='.8'%3E%3Cpath d='M4 8h58M98 8h58'/%3E%3Cpath d='M80 2.5l5.5 5.5-5.5 5.5-5.5-5.5z'/%3E%3Cpath d='M68 8c3-3.2 6-3.2 7.5 0M92 8c-3-3.2-6-3.2-7.5 0'/%3E%3C/g%3E%3Cg fill='%23b08c58'%3E%3Ccircle cx='80' cy='8' r='1.3'/%3E%3Ccircle cx='3' cy='8' r='1'/%3E%3Ccircle cx='157' cy='8' r='1'/%3E%3C/g%3E%3C/svg%3E");
  --grain: 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='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .4 0 0 0 0 .4 0 0 0 .45 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
.invite, .footer { overflow-x: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--hebrew);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.65;
  font-variant-numeric: lining-nums;
  overflow-x: hidden;
}
body::before { /* paper grain */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: var(--grain); opacity: 0.16; mix-blend-mode: multiply;
}
body.sealed { overflow: hidden; height: 100svh; }

.sep { color: var(--gold); padding: 0 0.35em; }
.muted { color: var(--muted); }
.sprig { position: absolute; pointer-events: none; user-select: none; }

/* ================= Envelope intro ================= */
.intro {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(28px, 6svh, 56px);
  overflow: hidden;
}
.intro-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 45% at 50% 42%, rgba(255, 255, 255, 0.07), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 45%, rgba(0, 0, 0, 0.5)),
    url("/env/linen.jpg") center / 256px repeat,
    var(--intro-bg);
  background-blend-mode: normal, normal, soft-light, normal;
}

.stage { position: relative; will-change: transform; }

.env {
  --w: min(76vw, 340px, calc(62svh / 1.4));
  position: relative;
  width: var(--w); height: calc(var(--w) * 1.4);
  perspective: calc(var(--w) * 5);
  perspective-origin: 50% 30%;
}
.env > * { position: absolute; }
.env img { display: block; user-select: none; -webkit-user-drag: none; }

.env-shadow {
  inset: 0; border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 10px 22px -6px rgba(0, 0, 0, 0.45),
    0 34px 70px -18px rgba(0, 0, 0, 0.6);
}
.env-back { inset: 0; width: 100%; height: 100%; border-radius: 4px; z-index: 1; }
.env-pocket { inset: 0; width: 100%; height: 100%; z-index: 3; }
.env-flap-shadow { left: 0; top: 0; width: 100%; height: auto; z-index: 4; }

.env-flap {
  left: 0; top: 0; width: 100%; height: 58%;
  z-index: 5;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
}
.flap-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flap-face > img { width: 100%; height: 100%; }
.flap-back { transform: rotateX(180deg); }

.seal {
  position: absolute; left: 32%; top: 72.14%; width: 36%; aspect-ratio: 1;
  margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.seal img { width: 100%; height: 100%; }
.seal:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.7); outline-offset: -14%; }

/* the invitation card inside */
.card {
  left: 4%; width: 92%; top: 2.5%; height: 90%;
  z-index: 2;
  background: url("/env/paper.jpg") center / 340px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16), 0 10px 24px -10px rgba(0, 0, 0, 0.35);
}
.card::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgb(var(--gold-rgb) / 0.55); pointer-events: none; }
.card::after { content: ""; position: absolute; inset: 13px; border: 1px solid rgb(var(--gold-rgb) / 0.3); pointer-events: none; }
.card-body {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 13%;
  text-align: center; color: var(--ink);
}
.card-body p { margin: 0; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75); }
.card-kicker { font-size: calc(var(--w) * 0.038); letter-spacing: 0.22em; color: var(--muted); }
.card-names { margin-top: 4% !important; font-weight: 300; font-size: calc(var(--w) * 0.16); line-height: 1.05; }
.card-names .amp { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 0.62em; }
.card-rule {
  width: 34%; height: calc(var(--w) * 0.03); margin: 5% 0 4%;
  background: var(--gold);
  -webkit-mask: var(--ornament) center / contain no-repeat; mask: var(--ornament) center / contain no-repeat;
}
.card-date { font-family: var(--serif); font-size: calc(var(--w) * 0.058); letter-spacing: 0.2em; direction: ltr; }
.card-place { margin-top: 2% !important; font-size: calc(var(--w) * 0.044); color: var(--ink-soft); }
.card-mono { position: absolute; bottom: 8%; font-family: var(--script); font-size: calc(var(--w) * 0.1); color: var(--gold); direction: ltr; text-shadow: none !important; }
.card-shade { /* the card is in the envelope's shadow until it rises */
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0.32) 60%);
}

.intro-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px; letter-spacing: 0.14em;
}

/* before the assets are ready, and the entrance */
.intro.loading .stage, .intro.loading .intro-hint { opacity: 0; }

/* ================= Music button ================= */
.music-btn {
  position: fixed; z-index: 40;
  left: 16px; bottom: calc(18px + env(safe-area-inset-bottom));
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 6px 16px rgb(var(--shade) / 0.14);
  animation: fade-in 1s ease both 3.6s;
}
.music-btn svg { width: 20px; height: 20px; fill: currentColor; }
.music-btn .icon-off { display: none; }
.music-btn[aria-pressed="false"] .icon-on { display: none; }
.music-btn[aria-pressed="false"] .icon-off { display: block; }
.music-btn[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  border: 1px solid var(--gold); opacity: 0;
  animation: ring 2.6s ease-out infinite;
}
@keyframes ring { from { transform: scale(1); opacity: 0.6; } to { transform: scale(1.55); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ================= Layout & type ================= */
.invite { position: relative; z-index: 1; max-width: 540px; margin: 0 auto; padding: 0 20px; }
.section { padding: 64px 0 12px; text-align: center; }

.eyebrow { margin: 0; font-family: var(--script); font-size: 32px; line-height: 1.2; color: var(--gold); direction: ltr; }
.title { margin: 0; font-weight: 400; font-size: clamp(34px, 9.5vw, 42px); line-height: 1.25; color: var(--ink); }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 18px; }
.ornament { width: 150px; height: 16px; margin: 18px auto 24px; background: var(--gold); -webkit-mask: var(--ornament) center / contain no-repeat; mask: var(--ornament) center / contain no-repeat; }

.frame {
  position: relative;
  padding: 36px 22px 32px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgb(var(--shade) / 0.08);
}
.frame::before { content: ""; position: absolute; inset: 7px; border: 1px solid var(--line); pointer-events: none; }

.reveal { opacity: 0; transform: translateY(14px); filter: blur(4px); transition: opacity 1.1s ease, transform 1.1s ease, filter 1.1s ease; }
.reveal.in { opacity: 1; transform: none; filter: none; }

/* ================= Hero ================= */
.hero {
  position: relative;
  min-height: 100svh;
  padding: calc(64px + env(safe-area-inset-top)) 0 36px;
  text-align: center;
}
.hero-sprig-r { top: -18px; right: -34px; width: min(44vw, 220px); transform: scale(-1, -1); opacity: 0; transition: opacity 1.6s ease 0.2s; }
.hero-sprig-l { top: -18px; left: -34px; width: min(40vw, 200px); transform: scaleY(-1); opacity: 0; transition: opacity 1.6s ease 0.4s; }
.bsd { position: absolute; top: calc(18px + env(safe-area-inset-top)); right: 0; font-size: 14px; color: var(--muted); opacity: 0; transition: opacity 1s ease 0.6s; }

.kicker {
  position: relative; margin: 0; color: var(--ink-soft);
  font-size: 17px; line-height: 1.85;
  opacity: 0; filter: blur(4px); transition: opacity 1.2s ease 0.4s, filter 1.2s ease 0.4s;
}
.names {
  position: relative;
  margin: 10px 0 0;
  font-weight: 300; font-size: clamp(76px, 23vw, 118px); line-height: 1.05;
  color: var(--ink);
  opacity: 0; transform: translateY(10px);
  transition: opacity 1.4s ease 1s, transform 1.4s ease 1s;
}
.names .amp { font-family: var(--serif); font-style: italic; font-weight: 300; color: var(--gold); font-size: 0.62em; padding: 0 0.04em; }
.hero-date {
  margin: 6px 0 30px; color: var(--muted); font-size: 17px;
  opacity: 0; transition: opacity 1.2s ease 1.6s;
}

body.opened .hero-sprig-r, body.opened .hero-sprig-l { opacity: 0.9; }
body.opened .bsd, body.opened .kicker, body.opened .hero-date { opacity: 1; filter: none; }
body.opened .names { opacity: 1; transform: none; }

/* photo booth */
.booth { position: relative; display: flex; flex-direction: column; align-items: center; }
.slot {
  position: relative; z-index: 2;
  width: min(84%, 330px); height: 15px; border-radius: 9px;
  background: linear-gradient(180deg, #f7ead0 0%, #c9a66d 42%, #ecd6ab 62%, #a5824e 100%);
  box-shadow: 0 3px 8px rgb(var(--shade) / 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  opacity: 0; transform: scaleX(0.6);
  transition: opacity 0.9s ease 2s, transform 1s cubic-bezier(.2, .8, .2, 1) 2s;
}
.slot::after {
  content: ""; position: absolute; left: 7%; right: 7%; top: 5.5px; height: 4px; border-radius: 3px;
  background: linear-gradient(180deg, #1d1a17, #4a443d);
}
body.opened .slot { opacity: 1; transform: none; }

.strip-window {
  position: relative; z-index: 1;
  margin-top: -7.5px;
  width: min(54%, 212px);
  overflow: hidden;
  padding: 0 12px 26px;
}
.strip {
  margin: 0;
  background: #fffdf9;
  padding: 9px 9px 0;
  box-shadow: 0 0 0 rgb(var(--shade) / 0);
  transform: translateY(-101%);
  transition: transform 5.5s cubic-bezier(.35, .1, .25, 1) 2.8s, box-shadow 1.2s ease 3.2s;
}
body.opened .strip { transform: none; box-shadow: 0 10px 22px rgb(var(--shade) / 0.22), 0 1px 3px rgb(var(--shade) / 0.15); }
.frames { display: grid; gap: 7px; }
.frames img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--linen); }
.strip-date { padding: 9px 0 10px; color: var(--ink-soft); font-family: var(--serif); font-size: 16px; letter-spacing: 0.14em; direction: ltr; }

.hero-venue {
  margin: 8px 0 0; color: var(--ink-soft); font-size: 17px; letter-spacing: 0.08em;
  opacity: 0; transition: opacity 1.2s ease 7.6s;
}
body.opened .hero-venue { opacity: 1; }

.scroll-cue {
  width: 22px; height: 36px; margin: 24px auto 0;
  border: 1px solid var(--line); border-radius: 12px;
  opacity: 0; transition: opacity 1s ease 8.4s;
}
.scroll-cue span { display: block; width: 3px; height: 7px; margin: 7px auto 0; border-radius: 2px; background: var(--gold); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }
body.opened .scroll-cue { opacity: 1; }

/* ================= Countdown ================= */
.clock { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 380px; margin: 0 auto; }
.unit { display: flex; flex-direction: column; align-items: center; padding: 0 4px; }
.unit + .unit { border-inline-start: 1px solid var(--line); }
.num { font-family: var(--serif); font-weight: 300; font-size: clamp(42px, 12vw, 54px); line-height: 1.05; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.lbl { margin-top: 4px; font-size: 15px; color: var(--muted); }
.clock-done { margin: 0; font-size: 26px; color: var(--ink); }

/* ================= Venue ================= */
.address { margin: 2px 0 0; font-size: 19px; color: var(--ink-soft); }
.when { margin: 0 0 22px; font-size: 18px; line-height: 1.7; }
.map { padding: 6px; background: #fff; box-shadow: 0 6px 18px rgb(var(--shade) / 0.12); }
.map iframe { display: block; width: 100%; height: 260px; border: 0; filter: var(--map-filter); }

.buttons { display: grid; gap: 10px; max-width: 300px; margin: 24px auto 0; }
.btn {
  display: block; padding: 12px 18px;
  border: 1px solid rgb(var(--ink-rgb) / 0.55); border-radius: 0;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 17px; font-weight: 400; letter-spacing: 0.04em;
  text-decoration: none; cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.btn:hover, .btn:focus-visible { background: var(--ink); border-color: var(--ink); color: var(--card); outline: none; }

/* ================= Schedule ================= */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; flex-direction: column; align-items: center; }
.timeline li + li::before {
  content: ""; display: block; width: 1px; height: 44px; margin: 14px auto 12px;
  background: linear-gradient(transparent, var(--gold), transparent);
}
.time { font-family: var(--serif); font-weight: 300; font-size: 46px; line-height: 1.05; color: var(--ink); }
.event { font-size: 21px; color: var(--ink-soft); }

/* ================= Families ================= */
.parents { display: grid; grid-template-columns: 1fr 1fr; }
.parents > div + div { border-inline-start: 1px solid var(--line); }
.parents-label { margin: 0; font-size: 15px; color: var(--muted); }
.parents-names { margin: 6px 0 0; font-size: 20px; line-height: 1.55; color: var(--ink); }

/* ================= Footer ================= */
.footer { position: relative; padding: 70px 0 calc(96px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); }
.footer p { margin: 0; }
.footer-sprig { position: relative; display: block; width: 120px; margin: 0 auto -18px; transform: rotate(-30deg); opacity: 0.85; }
.monogram { font-family: var(--script); font-size: 46px; line-height: 1.5; color: var(--gold); direction: ltr; }

@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; filter: none; transform: none; opacity: 1; }
  .strip { transition-duration: 0.01s; transition-delay: 0s; }
}
