/* World: the Bhatt-side invitation — Aipan rice-paste line on geru, teal Kumaoni doors, cream paper, maroon ink. */
:root {
  --paper: #fff4de;
  --paper-deep: #f5e6c8;
  --ink: #7d242d;
  --ink-soft: #8c4a4c;        /* 5.6:1 on paper */
  --geru: #96382f;
  --geru-deep: #6f2620;
  --rice: #fbf3e4;
  --teal: #244f5f;
  --teal-deep: #183a47;
  --brass: #af8b4a;
  --night: #1a0a0c;

  --script: 'Pinyon Script', 'Tiro Devanagari Hindi', 'Snell Roundhand', cursive;
  --serif: 'Libre Baskerville', 'Tiro Devanagari Hindi', Baskerville, Georgia, serif;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --t-fast: .15s; --t-medium: .35s; --t-slow: .7s;

  --col: min(100vw, 520px);
  --gap: 2px;
  --shadow-lift: 0 10px 28px rgba(0, 0, 0, .28);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100svh;
  background: var(--paper);
  /* paper fibre */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font: 400 16px/1.55 var(--serif);
  -webkit-tap-highlight-color: transparent;
}
:lang(hi) body, [lang=hi] body { font-size: 17px; }
::selection { background: var(--ink); color: var(--paper); }
input { caret-color: var(--ink); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.script { font-family: var(--script); font-weight: 400; letter-spacing: 0; line-height: 1.05; }
.picker { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- language toggle ---------- */
.lang {
  position: absolute; z-index: 30; top: max(10px, env(safe-area-inset-top)); right: max(10px, calc(50vw - 260px + 10px));
  display: flex; gap: 2px; padding: 3px; border: 1px solid rgba(125, 36, 45, .25); border-radius: 999px;
  background: rgba(255, 244, 222, .92); cursor: pointer;
}
.lang span { min-width: 34px; padding: 5px 8px; border-radius: 999px; font-size: 13px; line-height: 1; text-align: center; transition: background var(--t-fast), color var(--t-fast); }
.lang span[data-l=hi] { font-family: 'Tiro Devanagari Hindi', serif; font-size: 15px; }
html[lang=en] .lang [data-l=en], html[lang=hi] .lang [data-l=hi] { background: var(--ink); color: var(--paper); }

/* ---------- threshold (doors) ---------- */
.threshold {
  position: fixed; inset: 0; z-index: 20;
  display: grid; justify-items: center; align-content: center; gap: clamp(14px, 3svh, 28px);
  padding: max(56px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  background: inherit; background-color: var(--paper);
  transition: opacity .5s var(--ease-out-quart) 1.25s, visibility 0s linear 1.8s;
}
.threshold::after { /* misty hills from the film */
  content: ''; position: absolute; inset: auto 0 0; height: 22svh; z-index: -1;
  background:
    radial-gradient(120% 90% at 30% 120%, #c9cdbd 0 45%, transparent 46%),
    radial-gradient(110% 80% at 85% 125%, #bfc4b2 0 45%, transparent 46%);
  opacity: .55;
}
.couple { margin: 0; font-size: clamp(40px, 12vw, 56px); color: var(--ink); text-align: center; }
.hint { margin: 0; font-style: italic; font-size: 15px; color: var(--ink-soft); text-align: center; max-width: 28ch; }
.doorway {
  position: relative; display: block; padding: 0; border: 0; background: none; cursor: pointer;
  height: min(62svh, 560px); aspect-ratio: 556 / 894;
  perspective: 1200px; transform-origin: 50% 52%;
  transition: transform 1.1s cubic-bezier(.55, 0, .2, 1) .75s;
}
.doorway > * { position: absolute; }
.frame { inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
/* the opening the doors cover: left 7.73%, top 4.36%, 84.54% × 92.28% */
.opening { left: 7.73%; top: 4.36%; width: 84.54%; height: 92.28%; overflow: hidden; background: var(--geru-deep); z-index: 0; }
/* frame.webp's opening has a light fringe that reads as a white line round the doors: cover it with the frame's own teal */
.doorway::after { content: ''; position: absolute; left: 7.73%; top: 4.36%; width: 84.54%; height: 92.28%; z-index: 3; pointer-events: none; box-shadow: 0 0 0 1.5px #1c3c47; }
.behind { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scale(1.08); transition: transform 1.6s var(--ease-out-expo) .2s; }
.door { top: 4.36%; width: 42.27%; height: 92.28%; z-index: 2; transition: transform 1.3s cubic-bezier(.45, .05, .2, 1), filter 1.3s; }
.door-l { left: 7.73%; transform-origin: 0 50%; }
.door-r { left: 50%; transform-origin: 100% 50%; }
.threshold:not(.is-open) .doorway:active .door-l { transform: rotateY(6deg); }
.threshold:not(.is-open) .doorway:active .door-r { transform: rotateY(-6deg); }
.threshold.is-open .door { animation: none; }
.threshold.is-open .door-l { transform: rotateY(100deg); filter: brightness(.45); }
.threshold.is-open .door-r { transform: rotateY(-100deg); filter: brightness(.45); }
.threshold.is-open .behind { transform: scale(1); }
.threshold.is-open .doorway { transform: scale(2.6); }
.threshold.is-open { opacity: 0; visibility: hidden; }
.threshold.is-locked .doorway { cursor: default; }
/* "tap here": rings ripple out from the handles until the doors are opened */
.tap-ring {
  left: 50%; top: 52%; z-index: 4; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(232, 196, 120, .95); box-shadow: 0 0 14px rgba(232, 196, 120, .6); opacity: 0;
}
.threshold.is-open .tap-ring, .threshold.is-locked .tap-ring { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .tap-ring { animation: ripple 2.6s var(--ease-out-quart) 1.6s infinite; }
  .tap-ring + .tap-ring { animation-delay: 1.95s; }
}
@media (prefers-reduced-motion: reduce) { .tap-ring { opacity: .9; } }
@keyframes ripple { 0% { opacity: 0; transform: scale(.45); } 12% { opacity: 1; } 55%, 100% { opacity: 0; transform: scale(1.7); } }
@media (prefers-reduced-motion: no-preference) {
  .threshold:not(.is-open):not(.is-locked) .door { animation: knock 1.4s var(--ease-out-quart) .9s 1; }
  .door-r { animation-delay: 1s !important; }
}
@keyframes knock { 0%, 100% { transform: rotateY(0); } 30% { transform: rotateY(var(--k, 7deg)); } 60% { transform: rotateY(0); } }
.door-r { --k: -7deg; }
@media (prefers-reduced-motion: reduce) {
  .door, .doorway, .behind { transition-duration: .01s !important; }
  .threshold { transition: opacity .4s, visibility 0s linear .4s; }
}

/* ---------- home ---------- */
main { width: var(--col); margin: 0 auto; }
.hero { position: relative; overflow: hidden; background: var(--paper-deep); }
/* never taller than the screen, so the Add photos seal is always in the first view */
.hero-scene { display: block; width: 100%; height: min(calc(100svh - 62px), calc(var(--col) * 1471 / 828)); object-fit: cover; object-position: 50% 35%; }
.hero-copy {
  position: absolute; left: 0; right: 0; top: var(--band-top, 15%);
  display: grid; justify-items: center; gap: 2px; padding: 0 16%;
  text-align: center; transform: translateX(var(--band-shift, 0));
}
.hero-couple { margin: 0; font-size: clamp(18px, 5.4vw, 26px); color: var(--ink-soft); }
.hero-fn { margin: 0; font-size: clamp(44px, 13.5vw, 66px); color: var(--ink); text-wrap: balance; }
.hero-fn.is-long { font-size: clamp(34px, 9.6vw, 48px); }
.hero-fn:lang(hi) { font-size: clamp(40px, 11vw, 54px); line-height: 1.25; }
.hero-meta { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ink); font-style: italic; text-wrap: balance; }
:lang(hi) .hero-meta { font-style: normal; font-size: 15px; }
@media (prefers-reduced-motion: no-preference) {
  body.is-entering .hero-copy > * { animation: rise .9s var(--ease-out-expo) both; }
  body.is-entering .hero-fn { animation-delay: .08s; }
  body.is-entering .hero-meta { animation-delay: .16s; }
  body.is-entering .seal { animation: settle 1s var(--ease-out-expo) .3s both; }
}
/* a nudge downwards to the album; gone once the guest scrolls */
.more-cue {
  position: absolute; left: 50%; bottom: 10px; z-index: 2; width: 44px; height: 44px; margin-left: -22px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 244, 222, .94); color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  transition: opacity var(--t-medium), transform var(--t-medium) var(--ease-out-quart);
}
.more-cue svg { width: 24px; height: 24px; transform: rotate(-90deg); }
.more-cue.is-gone { opacity: 0; transform: translateY(10px); pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .more-cue:not(.is-gone) svg { animation: nudge 2.2s ease-in-out 1.4s infinite; }
}
@keyframes nudge { 0%, 50%, 100% { transform: rotate(-90deg) translateX(0); } 25% { transform: rotate(-90deg) translateX(-6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes settle { from { opacity: 0; transform: translate(-50%, 12px) scale(.86); } }

/* the seal: where the couple stood in the card scenes */
.seal {
  position: absolute; left: 50%; top: min(61%, calc(100% - 172px)); transform: translate(-50%, 0);
  width: 148px; height: 148px; border-radius: 50%;
  display: grid; place-content: center; justify-items: center; gap: 3px;
  background: radial-gradient(circle at 50% 38%, #a8443a, var(--geru) 58%, var(--geru-deep));
  color: var(--rice); cursor: pointer; text-align: center;
  box-shadow: var(--shadow-lift), inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: transform var(--t-medium) var(--ease-out-expo);
}
.seal:active { transform: translate(-50%, 0) scale(.95); }
.seal-ring { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.seal-ring circle { fill: none; stroke: var(--rice); stroke-width: 1.4; opacity: .9; }
.seal-ring .dots { stroke-width: 2.2; stroke-dasharray: 0 7.6; stroke-linecap: round; opacity: .75; }
.seal-hi { font-family: 'Tiro Devanagari Hindi', serif; font-size: 22px; line-height: 1.1; }
.seal-en { font-style: italic; font-size: 13.5px; opacity: .92; }
.seal:has(.picker:focus-visible), .fab:has(.picker:focus-visible) { outline: 2px solid var(--teal); outline-offset: 4px; }

.fab {
  position: fixed; z-index: 15; right: max(16px, calc(50vw - 260px + 16px)); bottom: max(18px, env(safe-area-inset-bottom));
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; padding: 10px;
  background: radial-gradient(circle at 50% 38%, #a8443a, var(--geru) 58%, var(--geru-deep));
  color: var(--rice); text-align: center; cursor: pointer; box-shadow: var(--shadow-lift);
  font-size: 12.5px; line-height: 1.15; font-style: italic;
  transition: transform var(--t-medium) var(--ease-out-expo), opacity var(--t-medium);
}
:lang(hi) .fab { font-style: normal; font-size: 14px; }
.fab.is-away { transform: scale(.6); opacity: 0; pointer-events: none; }
.fab:active { transform: scale(.94); }

/* ---------- tabs (sticky) + function filter (Albums) ---------- */
.rail {
  position: sticky; top: 0; z-index: 10; display: flex; gap: 6px; padding: 11px 12px;
  background: var(--paper); border-bottom: 1px solid rgba(125, 36, 45, .14);
}
.tab, .chip {
  min-width: 0; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid rgba(125, 36, 45, .32); border-radius: 999px; background: transparent; color: var(--ink);
}
.tab { flex: 1 1 0; padding: 9px 6px; font: 15px/20px var(--serif); }
.chips { display: flex; gap: 5px; padding: 14px 12px 0; } /* all five functions fit one line, down to 360 px phones */
.chip { flex: 0 1 auto; padding: 8px 7px; font: clamp(12.5px, 3.6vw, 14px) var(--serif); }
.tab[aria-pressed=true], .chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--rice); }

/* ---------- live: one framed collage at a time on a geru stage with an Aipan border ---------- */
.album.is-live { background: radial-gradient(130% 70% at 50% 34%, #8e3a30, var(--geru-deep) 76%); }
.stage {
  position: relative; display: grid; min-height: calc(100svh - 62px); overflow: hidden;
  padding: 26px 20px calc(104px + env(safe-area-inset-bottom));
}
.stage::before { /* rice-paste dots inside a brass hairline */
  content: ''; position: absolute; inset: 9px; pointer-events: none; border-radius: 6px;
  border: 2px dotted rgba(251, 243, 228, .5); box-shadow: inset 0 0 0 5px transparent, inset 0 0 0 6px rgba(175, 139, 74, .45);
}
.stage-card { grid-area: 1 / 1; display: grid; justify-items: center; align-content: center; gap: 18px; min-width: 0; }
.stage-card.is-out { opacity: 0; pointer-events: none; transition: opacity .6s var(--ease-out-quart); }
.collage { position: relative; isolation: isolate; }
.snap {
  position: absolute; margin: 0; padding: 5px; box-sizing: border-box; cursor: zoom-in; background: var(--rice);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .18), 0 16px 30px -12px rgba(0, 0, 0, .6);
}
.snap::before { content: ''; position: absolute; inset: 2px; border: 1px solid rgba(175, 139, 74, .4); pointer-events: none; }
.snap img { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--paper-deep); }
.snap .dur {
  position: absolute; left: 11px; bottom: 9px; display: flex; align-items: center; gap: 2px;
  color: #fff; font-size: 11.5px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
}
.snap .dur svg { width: 14px; height: 14px; }
.stage-cap { display: grid; justify-items: center; gap: 3px; color: var(--rice); text-align: center; }
.name-link, .more-link { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.stage-cap b { font: 400 40px/1.1 var(--script); }
.stage-cap b:lang(hi) { font: 400 26px/1.4 'Tiro Devanagari Hindi', serif; }
.stage-cap small { font-size: 13.5px; font-style: italic; color: rgba(251, 243, 228, .8); }
.more-link { text-decoration: underline; text-underline-offset: 3px; }
.new-tag {
  padding: 3px 11px; border-radius: 999px; background: var(--brass); color: var(--night);
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
}
.spark { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; color: #f6d991; opacity: 0; pointer-events: none; filter: drop-shadow(0 0 6px rgba(255, 228, 160, .9)); }
.spark svg { display: block; width: 100%; height: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .stage-card .snap { animation: slot .45s var(--ease-out-quart) both; animation-delay: calc(var(--i) * 90ms); }
  .stage-card .snap img { animation: pull 1s var(--ease-out-expo) both; animation-delay: calc(180ms + var(--i) * 150ms); }
  .stage-card .stage-cap { animation: rise .7s var(--ease-out-expo) .55s both; }
  .stage-card.is-new .collage::before { /* a warm light behind the new pick */
    content: ''; position: absolute; inset: -40px; z-index: -1; pointer-events: none;
    background: radial-gradient(closest-side, rgba(255, 226, 160, .38), transparent); animation: glow 2.6s ease-out both;
  }
  .stage-card.is-new .snap::after { /* one pass of light over each photo */
    content: ''; position: absolute; inset: 5px; pointer-events: none; background-repeat: no-repeat; background-size: 260% 100%;
    background-image: linear-gradient(105deg, transparent 38%, rgba(255, 248, 228, .65) 50%, transparent 62%);
    animation: sheen 1.2s var(--ease-out-quart) both; animation-delay: calc(950ms + var(--i) * 150ms);
  }
  .spark { animation: twinkle var(--d) var(--ease-out-quart) var(--w) both; }
}
@keyframes slot { from { opacity: 0; transform: scale(.94); } }
@keyframes pull { from { opacity: 0; transform: translate(var(--fx), -72px) rotate(var(--fr)) scale(1.18); } }
@keyframes sheen { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@keyframes glow { 0% { opacity: 0; transform: scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15); } }
@keyframes twinkle { 0% { opacity: 0; transform: scale(0) rotate(0); } 35% { opacity: 1; transform: scale(var(--s)) rotate(45deg); } 100% { opacity: 0; transform: scale(0) rotate(90deg); } }

/* ---------- leaderboard + awards ---------- */
.top-title { margin: 26px 20px 12px; color: var(--ink); font-size: 36px; text-align: center; }
:lang(hi) .top-title { font: 400 24px/1.4 'Tiro Devanagari Hindi', serif; }
.board { list-style: none; margin: 0; padding: 0 16px; display: grid; gap: 8px; }
.board button {
  position: relative; width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 14px 13px 10px; overflow: hidden; cursor: pointer; text-align: left;
  border: 1px solid rgba(125, 36, 45, .16); border-radius: 10px; background: var(--rice); color: var(--ink);
}
.board .rank {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid rgba(125, 36, 45, .25); color: var(--ink-soft); font: 15px var(--serif); font-variant-numeric: tabular-nums;
}
.board .m1 .rank { background: var(--brass); border-color: var(--brass); color: var(--rice); }
.board .m2 .rank { background: #8f8a83; border-color: #8f8a83; color: var(--rice); }
.board .m3 .rank { background: #a0623b; border-color: #a0623b; color: var(--rice); }
.board b { font: 400 28px/1.15 var(--script); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board b:lang(hi) { font: 400 19px/1.45 'Tiro Devanagari Hindi', serif; }
.board .count { color: var(--ink-soft); font-size: 13px; font-style: italic; }
.board .bar { position: absolute; left: 0; bottom: 0; width: calc(var(--w) * 100%); height: 3px; background: var(--geru); opacity: .5; }
.board .is-me button { border-color: rgba(150, 56, 47, .6); }
.awards { display: grid; gap: 10px; padding: 0 16px; }
.board:last-child, .awards { margin-bottom: calc(124px + env(safe-area-inset-bottom)); } /* clear of the Add button */
.award {
  display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 16px; align-items: center; padding: 10px 12px; cursor: pointer; text-align: left;
  border: 1px solid rgba(175, 139, 74, .5); border-radius: 12px; background: var(--rice); color: var(--ink);
}
.award-pic { width: 74px; height: 74px; padding: 4px; background: #fff; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .45); transform: rotate(-2deg); }
.award-pic img { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--paper-deep); }
.award-txt { display: grid; gap: 1px; min-width: 0; }
.award-title { color: var(--geru); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; }
.award b { font: 400 28px/1.15 var(--script); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.award b:lang(hi) { font: 400 19px/1.45 'Tiro Devanagari Hindi', serif; }
.award small { color: var(--ink-soft); font-size: 12.5px; font-style: italic; }
:lang(hi) .award-title, :lang(hi) .new-tag { letter-spacing: 0; } /* spacing breaks Devanagari joins */
.stars { grid-template-columns: 1fr; gap: 2px; padding: 14px 14px 6px; cursor: default; }
.star-row {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: baseline; gap: 10px; padding: 7px 0;
  border: 0; border-top: 1px solid rgba(175, 139, 74, .25); background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.star-row:first-of-type { border-top: 0; }
.star-fn { color: var(--ink-soft); font-size: 13px; }

/* ---------- album: one collection per person ---------- */
.album { display: flow-root; min-height: calc(100svh - 62px); scroll-margin-top: 62px; } /* tall enough that a short page still scrolls under the bar */
.col { padding: 20px 0 8px; }
.col + .col { border-top: 1px solid rgba(125, 36, 45, .1); }
.col-head {
  width: 100%; display: flex; align-items: baseline; gap: 10px; padding: 0 16px 10px;
  border: 0; background: none; color: var(--ink); cursor: pointer; text-align: left;
}
.col-head b { font: 400 30px/1.15 var(--script); }
.col-head b:lang(hi) { font: 400 20px/1.35 'Tiro Devanagari Hindi', serif; }
.col-head small { color: var(--ink-soft); font-size: 13px; font-style: italic; }
.col-head svg { margin-left: auto; align-self: center; width: 20px; height: 20px; transform: scaleX(-1); color: var(--ink-soft); }
.col-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0 16px; }
.col-row .tile { border-radius: 4px; }
.more { position: relative; }
.more .tile { display: block; width: 100%; }
.more-n {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 4px; pointer-events: none;
  background: rgba(26, 10, 12, .5); color: #fff; font-size: 19px; font-variant-numeric: tabular-nums;
}
.person-back { margin: 6px 0 0 8px; color: var(--ink); }
.grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap);
  padding-top: var(--gap); content-visibility: auto; contain-intrinsic-size: auto 600px;
}
.tile {
  position: relative; aspect-ratio: 1; padding: 0; border: 0; overflow: hidden; cursor: zoom-in;
  background: var(--geru);
}
.tile img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .9s var(--ease-out-quart); }
.tile img.is-in { opacity: 1; }
.tile .dur {
  position: absolute; left: 6px; bottom: 5px; display: flex; align-items: center; gap: 2px;
  color: #fff; font-size: 11.5px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
}
.tile .dur svg { width: 14px; height: 14px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.tile.is-local::after { /* still travelling */
  content: ''; position: absolute; inset: 5px; border: 1.5px dashed rgba(251, 243, 228, .85); border-radius: 2px;
}

.empty { display: grid; justify-items: center; gap: 6px; padding: 30px 24px 40px; text-align: center; }
.empty .lotus { width: 72px; height: 72px; color: var(--geru); opacity: .85; }
.empty p { margin: 0; }
.empty .script { font-size: 34px; }
:lang(hi) .empty .script { font-family: 'Tiro Devanagari Hindi', serif; font-size: 24px; }
.empty small { font-size: 13px; color: var(--ink-soft); font-style: italic; }

.person-head { display: grid; justify-items: center; gap: 2px; padding: 4px 20px 16px; text-align: center; }
.person-head b { font: 400 46px/1.15 var(--script); }
.person-head b:lang(hi) { font: 400 30px/1.35 'Tiro Devanagari Hindi', serif; }
.person-head small { color: var(--ink-soft); font-style: italic; }

.close-note { display: grid; justify-items: center; gap: 2px; padding: 64px 20px calc(150px + env(safe-area-inset-bottom)); text-align: center; }
.close-note .lotus { width: 54px; height: 54px; color: var(--geru); margin-bottom: 8px; }
.close-note p { margin: 0; }
.close-note .script { font-size: 34px; }
.close-sub { font-size: 12.5px; color: var(--ink-soft); font-style: italic; }

/* ---------- text buttons ---------- */
.text-btn { display: inline-flex; align-items: center; gap: 4px; padding: 10px 12px 10px 4px; border: 0; background: none; cursor: pointer; font-size: 15px; }
.text-btn svg { width: 22px; height: 22px; }

/* ---------- tray ---------- */
dialog { padding: 0; border: 0; max-width: none; max-height: none; }
.tray {
  width: var(--col); height: 100svh; margin: 0 auto; color: var(--rice); /* the card is the album column, never stretched to a desktop window */
  background: var(--geru) url(/img/aipan-card.webp) center / 100% 100%;
}
.tray::backdrop { background: var(--geru-deep); }
.tray-in { width: min(100%, 520px); height: 100%; margin: 0 auto; overflow-y: auto; padding: max(12svh, 84px) max(16%, 52px) max(12svh, 84px); display: flex; flex-direction: column; scrollbar-width: none; }
.tray-in::-webkit-scrollbar { display: none; }
.tray-back { position: fixed; top: max(6px, env(safe-area-inset-top)); left: max(8px, calc(50vw - 260px)); color: var(--rice); z-index: 2; }
.tray-ready { display: grid; gap: 22px; margin: auto 0; padding: 12px 0 24px; }
.tray-count { margin: 0; text-align: center; font-size: 40px; }
.tray-count:focus { outline: none; } /* focused only so the sheet opens on the title, not on Back */
:lang(hi) .tray-count { font: 400 26px/1.3 'Tiro Devanagari Hindi', serif; }
.field { display: grid; gap: 6px; }
.field-label, .fn-pick legend { font-size: 15px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1px solid rgba(251, 243, 228, .55); border-radius: 3px;
  background: rgba(251, 243, 228, .96); color: var(--ink); font: 17px var(--serif);
}
.field input::placeholder { color: #9a6a68; font-style: italic; }
.field-hint { font-size: 12.5px; font-style: italic; opacity: .85; }
.fn-pick { border: 0; margin: 0; padding: 0; min-width: 0; }
.fn-pick legend { padding: 0; margin-bottom: 10px; }
.fn-pick-row { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 3px; }
.fn-opt { flex: none; display: grid; justify-items: center; gap: 5px; cursor: pointer; font-size: 12.5px; }
.fn-opt input { position: absolute; opacity: 0; pointer-events: none; }
.win-arch { border-radius: 29px 29px 3px 3px; overflow: hidden; background: var(--geru); }
.win-arch img { width: 100%; height: 100%; object-fit: cover; }
.fn-opt .win-arch { width: 58px; height: 72px; outline: 1.5px solid rgba(251, 243, 228, .25); }
.fn-opt:has(input:checked) .win-arch { outline: 2.5px solid var(--rice); }
.fn-opt:has(input:checked) span { font-weight: 700; }
.fn-opt:has(input:focus-visible) .win-arch { outline-color: #fff; outline-style: dashed; }
.send {
  justify-self: center; min-width: 200px; padding: 15px 28px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--rice); color: var(--geru-deep); font-size: 17px; font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .3); transition: transform var(--t-fast) var(--ease-out-quart);
}
.send:active { transform: scale(.97); }

.tray-run { display: grid; gap: 4px; padding-top: 10px; }
.tray-status { margin: 0; text-align: center; font-size: 22px; font-variant-numeric: tabular-nums; }
.tray-sub { margin: 0 0 18px; text-align: center; font-size: 13px; font-style: italic; opacity: .85; }
.prints { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 14px; }
.print { position: relative; aspect-ratio: 1; padding: 7px; background: var(--rice); box-shadow: 0 6px 16px rgba(0, 0, 0, .32); transform: rotate(var(--r, 0deg)); }
.print img { width: 100%; height: 100%; object-fit: cover; background: var(--paper-deep); }
.print img:not([src]) { visibility: hidden; }
.print { background-color: var(--rice); }
.print svg { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); overflow: visible; pointer-events: none; }
.print rect { fill: none; stroke: var(--rice); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--p, 0)); transition: stroke-dashoffset .4s var(--ease-out-quart); }
.print.is-waiting rect { animation: wait 1.2s ease-in-out infinite alternate; }
@keyframes wait { to { opacity: .35; } }
.print.is-done::after {
  content: ''; position: absolute; right: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--rice) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%2396382f' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
@media (prefers-reduced-motion: no-preference) { .print.is-done::after { animation: pop .5s var(--ease-out-expo) both; } }
@keyframes pop { from { transform: scale(0); } }
.print.is-failed { opacity: .55; }
.skips { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; font-style: italic; text-align: center; }
.tray-done { display: grid; justify-items: center; gap: 4px; padding: 30px 0 10px; text-align: center; }
.thanks { margin: 0; font-size: 58px; }
:lang(hi) .thanks { font: 400 40px/1.2 'Tiro Devanagari Hindi', serif; }
.thanks-sub { margin: 0 0 22px; font-style: italic; }

/* ---------- viewer ---------- */
.viewer { width: 100vw; height: 100svh; margin: 0; background: var(--night); color: var(--rice); overflow: hidden; }
.viewer::backdrop { background: var(--night); }
.viewer[open] { display: grid; grid-template-rows: auto 1fr auto; }
.viewer-top { display: flex; align-items: center; justify-content: space-between; padding: max(4px, env(safe-area-inset-top)) 10px 0; }
.viewer-top .text-btn { color: var(--rice); }
.viewer-hint { font-size: 13px; font-style: italic; opacity: 0; transition: opacity var(--t-fast); }
.viewer.is-pulling .viewer-hint { opacity: .8; }
.track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain;
  touch-action: pan-x; transition: transform var(--t-medium) var(--ease-out-quart), opacity var(--t-medium);
}
.track::-webkit-scrollbar { display: none; }
.viewer.is-pulling .track { transition: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: grid; place-items: center; min-height: 0; padding: 8px 0; }
.slide img, .slide video { max-width: 100%; max-height: 100%; object-fit: contain; }
.slide video { width: 100%; background: #000; }
.viewer-foot { display: grid; gap: 10px; padding: 10px 18px max(16px, env(safe-area-inset-bottom)); }
.credit { margin: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-height: 32px; }
.credit-name { color: var(--rice); font-size: 30px; text-decoration: none; }
.credit-name:lang(hi), :lang(hi) .credit-name.is-hi { font: 400 19px/1.2 'Tiro Devanagari Hindi', serif; }
.credit-meta { font-size: 13px; font-style: italic; opacity: .8; }
.actions { display: flex; gap: 10px; }
.act {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px 10px 12px; cursor: pointer;
  border: 1px solid rgba(251, 243, 228, .3); border-radius: 999px; background: none; color: var(--rice); font-size: 14px;
}
.act svg { width: 20px; height: 20px; }
.act:active { background: rgba(251, 243, 228, .12); }
.act-hide { margin-left: auto; border-color: rgba(226, 120, 100, .6); color: #f0b4a6; }

@media (min-width: 700px) {
  body { background-color: var(--paper-deep); }
  main { box-shadow: 0 0 0 1px rgba(125, 36, 45, .1), 0 30px 80px rgba(0, 0, 0, .08); background: inherit; background-color: var(--paper); }
}
