/* Housewarming invitation — Joseph & Ambily
   Colours: ivory, beige, olive, charcoal, champagne gold
   Fonts: Bodoni Moda (headings), Jost (body) */

:root {
  --ivory: #f6f1e7;
  --beige: #e7dccb;
  --olive: #3a4130;
  --olive-dark: #262b1f;
  --charcoal: #22221f;
  --gold: #c3a46b;
  --gold-light: #dcc697;
  --muted: #5d5a50;

  --serif: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --sans: Jost, "Futura", "Century Gothic", system-ui, sans-serif;
  --ease: cubic-bezier(.22, .7, .16, 1);
}

* { box-sizing: border-box; min-width: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ivory); color: var(--charcoal); font: 300 17px/1.7 var(--sans); overflow-x: clip; }
body.locked { overflow: hidden; height: 100svh; }
img { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.05; text-wrap: balance; }
h2 { font-size: clamp(32px, 5vw, 54px); letter-spacing: -.01em; }
h3 { font-size: clamp(24px, 3vw, 30px); }
p { margin: 0 0 1em; }

.band { position: relative; padding: clamp(72px, 11vw, 150px) max(6vw, 20px); }
.wrap { max-width: 1120px; margin: 0 auto; }
.narrow { max-width: 620px; margin: 0 auto; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.eyebrow { font: 400 12px/1.4 var(--sans); letter-spacing: .32em; text-transform: uppercase; color: var(--gold); margin: 0 0 18px; }
.lead { font: 400 clamp(19px, 2.2vw, 23px)/1.6 var(--serif); }

.cross { display: block; width: 14px; height: 22px; margin: 0 auto 24px; fill: none; stroke: currentColor; stroke-width: 1.1; color: var(--gold-light); }

/* Buttons */
.btn {
  position: relative; overflow: hidden; z-index: 0;
  min-height: 52px; padding: 19px 34px; border-radius: 99px;
  border: 1px solid var(--gold-light); background: rgba(34, 34, 31, .3); color: var(--ivory);
  font: 400 13px/1 var(--sans); letter-spacing: .32em; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: color .5s;
}
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--gold-light); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.btn:hover, .btn:focus-visible { color: var(--olive-dark); }
.btn:hover::before, .btn:focus-visible::before { transform: scaleX(1); }

.pill {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border-radius: 99px; border: 1px solid rgba(220, 198, 151, .55);
  color: var(--ivory); text-decoration: none; font: 400 14px/1 var(--sans); letter-spacing: .04em;
  transition: background .4s, color .4s;
}
.pill:hover { background: var(--gold-light); color: var(--olive-dark); }

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

/* Loading screen */
#loader { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: var(--olive-dark); transition: opacity .9s var(--ease), visibility .9s; }
#loader.done { opacity: 0; visibility: hidden; }
.monogram { font: italic 400 40px/1 var(--serif); color: var(--gold-light); text-align: center; }
.monogram span { color: var(--ivory); opacity: .6; }
.monogram small { display: block; margin-top: 16px; font: 400 11px/1 var(--sans); letter-spacing: .4em; color: rgba(246, 241, 231, .6); }
.monogram .bar { width: 120px; height: 1px; margin: 20px auto 0; overflow: hidden; background: rgba(220, 198, 151, .25); }
.monogram .bar i { display: block; width: 40%; height: 100%; background: var(--gold-light); animation: loading 1.4s var(--ease) infinite; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* Front door */
#door { position: fixed; inset: 0; z-index: 60; perspective: 1800px; background: radial-gradient(60% 70% at 50% 55%, #fff6dc, #e9cf98 45%, #8a7246 100%); }
.leaf { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; transition: transform 1.9s var(--ease), filter 1.9s var(--ease); will-change: transform; }
.leaf.left { left: 0; transform-origin: left center; }
.leaf.right { right: 0; transform-origin: right center; }
.leaf-inner { position: absolute; top: 0; bottom: 0; width: 200%; }
.leaf.right .leaf-inner { left: -100%; }
.leaf img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 46%; animation: breathe 18s ease-in-out infinite alternate; }
@keyframes breathe { from { transform: scale(1.04); } to { transform: scale(1.12); } }
.leaf::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 22, 16, .35), rgba(20, 22, 16, .2) 28%, rgba(20, 22, 16, .62) 50%, rgba(20, 22, 16, .9) 72%, rgba(20, 22, 16, .94));
}
.seam {
  position: absolute; z-index: 2; left: 50%; top: 18%; bottom: 18%; width: 2px; transform: translateX(-50%);
  background: linear-gradient(transparent, #ffe9b8, transparent);
  box-shadow: 0 0 22px 6px rgba(255, 226, 160, .45);
  animation: glow 3.2s ease-in-out infinite;
}
@keyframes glow { 50% { opacity: .35; box-shadow: 0 0 12px 2px rgba(255, 226, 160, .25); } }

.door-text {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0 24px calc(11vh + env(safe-area-inset-bottom));
  text-align: center; color: var(--ivory);
  transition: opacity .7s var(--ease), transform .9s var(--ease);
}
.door-text .eyebrow { color: var(--gold-light); margin-bottom: 22px; }
.door-text h1 { font-size: clamp(44px, 9.4vw, 112px); letter-spacing: .05em; line-height: 1; text-shadow: 0 2px 24px rgba(0, 0, 0, .55); }
.door-text .sub { font: italic 400 clamp(20px, 3vw, 30px)/1.2 var(--serif); color: #f3e9d4; margin: 14px 0 40px; }
.door-text .eyebrow, .door-text .sub { text-shadow: 0 1px 12px rgba(0, 0, 0, .6); }

.door-text > * { opacity: 0; transform: translateY(18px); transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); }
body.ready .door-text > * { opacity: 1; transform: none; }
body.ready .door-text > :nth-child(2) { transition-delay: .25s; }
body.ready .door-text > :nth-child(3) { transition-delay: .55s; }
body.ready .door-text > :nth-child(4) { transition-delay: .85s; }

#door.open .door-text { opacity: 0; transform: scale(.96); }
#door.open .leaf.left { transform: rotateY(78deg) translateX(-6%); filter: brightness(.6); }
#door.open .leaf.right { transform: rotateY(-78deg) translateX(6%); filter: brightness(.6); }
#door.open .seam { opacity: 0; }
#door.gone { opacity: 0; transition: opacity 1s var(--ease) .1s; }

/* Scroll animations */
.fade { opacity: 0; transform: translateY(28px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.mask { clip-path: inset(0 0 100% 0); transform: translateY(16px); transition: clip-path 1.2s var(--ease), transform 1.2s var(--ease); }
.fade.visible { opacity: 1; transform: none; }
.mask.visible { clip-path: inset(0 0 -10% 0); transform: none; }
.delay-1 { transition-delay: .12s !important; }
.delay-2 { transition-delay: .24s !important; }
.delay-3 { transition-delay: .36s !important; }

/* Story */
.story { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(36px, 6vw, 90px); align-items: center; }
.story-text { margin-top: 28px; }
.arch { position: relative; }
.arch::before { content: ""; position: absolute; inset: -14px -14px 14px 14px; border: 1px solid var(--gold); border-radius: 999px 999px 3px 3px / 50vw 50vw 3px 3px; opacity: .55; }
.arch-photo {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden;
  border-radius: 999px 999px 3px 3px / 50vw 50vw 3px 3px;
  box-shadow: 0 30px 60px -30px rgba(34, 34, 31, .45);
  opacity: 0; transform: translateY(30px) scale(.97);
  transition: opacity 1.4s var(--ease), transform 1.6s var(--ease);
}
.arch-photo.visible { opacity: 1; transform: none; }
.arch-photo img { position: absolute; left: 0; right: 0; top: -8%; width: 100%; height: 116%; object-fit: cover; }

/* Verse */
.verse { text-align: center; padding-block: clamp(64px, 9vw, 120px); }
.verse .cross { color: var(--gold); margin-bottom: 28px; }
.verse blockquote { max-width: 720px; margin: 0 auto; }
.verse p { margin: 0; font: italic 400 clamp(24px, 3.6vw, 40px)/1.3 var(--serif); color: var(--olive-dark); }
.verse cite { display: block; margin-top: 22px; font: 400 12px/1 var(--sans); font-style: normal; letter-spacing: .32em; color: var(--gold); }

/* Invitation */
.invite { background: var(--olive); color: var(--ivory); }
.invite .eyebrow { color: var(--gold-light); }
.invite h2 { font-size: clamp(30px, 5.6vw, 66px); letter-spacing: .06em; }
.tagline { margin: 18px 0 0; font: italic 400 clamp(18px, 2.3vw, 23px)/1.45 var(--serif); color: var(--gold-light); }
.intro { max-width: 560px; margin: 22px auto 0; color: rgba(246, 241, 231, .85); }

.divider { display: flex; align-items: center; justify-content: center; gap: 14px; max-width: 260px; margin: 34px auto; color: var(--gold); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .55; }
.divider svg { width: 14px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.2; }

.date { margin: 54px auto 10px; }
.date .day { font: 400 13px/1 var(--sans); letter-spacing: .4em; color: var(--gold-light); }
.date .num { margin: 10px 0 4px; font: 400 clamp(64px, 12vw, 128px)/1 var(--serif); }
.date .month { font: 400 clamp(14px, 1.8vw, 16px)/1 var(--sans); letter-spacing: .4em; }
.countdown { margin-top: 18px; font-size: 14px; color: rgba(246, 241, 231, .72); }

.events { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 56px; }
.event { padding: clamp(26px, 4vw, 40px); border: 1px solid rgba(220, 198, 151, .35); border-radius: 3px; background: rgba(38, 43, 31, .35); }
.event .label { margin-bottom: 16px; font: 400 11px/1.4 var(--sans); letter-spacing: .3em; color: var(--gold-light); }
.event h3 { margin-bottom: 22px; }
.row { display: flex; align-items: flex-start; gap: 14px; margin: 12px 0; }
.row svg { width: 20px; height: 20px; flex: none; margin-top: 3px; fill: none; stroke: var(--gold-light); stroke-width: 1.5; }
.row strong { font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
.event .note { margin: 16px 0 0; font-size: 15px; color: rgba(246, 241, 231, .75); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.hosts { margin-top: 70px; text-align: center; }
.hosts .names { font: italic 400 clamp(34px, 5vw, 54px)/1.1 var(--serif); }
.hosts p { max-width: 520px; margin: 16px auto 0; color: rgba(246, 241, 231, .8); }

/* Gallery */
.gallery { padding-inline: 0; background: var(--charcoal); color: var(--ivory); }
.gallery .eyebrow { color: var(--gold-light); }
.gallery-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 20px; max-width: 1220px; margin: 0 auto 40px; padding: 0 max(6vw, 20px); }
.arrows { display: flex; gap: 10px; }
.arrows button { width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(220, 198, 151, .5); background: none; color: var(--ivory); font-size: 18px; cursor: pointer; }
.arrows button:hover { background: var(--gold-light); color: var(--charcoal); }
.reel { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 max(6vw, 20px) 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.reel::-webkit-scrollbar { display: none; }
.shot { position: relative; flex: 0 0 min(84vw, 600px); aspect-ratio: 4 / 3; margin: 0; overflow: hidden; border-radius: 2px; scroll-snap-align: center; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 6s ease-out; }
.shot.visible img { transform: scale(1.08); }
.shot figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 20px 18px;
  background: linear-gradient(transparent, rgba(20, 20, 18, .88));
  font: italic 400 20px/1.2 var(--serif); text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}

/* Full-bleed photo sections */
.welcome, .closing { overflow: hidden; color: var(--ivory); }
.bg { position: absolute; left: 0; right: 0; top: -12%; width: 100%; height: 124%; object-fit: cover; }

.welcome { display: grid; place-items: center; min-height: 92svh; text-align: center; }
.welcome::before { content: ""; position: absolute; inset: 0; z-index: 1; background: radial-gradient(90% 70% at 50% 50%, rgba(20, 22, 16, .82), rgba(20, 22, 16, .7)); }
.welcome blockquote { position: relative; z-index: 2; max-width: 760px; margin: 0; }
.welcome blockquote p { font: 400 clamp(24px, 3.8vw, 42px)/1.35 var(--serif); text-shadow: 0 1px 16px rgba(0, 0, 0, .5); }
.welcome .accent { margin-top: 28px; font-style: italic; color: var(--gold-light); }
.welcome .cross, .closing .cross { width: 16px; height: 26px; filter: drop-shadow(0 0 6px rgba(0, 0, 0, .5)); }

/* RSVP */
.rsvp { background: var(--beige); }
.rsvp-intro { max-width: 480px; margin: 16px auto 40px; text-align: center; color: var(--muted); }
.rsvp-options { display: grid; gap: 14px; }
.option {
  display: grid; gap: 6px; padding: 22px 20px; text-align: center; text-decoration: none;
  border: 1px solid rgba(58, 65, 48, .35); border-radius: 3px; background: var(--ivory); color: var(--olive-dark);
  transition: transform .4s var(--ease);
}
.option:hover { transform: translateY(-2px); }
.option .title { font: 400 clamp(22px, 2.8vw, 26px)/1.15 var(--serif); }
.option .hint { font-size: 14px; color: var(--muted); }
.option.yes { background: var(--olive); border-color: var(--olive); color: var(--ivory); }
.option.yes .hint { color: rgba(246, 241, 231, .75); }
.small { margin: 10px 0 0; font-size: 13px; line-height: 1.7; text-align: center; color: var(--muted); }

/* Closing */
.closing { display: flex; align-items: flex-end; min-height: 100svh; padding-bottom: calc(clamp(60px, 10vw, 120px) + env(safe-area-inset-bottom)); }
.closing::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(rgba(20, 22, 16, .3), rgba(20, 22, 16, .55) 35%, rgba(20, 22, 16, .88) 60%, rgba(20, 22, 16, .95)); }
.closing .wrap { position: relative; z-index: 2; width: 100%; text-align: center; text-shadow: 0 1px 14px rgba(0, 0, 0, .5); }
.closing h2 { font-size: clamp(36px, 6.4vw, 80px); letter-spacing: .05em; }
.closing .sub { margin: 18px 0 36px; font: italic 400 clamp(20px, 2.7vw, 28px)/1.3 var(--serif); color: var(--gold-light); }
.blessing { margin: 0 0 22px; font: italic 400 18px/1.4 var(--serif); color: var(--gold-light); }
.signoff { font-size: 12px; letter-spacing: .4em; color: rgba(246, 241, 231, .85); }
.signoff em { display: block; margin-top: 12px; font: italic 400 clamp(26px, 3.4vw, 36px)/1.2 var(--serif); letter-spacing: 0; color: var(--ivory); }
.signoff em.kids { font-size: clamp(22px, 2.6vw, 28px); color: var(--gold-light); }
.closing .actions { justify-content: center; margin-top: 36px; }
.closing .pill { border-color: rgba(220, 198, 151, .6); }

/* Music button */
#music {
  position: fixed; z-index: 40; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px 0 14px;
  border-radius: 99px; border: 1px solid rgba(220, 198, 151, .6); background: rgba(38, 43, 31, .85); color: var(--ivory);
  font: 400 13px/1 var(--sans); letter-spacing: .04em; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: .6s var(--ease);
}
#music.show { opacity: 1; pointer-events: auto; transform: none; }
#music .eq { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
#music .eq i { width: 2px; height: 4px; background: var(--gold-light); }
#music.on .eq i { animation: eq 1.2s ease-in-out infinite; }
#music.on .eq i:nth-child(2) { animation-delay: .2s; }
#music.on .eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 50% { height: 14px; } }

/* Mobile */
@media (max-width: 760px) {
  .story { grid-template-columns: 1fr; }
  .arch { margin: 0 10px; }
  .arch-photo { aspect-ratio: 4 / 4.6; }
  .arch-photo, .arch::before { border-radius: 999px 999px 3px 3px / 45vw 45vw 3px 3px; }
  .arch::before { inset: -10px -10px 10px 10px; }
  .events { grid-template-columns: 1fr; }
  .door-text { padding-bottom: calc(14vh + env(safe-area-inset-bottom)); }
  .door-text .eyebrow span { display: block; line-height: 2; }
  .door-text .eyebrow .dot { display: none; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .fade, .mask, .arch-photo { opacity: 1; transform: none; clip-path: none; }
  #door.open .leaf { transform: none; }
}
