/* DigiPatrika - the guest's card.
   A design is a set of artwork in assets/img (envelope, paper top / tile / end, frame) plus the
   colours and type below. Rajwada is the first; others slot in as .theme-<name> blocks. */

* { box-sizing: border-box; margin: 0; padding: 0; }

.theme-rajwada {
  --paper: #fbf2de; --ink: #3b1c13; --soft: #7b5b3e; --gold: #a26f17; --gold-hi: #ecc96f;
  --foil: linear-gradient(160deg, #c9973a, #a26f17 55%, #c9973a); --foil-hi: linear-gradient(160deg, #f4dc93, #d9ab45 50%, #f4dc93);
  --art-tile: url(../img/rajwada-tile.jpg); --pad: 15.5%;
  --fa: 640 / 819; --hx: 19.2%; --hy: 13.4%; --hw: 61.6%; --hh: 72%;
}
.theme-paithani {
  --paper: #fdf6e3; --ink: #3a1420; --soft: #7d5560; --gold: #a8780f; --gold-hi: #f3d684;
  --foil: linear-gradient(160deg, #cfa238, #a8780f 55%, #cfa238); --foil-hi: linear-gradient(160deg, #f8e3a0, #dcb04a 50%, #f8e3a0);
  --art-tile: url(../img/paithani-tile.jpg); --pad: 19.5%;
  --fa: 600 / 788; --hx: 20%; --hy: 13.2%; --hw: 60.2%; --hh: 72%;
}
.theme-warli {
  --paper: #fbf3e2; --ink: #43200f; --soft: #85604a; --gold: #9a4420; --gold-hi: #fff0dc;
  --foil: #9a4420; --foil-hi: #fff0dc;
  --art-tile: url(../img/warli-tile.jpg); --pad: 11.5%;
  --fa: 600 / 776; --hx: 20.4%; --hy: 14.9%; --hw: 59.2%; --hh: 69.9%;
}
.theme-rajwada, .theme-paithani, .theme-warli { --body: "Tiro Devanagari Marathi", Georgia, serif; }
/* Colour of the envelope, and of names and buttons inside. */
.c-maroon   { --main: #7a1422; --deep: #3f0a13; --ground: url(../img/paper-maroon.jpg); }
.c-peacock  { --main: #14506b; --deep: #0a2c3d; --ground: url(../img/paper-peacock.jpg); }
.c-emerald  { --main: #1c5f48; --deep: #0d3327; --ground: url(../img/paper-emerald.jpg); }
.c-jamun    { --main: #5a2a7e; --deep: #2e1344; --ground: url(../img/paper-jamun.jpg); }
.c-paithani { --main: #a3155f; --deep: #570a33; --ground: url(../img/paper-paithani.jpg); }
.c-warli    { --main: #8f3a1c; --deep: #4f1d0c; --ground: url(../img/paper-warli.jpg); }
/* Lettering for names and headings. */
.f-rozha { --display: "Rozha One", "Tiro Devanagari Marathi", serif; --dw: 400; }
.f-tiro  { --display: "Tiro Devanagari Marathi", Georgia, serif; --dw: 400; }
.f-kalam { --display: "Kalam", "Tiro Devanagari Marathi", cursive; --dw: 700; }

body.card {
  min-height: 100vh; min-height: 100svh;
  color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.65;
  background: linear-gradient(color-mix(in srgb, var(--deep) 60%, transparent), color-mix(in srgb, var(--deep) 80%, transparent)), var(--ground) center / 520px;
  background-color: var(--deep);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}

#sky { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 25; }

.ribbon {
  position: sticky; top: 0; z-index: 30; padding: 8px 14px; text-align: center;
  background: #1c1c26; color: #fff; font: 500 13px/1.4 system-ui, sans-serif;
}

/* Ganesha, the kalash and the function drawings are cut-outs, coloured here to suit each design. */
.ganesha, .kalash, .ficon { display: block; margin: 0 auto; background: var(--foil); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ganesha { --m: url(../img/ganesha.webp); width: 70px; aspect-ratio: 520 / 639; }
.kalash { --m: url(../img/kalash.webp); width: 62px; aspect-ratio: 300 / 382; margin-bottom: 8px; }
.ficon { width: 46px; height: 46px; margin-bottom: 4px; -webkit-mask: url(../img/icons.webp) calc(var(--n) * 20%) 0 / 600% 100% no-repeat; mask: url(../img/icons.webp) calc(var(--n) * 20%) 0 / 600% 100% no-repeat; }
.lotus {
  display: block; width: 104px; height: 58px; margin: 0 auto 4px;
  background: url(../img/lotus.jpg) center / contain no-repeat; mix-blend-mode: multiply;
  -webkit-mask: radial-gradient(ellipse 50% 50%, #000 52%, transparent 96%); mask: radial-gradient(ellipse 50% 50%, #000 52%, transparent 96%);
}
.theme-warli .lotus { display: none; }

/* ---------- the sealed envelope ---------- */
.cover {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 30%, rgba(8, 4, 6, .66) 100%),
    linear-gradient(color-mix(in srgb, var(--deep) 45%, transparent), color-mix(in srgb, var(--deep) 45%, transparent)),
    var(--ground) center / 520px;
  background-color: var(--deep);
  transition: opacity .7s 1s;
}
.cover-in { width: min(100%, 460px); padding: 20px 0; text-align: center; color: var(--gold-hi); }
.cover .ganesha { width: 76px; background: var(--foil-hi); }
.cover-top { margin-top: 10px; font-size: 16px; }
.cover-guest { margin-top: 16px; font-size: 15px; color: #f1dfb8; }
.cover-guest strong { display: block; font-size: 22px; font-weight: 400; color: #fff6dc; }

.envelope {
  position: relative; display: block; width: 92%; margin: 26px auto 24px; padding: 0;
  background: none; border: 0; cursor: pointer; transform: rotate(-2.5deg);
  transition: transform .9s cubic-bezier(.6, 0, .3, 1) .8s, opacity .6s .95s;
  -webkit-tap-highlight-color: transparent;
}
.env-art { position: relative; display: block; width: 100%; height: auto; border-radius: 5px; box-shadow: 0 24px 50px rgba(0, 0, 0, .55); transition: opacity .3s .3s; }
.env-open { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 5px; }
.opened .env-open + .env-art { opacity: 0; box-shadow: none; }
.seal {
  position: absolute; left: 50%; top: 50%; width: 31%; transform: translate(-50%, -46%) rotate(8deg);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45));
  transition: transform .5s cubic-bezier(.3, 1.4, .5, 1), opacity .4s .1s;
  animation: nudge 2.6s ease-in-out 1.2s infinite;
}
.seal img { display: block; width: 100%; height: auto; }
.seal b {
  position: absolute; inset: 0; display: grid; place-items: center; padding-top: 2%;
  font: var(--dw) clamp(19px, 6.4vw, 30px)/1 var(--display); color: rgba(96, 14, 6, .82);
  text-shadow: 0 1px 0 rgba(255, 170, 140, .55);
}
@keyframes nudge {
  0%, 70%, 100% { transform: translate(-50%, -46%) rotate(8deg) scale(1); }
  80% { transform: translate(-50%, -46%) rotate(4deg) scale(1.07); }
  90% { transform: translate(-50%, -46%) rotate(10deg) scale(1.02); }
}
.s-gold .seal b { color: rgba(104, 66, 4, .85); text-shadow: 0 1px 0 rgba(255, 244, 200, .7); }
.seal-b { position: absolute; left: 50%; top: 50%; width: 31%; aspect-ratio: 420 / 430; transform: translate(-50%, -46%) rotate(8deg); opacity: 0; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45)); }
.seal-b i { position: absolute; inset: 0; background: var(--crack) center / 100% 100% no-repeat; }
.seal-b i:first-child { clip-path: inset(0 46% 0 0); }
.seal-b i:last-child { clip-path: inset(0 0 0 54%); }
.opened .seal-b { opacity: 1; }
.opened .seal-b i:first-child { animation: crack-l .75s ease-out forwards; }
.opened .seal-b i:last-child { animation: crack-r .75s ease-out forwards; }
@keyframes crack-l { 60% { opacity: 1; } to { transform: translate(-75%, 40%) rotate(-28deg); opacity: 0; } }
@keyframes crack-r { 60% { opacity: 1; } to { transform: translate(75%, 46%) rotate(24deg); opacity: 0; } }
.envelope:focus-visible { outline: 3px solid #fff6dc; outline-offset: 8px; border-radius: 6px; }
.cover-names { font: var(--dw) clamp(27px, 8.4vw, 36px)/1.25 var(--display); color: #fff3d2; padding: 0 16px; }
.cover-names i { font: 400 .55em var(--body); color: var(--gold-hi); padding: 0 .25em; }
.cover-hint { margin-top: 12px; font-size: 15px; color: #e7cf9c; }

/* Opening: the seal lifts away, the envelope drops, the card comes up from behind it. */
.opened .seal { animation: none; opacity: 0; transition: none; }
.opened .envelope { transform: translateY(70vh) rotate(-9deg); opacity: 0; }
.opened .cover { opacity: 0; pointer-events: none; }
.opened .cover-top, .opened .cover-names, .opened .cover-hint, .opened .cover-guest, .opened .cover .ganesha { opacity: 0; transition: opacity .35s; }
.cover[hidden] { display: none; }

/* ---------- the card ---------- */
.patrika {
  position: relative; z-index: 2; max-width: 480px; margin: 0 auto; text-align: center; background: var(--paper);
  transition: transform 1s cubic-bezier(.2, .8, .2, 1) 1s, opacity .6s 1s;
}
body:not(.opened) .patrika { transform: translateY(60px) scale(.94); opacity: 0; }
@media (min-width: 540px) {
  .patrika { margin: 30px auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
  .card.embed .patrika { margin: 0 auto; }
}
.paper-top { display: block; width: 100%; height: auto; }
.paper-body { padding: 4px var(--pad) 110px; background: var(--art-tile) top center / 100% auto repeat-y; }
/* The lotus end-piece fades in over the last stretch of the repeating paper, so no join shows. */
.paper-end { position: relative; margin-top: -90px; }
.paper-end img {
  display: block; width: 100%; height: auto;
  -webkit-mask: linear-gradient(transparent, #000 90px); mask: linear-gradient(transparent, #000 90px);
}
.made { position: absolute; left: 0; right: 0; bottom: 7px; }
.made a { font: 400 11.5px/1 system-ui, sans-serif; color: var(--soft); text-decoration: none; }

.p-head { padding-top: 2px; }
.mantra { margin-top: 8px; color: var(--gold); font-size: 16px; }

.couple { padding: 20px 0 4px; }
.frame { position: relative; width: 96%; aspect-ratio: var(--fa); margin: 0 auto 26px; }
.theme-paithani .frame { width: 104%; margin-left: -2%; }
.frame-photo { position: absolute; left: var(--hx); top: var(--hy); width: var(--hw); height: var(--hh); object-fit: cover; object-position: 50% 20%; }
.frame-art { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 10px 14px rgba(70, 30, 0, .3)); }
.who .tagline { display: block; color: var(--soft); font-size: 15px; }
.who h1 { font: var(--dw) clamp(33px, 10vw, 46px)/1.25 var(--display); color: var(--main); overflow-wrap: anywhere; }
.who p { color: var(--soft); font-size: 15.5px; margin-top: 2px; }
.weds { display: flex; align-items: center; gap: 12px; margin: 12px auto; max-width: 190px; color: var(--gold); font-size: 17px; }
.weds::before, .weds::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, currentColor); }
.weds::after { transform: scaleX(-1); }

.invite { padding: 24px 0 8px; }
.invite p { font-style: italic; font-size: 17.5px; }

.count { padding: 20px 0 6px; }
.count-label { color: var(--soft); font-size: 14.5px; }
.count-row { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 8px; }
.count-row div + div { border-left: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.count-row b { display: block; font: var(--dw) 29px/1.15 var(--display); color: var(--main); font-variant-numeric: tabular-nums; }
.count-row span { font-size: 12.5px; color: var(--soft); }

.patrika section + section { margin-top: 30px; }
.patrika h2 { font: var(--dw) 26px/1.3 var(--display); color: var(--main); margin-bottom: 14px; }

.event + .event { margin-top: 26px; padding-top: 24px; background: linear-gradient(90deg, transparent, var(--gold), transparent) top center / 120px 1px no-repeat; }
.event h3 { font: var(--dw) 22px/1.3 var(--display); color: var(--gold); }
.event .when { font-size: 18px; margin-top: 4px; }
.event .where { color: var(--soft); margin-top: 8px; font-size: 16px; }
.event .where strong { color: var(--ink); font-weight: 400; font-size: 17.5px; }
.pbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 14px; cursor: pointer; text-decoration: none;
  font: 400 16px/1.2 var(--body); color: var(--main);
  background: rgba(255, 252, 240, .6); border: 1px solid var(--main); border-radius: 3px;
}
.pbtn-main { background: var(--main); color: #fff3d2; border-color: var(--main); outline: 1px solid rgba(236, 201, 111, .7); outline-offset: -4px; }
.pbtn svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pbtn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Gallery photos sit like prints laid on the paper. */
.gal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.gal-grid a { display: block; padding: 4px 4px 14px; background: #fffdf6; box-shadow: 0 5px 12px rgba(70, 30, 0, .28); transform: rotate(var(--tilt)); }
.gal-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }

.rsvp form { display: grid; gap: 14px; text-align: left; }
.rsvp form .pbtn { width: 100%; }
.rsvp label { display: grid; gap: 2px; font-size: 14.5px; color: var(--soft); }
.rsvp input:not([type=radio]) {
  width: 100%; padding: 8px 2px; font: 400 17px/1.3 var(--body); color: var(--ink);
  background: transparent; border: 0; border-bottom: 1px solid rgba(162, 111, 23, .8); border-radius: 0;
}
.rsvp input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.yn { display: grid; gap: 8px; }
.yn label { display: block; }
.yn input { position: absolute; opacity: 0; }
.yn span { display: grid; place-items: center; min-height: 44px; padding: 6px; text-align: center; cursor: pointer; color: var(--ink); font-size: 16px; border: 1px solid rgba(162, 111, 23, .7); border-radius: 3px; }
.yn input:checked + span { background: var(--main); border-color: var(--main); color: #fff3d2; }
.yn input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.rsvp-out { text-align: center; font-size: 17px; color: var(--main); }
.rsvp [hidden] { display: none; }

.p-foot { margin-top: 34px; display: grid; gap: 16px; justify-items: center; }
.p-foot span { display: block; font-size: 14px; color: var(--soft); }
.hosts { font-size: 18.5px; }

/* ---------- button bar: everything a guest can do, kept off the card itself ---------- */
.bar {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 15; transform: translate(-50%, 140%);
  display: flex; gap: 2px; padding: 5px; border-radius: 18px; max-width: calc(100vw - 20px);
  background: color-mix(in srgb, var(--deep) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(236, 201, 111, .45);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1) 1.9s;
}
.opened .bar { transform: translate(-50%, 0); }
.bar a, .bar button {
  display: grid; justify-items: center; gap: 3px; min-width: 70px; padding: 8px 12px 7px; cursor: pointer; text-decoration: none; white-space: nowrap;
  font: 400 13.5px/1.2 var(--body); color: #fdf1d3; background: none; border: 0; border-radius: 13px;
}
.bar svg { width: 21px; height: 21px; fill: none; stroke: #ecc96f; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bar a:active, .bar button:active { background: rgba(255, 255, 255, .12); }
.bar :focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.bar .bar-main { grid-auto-flow: column; align-items: center; gap: 7px; padding: 12px 18px; font-size: 15.5px; background: #ecc96f; color: #3a1206; }
.bar .bar-main svg { stroke: #3a1206; }
.paper-end { padding-bottom: 0; }
.patrika { margin-bottom: 92px; }
.card.embed .patrika { margin-bottom: 84px; }

.sheet { position: fixed; inset: 0; z-index: 35; display: grid; align-items: end; background: rgba(10, 4, 6, .6); }
.sheet[hidden] { display: none; }
.sheet-in {
  width: min(100%, 480px); max-height: 86vh; overflow: auto; margin: 0 auto; padding: 22px 22px 18px; display: grid; gap: 14px;
  background: var(--paper); border-radius: 18px 18px 0 0; text-align: center; animation: sheet-up .3s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } }
.sheet-in h2 { font: var(--dw) 23px/1.3 var(--display); color: var(--main); }
.way { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.way p { font-size: 16px; color: var(--soft); }
.way strong { display: block; font: var(--dw) 19px/1.3 var(--display); color: var(--gold); }
.way span { display: block; font-size: 14.5px; }
.way div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.way div > :only-child { grid-column: 1 / -1; }
.sheet-x { justify-self: center; padding: 8px 18px; cursor: pointer; font: 400 15px var(--body); color: var(--soft); background: none; border: 0; text-decoration: underline; text-underline-offset: 4px; }

.lightbox { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, .92); padding: 12px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; }

.gone { display: grid; place-items: center; padding: 24px; }
.gone-box .kalash { margin-bottom: 14px; }
.gone-box { max-width: 380px; text-align: center; background: var(--paper); padding: 36px 26px; border-radius: 4px; font-family: system-ui, sans-serif; }
.gone-box h1 { font-size: 22px; line-height: 1.35; margin-bottom: 10px; color: var(--main); }
.gone-box p { color: var(--soft); }
.gone-box a { display: inline-block; margin-top: 18px; color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  .seal { animation: none; }
  .seal, .envelope, .cover, .patrika, .bar, .env-art { transition-duration: .01s; transition-delay: 0s; }
  .seal-b { display: none; }
  .sheet-in { animation: none; }
}

/* the family's tune: starts when the guest opens the card, one button to silence it */
.tune-btn {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 16; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 50%; background: color-mix(in srgb, var(--deep) 88%, transparent); box-shadow: inset 0 0 0 1px rgba(236, 201, 111, .55), 0 6px 14px rgba(0, 0, 0, .35);
  opacity: 0; pointer-events: none; transition: opacity .4s 2s;
}
.opened .tune-btn { opacity: 1; pointer-events: auto; }
.tune-btn svg { width: 21px; height: 21px; fill: none; stroke: #ecc96f; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tune-btn .off { display: none; stroke: #fff; }
.tune-btn[aria-pressed=false] .off { display: block; }
.tune-btn[aria-pressed=false] svg { opacity: .75; }

/* English cards: a script face reads smaller than Devanagari at the same size */
html[lang=en] body.card h1, html[lang=en] body.card h2, html[lang=en] body.card h3 { letter-spacing: .01em; }
html[lang=en] body.card { font-size: 17.5px; }
