/*
 * feed.css — Docent Feed (the signature screen)
 * Vertical scroll-snap reel + Ken Burns auto-play + tap→next + double-tap→heart
 * + docent/verse bottom sheet. Ported from docs/mockups/premium/light/docent-feed.html
 * and the BEATS engine in docs/feed-samples/.
 */

/* The reel takes over the whole app shell (no scroll padding for nav). */
.reel {
  position: absolute; inset: 0; overflow-y: scroll; overflow-x: hidden;
  scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  background: #0c0814;
}
.reel::-webkit-scrollbar { display: none; }

.slide {
  position: relative; width: 100%; height: 100%;   /* fill the reel/app shell exactly (not 100dvh — avoids the desktop device-frame mismatch that clipped the sheet) */
  scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: #0c0814;
  container-type: size;                              /* the card sizes against the slide, whatever its real height */
}

/* blurred full-bleed fill — the leftover around the 9:16 card (no black bars) */
.canvas-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: blur(38px) saturate(1.15) brightness(.5);
  transform: scale(1.25); /* hide the blur's translucent edge */
}

/* the 9:16 "feed card" — contain-fit & centered on any screen + safe areas */
.stage {
  position: relative; z-index: 1; overflow: hidden;
  width: min(100cqw, calc(100cqh * 9 / 16));
  height: min(100cqh, calc(100cqw * 16 / 9));
}

/* the 9:16 film fills the card exactly (same aspect → no crop) */
.stage .art-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0c0814; }

/* full-bleed artwork — Ken Burns pan/zoom is driven by JS across the timeline */
.slide .art {
  position: absolute; inset: -6%; /* bleed so pan never shows an edge */
  transform-origin: 50% 40%;
  transform: scale(1.06);
  will-change: transform;
}

.scrim-t { position: absolute; top: 0; left: 0; right: 0; height: 200px; z-index: 2; background: linear-gradient(180deg, rgba(12, 8, 20, .55), transparent); }
.scrim-b { position: absolute; bottom: 0; left: 0; right: 0; height: 460px; z-index: 2; background: linear-gradient(0deg, rgba(12, 8, 20, .92) 14%, rgba(12, 8, 20, .55) 46%, transparent); }

/* ── YouTube-style center play / pause flash ── */
.playpause {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.9);
  z-index: 7; width: 78px; height: 78px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(12, 8, 20, .42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .4s var(--ease);
}
.playpause svg { width: 38px; height: 38px; fill: rgba(255, 255, 255, .97); }
.playpause .i-play { margin-left: 4px; }
.playpause .i-pause { display: none; }
.slide.playing .playpause .i-play { display: none; }
.slide.playing .playpause .i-pause { display: block; }
.slide.paused .playpause { opacity: 1; }                 /* persistent play glyph while paused */
.playpause.flash { animation: ppflash .55s var(--ease); }
@keyframes ppflash {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.78); }
  35%  { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.12); }
}

/* ── YouTube-style draggable scrubber (bottom edge) ── */
.scrubber { position: absolute; left: 0; right: 0; bottom: 0; z-index: 9; padding: 13px 0; cursor: pointer; touch-action: none; }
.scrub-track { position: relative; height: 3px; margin: 0 6px; border-radius: 3px; background: rgba(255, 255, 255, .32); transition: height .18s var(--ease), margin .18s var(--ease); }
.scrub-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #ff2d55; border-radius: 3px; }
.scrub-knob { position: absolute; top: 50%; left: 0; width: 13px; height: 13px; margin-left: -1px; border-radius: 50%; background: #ff2d55; transform: translate(-50%, -50%) scale(0); transition: transform .18s var(--ease); box-shadow: 0 0 0 5px rgba(255, 45, 85, .22); }
.slide.scrubbing .scrub-track { height: 6px; margin: 0; }
.slide.scrubbing .scrub-knob { transform: translate(-50%, -50%) scale(1.7); }

/* time bubble — centred above the bar while scrubbing */
.scrub-time {
  position: absolute; left: 50%; bottom: 44px; z-index: 10;
  transform: translateX(-50%) translateY(8px);
  padding: 6px 15px; border-radius: 999px; background: rgba(12, 8, 20, .8);
  color: #fff; font-family: var(--grotesk); font-size: 14px; font-weight: 700; letter-spacing: .02em;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.slide.scrubbing .scrub-time { opacity: 1; transform: translateX(-50%) translateY(0); }

/* frame preview thumbnail — follows the knob while scrubbing */
.scrub-preview {
  position: absolute; left: 0; bottom: 70px; z-index: 10; width: 128px;
  transform: translateX(-50%) translateY(12px) scale(.96);
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.slide.scrubbing .scrub-preview { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.scrub-preview .thumb { display: block; width: 128px; height: 168px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .92); box-shadow: 0 14px 34px rgba(0, 0, 0, .55); }
.scrub-preview .plabel { display: block; margin-top: 7px; text-align: center; color: #fff; font-family: var(--grotesk); font-size: 11px; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* hide the reading UI while scrubbing (YouTube-style clean scrub) */
.slide.scrubbing .cap, .slide.scrubbing .acts, .slide.scrubbing .playpause { opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); }

/* per-slide caption */
.cap { position: absolute; left: 22px; right: 96px; bottom: 120px; z-index: 4; }
.cap .ix { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 253, 249, .82); border: 1px solid var(--lime-deep); color: #7c3aed; font-family: var(--grotesk); font-size: 9px; font-weight: 700; letter-spacing: .2em; padding: 4px 10px; border-radius: 999px; margin-bottom: 11px; }
.cap .ix .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--lime-deep); }
.cap h2 { font-family: var(--serif); font-size: 33px; font-weight: 360; line-height: 1.02; letter-spacing: -.02em; color: #fff; text-shadow: 0 2px 20px rgba(12, 8, 20, .7); }
.cap .en { font-family: var(--grotesk); font-size: 12px; letter-spacing: .06em; color: rgba(255, 255, 255, .78); margin-top: 8px; }

/* back button — top-left */
.reel-back { position: absolute; top: max(44px, calc(env(safe-area-inset-top, 0px) + 10px)); left: max(18px, env(safe-area-inset-left, 0px)); z-index: 31; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #2b1a52; text-decoration: none; background: rgba(255, 255, 255, .62); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(124, 58, 237, .14); box-shadow: 0 6px 18px rgba(43, 26, 82, .12); transition: opacity .3s var(--ease); }
.reel-back:active { transform: scale(.92); }
/* hide the back button while a docent sheet is expanded full-screen */
.reel.sheet-full .reel-back { opacity: 0; pointer-events: none; }
.reel-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }

/* right action rail */
.acts { position: absolute; right: 13px; bottom: 120px; z-index: 5; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.act { display: flex; flex-direction: column; align-items: center; gap: 5px; color: #fff; font-family: var(--grotesk); font-size: 11px; font-weight: 600; text-decoration: none; background: none; border: none; cursor: pointer; text-shadow: 0 1px 6px rgba(12, 8, 20, .6); }
.act .ic { width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 253, 249, .7); backdrop-filter: blur(8px); border: 1px solid rgba(124, 58, 237, .22); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px -10px rgba(91, 33, 182, .4); transition: transform .45s var(--ease); }
.act:active .ic { transform: scale(.9); }
.act svg { width: 24px; height: 24px; stroke: var(--violet-deep); fill: none; stroke-width: 1.6; }
.act .lbl { color: #fff; }
.savebtn.on .ic { border-color: var(--violet); background: var(--violet); }
.savebtn.on svg { fill: #fff; stroke: #fff; }
.docentbtn.act-on .ic { border-color: var(--lime); background: var(--lime); }
.docentbtn.act-on svg { stroke: #23163f; fill: none; }
.replaybtn svg { fill: var(--violet-deep); stroke: none; }
.replaybtn.spin .ic { animation: replaypulse .6s var(--ease); }
@keyframes replaypulse { 0% { transform: scale(1); } 40% { transform: scale(.84) rotate(-12deg); } 100% { transform: scale(1); } }

/* double-tap heart pop */
.heart-pop { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.heart-pop svg { width: 120px; height: 120px; fill: rgba(255, 255, 255, .96); filter: drop-shadow(0 8px 30px rgba(91, 33, 182, .6)); opacity: 0; transform: scale(.4); }
.heart-pop.go svg { animation: heartpop .9s var(--ease); }
@keyframes heartpop { 0% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1.12); } 55% { opacity: 1; transform: scale(.98); } 100% { opacity: 0; transform: scale(1.05); } }

/* ===== docent bottom sheet ===== */
.modewrap { position: absolute; inset: 0; z-index: 11; pointer-events: none; }
.modewrap.open { pointer-events: auto; }
.modewrap .backdrop { position: absolute; inset: 0; background: rgba(91, 33, 182, .18); backdrop-filter: blur(2px); opacity: 0; transition: opacity .4s var(--ease); }
.modewrap.open .backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 10px; right: 10px; bottom: 18px; padding: 8px 18px 22px; border-radius: 28px;
  background: rgba(255, 253, 249, .96); backdrop-filter: blur(26px); border: 1px solid var(--hair-2);
  box-shadow: 0 -26px 56px -16px rgba(91, 33, 182, .4), inset 0 1px 1px rgba(255, 255, 255, .9);
  height: var(--sheet-h, 420px); max-height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(140%); pointer-events: none; touch-action: none;
  /* iOS-sheet easing — smooth glide on open / snap, not a hard jump */
  transition: transform .46s cubic-bezier(.32, .72, 0, 1), height .46s cubic-bezier(.32, .72, 0, 1),
              left .46s cubic-bezier(.32, .72, 0, 1), right .46s cubic-bezier(.32, .72, 0, 1),
              bottom .46s cubic-bezier(.32, .72, 0, 1), border-radius .46s cubic-bezier(.32, .72, 0, 1);
}
/* while the finger is down: a tiny smoothing transition (not 0) so discrete
   pointer moves glide instead of stepping ("휙휙") */
.sheet.dragging { transition: height .13s linear, transform .13s linear; }
.modewrap.open .sheet { transform: translateY(0); pointer-events: auto; }
/* full = cover the whole screen, edge to edge, up to the very top
   (height stays driven by --sheet-h so a drag-down still shrinks it) */
.modewrap.full .sheet {
  left: 0; right: 0; bottom: 0; max-height: 100%; border-radius: 0;
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
}
.grabber { width: 38px; height: 5px; border-radius: 999px; background: rgba(124, 58, 237, .28); margin: 6px auto 4px; cursor: grab; flex: 0 0 auto; touch-action: none; transition: background .2s var(--ease), width .2s var(--ease), height .2s var(--ease); }
/* grabber turns white + grows while it is being held / dragged */
.grabber:active,
.sheet.dragging .grabber { background: #fff; width: 52px; height: 6px; box-shadow: 0 1px 6px rgba(91, 33, 182, .35); }
.sscroll { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
.sscroll::-webkit-scrollbar { display: none; }
.shead { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 14px; }
.shead .st { font-family: var(--grotesk); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.shead .sclose { width: 30px; height: 30px; flex: 0 0 auto; border: none; cursor: pointer; border-radius: 50%; background: rgba(139, 92, 246, .08); border: 1px solid var(--hair); display: flex; align-items: center; justify-content: center; }
.shead .sclose svg { width: 15px; height: 15px; stroke: var(--ink-soft); fill: none; stroke-width: 2.2; }
.seg { display: flex; gap: 5px; padding: 5px; border-radius: 14px; background: rgba(139, 92, 246, .06); border: 1px solid var(--hair); margin: 0 0 14px; }
.segbtn { flex: 1; border: none; cursor: pointer; background: transparent; border-radius: 10px; padding: 10px 0; font-family: var(--grotesk); font-size: 13px; font-weight: 600; letter-spacing: .03em; color: var(--ink-dim); transition: background .4s var(--ease), color .4s var(--ease); }
.segbtn.sel { background: var(--violet); color: #fff; box-shadow: 0 8px 20px -8px rgba(139, 92, 246, .6); }
.scenelabel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.scenelabel .pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 253, 249, .8); border: 1px solid var(--lime-deep); color: #7c3aed; font-family: var(--grotesk); font-size: 9.5px; font-weight: 700; letter-spacing: .2em; padding: 4px 11px; border-radius: 999px; }
.scenelabel .pill .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--lime-deep); }
.scenelabel .room { font-family: var(--grotesk); font-size: 11px; color: var(--ink-dim); letter-spacing: .04em; }
.sbody { display: none; }
.modewrap[data-view="docent"] .sbody[data-body="docent"] { display: block; }
.modewrap[data-view="verse"] .sbody[data-body="verse"] { display: block; }
.sbody .sttl { font-family: var(--serif); font-size: 25px; font-weight: 360; line-height: 1.05; letter-spacing: -.02em; margin-bottom: 10px; color: var(--ink); }
.sbody .sdoc { font-size: 13.5px; line-height: 1.62; color: var(--ink-soft); margin-bottom: 16px; }
.sbody .sdoc b { color: var(--violet-dark); font-weight: 700; }
.sbody .splaque { font-family: var(--grotesk); font-size: 11px; color: var(--ink-dim); letter-spacing: .02em; margin-bottom: 16px; }
.sbody .vref { font-family: var(--grotesk); font-size: 11px; letter-spacing: .16em; color: var(--lime-deep); font-weight: 700; margin-bottom: 10px; }
.sbody .verse { font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.5; color: var(--violet-deep); }

/* End-of-reel stop card — anti-infinite-scroll signature */
.reel-stop { position: relative; width: 100%; height: 100%; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 40px; background: radial-gradient(120% 80% at 50% 30%, #efe6fb, #ece3d6 70%); }
.reel-stop h3 { font-family: var(--serif); font-size: 28px; font-weight: 360; color: var(--ink); }
.reel-stop p { font-size: 14px; color: var(--ink-soft); }
.reel-stop a { margin-top: 16px; display: inline-flex; align-items: center; gap: 8px; background: var(--violet); color: #fff; font-family: var(--grotesk); font-size: 13px; font-weight: 600; padding: 11px 22px; border-radius: 999px; text-decoration: none; box-shadow: 0 10px 24px -8px rgba(139, 92, 246, .6); }

/* hidden classical BGM audio is just an <audio>, no styles needed */
