:root {
  --cream: #f7f2e9;
  --paper: #fffaf2;
  --ink: #2b2420;
  --muted: #756b63;
  --wine: #852f2c;
  --wine-dark: #64211f;
  --gold: #c0a164;
  --line: rgba(43, 36, 32, .14);
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Manrope", system-ui, sans-serif;
  --script: "Allura", cursive;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
html { background: #1f1916; }
body { margin: 0; overflow: hidden; color: var(--ink); background: var(--cream); font-family: var(--body); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.experience { height: 100svh; min-height: 620px; display: grid; grid-template-rows: minmax(255px, 40svh) minmax(0, 1fr); overflow: hidden; background: var(--cream); }

/* Photo stage */
.visual-stage { position: relative; min-height: 0; overflow: hidden; isolation: isolate; color: #fff; background: #362b26; }
.photo-stack, .hero-photo, .stage-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-photo { z-index: -3; object-fit: cover; object-position: 50% 42%; opacity: 0; transform: scale(1.025); transition: opacity .65s ease, transform 1.2s var(--ease); }
.hero-photo.is-active { opacity: 1; transform: scale(1); }
.hero-photo[data-photo="1"] { object-position: 50% 46%; }
.hero-photo[data-photo="2"] { object-position: 50% 45%; }
.hero-photo[data-photo="3"] { object-position: 50% 38%; }
.hero-photo[data-photo="4"] { object-position: 50% 38%; }
.hero-photo[data-photo="5"] { object-position: 50% 35%; }
.stage-shade { z-index: -1; background: linear-gradient(180deg, rgba(24,19,16,.34), rgba(24,19,16,.03) 43%, rgba(24,19,16,.66)); pointer-events: none; }
.topbar { position: absolute; z-index: 3; inset: max(14px, env(safe-area-inset-top)) 16px auto; display: flex; align-items: start; justify-content: space-between; }
.side-badge { display: grid; gap: 2px; padding: 8px 11px; border-left: 2px solid var(--gold); background: rgba(22,17,14,.25); backdrop-filter: blur(8px); text-transform: uppercase; }
.side-badge span { font-size: 8px; letter-spacing: .22em; }
.side-badge strong { font: 500 13px/1 var(--display); letter-spacing: .08em; }
.icon-button, .photo-arrow { display: grid; place-items: center; color: #fff; border: 1px solid rgba(255,255,255,.48); border-radius: 999px; background: rgba(28,22,19,.3); backdrop-filter: blur(8px); cursor: pointer; }
.icon-button { width: 42px; height: 42px; font-size: 19px; }
.music-button[aria-pressed="true"] { color: var(--ink); border-color: var(--gold); background: var(--gold); }
.music-button[aria-pressed="true"] span { animation: music 1.2s ease-in-out infinite alternate; }
.hero-signature { position: absolute; z-index: 2; left: 50%; bottom: 28px; width: calc(100% - 120px); transform: translateX(-50%); text-align: center; text-shadow: 0 2px 20px rgba(0,0,0,.3); }
.hero-signature > p:first-child { margin: 0 0 3px; font: 600 8px/1 var(--body); letter-spacing: .3em; text-transform: uppercase; }
h1 { margin: 0; font: 400 clamp(36px, 11vw, 52px)/.72 var(--script); }
h1 span { display: inline; white-space: nowrap; }
h1 i { display: inline-block; margin: 0 8px; color: var(--gold); font: italic 400 .48em/1 var(--display); }
.hero-date { margin: 13px 0 0; font: 500 11px/1 var(--display); letter-spacing: .32em; }
.photo-controls { position: absolute; z-index: 3; right: 13px; bottom: 16px; display: flex; align-items: center; gap: 6px; }
.photo-controls p { margin: 0 2px; font: 600 8px/1 var(--body); letter-spacing: .08em; }
.photo-arrow { width: 30px; height: 30px; font-size: 13px; }

/* Interactive folio */
.folio { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) 68px; overflow: hidden; background: radial-gradient(circle at 100% 0, rgba(192,161,100,.1), transparent 44%), var(--paper); }
.folio-heading { padding: 19px 22px 10px; text-align: center; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 3px; color: var(--wine); font: 600 8px/1.2 var(--body); letter-spacing: .22em; text-transform: uppercase; }
h2 { margin: 0; font: 500 clamp(28px, 8vw, 42px)/.94 var(--display); letter-spacing: -.03em; }
.folio-subtitle { margin: 6px 0 0; color: var(--muted); font: italic 400 13px/1.25 var(--display); }
.panels { min-height: 0; overflow: hidden; }
.panel { height: 100%; padding: 15px 22px 13px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--gold) transparent; animation: panelIn .35s var(--ease); }
.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-thumb { background: var(--gold); }

.couple-lockup { display: grid; grid-template-columns: 1fr 20px 1fr; align-items: center; text-align: center; }
.couple-lockup div { min-width: 0; }
.couple-lockup small, .quick-event span, .label { display: block; color: var(--muted); font: 600 8px/1.2 var(--body); letter-spacing: .16em; text-transform: uppercase; }
.couple-lockup strong { display: block; margin-top: 5px; color: var(--wine); font: 500 19px/1 var(--display); }
.couple-lockup > span { color: var(--gold); font-size: 9px; }
.quick-event { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 16px; max-width: 380px; margin: 14px auto 0; padding: 12px 0; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); }
.quick-event > div { text-align: center; }
.quick-event > div strong { display: block; color: var(--wine); font: 500 52px/.78 var(--display); }
.quick-event > div span:last-child { margin-top: 7px; }
.quick-event > p { margin: 0; text-align: left; }
.quick-event > p span { margin-bottom: 3px; color: var(--wine); font: 600 20px/1 var(--display); letter-spacing: 0; }
.quick-event > p strong { display: block; font: 600 13px/1.25 var(--display); text-transform: uppercase; }
.quick-event > p small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.25; }
.warm-note { max-width: 36ch; margin: 11px auto 0; color: var(--muted); text-align: center; font: italic 400 13px/1.35 var(--display); }

.event-card { display: grid; grid-template-columns: 104px 1fr; gap: 18px; align-items: center; max-width: 400px; margin: 0 auto; }
.date-seal { padding: 12px 4px; display: grid; text-align: center; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); }
.date-seal span { color: var(--muted); font-size: 8px; letter-spacing: .11em; text-transform: uppercase; }
.date-seal strong { color: var(--wine); font: 500 55px/.78 var(--display); }
.event-copy { min-width: 0; }
.event-copy h3 { margin: 3px 0; color: var(--wine); font: 500 33px/.9 var(--display); }
.event-copy p { margin: 5px 0; color: var(--muted); font: 400 11px/1.35 var(--body); }
.event-copy p strong { color: var(--ink); font: 600 13px/1.25 var(--display); }
.countdown { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; max-width: 390px; margin: 13px auto; }
.countdown div { padding: 7px; text-align: center; border: 1px solid var(--line); background: rgba(192,161,100,.06); }
.countdown strong { display: block; color: var(--wine); font: 500 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.countdown span { display: block; margin-top: 2px; color: var(--muted); font-size: 7px; letter-spacing: .1em; text-transform: uppercase; }
.primary-action { width: 100%; min-height: 42px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: #fff; border: 0; border-radius: 2px; background: var(--wine); cursor: pointer; text-decoration: none; font: 600 10px/1 var(--body); letter-spacing: .09em; text-transform: uppercase; }
.primary-action:hover { background: var(--wine-dark); }

.gift-panel { display: grid; align-content: center; }
.gift-note { max-width: 34ch; margin: 0 auto 10px; color: var(--muted); text-align: center; font: italic 400 12px/1.35 var(--display); }
.gift-card { width: min(100%, 390px); margin: 0 auto; padding: 11px; display: grid; grid-template-columns: minmax(115px, .9fr) minmax(130px, 1.1fr); gap: 13px; align-items: center; border: 1px solid rgba(133,47,44,.22); background: rgba(133,47,44,.035); }
.qr-preview { position: relative; min-width: 0; padding: 0; overflow: hidden; border: 0; border-radius: 4px; background: #fff; cursor: zoom-in; }
.qr-preview img { width: 100%; aspect-ratio: .87; display: block; object-fit: cover; }
.qr-preview span { position: absolute; inset: auto 4px 4px; padding: 4px; color: #fff; border-radius: 2px; background: rgba(31,25,22,.72); font-size: 7px; letter-spacing: .05em; text-transform: uppercase; }
.gift-details { min-width: 0; text-align: left; }
.gift-details small { display: block; color: var(--wine); font: 600 8px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; }
.gift-details strong { display: block; margin: 6px 0 4px; font: 500 24px/1 var(--display); }
.gift-details > span { display: block; color: var(--ink); font: 500 18px/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.copy-account { min-height: 34px; margin-top: 12px; padding: 7px 10px; color: #fff; border: 0; border-radius: 2px; background: var(--wine); cursor: pointer; font-size: 8px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.qr-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; }
.qr-backdrop { position: absolute; inset: 0; background: rgba(28,22,19,.78); backdrop-filter: blur(5px); }
.qr-dialog { position: relative; z-index: 1; width: min(100%, 430px); max-height: calc(100svh - 36px); padding: 22px; overflow: auto; text-align: center; border-radius: 8px; background: var(--paper); box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.qr-dialog h2 { margin-bottom: 14px; font-size: 34px; }
.qr-dialog img { width: min(100%, 310px); display: block; margin: 0 auto; border-radius: 6px; }
.qr-dialog > p:last-child { margin: 13px 0 0; color: var(--muted); line-height: 1.5; }
.qr-dialog > p:last-child strong { color: var(--ink); font: 500 20px/1 var(--display); }
.qr-close { position: absolute; z-index: 2; top: 7px; right: 7px; width: 40px; height: 40px; color: var(--muted); border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 25px; }
body.modal-open { overflow: hidden; }

.gallery-copy p { margin: 0 0 10px; color: var(--muted); text-align: center; font: italic 400 12px/1.3 var(--display); }
.gallery-grid { height: calc(100% - 27px); min-height: 150px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, minmax(68px, 1fr)); gap: 7px; }
.gallery-thumb { min-height: 0; padding: 0; overflow: hidden; border: 2px solid transparent; background: #ddd; cursor: pointer; }
.gallery-thumb.is-active { border-color: var(--wine); }
.gallery-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.gallery-thumb:nth-child(3) img { object-position: 50% 48%; }

.rsvp-panel { padding-top: 11px; }
.rsvp-panel form { max-width: 390px; margin: 0 auto; }
.rsvp-panel label, .rsvp-panel legend { display: block; margin: 0 0 4px; font-size: 9px; font-weight: 600; }
.rsvp-panel label small { float: right; color: var(--muted); font-weight: 400; }
.rsvp-panel input[type="text"], .rsvp-panel textarea, .rsvp-panel select { width: 100%; min-height: 36px; margin-bottom: 8px; padding: 8px 10px; color: var(--ink); border: 1px solid rgba(43,36,32,.24); border-radius: 2px; background: rgba(255,255,255,.7); font-size: 11px; }
.rsvp-panel textarea { min-height: 48px; resize: none; }
.rsvp-panel fieldset { min-width: 0; margin: 0 0 8px; padding: 0; border: 0; }
.attendance-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.attendance-options label { margin: 0; }
.attendance-options input { position: absolute; opacity: 0; pointer-events: none; }
.attendance-options span { min-height: 34px; padding: 7px; display: grid; place-items: center; border: 1px solid var(--line); cursor: pointer; text-align: center; font-size: 9px; }
.attendance-options input:checked + span { color: #fff; border-color: var(--wine); background: var(--wine); }
.guest-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; }
.guest-row select { margin-bottom: 7px; }
.form-status { min-height: 15px; margin: 5px 0 0; color: var(--wine); text-align: center; font-size: 9px; font-weight: 600; }

.folio-nav { padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: rgba(255,250,242,.96); }
.nav-item { min-width: 0; min-height: 52px; padding: 3px 2px; display: grid; place-items: center; gap: 1px; color: var(--muted); border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.nav-item span { font: 500 18px/1 var(--display); }
.nav-item small { font: 600 8px/1 var(--body); }
.nav-item.is-active { color: var(--wine); background: rgba(133,47,44,.075); }
.noscript { position: fixed; inset: auto 10px 10px; z-index: 100; padding: 12px; color: #fff; background: #852f2c; }

@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes music { to { transform: scale(1.16) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (min-width: 760px) {
  .experience { min-height: 680px; grid-template-columns: minmax(420px, 1.15fr) minmax(390px, .85fr); grid-template-rows: 100%; }
  .visual-stage { height: 100%; }
  .folio { height: 100%; grid-template-rows: auto minmax(0, 1fr) 78px; }
  .folio-heading { padding: clamp(30px, 5vh, 56px) 32px 20px; }
  h2 { font-size: clamp(38px, 4.2vw, 54px); }
  .folio-subtitle { font-size: 16px; }
  .panel { padding: clamp(22px, 4vh, 42px) clamp(28px, 4vw, 58px) 20px; }
  .hero-signature { bottom: 60px; width: calc(100% - 150px); }
  h1 { font-size: clamp(50px, 6vw, 82px); }
  .hero-signature > p:first-child { font-size: 10px; }
  .hero-date { font-size: 13px; }
  .topbar { inset: 24px 24px auto; }
  .photo-controls { right: 24px; bottom: 24px; }
  .photo-arrow { width: 38px; height: 38px; }
  .couple-lockup strong { font-size: clamp(21px, 2vw, 28px); }
  .quick-event { margin-top: clamp(22px, 4vh, 38px); padding: 18px 0; }
  .quick-event > div strong { font-size: 70px; }
  .warm-note { margin-top: 20px; font-size: 16px; }
  .event-card { grid-template-columns: 125px 1fr; gap: 26px; }
  .date-seal { padding: 20px 4px; }
  .date-seal strong { font-size: 72px; }
  .event-copy h3 { font-size: 42px; }
  .event-copy p, .event-copy p strong { font-size: 14px; }
  .countdown { margin: 24px auto; gap: 10px; }
  .countdown div { padding: 13px; }
  .countdown strong { font-size: 30px; }
  .gift-note { margin-bottom: 18px; font-size: 15px; }
  .gift-card { padding: 16px; grid-template-columns: minmax(140px, .9fr) minmax(150px, 1.1fr); gap: 20px; }
  .gift-details strong { font-size: 30px; }
  .gift-details > span { font-size: 22px; }
  .copy-account { min-height: 40px; font-size: 9px; }
  .gallery-grid { gap: 10px; }
  .rsvp-panel label, .rsvp-panel legend { font-size: 11px; }
  .rsvp-panel input[type="text"], .rsvp-panel textarea, .rsvp-panel select { min-height: 42px; font-size: 13px; }
  .attendance-options span { min-height: 40px; font-size: 11px; }
  .nav-item { min-height: 60px; }
  .nav-item span { font-size: 22px; }
  .nav-item small { font-size: 9px; }
}

@media (max-height: 690px) and (max-width: 759px) {
  .experience { min-height: 560px; grid-template-rows: 36svh minmax(0, 1fr); }
  .hero-signature { bottom: 20px; }
  h1 { font-size: 34px; }
  .folio-heading { padding-top: 13px; }
  .panel { padding-top: 10px; }
  .folio-nav { height: 62px; }
}

@media (max-width: 360px) {
  .hero-signature { width: calc(100% - 90px); }
  h1 { font-size: 32px; }
  .folio-heading { padding-inline: 14px; }
  .panel { padding-inline: 14px; }
  .couple-lockup strong { font-size: 16px; }
}
