:root {
  --ivory: #f4efe5;
  --soft: rgba(244, 239, 229, .72);
  --gold: #c8aa78;
  --ink: #0b0b0d;
  --fade: 1600ms;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--ink); }
body { color: var(--ivory); font-family: "Avenir Next", "Gill Sans", sans-serif; }
button { font: inherit; }

#memorial { position: relative; width: 100%; height: 100%; min-height: 100svh; isolation: isolate; background: #08080a; }
.stage, .slide, .slide img, .ambient, .vignette { position: absolute; inset: 0; }
.stage { overflow: hidden; }
.slide { margin: 0; opacity: 0; transition: opacity var(--fade) ease-in-out; will-change: opacity; }
.slide.is-visible { opacity: 1; z-index: 1; }
.slide img { width: 100%; height: 100%; object-fit: contain; transform: scale(1.02); will-change: transform; }
.slide::before {
  content: ""; position: absolute; inset: -4%; z-index: -1;
  background-image: var(--slide-bg); background-size: cover; background-position: center;
  filter: blur(34px) saturate(.7) brightness(.38); transform: scale(1.12);
}
.slide.moving-in img { animation: drift-in var(--duration) linear both; }
.slide.moving-out img { animation: drift-out var(--duration) linear both; }
@keyframes drift-in { from { transform: scale(1.015) translate3d(-.3%, .2%, 0); } to { transform: scale(1.10) translate3d(.35%, -.25%, 0); } }
@keyframes drift-out { from { transform: scale(1.10) translate3d(.35%, -.2%, 0); } to { transform: scale(1.015) translate3d(-.3%, .25%, 0); } }

.ambient { z-index: 2; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.42), transparent 24%, transparent 62%, rgba(0,0,0,.58)); }
.vignette { z-index: 3; pointer-events: none; box-shadow: inset 0 0 20vw rgba(0,0,0,.46); }
.vignette::after { content: ""; position: absolute; inset: 0; opacity: .12; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }

.identity { position: absolute; z-index: 5; left: clamp(24px, 5vw, 76px); top: clamp(24px, 5vw, 64px); text-shadow: 0 2px 18px rgba(0,0,0,.7); transition: opacity .6s ease; }
.eyebrow { margin: 0 0 4px; color: var(--gold); font-size: clamp(.62rem, 1vw, .77rem); font-weight: 600; letter-spacing: .24em; text-transform: uppercase; }
.identity h1 { margin: 0; font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif; font-size: clamp(3rem, 8vw, 7.25rem); font-weight: 500; line-height: .88; letter-spacing: -.045em; }
.full-name { margin: 11px 0 0 4px; color: var(--ivory); font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif; font-size: clamp(.92rem, 1.6vw, 1.22rem); letter-spacing: .045em; }
.lifespan { margin: 3px 0 0 4px; color: var(--gold); font-size: clamp(.62rem, 1vw, .75rem); font-weight: 500; letter-spacing: .12em; }
.subtitle { margin: 12px 0 0 4px; color: var(--soft); font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif; font-size: clamp(.9rem, 1.6vw, 1.18rem); font-style: italic; }
.tribute { margin: 5px 0 0 4px; color: rgba(244,239,229,.64); font-size: clamp(.58rem, .9vw, .7rem); letter-spacing: .055em; }

.controls { position: absolute; z-index: 8; right: clamp(16px, 3vw, 40px); bottom: clamp(18px, 4vw, 42px); display: flex; max-width: calc(100vw - 32px); align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; opacity: .68; transition: opacity .25s ease; }
.controls:hover, .controls:focus-within { opacity: 1; }
.controls button { height: 42px; border: 1px solid rgba(255,255,255,.22); color: var(--ivory); background: rgba(12,12,14,.45); backdrop-filter: blur(14px); cursor: pointer; }
.controls button:hover { background: rgba(32,31,30,.7); border-color: rgba(255,255,255,.38); }
.title-toggle { height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: var(--soft); background: rgba(12,12,14,.45); backdrop-filter: blur(14px); cursor: pointer; font-size: .69rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.title-toggle input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.checkmark { width: 14px; height: 14px; border: 1px solid rgba(255,255,255,.45); border-radius: 3px; display: grid; place-items: center; }
.title-toggle input:checked + .checkmark { border-color: var(--gold); background: var(--gold); }
.title-toggle input:checked + .checkmark::after { content: ""; width: 6px; height: 3px; border-left: 2px solid #121214; border-bottom: 2px solid #121214; transform: rotate(-45deg) translateY(-1px); }
.title-toggle:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.icon-button { width: 42px; border-radius: 50%; display: grid; place-items: center; }
.icon-button svg { width: 18px; fill: currentColor; }
.sound-off { display: none; }
.is-muted .sound-off { display: block; }
.is-muted .sound-on { display: none; }
.pause-button { min-width: 76px; padding: 0 16px; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.now-playing { position: absolute; z-index: 8; left: clamp(20px, 4vw, 58px); bottom: clamp(22px, 4vw, 44px); display: grid; width: min(390px, calc(100vw - 40px)); padding: 11px 16px 12px; border-left: 2px solid var(--gold); color: var(--soft); background: linear-gradient(90deg, rgba(8,8,10,.82), rgba(8,8,10,.18)); text-shadow: 0 1px 12px #000; opacity: .86; transition: opacity .35s ease; }
.now-playing-label { margin-bottom: 3px; color: var(--gold); font-size: .57rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
.now-playing strong { overflow: hidden; color: var(--ivory); font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif; font-size: clamp(1.05rem, 2vw, 1.35rem); font-weight: 500; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
#track-artist { margin-top: 3px; overflow: hidden; font-size: .68rem; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }
.track-controls { display: grid; grid-template-columns: 32px 32px minmax(0, 1fr) 32px; gap: 5px; margin-top: 9px; text-shadow: none; }
.track-controls button, .track-controls select { height: 32px; border: 1px solid rgba(255,255,255,.2); color: var(--ivory); background: rgba(12,12,14,.72); backdrop-filter: blur(12px); }
.track-button { border-radius: 50%; cursor: pointer; font-family: "Avenir Next", sans-serif; font-size: 1.35rem; line-height: 1; }
.track-button:hover, .track-button:focus-visible, .track-controls select:hover, .track-controls select:focus-visible { border-color: var(--gold); outline: none; }
.track-controls select { min-width: 0; padding: 0 8px; border-radius: 999px; cursor: pointer; font-size: .67rem; text-overflow: ellipsis; }
.progress { position: absolute; z-index: 7; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.12); }
.progress span { display: block; height: 100%; width: 0; background: var(--gold); }
.progress.running span { animation: progress var(--duration) linear both; }
@keyframes progress { from { width: 0; } to { width: 100%; } }

.welcome { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 42%, rgba(45,41,34,.44), rgba(5,5,7,.9) 70%); backdrop-filter: blur(20px); transition: opacity .9s ease, visibility .9s; }
.welcome.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.welcome-card { width: min(560px, 100%); padding: clamp(34px, 7vw, 68px); text-align: center; border: 1px solid rgba(200,170,120,.26); background: rgba(15,15,17,.64); box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.welcome-card h2 { margin: 9px 0 10px; font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif; font-size: clamp(2.3rem, 6vw, 4.2rem); font-weight: 500; line-height: .95; letter-spacing: -.04em; }
.welcome-card h2 span { display: block; color: var(--gold); font-style: italic; }
.welcome-lifespan { margin: 0 0 9px; color: var(--ivory); font-size: .73rem; font-weight: 500; letter-spacing: .13em; }
.welcome-tribute { margin: 0 auto 18px; color: var(--soft); font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif; font-size: 1rem; font-style: italic; }
.welcome-note { margin: 0 auto 25px; color: rgba(244,239,229,.56); font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif; font-size: 1.05rem; }
.welcome-card button { display: block; width: min(250px, 100%); margin: 0 auto 11px; padding: 15px 24px; border: 1px solid var(--gold); color: #121214; background: var(--gold); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: transform .2s ease, background .2s ease; }
.welcome-card button:hover { transform: translateY(-2px); background: #dbc59e; }
.welcome-card small { color: rgba(244,239,229,.45); font-size: .65rem; letter-spacing: .1em; text-transform: uppercase; }

.cast-dialog { width: min(520px, calc(100vw - 32px)); padding: clamp(30px, 6vw, 54px); border: 1px solid rgba(200,170,120,.34); color: var(--ivory); background: rgba(16,16,18,.96); box-shadow: 0 30px 100px rgba(0,0,0,.65); }
.cast-dialog::backdrop { background: rgba(4,4,6,.72); backdrop-filter: blur(12px); }
.cast-dialog h2 { margin: 8px 0 15px; font-family: "Baskerville", "Iowan Old Style", "Palatino Linotype", serif; font-size: clamp(2rem, 5vw, 3.15rem); font-weight: 500; line-height: 1; }
.cast-dialog p, .cast-dialog li { color: var(--soft); font-size: .88rem; line-height: 1.65; }
.cast-dialog ol { margin: 20px 0 26px; padding-left: 21px; }
.cast-dialog li { margin-bottom: 6px; padding-left: 5px; }
.dialog-close { position: absolute; top: 12px; right: 15px; border: 0; color: var(--soft); background: transparent; cursor: pointer; font-family: serif; font-size: 1.8rem; }
.dialog-action { padding: 12px 18px; border: 1px solid var(--gold); color: #111; background: var(--gold); cursor: pointer; font-size: .7rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }

body.idle .controls, body.idle .identity, body.idle .now-playing { opacity: 0; }
body.title-pinned.idle .identity { opacity: 1; }
@media (max-width: 760px) { .identity { top: 28px; left: 24px; max-width: calc(100vw - 48px); } .subtitle, .tribute { display: none; } .full-name { margin-top: 7px; } .controls { opacity: .9; } .now-playing { bottom: 82px; } .title-toggle > span:last-child { display: none; } .title-toggle { width: 42px; padding: 0; justify-content: center; } }
@media (max-width: 480px) { .now-playing { left: 16px; width: calc(100vw - 32px); } .track-controls { grid-template-columns: 32px 32px minmax(0, 1fr) 32px; } }
@media (prefers-reduced-motion: reduce) { .slide img { animation: none !important; } .slide { transition-duration: 300ms; } }
