@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Tamil:wght@500&family=Cinzel:wght@600&family=Caveat:wght@700&display=swap');

/* =====================================================================
   Maalai Maatral — theme styles. Loaded only for layout "maalai-maatral".
   Jasmine curtain → three garland exchanges → the oonjal → the date on a
   jasmine-and-rose garland banner. Palette: magenta silk, emerald border, sunset gold.
   ===================================================================== */

.layout-maalai-maatral { --mm-rose: #c2185b; --mm-emerald: #0f7a55; --mm-gold: #f2c96a; --mm-ink: #4a0f2a; }

/* ---------------- Opening: a curtain of jasmine ---------------- */
.intro-theme { padding: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #ffd9c2, #f2a3b5 45%, #8a1f4a); }
.mmi { position: absolute; inset: 0; display: grid; place-items: center; }
.mmi-strings { position: absolute; inset: 0; display: flex; justify-content: space-between; padding: 0 1%; }
.mmi-strings i { position: relative; flex: none; width: 10px; height: calc(92% + var(--m) * 3%); transform-origin: 50% 0;
    background:
        radial-gradient(circle, #fffdf3 0 3.6px, #e8e2c6 4px, transparent 4.6px) 0 0 / 10px 11px repeat-y,
        linear-gradient(90deg, transparent 4.5px, #5f7d3a 4.5px 5.5px, transparent 5.5px);
    filter: drop-shadow(0 1px 1px rgba(80, 20, 40, .35)); animation: mmSway 3.6s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -.21s);
    transition: transform 1.4s cubic-bezier(.6, .05, .3, 1), opacity 1.4s; transition-delay: calc(var(--d) * .035s); }
.mmi-strings i::after { content: ''; position: absolute; left: 50%; bottom: -10px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
    background: radial-gradient(circle, #7a0f1e 0 2.4px, transparent 3px), conic-gradient(from 20deg, #d6334d, #f06a7f, #c2183a, #f06a7f, #d6334d, #a8102c, #f06a7f, #d6334d); box-shadow: 0 2px 3px rgba(0, 0, 0, .3); }
.mmi-strings i:nth-child(3n)::after { background: radial-gradient(circle, #b8560a 0 2.4px, transparent 3px), repeating-conic-gradient(#ffb02e 0 12deg, #e8851a 12deg 24deg); }
@keyframes mmSway { from { rotate: -1.6deg; } to { rotate: 1.6deg; } }
.mmi-card { position: relative; z-index: 2; margin: 0 18px; max-width: 360px; padding: 28px 24px; text-align: center; border-radius: 22px;
    background: rgba(74, 15, 42, .72); backdrop-filter: blur(4px); box-shadow: 0 0 0 1px rgba(242, 201, 106, .6), 0 20px 50px rgba(74, 15, 42, .45); transition: opacity .6s, transform .8s; }
.mmi-tamil { margin: 0 0 8px; font: 500 1.05rem 'Noto Serif Tamil', serif; color: var(--mm-gold); }
.mmi .intro-to { color: #fff2f6; font-size: 1.1rem; margin-bottom: 6px; }
.mmi .intro-names { color: var(--mm-gold); }
.mmi .intro-btn { color: #4a0f2a; background: linear-gradient(180deg, #fff1c9, #f2c96a); border-color: #fff1c9; }
/* the strings sweep aside from the middle outwards */
.intro.opening .mmi-strings i:nth-child(-n+12) { transform: translateX(-60vw) rotate(-18deg); opacity: 0; }
.intro.opening .mmi-strings i:nth-child(n+13) { transform: translateX(60vw) rotate(18deg); opacity: 0; }
.intro.opening .mmi-card { opacity: 0; transform: scale(.94); }
.intro-theme.opened { transition-delay: .2s; }

/* ---------------- Hero: the garland exchange ---------------- */
.layout-maalai-maatral .hero { padding: 0; display: block; min-height: 0; }
.layout-maalai-maatral .scroll-cue { display: none; }

.mm { --h: max(calc(100vh - var(--mm-off, 0px)), 560px); position: relative; width: 100%; height: var(--h); overflow: hidden; isolation: isolate; background: #f2a3b5; }
@supports (height: 100svh) { .mm { --h: max(calc(100svh - var(--mm-off, 0px)), 560px); } }
.mm-fill { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(26px) saturate(1.15); }
.mm-frame { position: absolute; top: 0; left: 50%; height: 100%; width: min(calc(var(--h) * 9 / 16), 100%); transform: translateX(-50%); container-type: inline-size; overflow: hidden; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mm-pose { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1s ease; }
.mm[data-state="rest"] .p1, .mm[data-state="ex1"] .p1, .mm[data-state="ex3"] .p1, .mm[data-state="ex2"] .p2,
.mm[data-state="swing"] .p3, .mm[data-state="done"] .p3 { opacity: 1; }
/* the oonjal sways gently once they sit down */
.mm .p3 { transform-origin: 50% 0; }
.mm[data-state="swing"] .p3, .mm[data-state="done"] .p3 { animation: mmSwing 4.2s ease-in-out infinite; }
@keyframes mmSwing { 0%, 100% { transform: rotate(-.7deg) translateX(-.6%) scale(1.02); } 50% { transform: rotate(.7deg) translateX(.6%) scale(1.02); } }
.mm-glow { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light;
    background: radial-gradient(ellipse at 50% 40%, rgba(255, 220, 160, .55), transparent 60%); animation: mmGlow 5s ease-in-out infinite alternate; }
@keyframes mmGlow { from { opacity: .5; } to { opacity: 1; } }

/* names over the sunset sky */
.mm-top { position: absolute; top: 3%; left: 7%; right: 7%; padding: 2.2cqw 3cqw 2.6cqw; text-align: center; border-radius: 4cqw; color: #fff4f7;
    background: radial-gradient(ellipse at 50% 50%, rgba(74, 15, 42, .72), rgba(74, 15, 42, .48) 75%, rgba(74, 15, 42, .28));
    box-shadow: 0 0 0 1px rgba(242, 201, 106, .5), 0 8px 24px rgba(74, 15, 42, .3); backdrop-filter: blur(3px); text-shadow: 0 1px 2px rgba(40, 6, 20, .85); transition: opacity .9s; }
.mm[data-state="rest"] .mm-top { opacity: 0; }
.mm-tamil { margin: 0; font: 500 3.2cqw/1.4 'Noto Serif Tamil', serif; color: var(--mm-gold); }
.mm-kick { margin: .6cqw 0 0; font: 600 2.3cqw/1.3 'Cinzel', serif; letter-spacing: .16em; text-transform: uppercase; }
.mm-top .names { margin: 1cqw 0 0; font-family: var(--hf); font-weight: 400; font-size: 10cqw; line-height: 1.05; white-space: nowrap; color: var(--mm-gold); }
.mm-top .names.long { font-size: 7.6cqw; }
.mm-top .names.xlong { font-size: 5.6cqw; white-space: normal; }
.mm-top .names .amp { display: inline-block; margin: 0 .2em; font-size: .6em; color: #fff4f7; }
.mm-sub { margin: .6cqw 0 0; font: italic 500 3.6cqw/1.3 'Cormorant Garamond', Georgia, serif; }

/* "1 of 3" exchange counter */
.mm-count { position: absolute; left: 50%; top: 31%; transform: translateX(-50%); display: grid; justify-items: center; gap: 1cqw; pointer-events: none; transition: opacity .6s; }
.mm[data-state="rest"] .mm-count, .mm[data-state="swing"] .mm-count, .mm[data-state="done"] .mm-count { opacity: 0; }
.mm-step { grid-area: 1 / 1; padding: 1cqw 3.4cqw; border-radius: 99px; font: 700 4.4cqw/1.2 'Caveat', cursive; color: #fff; background: rgba(194, 24, 91, .82); box-shadow: 0 0 0 1px rgba(255, 255, 255, .6);
    opacity: 0; transform: scale(.6); transition: opacity .4s, transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.mm[data-state="ex1"] .mm-step[data-n="1"], .mm[data-state="ex2"] .mm-step[data-n="2"], .mm[data-state="ex3"] .mm-step[data-n="3"] { opacity: 1; transform: none; }
.mm-dots { display: flex; gap: 1.4cqw; }
.mm-dots i { width: 2.4cqw; height: 2.4cqw; border-radius: 50%; background: rgba(255, 255, 255, .5); box-shadow: 0 0 0 1px rgba(194, 24, 91, .6); transition: background .3s, transform .3s; }
.mm[data-state="ex1"] .mm-dots i:nth-child(1), .mm[data-state="ex2"] .mm-dots i:nth-child(-n+2), .mm[data-state="ex3"] .mm-dots i { background: #f2c96a; transform: scale(1.15); }

/* the date on a jasmine-and-rose garland banner */
.mm-date { position: absolute; left: 50%; bottom: 4%; width: 74cqw; padding: 6cqw 4cqw 3cqw; transform: translate(-50%, 4cqw); display: grid; justify-items: center; text-align: center; border-radius: 4cqw;
    background: linear-gradient(180deg, rgba(74, 15, 42, .88), rgba(110, 18, 60, .9)); box-shadow: 0 0 0 1.5px var(--mm-gold), 0 0 0 5px rgba(74, 15, 42, .5), 0 10px 30px rgba(40, 6, 20, .5);
    color: #fff4f7; opacity: 0; transition: opacity .9s, transform 1s cubic-bezier(.2, .9, .3, 1.2); }
.mm[data-state="done"] .mm-date { opacity: 1; transform: translate(-50%, 0); }
.mm-garland { position: absolute; left: -3%; top: -2.6cqw; width: 106%; height: 9cqw; filter: drop-shadow(0 2px 2px rgba(40, 6, 20, .45)); }
.mm-date span { font: 600 2.2cqw/1.3 'Cinzel', serif; letter-spacing: .24em; text-transform: uppercase; color: var(--mm-gold); }
.mm-date b { margin-top: .6cqw; font: 600 7cqw/1.1 'Cinzel', serif; color: #fff4f7; }
.mm-date em { margin-top: .6cqw; font: italic 600 3.4cqw/1.2 'Cormorant Garamond', serif; }

.mm-hint { position: absolute; left: 0; right: 0; bottom: 1.2%; margin: 0; text-align: center; font: 700 3.4cqw 'Caveat', cursive; color: #fff; text-shadow: 0 1px 3px rgba(40, 6, 20, .9); opacity: 0; transition: opacity .8s .6s; }
.mm[data-state="done"] .mm-hint { opacity: .9; }

/* petals and akshata (created by theme.js) */
.mm-burst { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.mm-burst i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: calc(var(--s) * 1.25); margin: calc(var(--s) * -.6); border-radius: 50% 0 50% 0; background: var(--c);
    animation: mmPetal var(--t) cubic-bezier(.2, .6, .4, 1) forwards; }
.mm-burst i.rice { border-radius: 50%; width: calc(var(--s) * .45); height: calc(var(--s) * .7); }
@keyframes mmPetal {
    0% { transform: translate(0, 0) rotate(0); opacity: 1; }
    25% { transform: translate(calc(var(--dx) * .5), calc(var(--dy) - 6cqw)) rotate(140deg); }
    100% { transform: translate(var(--dx), calc(var(--dy) + 40cqw)) rotate(520deg); opacity: 0; }
}

.mm-melam { position: absolute; right: 12px; bottom: 40px; z-index: 6; border: 1px solid rgba(242, 201, 106, .7); border-radius: 99px; padding: 8px 14px; font: 600 13px var(--bf); color: #fff4f7; background: rgba(74, 15, 42, .6); backdrop-filter: blur(4px); cursor: pointer; }
.mm-melam[aria-pressed="true"] { background: linear-gradient(180deg, #fff1c9, #f2c96a); color: #4a0f2a; }
.mm-melam:focus-visible { outline: 2px solid var(--mm-gold); outline-offset: 2px; }
.mm-credit { position: absolute; left: 0; right: 0; bottom: 3px; z-index: 6; margin: 0; text-align: center; font-size: 9px; color: rgba(255, 244, 247, .7); text-shadow: 0 1px 2px rgba(40, 6, 20, .8); }
.mm-credit a { color: inherit; }

/* keep the bottom menu out of the way while the scene is on screen */
.layout-maalai-maatral .dock { transition: opacity .4s, translate .4s, visibility 0s; }
.layout-maalai-maatral.mm-at-top .dock { opacity: 0 !important; translate: 0 24px; visibility: hidden; pointer-events: none; transition: opacity .3s, translate .3s, visibility 0s .3s; }

/* ---------------- The rest of the invitation: silk and jasmine ---------------- */
.layout-maalai-maatral .inv-main { background: linear-gradient(#fde3ea, var(--bg) 420px); }
/* a jasmine string with a rose drapes between sections */
.layout-maalai-maatral .sec + .sec::before { content: ''; position: absolute; top: 0; left: 10%; right: 10%; height: 22px;
    background: radial-gradient(circle, #fffdf3 0 3.4px, #e2dbc0 3.8px, transparent 4.4px) 0 0 / 11px 11px repeat-x;
    -webkit-mask: radial-gradient(ellipse 52% 100% at 50% 0, transparent 70%, #000 71%) ; mask: radial-gradient(ellipse 52% 100% at 50% 0, transparent 70%, #000 71%); }
.layout-maalai-maatral .sec { position: relative; }
.layout-maalai-maatral .sec-title h2 { color: var(--mm-rose); }
.layout-maalai-maatral .sec-title .kick { color: var(--mm-emerald); }
.layout-maalai-maatral .card { border: 1px solid rgba(15, 122, 85, .35); box-shadow: inset 0 0 0 4px #fffaf6, inset 0 0 0 5px rgba(194, 24, 91, .3), 0 12px 30px rgba(194, 24, 91, .1); }
.layout-maalai-maatral .reveal { transform: translateY(16px) rotate(-1deg); transition: opacity .9s ease, transform 1s cubic-bezier(.3, 1.4, .5, 1); }
.layout-maalai-maatral .reveal.in { transform: none; }

@media (prefers-reduced-motion: reduce) {
    .mm *, .mmi * { animation: none !important; }
}

/* ---------------- Oonjal rituals ---------------- */
/* pidi suthal: red and yellow rice balls circle the couple, then fly to the four directions */
.mm-pidi { position: absolute; left: 50%; top: 52%; width: 0; height: 0; z-index: 3; pointer-events: none; opacity: 0; }
.mm-pidi i { position: absolute; left: -2.6cqw; top: -2.6cqw; width: 5.2cqw; height: 5.2cqw; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--c) 40%, color-mix(in srgb, var(--c), #000 25%)); box-shadow: 0 1cqw 1.6cqw rgba(40, 6, 20, .35);
    transform: rotate(calc(var(--i) * 90deg)) translateX(30cqw) rotate(calc(var(--i) * -90deg)); }
.mm[data-state="swing"] .mm-pidi { opacity: 1; animation: mmOrbit 3s cubic-bezier(.45, 0, .55, 1) forwards; }
.mm[data-state="swing"] .mm-pidi i { animation: mmThrow .9s ease-in 3s forwards; }
@keyframes mmOrbit { from { transform: scaleY(.55) rotate(0); } to { transform: scaleY(.55) rotate(720deg); } }
@keyframes mmThrow { to { transform: rotate(calc(var(--i) * 90deg)) translateX(90cqw) rotate(calc(var(--i) * -90deg)) scale(.4); opacity: 0; } }

/* aarathi: a brass plate with a lit diya circles in front of the couple */
.mm-aarathi { position: absolute; left: 50%; top: 60%; width: 0; height: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .6s; }
.mm-plate { position: absolute; left: -8cqw; top: -2.6cqw; width: 16cqw; height: 5.2cqw; border-radius: 50%;
    background: radial-gradient(ellipse at 50% 40%, #d62839 0 38%, #f2c96a 40% 52%, #b8781e 54% 70%, #8a5a12 72%); box-shadow: 0 1.2cqw 2cqw rgba(40, 6, 20, .4), 0 0 5cqw rgba(255, 180, 60, .45); }
.mm-diya { position: absolute; left: 50%; top: -2.4cqw; width: 2.2cqw; height: 3.4cqw; margin-left: -1.1cqw; border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
    background: radial-gradient(ellipse at 50% 70%, #fff6c8 0 25%, #ffb627 50%, #e8571a 80%); box-shadow: 0 0 3cqw 1cqw rgba(255, 180, 40, .7); transform-origin: 50% 100%; animation: mmFlick .5s ease-in-out infinite alternate; }
@keyframes mmFlick { to { transform: scaleY(.8) rotate(4deg); } }
.mm[data-state="swing"] .mm-aarathi { opacity: 1; animation: mmCircle 2.2s linear 3s 2; }
@keyframes mmCircle {
    0% { transform: translate(0, -14cqw); } 25% { transform: translate(15cqw, 0); } 50% { transform: translate(0, 12cqw); }
    75% { transform: translate(-15cqw, 0); } 100% { transform: translate(0, -14cqw); }
}
.mm-ritual { position: absolute; left: 50%; top: 31%; margin: 0; padding: 1cqw 3.4cqw; transform: translateX(-50%); white-space: nowrap; border-radius: 99px;
    font: 700 4.2cqw/1.2 'Caveat', cursive; color: #fff; background: rgba(15, 122, 85, .85); box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); opacity: 0; transition: opacity .5s; pointer-events: none; }
.mm[data-state="swing"] .mm-ritual { opacity: 1; }

/* ---------------- Nalangu: who finds the ring first? ---------------- */
.mm-nalangu { position: relative; padding: 56px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); text-align: center;
    background: radial-gradient(circle at 50% 0, rgba(242, 201, 106, .25), transparent 60%), linear-gradient(#fde3ea, #fff6f8); }
.mm-n-kick { margin: 0; font: 600 .78rem 'Cinzel', serif; letter-spacing: .28em; text-transform: uppercase; color: var(--mm-emerald); }
.mm-nalangu h2 { margin: 6px 0 10px; font-family: var(--hf); font-weight: 400; font-size: clamp(2rem, 8vw, 2.8rem); color: var(--mm-rose); }
.mm-n-text { max-width: 34ch; margin: 0 auto 18px; color: var(--mm-ink); }
.mm-pot { position: relative; width: min(220px, 60vw); margin: 0 auto 18px; }
.mm-pot svg { display: block; width: 100%; height: auto; overflow: visible; }
.mm-ring { opacity: 0; transform: translateY(24px); transition: opacity .3s, transform .6s cubic-bezier(.3, 1.6, .5, 1); }
.mm-nalangu.found .mm-ring { opacity: 1; transform: translateY(-10px); }
.mm-hand { position: absolute; top: -6%; width: 18%; height: 34%; border-radius: 40% 40% 45% 45%; background: linear-gradient(#e8b996, #c98d6a); box-shadow: inset 0 -6px 0 #c2183a; opacity: 0; }
.mm-hand.l { left: 28%; transform: rotate(14deg); } .mm-hand.r { right: 28%; transform: rotate(-14deg); }
.mm-nalangu.dipping .mm-hand { opacity: 1; animation: mmDip .5s ease-in-out 3 alternate; }
@keyframes mmDip { to { translate: 0 22%; } }
.mm-n-pick { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.mm-n-pick .ibtn[aria-pressed="true"] { outline: 2px solid var(--mm-gold); outline-offset: 2px; }
.mm-n-result { min-height: 1.6em; margin: 14px 0 0; font: 700 1.35rem 'Caveat', cursive; color: var(--mm-rose); }
