/* Kaagaz Kahani: hand-drawn paper layers placed in 3D space. Phone first. */
:root {
  --ink: #3a2a22; --ink2: #6b5245; --gold: #b88a35; --gold2: #d9b46a; --paper: #f7f0e2; --rose: #b4463f;
  --sky-a: #f6d3b5; --sky-b: #f9ecdc; --night: 0;
  --f-names: 'Pinyon Script', 'Great Vibes', cursive;
  --f-head: 'Cormorant Garamond', Georgia, serif;
  --f-caps: 'Cinzel', 'Cormorant Garamond', serif;
  --f-hand: 'Caveat', 'Segoe Print', cursive;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #f3e6d2; color: var(--ink); -webkit-text-size-adjust: 100%; }
body { font: 500 17px/1.45 var(--f-head); overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
html:not(.kk-open) body { overflow: hidden; height: 100%; }
button, input, textarea { font: inherit; color: inherit; }

/* ---------- world ---------- */
#kkSky { position: fixed; inset: 0; background: linear-gradient(180deg, var(--sky-a) 0%, var(--sky-b) 78%); z-index: 0; }
#kkStars { position: absolute; inset: 0 0 35% 0; opacity: var(--night); pointer-events: none;
  background-image: radial-gradient(1.4px 1.4px at 12% 18%, #fff8e0 50%, transparent 51%), radial-gradient(1px 1px at 28% 8%, #fff 50%, transparent 51%), radial-gradient(1.6px 1.6px at 44% 26%, #ffe9b8 50%, transparent 51%), radial-gradient(1px 1px at 61% 12%, #fff 50%, transparent 51%), radial-gradient(1.3px 1.3px at 77% 22%, #fff4d0 50%, transparent 51%), radial-gradient(1px 1px at 90% 6%, #fff 50%, transparent 51%), radial-gradient(1.2px 1.2px at 8% 40%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 52% 44%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 85% 46%, #ffefc8 50%, transparent 51%), radial-gradient(1px 1px at 36% 52%, #fff 50%, transparent 51%);
  background-size: 260px 260px; animation: kkTw 5s ease-in-out infinite alternate; }
@keyframes kkTw { from { filter: brightness(.8); } to { filter: brightness(1.15); } }
#kkStage { position: fixed; inset: 0; overflow: hidden; z-index: 1; touch-action: pan-y; contain: strict; }
#kkGrain { position: fixed; inset: 0; z-index: 3; pointer-events: none; background: url(assets/grain.webp) 0 0 / 256px 256px; opacity: .16; mix-blend-mode: normal; }
#kkTrack { position: relative; z-index: 0; width: 1px; pointer-events: none; }
.kk-l { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; will-change: transform, opacity; backface-visibility: hidden; pointer-events: none; user-select: none; -webkit-user-select: none; }
.kk-l.off { visibility: hidden; }
.kk-l img { display: block; width: 100%; height: 100%; -webkit-user-drag: none; }
.kk-strip { background-repeat: repeat-x; background-position: 50% 100%; background-size: auto 100%; }
.kk-l.kk-top { background-position: 50% 0; }
.kk-ui { pointer-events: auto; }
.kk-bob { animation: kkBob 7s ease-in-out infinite alternate; }
@keyframes kkBob { from { translate: 0 -1.5%; } to { translate: 0 1.5%; } }

/* ---------- thread (gold, hand drawn) ---------- */
.kk-thread { overflow: visible; }
.kk-thread path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: var(--off, 1); }
.kk-thread .t1 { stroke: var(--gold); stroke-width: 2.6; }
.kk-thread .t2 { stroke: #e9cf8e; stroke-width: 1; opacity: .8; }
.kk-thread .t3 { stroke: var(--ink2); stroke-width: 1.4; opacity: .7; }
.kk-thread circle.nib { fill: #f4d98f; filter: drop-shadow(0 0 4px rgba(255,210,120,.9)); }
.kk-note { font: 600 22px/1.1 var(--f-hand); color: var(--ink); white-space: nowrap; text-align: center; }
.kk-dark .kk-note { color: #f4e6c8; }

/* ---------- text on the sky ---------- */
.kk-cap { text-align: center; padding: 0 6px; }
.kk-bless { font: 500 15px/1.4 'Tiro Devanagari Hindi', serif; color: var(--rose); margin: 0 0 6px; letter-spacing: .02em; }
.kk-eyebrow { font: 500 11.5px/1.5 var(--f-caps); letter-spacing: .22em; text-transform: uppercase; color: var(--ink2); margin: 0 0 8px; }
.kk-names { font: 400 64px/0.98 var(--f-names); margin: 4px 0 6px; color: var(--ink); font-weight: 400; }
.kk-names span { display: block; }
.kk-names i { display: block; font: italic 500 30px/1 var(--f-head); color: var(--gold); margin: 2px 0 4px; }
.kk-line { font: italic 500 18px/1.35 var(--f-head); color: var(--ink2); margin: 6px auto 12px; max-width: 16em; }
.kk-date { font: 600 13px/1.4 var(--f-caps); letter-spacing: .16em; text-transform: uppercase; margin: 0; }
.kk-city { font: 500 12px/1.5 var(--f-caps); letter-spacing: .3em; text-transform: uppercase; color: var(--ink2); margin: 4px 0 0; }

/* ---------- paper cards ---------- */
.kk-card { position: relative; background: var(--paper) url(assets/grain.webp) 0 0 / 256px; border-radius: 3px; padding: 26px 22px 24px; text-align: center;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 22px 44px -14px rgba(50,25,10,.45), 0 4px 10px rgba(50,25,10,.18); }
.kk-card::before { content: ''; position: absolute; inset: 7px; border: 1px solid rgba(184,138,53,.55); border-radius: 2px; pointer-events: none; }
.kk-card::after { content: ''; position: absolute; inset: 10px; border: .6px solid rgba(184,138,53,.3); border-radius: 1px; pointer-events: none; }
.kk-card > * { position: relative; z-index: 1; }
.kk-k { font: 500 10.5px/1.5 var(--f-caps); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); margin: 0 0 6px; }
.kk-h { font: 600 31px/1.08 var(--f-head); margin: 0 0 8px; color: var(--ink); }
.kk-h.kk-script { font: 400 46px/1 var(--f-names); }
.kk-p { margin: 0 0 10px; color: var(--ink2); font-size: 16.5px; }
.kk-full { font: 600 22px/1.15 var(--f-head); margin: 10px 0 2px; color: var(--ink); }
.kk-fam { font: italic 500 15.5px/1.35 var(--f-head); color: var(--ink2); margin: 0; }
.kk-with { font: 400 30px/1 var(--f-names); color: var(--gold); margin: 8px 0 0; }
.kk-rule { display: block; width: 120px; height: 14px; margin: 10px auto; color: var(--gold); }
.kk-meta { font: 600 12.5px/1.6 var(--f-caps); letter-spacing: .12em; text-transform: uppercase; margin: 6px 0 2px; color: var(--ink); }
.kk-at { font: italic 500 17px/1.35 var(--f-head); color: var(--ink2); margin: 0 0 4px; }
.kk-dress { display: inline-block; font: 600 18px/1.2 var(--f-hand); color: var(--rose); margin: 6px 0 0; padding: 2px 10px; border-bottom: 1.5px dashed rgba(180,70,63,.45); }
.kk-icon { display: block; width: 64px; height: 64px; margin: -4px auto 6px; color: var(--ink); }
.kk-icon path, .kk-icon circle, .kk-icon ellipse { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: var(--off, 1); }
.kk-icon .g { stroke: var(--gold); }
.kk-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.kk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 10px 18px; border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--ink); color: #f8efdc; font: 600 12px/1 var(--f-caps); letter-spacing: .14em; text-transform: uppercase; box-shadow: 0 8px 18px -8px rgba(40,20,10,.6); }
.kk-btn.kk-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.2px rgba(58,42,34,.55); }
.kk-btn:active { transform: translateY(1px); }

/* story */
.kk-story { list-style: none; margin: 14px 0 0; padding: 0 0 0 26px; text-align: left; position: relative; }
.kk-story li { position: relative; margin: 0 0 14px; }
.kk-story li:last-child { margin-bottom: 0; }
.kk-story li::before { content: ''; position: absolute; left: -24px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 2px var(--gold); }
.kk-story b { display: block; font: 600 12px/1.3 var(--f-caps); letter-spacing: .16em; color: var(--gold); }
.kk-story strong { display: block; font: 600 19px/1.2 var(--f-head); color: var(--ink); }
.kk-story span { display: block; font-size: 15.5px; color: var(--ink2); line-height: 1.38; }
.kk-story::before { content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 0; border-left: 1.5px dashed rgba(184,138,53,.7); }

/* families */
.kk-fams { display: grid; gap: 14px; margin-top: 10px; }
.kk-fg h3 { font: 400 30px/1 var(--f-names); color: var(--rose); margin: 0 0 4px; }
.kk-fg p { margin: 0 0 6px; }
.kk-fg b { display: block; font: 600 18px/1.2 var(--f-head); color: var(--ink); }
.kk-fg span { display: block; font: italic 500 14.5px/1.3 var(--f-head); color: var(--ink2); }

/* countdown */
.kk-count { display: flex; justify-content: center; gap: 8px; margin: 12px 0 4px; }
.kk-count div { min-width: 56px; padding: 8px 4px 6px; border-radius: 3px; background: rgba(184,138,53,.1); box-shadow: inset 0 0 0 1px rgba(184,138,53,.4); }
.kk-count b { display: block; font: 600 25px/1 var(--f-head); color: var(--ink); font-variant-numeric: tabular-nums; }
.kk-count span { display: block; font: 500 9.5px/1.6 var(--f-caps); letter-spacing: .16em; text-transform: uppercase; color: var(--ink2); }
.kk-more { margin: 12px 0 0; padding: 10px 0 0; border-top: 1px dashed rgba(184,138,53,.5); text-align: left; }
.kk-more p { margin: 0 0 6px; font-size: 15px; color: var(--ink2); }
.kk-more b { color: var(--ink); font-weight: 600; }
.kk-more a { color: var(--rose); }

/* RSVP */
.kk-form { text-align: left; margin-top: 8px; }
.kk-form label { display: block; margin: 0 0 9px; }
.kk-form label > span { display: block; font: 500 10.5px/1.6 var(--f-caps); letter-spacing: .16em; text-transform: uppercase; color: var(--ink2); }
.kk-form input:not([type=radio]), .kk-form textarea { width: 100%; padding: 9px 11px; border: 0; border-radius: 3px; background: rgba(255,255,255,.75); box-shadow: inset 0 0 0 1px rgba(107,82,69,.35); font-size: 16px; outline: none; }
.kk-form input:focus, .kk-form textarea:focus { box-shadow: inset 0 0 0 1.6px var(--gold); }
.kk-row { display: grid; grid-template-columns: 84px 1fr; gap: 8px; }
.kk-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 10px; }
.kk-choice label { margin: 0; position: relative; }
.kk-choice input { position: absolute; opacity: 0; }
.kk-choice span { display: block; text-align: center; padding: 10px 4px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(107,82,69,.35); font: 600 15px/1.1 var(--f-head); cursor: pointer; }
.kk-choice input:checked + span { background: var(--ink); color: #f8efdc; box-shadow: none; }
.kk-form .kk-btn { width: 100%; margin-top: 2px; }
.kk-msg { min-height: 1.3em; margin: 8px 0 0; text-align: center; font: 600 19px/1.25 var(--f-hand); color: var(--rose); }
.kk-form.sent .kk-msg { color: #2f6b4f; }

/* closing */
.kk-contacts { list-style: none; padding: 0; margin: 12px 0 4px; display: grid; gap: 8px; }
.kk-contacts li { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; padding: 8px 0; border-top: 1px dashed rgba(184,138,53,.45); }
.kk-contacts b { display: block; font: 600 17px/1.2 var(--f-head); }
.kk-contacts small { display: block; font: italic 500 14px/1.2 var(--f-head); color: var(--ink2); }
.kk-contacts span.kk-cl { display: flex; gap: 6px; flex: none; }
.kk-contacts a { font: 600 10.5px/1 var(--f-caps); letter-spacing: .1em; text-transform: uppercase; text-decoration: none; color: var(--ink); padding: 8px 10px; border-radius: 99px; box-shadow: inset 0 0 0 1px rgba(58,42,34,.4); }
.kk-sign { font: 600 21px/1.25 var(--f-hand); color: var(--ink2); margin: 10px 0 0; }
.kk-tag { font: 600 12px/1.5 var(--f-caps); letter-spacing: .16em; color: var(--gold); margin: 6px 0 0; }

/* ---------- interface ---------- */
#kkHud { position: fixed; left: 0; right: 0; top: 0; z-index: 6; padding: calc(env(safe-area-inset-top) + 12px) 16px 0; pointer-events: none; display: flex; justify-content: center; }
#kkChap { font: 500 10.5px/1 var(--f-caps); letter-spacing: .26em; text-transform: uppercase; color: var(--ink2); padding: 8px 14px; border-radius: 99px; background: rgba(247,240,226,.72); box-shadow: 0 0 0 1px rgba(184,138,53,.3); opacity: 0; transition: opacity .5s; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.kk-open #kkChap { opacity: 1; }
#kkDots { position: fixed; right: 8px; top: 50%; transform: translateY(-50%); z-index: 6; display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .5s; }
.kk-open #kkDots { opacity: 1; }
#kkDots button { width: 26px; height: 22px; border: 0; padding: 0; background: none; cursor: pointer; display: grid; place-items: center; }
#kkDots button i { width: 6px; height: 6px; border-radius: 50%; background: rgba(58,42,34,.32); transition: transform .3s, background .3s; }
#kkDots button.on i { background: var(--gold); transform: scale(1.6); box-shadow: 0 0 0 2px rgba(247,240,226,.8); }
.kk-music { position: fixed; z-index: 7; left: 14px; bottom: calc(env(safe-area-inset-bottom) + 14px); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(247,240,226,.9); color: var(--ink); box-shadow: 0 6px 18px -6px rgba(40,20,10,.5), 0 0 0 1px rgba(184,138,53,.4); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .5s; }
.kk-open .kk-music { opacity: 1; }
.kk-music svg { width: 20px; height: 20px; }
.kk-music i { position: absolute; inset: -4px; border-radius: 50%; border: 1px solid rgba(184,138,53,.6); opacity: 0; }
.kk-music.on i { animation: kkPulse 2.4s ease-out infinite; }
.kk-music:not(.on)::after { content: ''; position: absolute; width: 24px; height: 1.6px; background: currentColor; transform: rotate(-45deg); border-radius: 2px; }
@keyframes kkPulse { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }
#kkHint { position: fixed; z-index: 6; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 18px); margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font: 600 19px/1 var(--f-hand); color: var(--ink2); pointer-events: none; opacity: 0; transition: opacity .6s; }
#kkHint svg { width: 22px; height: 32px; }
#kkHint span { padding: 6px 14px 7px; border-radius: 99px; background: rgba(247,240,226,.82); box-shadow: 0 0 0 1px rgba(184,138,53,.3); }
#kkHint svg { filter: drop-shadow(0 0 3px rgba(247,240,226,.9)); }
#kkHint path { stroke-dasharray: 1 1; animation: kkDraw 2.2s ease-in-out infinite; }
@keyframes kkDraw { 0% { stroke-dashoffset: 1; } 55%, 80% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -1; } }
.kk-open.kk-at0 #kkHint { opacity: 1; }
.kk-dark #kkDots button i { background: rgba(244,230,200,.4); }

/* ---------- gate ---------- */
.kk-gate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--ink); }
.kk-door { position: absolute; top: 0; bottom: 0; width: 50.5%; background: #f3e8d4 url(assets/grain.webp) 0 0 / 256px; transition: transform 1.5s cubic-bezier(.7,0,.2,1), box-shadow 1.5s; }
.kk-door-l { left: 0; box-shadow: inset -1px 0 0 rgba(184,138,53,.35); }
.kk-door-r { right: 0; box-shadow: inset 1px 0 0 rgba(184,138,53,.35); }
.kk-door::after { content: ''; position: absolute; top: 16px; bottom: 16px; width: calc(100% - 16px); border: 1px solid rgba(184,138,53,.45); }
.kk-door-l::after { left: 16px; border-right: 0; }
.kk-door-r::after { right: 16px; border-left: 0; }
.kk-gate-in { position: relative; max-width: 340px; transition: opacity .6s, transform .8s; }
.kk-seal { width: 104px; height: 104px; color: var(--gold); display: block; margin: 0 auto 10px; }
.kk-seal-ring { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: kkRing 2.4s .2s cubic-bezier(.6,0,.3,1) forwards; }
.kk-seal-ring + .kk-seal-ring { animation-delay: .6s; }
@keyframes kkRing { to { stroke-dashoffset: 0; } }
.kk-seal text { font: 400 38px var(--f-names); fill: var(--ink); }
.kk-gate-bless { font: 500 14px/1.4 'Tiro Devanagari Hindi', serif; color: var(--rose); margin: 0 0 10px; }
.kk-gate-k { font: 500 11px/1.6 var(--f-caps); letter-spacing: .24em; text-transform: uppercase; color: var(--ink2); margin: 0; }
.kk-gate-names { font: 400 54px/1.05 var(--f-names); margin: 8px 0 6px; font-weight: 400; }
.kk-gate-when { font: 600 12.5px/1.5 var(--f-caps); letter-spacing: .18em; text-transform: uppercase; margin: 0 0 22px; }
.kk-enter { opacity: .4; pointer-events: none; transition: opacity .4s; }
.kk-gate.ready .kk-enter { opacity: 1; pointer-events: auto; }
.kk-gate-note { font: 600 17px/1 var(--f-hand); color: var(--ink2); margin: 14px 0 0; }
.kk-bar { width: 120px; height: 1.5px; margin: 18px auto 0; background: rgba(184,138,53,.25); overflow: hidden; }
.kk-bar i { display: block; height: 100%; background: var(--gold); transform: scaleX(0); transform-origin: 0 50%; transition: transform .3s; }
.kk-gate.ready .kk-bar { opacity: 0; transition: opacity .6s; }
.kk-gate.out .kk-gate-in { opacity: 0; transform: scale(.96); }
.kk-gate.out .kk-door-l { transform: translateX(-102%); box-shadow: 20px 0 40px -10px rgba(40,20,10,.35); }
.kk-gate.out .kk-door-r { transform: translateX(102%); box-shadow: -20px 0 40px -10px rgba(40,20,10,.35); }
.kk-gate.out { pointer-events: none; }

@media (min-width: 760px) {
  .kk-names { font-size: 76px; }
  #kkDots { right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .kk-bob, #kkStars, #kkHint path { animation: none; }
}
