:root {
  --maroon: #5c0f1e;
  --red: #8f1d2c;
  --gold: #c9971c;
  --gold-2: #f0c75e;
  --cream: #fff7e8;
  --paper: #fffdf7;
  --green: #285c3c;
  --ink: #3a1a12;
  --muted: #7a5a4a;
  --dev: "Tiro Devanagari Marathi", "Mukta", "Noto Sans Tamil", "Noto Sans Telugu", "Noto Sans Kannada", "Noto Sans Malayalam", serif;
  --latin: "Cormorant Garamond", Georgia, serif;
  --ui: "Mukta", "Noto Sans Tamil", "Noto Sans Telugu", "Noto Sans Kannada", "Noto Sans Malayalam", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background: var(--cream);
  background-image:
    radial-gradient(circle at 20px 20px, rgba(201,151,28,.12) 2px, transparent 3px),
    radial-gradient(circle at 0 0, rgba(143,29,44,.05) 2px, transparent 3px);
  background-size: 40px 40px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

/* ---------- Gate (cinematic opening) ---------- */
.gate { position: fixed; inset: 0; z-index: 50; perspective: 1400px; background: #2a0a10; overflow: hidden; }
.door {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.12) 0 3px, transparent 3px 46px),
    linear-gradient(180deg, #7a3b1d, #4f2310 60%, #3b1a0b);
  transition: transform 1.8s cubic-bezier(.6,.05,.2,1);
  box-shadow: inset 0 0 60px rgba(0,0,0,.55);
}
.door.left { left: 0; transform-origin: left center; border-right: 3px solid #2a1206; }
.door.right { right: 0; transform-origin: right center; border-left: 3px solid #2a1206; }
.door .carve {
  position: absolute; inset: 9% 12%;
  border: 3px solid var(--gold); border-radius: 50% 50% 6px 6px / 22% 22% 6px 6px;
  box-shadow: inset 0 0 0 8px rgba(201,151,28,.25), inset 0 0 0 11px var(--gold);
}
.door .knocker { position: absolute; top: 36%; width: 34px; height: 34px; border: 4px solid var(--gold-2); border-radius: 50%; }
.door.left .knocker { right: 18px; } .door.right .knocker { left: 18px; }
.gate.open .door.left { transform: rotateY(-108deg); }
.gate.open .door.right { transform: rotateY(108deg); }
.gate.open .gate-center { opacity: 0; transform: scale(1.3); }
.gate.done { opacity: 0; pointer-events: none; transition: opacity .8s; }
.toran {
  position: absolute; top: 0; left: 0; right: 0; height: 64px; z-index: 3;
  background:
    radial-gradient(circle at 50% 14px, #f39c12 9px, transparent 10px) 0 0 / 38px 64px repeat-x,
    linear-gradient(135deg, transparent 45%, #2f7a3a 46% 54%, transparent 55%) 0 22px / 38px 42px repeat-x,
    linear-gradient(225deg, transparent 45%, #3c8f46 46% 54%, transparent 55%) 19px 22px / 38px 42px repeat-x;
  border-top: 6px solid var(--gold);
}
.gate-center {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--gold-2); padding: 24px; transition: opacity .9s, transform 1.4s;
}
.om { font-family: var(--dev); font-size: 1.15rem; letter-spacing: .03em; margin: 0 0 10px; color: var(--gold-2); }
.gate-name { font-family: var(--dev); font-size: 1.5rem; margin: 0 0 22px; color: #fff3d6; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.open-btn {
  border: 2px solid var(--gold-2); color: var(--maroon); background: var(--gold-2);
  padding: 12px 34px; border-radius: 40px; font-family: var(--dev); font-size: 1.2rem;
  box-shadow: 0 0 0 6px rgba(240,199,94,.25); animation: pulse 1.8s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(240,199,94,.05); } }

/* ---------- Petals ---------- */
#petals { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.petal {
  position: absolute; top: -30px; width: 14px; height: 18px; border-radius: 80% 0 80% 0;
  background: linear-gradient(135deg, #ff9a3c, #e8590c); opacity: .9;
  animation: fall linear forwards;
}
.petal.rose { background: linear-gradient(135deg, #e0475a, #a3182c); }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg) translateX(40px); opacity: .7; } }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: rgba(92,15,30,.94); color: var(--gold-2); }
.lang { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: calc(100vw - 70px); }
.lang::-webkit-scrollbar { display: none; }
.lang button { flex: none; white-space: nowrap; background: none; border: 1px solid transparent; color: #f6dfb1; padding: 3px 10px; border-radius: 20px; font-size: .9rem; }
.lang button.on { border-color: var(--gold-2); color: var(--gold-2); }
.music-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gold-2); background: none; color: var(--gold-2); }
.music-btn.off { opacity: .5; text-decoration: line-through; }

.live { position: sticky; top: 52px; z-index: 15; background: var(--green); color: #fff; padding: 8px 14px; font-size: .95rem; text-align: center; }
.live b { color: var(--gold-2); }

/* ---------- Layout ---------- */
main { max-width: 560px; margin: 0 auto; padding: 14px 14px 40px; }
section { margin: 18px 0; }
.card {
  background: var(--paper); border-radius: 14px; padding: 20px 18px;
  border: 1px solid rgba(201,151,28,.45);
  box-shadow: 0 6px 20px rgba(92,15,30,.07);
}
/* paithani-style border band */
.paithani { position: relative; padding-top: 30px; padding-bottom: 30px; }
.paithani::before, .paithani::after {
  content: ""; position: absolute; left: 0; right: 0; height: 12px;
  background:
    linear-gradient(45deg, var(--gold) 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(-45deg, var(--gold) 25%, transparent 25%) 0 0 / 12px 12px,
    var(--green);
}
.paithani::before { top: 0; border-radius: 14px 14px 0 0; }
.paithani::after { bottom: 0; border-radius: 0 0 14px 14px; }
h1, h2, h3 { font-family: var(--dev); color: var(--maroon); font-weight: 400; line-height: 1.3; }
:lang(en) h1, :lang(en) h2, :lang(en) h3 { font-family: var(--latin); font-weight: 700; }
h2 { font-size: 1.45rem; text-align: center; margin: 0 0 14px; }
h2::after { content: "❀"; display: block; color: var(--gold); font-size: .9rem; margin-top: 2px; }
h3 { font-size: 1.2rem; margin: 0 0 4px; }

.hero { text-align: center; }
.hero .om { color: var(--red); }
.dear { margin: 0 0 6px; color: var(--muted); }
.dear b { color: var(--maroon); font-family: var(--dev); font-size: 1.15rem; }
.title { font-size: 2.3rem; margin: 6px 0 8px; color: var(--red); }
.couple { display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--dev); font-size: 1.7rem; color: var(--maroon); }
:lang(en) .couple { font-family: var(--latin); font-size: 2.1rem; font-weight: 700; }
.couple .amp { color: var(--gold); font-size: 1.2rem; }
.date { font-weight: 600; color: var(--green); margin: 10px 0 4px; }
.invite-line { color: var(--muted); font-size: 1rem; }

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.countdown div { background: var(--maroon); color: var(--gold-2); border-radius: 10px; padding: 8px 2px; }
.countdown b { display: block; font-size: 1.5rem; line-height: 1.1; font-family: var(--latin); }
.countdown span { font-size: .75rem; color: #f6dfb1; }
.countdown.done { display: block; background: var(--green); color: #fff; border-radius: 10px; padding: 10px; }

.fam-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: center; }
.fam-grid p { margin: 4px 0 0; white-space: pre-line; }
.blessings { text-align: center; color: var(--muted); font-style: italic; margin: 14px 0 0; }

.event { border-top: 1px dashed rgba(201,151,28,.6); padding: 16px 0; }
.event:first-of-type { border-top: 0; padding-top: 0; }
.event .when { color: var(--green); font-weight: 600; margin: 0; }
.event .venue { margin: 4px 0; }
.event .venue small { color: var(--muted); }
.event .dress { margin: 2px 0 8px; font-size: .95rem; }
.event .dress b { color: var(--red); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--red); background: var(--red); color: #fff; border-radius: 30px;
  padding: 9px 18px; font-size: .95rem; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--red); }
.btn.small { padding: 6px 14px; font-size: .88rem; }
.btn[disabled] { opacity: .5; }

.rsvp { margin-top: 10px; background: var(--cream); border-radius: 10px; padding: 10px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; border: 1px solid var(--gold); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 4px; font-size: .92rem; }
.seg button.on { background: var(--green); border-color: var(--green); color: #fff; }
.seg button.on.no { background: var(--muted); border-color: var(--muted); }
.rsvp-more { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.rsvp-more label { flex: 1; font-size: .88rem; color: var(--muted); }
.rsvp-more select { display: block; width: 100%; margin-top: 2px; padding: 7px; border: 1px solid var(--gold); border-radius: 8px; background: #fff; font: inherit; }
.rsvp .btn { margin-top: 8px; width: 100%; }

.timeline { list-style: none; padding: 0 0 0 18px; margin: 0; border-left: 2px solid var(--gold); }
.timeline li { position: relative; margin: 0 0 16px; }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid var(--gold-2); }
.timeline .yr { font-weight: 600; color: var(--gold); font-size: .9rem; }
.timeline p { margin: 2px 0 0; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: #eee; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(20,5,8,.92); display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

.vote-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side-btn { border: 2px solid; border-radius: 14px; padding: 16px 8px; font-family: var(--dev); font-size: 1.2rem; background: #fff; }
.side-btn.bride { border-color: #c2185b; color: #c2185b; }
.side-btn.groom { border-color: #1f5f8b; color: #1f5f8b; }
.voted { text-align: center; margin: 0; }

textarea {
  width: 100%; min-height: 84px; resize: vertical; border: 1px solid var(--gold); border-radius: 10px;
  padding: 10px; font: inherit; background: #fff; color: var(--ink);
}
.hint { color: var(--muted); font-size: .92rem; text-align: center; margin: 0 0 10px; }
.counter { text-align: right; font-size: .8rem; color: var(--muted); margin: 2px 0 8px; }
.form-row { display: flex; justify-content: flex-end; }
.status-note { background: var(--cream); border-radius: 10px; padding: 10px; text-align: center; font-size: .95rem; color: var(--green); }

.notes { display: grid; gap: 8px; margin-top: 14px; }
.note { background: #fff; border-left: 4px solid var(--gold); border-radius: 0; padding: 8px 12px; font-size: .98rem; }
.note .by { display: block; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.note.ukhana { border-left-color: var(--red); font-family: var(--dev); }

/* ---------- Blessing kalash ---------- */
.kalash-wrap { position: relative; width: 170px; height: 190px; margin: 0 auto 6px; }
.kalash-wrap svg { width: 100%; height: 100%; }
.kalash-count { text-align: center; font-weight: 600; color: var(--maroon); margin: 0 0 12px; }
.drop { position: absolute; left: 50%; top: -20px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
  background: radial-gradient(circle, #ffd166 30%, #f39c12 70%); animation: drop 1.1s ease-in forwards; }
@keyframes drop { to { transform: translateY(95px) scale(.6); opacity: 0; } }

/* ---------- Voice ---------- */
.voice-box { text-align: center; }
.rec-btn { width: 78px; height: 78px; border-radius: 50%; border: 4px solid var(--gold-2); background: var(--red); color: #fff; font-size: .85rem; }
.rec-btn.on { animation: pulse 1s infinite; background: #c0392b; }
.rec-time { font-family: var(--latin); font-size: 1.2rem; color: var(--maroon); margin: 6px 0; }
.voice-list { display: grid; gap: 8px; margin-top: 12px; }
.voice-list audio { width: 100%; }
.voice-list .by { font-size: .85rem; color: var(--muted); text-align: left; }

footer { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 30px; }
footer a { color: var(--red); }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; background: var(--maroon); color: #fff;
  padding: 10px 18px; border-radius: 30px; font-size: .95rem; max-width: 90vw; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

@media (prefers-reduced-motion: reduce) {
  .door, .gate-center { transition-duration: .01s; }
  .petal, .drop, .open-btn, .rec-btn.on { animation: none; }
}

/* =================== dynamic layer (all themes) =================== */

/* --- curtain opening: velvet drapes part, the stage pushes in --- */
.gate.curtain .door, .gate.curtain .toran { display: none; }
.gate.curtain .stage {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 30% 22% at 50% 22%, rgba(255,226,150,.55), transparent 70%),
    radial-gradient(ellipse 70% 60% at 50% 40%, #8a1d24, #3a0a10 70%, #1c0408);
  transform-origin: 50% 30%;
  transition: transform 2.8s cubic-bezier(.4,0,.2,1), filter 2.8s;
}
.gate.curtain .drape {
  position: absolute; top: 0; bottom: 0; width: 50.5%; z-index: 2;
  background:
    linear-gradient(180deg, rgba(0,0,0,.35), transparent 18%, transparent 75%, rgba(0,0,0,.45)),
    repeating-linear-gradient(90deg, #5e0c16 0 10px, #8e1a26 18px, #a8232f 24px, #7a1420 32px, #5e0c16 42px);
  box-shadow: inset 0 0 40px rgba(0,0,0,.6);
  transition: transform 2.2s cubic-bezier(.6,.05,.25,1) .15s;
}
.gate.curtain .drape.l { left: 0; transform-origin: left center; border-right: 2px solid #d4a73c; }
.gate.curtain .drape.r { right: 0; transform-origin: right center; border-left: 2px solid #d4a73c; }
.gate.curtain .valance {
  position: absolute; top: 0; left: 0; right: 0; height: 92px; z-index: 3;
  background:
    radial-gradient(circle at 50% 0, #7a1420 62%, transparent 63%) 0 30px / 64px 64px repeat-x,
    linear-gradient(180deg, #4d0a12, #7a1420 40px, transparent 40px);
  border-top: 4px solid #d4a73c;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.5));
  transition: transform 1.6s ease 1s;
}
.gate.curtain .gate-center { z-index: 4; }
.gate.curtain.open .drape.l { transform: translateX(-88%) scaleX(.35); }
.gate.curtain.open .drape.r { transform: translateX(88%) scaleX(.35); }
.gate.curtain.open .valance { transform: translateY(-110%); }
.gate.curtain.open .stage { transform: scale(1.16); filter: brightness(1.12); }
.gate.curtain.open .gate-center { opacity: 0; transform: scale(.92); transition-duration: .6s; }

/* --- optional intro video --- */
.intro-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 6; background: #000; }
.gate.playing .gate-center, .gate.playing .drape, .gate.playing .valance { opacity: 0; transition: opacity .4s; }

/* --- petals that keep drifting --- */
.petal.soft { width: 10px; height: 13px; opacity: .55; }

/* --- sections rise in as you scroll --- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal.in h2 { animation: titleIn 1.1s ease both; }
@keyframes titleIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

.kicker { text-align: center; font-size: .8rem; color: var(--red); margin: 0 0 4px; }
:lang(en) .kicker { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; }

/* --- scratch to reveal --- */
.scratch { position: relative; height: 170px; border-radius: 14px; overflow: hidden; border: 2px solid var(--gold); background: var(--paper);
  box-shadow: inset 0 0 0 6px var(--paper), inset 0 0 0 7px rgba(201,151,28,.5); touch-action: none; user-select: none; }
.scratch-under { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10px; }
.scratch-date { font-family: var(--dev); font-size: 1.45rem; color: var(--maroon); margin: 2px 0 0; line-height: 1.25; }
:lang(en) .scratch-date { font-family: var(--latin); font-weight: 700; }
.scratch-time { margin: 2px 0 0; color: var(--muted); }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; transition: opacity .7s; }
.scratch.done canvas { opacity: 0; }
.scratch.done .scratch-under { animation: pop .8s cubic-bezier(.2,1.5,.4,1); }
@keyframes pop { from { transform: scale(.85); opacity: .4; } }
.scratch-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #fff4d6; pointer-events: none;
  font-size: .95rem; letter-spacing: .05em; padding-left: 30px; transition: opacity .4s; animation: nudge 1.6s ease-in-out infinite; }
.scratch-hint::before { content: "☝"; position: absolute; left: 0; top: -4px; font-size: 1.3rem; }
.scratch-hint.gone { opacity: 0; }
@keyframes nudge { 50% { transform: translate(-40%, -50%); } }

/* --- photo carousel --- */
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 10px; }
.carousel::-webkit-scrollbar { display: none; }
.carousel figure { flex: 0 0 100%; min-width: 0; margin: 0; scroll-snap-align: center; aspect-ratio: 4 / 5; overflow: hidden; }
.carousel img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; transform: scale(1.06); transition: transform 6s ease; }
.reveal.in .carousel img { transform: scale(1); }
.dots { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.dots button { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--red); background: transparent; padding: 0; }
.dots button.on { background: var(--red); }

/* --- wedding-day schedule --- */
.sched { list-style: none; margin: 0; padding: 0; position: relative; }
.sched::before { content: ""; position: absolute; left: 92px; top: 6px; bottom: 6px; border-left: 1px solid var(--gold); }
.sched li { display: grid; grid-template-columns: 80px 1fr; gap: 24px; padding: 8px 0; position: relative; }
.sched li::before { content: ""; position: absolute; left: 87px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.sched .st { text-align: right; color: var(--red); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.sched .sd b { display: block; font-family: var(--dev); font-weight: 400; font-size: 1.1rem; color: var(--maroon); }
:lang(en) .sched .sd b { font-family: var(--latin); font-weight: 700; }
.sched .sd small { color: var(--muted); font-style: italic; }

/* --- dress code swatches --- */
.swatches { display: flex; justify-content: center; margin-top: 8px; }
.swatches span { width: 46px; height: 46px; border-radius: 50%; margin-left: -8px; border: 3px solid var(--paper); box-shadow: 0 3px 10px rgba(0,0,0,.18);
  transform: translateY(14px); opacity: 0; transition: transform .6s cubic-bezier(.2,1.4,.4,1), opacity .6s; transition-delay: calc(var(--i) * .12s + .2s); }
.reveal.in .swatches span, .swatches:not(.reveal *) span { transform: none; opacity: 1; }

/* --- closing card --- */
.closing { text-align: center; }
.closing h2 { font-size: 1.6rem; }
.closing-names { font-family: var(--dev); font-size: 1.5rem; color: var(--red); margin: 6px 0; }
:lang(en) .closing-names { font-family: var(--latin); font-style: italic; font-weight: 700; font-size: 1.8rem; }
.closing-names i { color: var(--gold); font-style: normal; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .gate.curtain .drape, .gate.curtain .stage, .gate.curtain .valance { transition-duration: .01s; }
  .scratch-hint { animation: none; }
}

/* ---------- hosts & contact ---------- */
.hosts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-top: 8px; }
.host { text-align: center; padding: 14px 10px; border: 1px solid rgba(201,151,28,.35); border-radius: 14px; }
.host .kicker { margin: 0 0 4px; }
.host-name { margin: 0 0 10px; font-weight: 600; }
.rsvp-by { text-align: center; margin: -4px 0 14px; }
.skip-video { position: absolute; z-index: 60; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); border: 0; border-radius: 999px; padding: 8px 16px; min-height: 40px; background: rgba(0,0,0,.55); color: #fff; font: 600 .9rem system-ui, sans-serif; cursor: pointer; }
/* ---------- pre-wedding film ---------- */
.film { border-radius: 16px; overflow: hidden; background: #000; box-shadow: 0 10px 30px rgba(0,0,0,.25); margin-top: 6px; }
.film video { display: block; width: 100%; max-height: 72vh; background: #000; }
body.watching #petals { display: none; }
