:root {
  --paper: #eee6d5; --paper-2: #e6dcc8; --ink: #2b2520; --ink-2: #5a4c40; --saff: #e0822a; --saff-deep: #b4581a;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif; --hand: Caveat, cursive; --mono: "IBM Plex Mono", ui-monospace, monospace; --gur: "Noto Serif Gurmukhi", serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); overflow: hidden; }
body { font-family: var(--serif); -webkit-font-smoothing: antialiased; }
canvas#scroll { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px; }
.skip:focus { left: 12px; }

/* arrival: a saffron wash leaves the screen, continuing the wipe from the first page */
.wipe-in { position: fixed; top: 0; left: 0; width: 180vw; height: 100vh; pointer-events: none; z-index: 40; transform: translateX(-40vw); animation: wipeOut 1.1s cubic-bezier(.45,0,.25,1) .1s forwards; }
.wipe-in svg { width: 100%; height: 100%; display: block; }
@keyframes wipeOut { to { transform: translateX(-182vw); } }
.rm .wipe-in { animation: fadeOut .3s linear forwards; }
@keyframes fadeOut { to { opacity: 0; } }

.top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: max(14px, env(safe-area-inset-top)) clamp(16px, 3vw, 32px) 0; z-index: 10; transition: opacity .6s var(--ease); }
.home { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px 0 10px; border-radius: 999px; color: var(--ink); text-decoration: none; font: 500 13px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; background: rgba(241, 233, 218, .72); backdrop-filter: blur(6px); border: 1px solid rgba(43, 37, 32, .12); }
.home:hover { background: rgba(241, 233, 218, .95); }
.home:focus-visible, .ctl:focus-visible, .track:focus-visible, .pill:focus-visible, .transcript summary:focus-visible { outline: 2px solid var(--saff-deep); outline-offset: 3px; }
.title-mini { margin: 0; font: 500 12px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); text-shadow: 0 0 10px var(--paper), 0 0 4px var(--paper); }
.title-mini span { font-family: var(--gur); letter-spacing: 0; text-transform: none; font-size: 14px; }

.caption { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(900px, calc(100vw - 32px)); text-align: center; z-index: 5; pointer-events: none; }
.kicker { margin: 0 0 10px; font: 500 12px/1 var(--mono); letter-spacing: .28em; text-transform: uppercase; color: var(--ink-2); text-shadow: 0 0 12px var(--paper), 0 0 6px var(--paper), 0 0 2px var(--paper); }
.line { margin: 0; font: italic 500 clamp(21px, 2.5vw, 34px)/1.28 var(--serif); color: rgba(43, 37, 32, .92); text-shadow: 0 0 18px var(--paper), 0 0 10px var(--paper), 0 0 4px var(--paper), 0 0 2px var(--paper); text-wrap: balance; }
.line.quote { font-size: clamp(30px, 4.4vw, 60px); font-style: normal; font-weight: 600; letter-spacing: -.005em; line-height: 1.12; }
.sub { margin: 12px 0 0; font: 600 clamp(20px, 2vw, 26px)/1.2 var(--hand); color: var(--ink-2); text-shadow: 0 0 10px var(--paper), 0 0 4px var(--paper); min-height: 0; }

.controls { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(760px, calc(100vw - 24px)); display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 999px; background: rgba(241, 233, 218, .78); backdrop-filter: blur(10px) saturate(1.1); border: 1px solid rgba(43, 37, 32, .12); box-shadow: 0 10px 30px -14px rgba(60, 40, 20, .35); z-index: 10; transition: opacity .6s var(--ease), transform .6s var(--ease); }
body.idle .controls { opacity: 0; transform: translate(-50%, 12px); }
body.idle .top { opacity: 0; }
body.idle { cursor: none; }
.ctl { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; transition: background .2s; }
.ctl:hover { background: rgba(43, 37, 32, .07); }
.ctl svg { width: 20px; height: 20px; }
.ctl.play { background: var(--ink); color: var(--paper); }
.ctl.play:hover { background: #3b322b; }
.ctl.play .i-play { display: none; }
.ctl.play[data-state="play"] .i-play { display: block; }
.ctl.play[data-state="play"] .i-pause { display: none; }
.ctl.sound .x { display: block; } .ctl.sound .w { display: none; }
.ctl.sound[data-on="1"] .x { display: none; } .ctl.sound[data-on="1"] .w { display: block; }
.trackwrap { flex: 1; min-width: 0; padding: 0 10px; }
.chapter { margin: 0 0 6px; font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { position: relative; height: 18px; cursor: pointer; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: rgba(43, 37, 32, .16); border-radius: 2px; }
.fill { position: absolute; left: 0; top: 8px; height: 2px; background: var(--saff-deep); border-radius: 2px; }
.tick { position: absolute; top: 0; height: 18px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.tick::after { content: ""; position: absolute; left: 0; top: 5px; width: 1.5px; height: 8px; background: rgba(43, 37, 32, .35); }
.tick:hover::before { content: ""; position: absolute; inset: 7px 1px; background: rgba(224, 130, 42, .25); border-radius: 2px; }

/* finale */
.finale { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 70px 20px 120px; pointer-events: none; z-index: 6; visibility: hidden; }
.finale.on { visibility: visible; }
.finale > * { grid-area: 1 / 1; }
.onkar { margin: 0; font: 600 clamp(110px, 17vh, 190px)/1 var(--gur); color: #c9952f; background: repeating-linear-gradient(-58deg, rgba(255,240,190,.35) 0 1px, rgba(110,70,15,.25) 1px 2px), linear-gradient(135deg, #f3d888, #c9952f 40%, #eecb6c 65%, #a3711e); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(1px 2px 1.5px rgba(70,40,10,.35)); clip-path: inset(0 calc((1 - var(--p, 0)) * 100%) 0 0); }
.mm, .mm-en, .teach, .end { position: absolute; left: 50%; transform: translateX(-50%); width: min(980px, calc(100vw - 32px)); }
.mm { top: calc(50% + 5vh); }
.mm .gur { margin: 0; font: 600 clamp(20px, 2.6vw, 36px)/1.6 var(--gur); color: var(--ink); }
.mm-en { top: calc(50% + 5vh + clamp(84px, 9.5vw, 128px)); }
.mm-en p { margin: 0; font: italic 500 clamp(18px, 1.9vw, 25px)/1.45 var(--serif); color: var(--ink-2); }
.mm-en .src { margin-top: 12px; font: 500 11px/1.4 var(--mono); font-style: normal; letter-spacing: .16em; text-transform: uppercase; opacity: .8; }
.teach { top: calc(50% + 11vh); list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, 3vw, 44px); }
.teach li { display: flex; flex-direction: column; gap: 4px; align-items: center; transform: translateY(calc((1 - var(--p, 0)) * 14px)); }
.teach .g { font: 600 clamp(24px, 2.8vw, 38px)/1.3 var(--gur); color: #3f5384; }
.teach .r { font: 500 12px/1 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2); }
.teach .m { font: italic 500 clamp(18px, 1.8vw, 24px)/1.3 var(--serif); color: var(--ink); }
.end { top: auto; bottom: calc(88px + env(safe-area-inset-bottom)); pointer-events: auto; }
.dhan { margin: 0 0 14px; font: 600 clamp(18px, 2vw, 24px)/1 var(--gur); color: var(--ink-2); }
.end-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pill { min-height: 46px; padding: 0 22px; display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font: 500 13px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; text-decoration: none; }
.pill.ghost { background: rgba(241, 233, 218, .7); color: var(--ink); }
.pill:hover { background: #3b322b; color: var(--paper); }
.finale:not(.on) .end { pointer-events: none; }

/* written story */
.transcript { position: fixed; right: clamp(12px, 2vw, 28px); top: calc(max(14px, env(safe-area-inset-top)) + 54px); z-index: 11; max-width: min(420px, calc(100vw - 24px)); font-size: 17px; }
.transcript summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px; background: rgba(241, 233, 218, .72); backdrop-filter: blur(6px); border: 1px solid rgba(43, 37, 32, .12); font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; float: right; }
.transcript summary::-webkit-details-marker { display: none; }
.transcript[open] #transcriptBody { clear: both; margin-top: 54px; max-height: min(60vh, 560px); overflow: auto; padding: 18px 20px; background: rgba(241, 233, 218, .96); border: 1px solid rgba(43, 37, 32, .14); border-radius: 14px; box-shadow: 0 20px 40px -24px rgba(60, 40, 20, .4); }
.transcript h3 { margin: 16px 0 4px; font: 500 11px/1.3 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--saff-deep); }
.transcript h3:first-child { margin-top: 0; }
.transcript p { margin: 0 0 8px; line-height: 1.45; }
body.idle .transcript:not([open]) { opacity: 0; transition: opacity .6s; }

@media (max-width: 640px) {
  .title-mini { display: none; }
  .caption { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .kicker { font-size: 11px; letter-spacing: .22em; }
  .chapter { font-size: 10px; }
  .controls { gap: 0; padding: 5px 6px; }
  .trackwrap { padding: 0 6px; }
  .teach { grid-template-columns: 1fr; gap: 12px; top: calc(50% - 4vh); }
  .onkar { font-size: clamp(90px, 14vh, 130px); margin-top: -18vh; }
  .mm { top: calc(50% - 6vh); } .mm-en { top: calc(50% - 6vh + 108px); }
  .end { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .controls, .top, .ctl { transition: none; }
  body.idle .controls { transform: translateX(-50%); }
}
.still .wipe-in { display: none; }
