/* Lightbrary cinema engine — gita.yoga.org room grammar + ambient motion */
:root {
  --gold: #d4a84b;
  --warm: #f3e6c8;
  --text: #eef2ff;
  --muted: #aab6d4;
  --ink: #07070a;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --chrome-offset: 72px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  background: #000;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
}
body.lb-room-mode { overflow: hidden; height: 100%; height: 100dvh; }
html.ys-has-legal body.lb-room-mode .room {
  top: var(--ys-legal-h, 0px);
  height: calc(100dvh - var(--ys-legal-h, 0px));
}
.room {
  position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; background: #000; overflow: hidden;
}
.room .plates { position: absolute; inset: 0; z-index: 0; }
.room .plate {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background-size: cover; background-position: center 28%;
  background-repeat: no-repeat; background-color: #0a0806;
  opacity: 0; transform: scale(1.04);
  transition: opacity 1.1s ease;
  animation: none;
}
.room .plate.is-on {
  opacity: 1;
  animation: lbKen 34s ease-in-out alternate infinite;
}
.room .plate.is-photo {
  background-size: contain;
  background-position: center 40%;
  background-color: #1a140e;
  background-image:
    linear-gradient(180deg, rgba(26,20,14,.2), rgba(26,20,14,.55)),
    var(--plate-url);
  transform: none !important;
  animation: none !important;
}
.room .plate.is-photo.is-on {
  animation: none;
  transform: none;
}
@keyframes lbKen {
  from { transform: scale(1.03) translate3d(-1.2%, 0, 0); }
  to { transform: scale(1.08) translate3d(1.2%, -0.8%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .room .plate.is-on { animation: none; transform: scale(1.04); }
}
.room .scrim {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.22) 42%, transparent 68%),
    linear-gradient(transparent 48%, rgba(0,0,0,.88) 100%);
}
.room .rays {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .35; mix-blend-mode: screen;
  background:
    radial-gradient(ellipse 40% 60% at 70% 10%, rgba(255,206,120,.35), transparent 60%),
    radial-gradient(ellipse 30% 50% at 30% 0%, rgba(255,220,160,.18), transparent 55%);
  animation: lbRays 18s ease-in-out alternate infinite;
}
@keyframes lbRays { from { opacity: .22; } to { opacity: .42; } }
.room .motes {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden;
}
.room .motes i {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: rgba(255, 220, 150, .75); box-shadow: 0 0 6px rgba(255,206,120,.55);
  animation: lbMote linear infinite;
  opacity: 0;
}
@keyframes lbMote {
  0% { transform: translate3d(0, 20px, 0); opacity: 0; }
  10% { opacity: .7; }
  90% { opacity: .5; }
  100% { transform: translate3d(12px, -110vh, 0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .room .rays, .room .motes i { animation: none; opacity: .25; }
}
.stage {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 0 max(16px, var(--sar)) max(18px, var(--sab)) max(16px, var(--sal));
  max-width: 680px;
}
.stage-fixed {
  min-height: min(46dvh, 420px);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.mode-row {
  margin: 0 0 10px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.mode-toggle {
  appearance: none; cursor: pointer;
  color: rgba(238,242,255,.92);
  font-size: 13px; font-weight: 650;
  padding: 8px 12px; border-radius: 999px; min-height: 44px;
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.2);
  text-decoration: none; display: inline-flex; align-items: center;
}
.cite {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 8px; font-weight: 700;
  min-height: 1.2em;
}
.en {
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 4.2vw, 1.45rem);
  line-height: 1.4; color: var(--warm); margin: 0 0 10px;
  max-width: 36em; text-shadow: 0 2px 18px rgba(0,0,0,.7);
  min-height: 5.6em;
  overflow: hidden;
}
.en em { font-style: italic; color: var(--gold); }
.edition-line {
  margin: 0 0 14px; font-size: 13px; color: rgba(238,242,255,.78);
  text-shadow: 0 1px 10px rgba(0,0,0,.55); max-width: 36em;
  min-height: 1.35em;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 46px; }
.btn-watch {
  appearance: none; border: 0; cursor: pointer;
  background: var(--gold); color: #1a1408;
  font-weight: 700; font-size: 15px;
  padding: 12px 20px; border-radius: 6px; min-height: 46px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 88px;
}
.btn-ghost, a.btn-ghost {
  appearance: none; cursor: pointer;
  background: rgba(255,255,255,.1); color: var(--text);
  border: 1px solid rgba(255,255,255,.22);
  font-weight: 600; font-size: 13px;
  padding: 10px 14px; border-radius: 6px; min-height: 46px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn-ghost:disabled, a.btn-ghost.is-off { opacity: .35; pointer-events: none; }
.bars { margin-top: 12px; max-width: 320px; display: grid; gap: 8px; }
.bar {
  height: 8px; background: #243041; border-radius: 99px; overflow: hidden;
  position: relative;
}
.bar.chapter { height: 6px; background: rgba(36,48,65,.85); }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #f0d78c); transition: width .12s linear; }
.bar-labels {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11px; color: var(--muted); margin-top: 4px; max-width: 320px;
}
/* Exit / mode toggle — BELOW yoga.org chrome */
.exit {
  position: absolute; top: calc(var(--chrome-offset) + var(--sat)); right: 0; z-index: 6;
  display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap;
  padding: 8px max(12px, var(--sar)) 0 max(12px, var(--sal));
  pointer-events: none;
}
html.ys-has-legal .exit {
  top: calc(var(--chrome-offset) + var(--ys-legal-h, 0px) + var(--sat));
}
.exit a, .exit button {
  pointer-events: auto;
  color: rgba(238,242,255,.88);
  text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(0,0,0,.42); border: 1px solid rgba(255,255,255,.16); cursor: pointer;
  min-height: 44px;
}
/* Shelves below hero (home only) */
.lb-below {
  position: relative; z-index: 1;
  margin-top: 100dvh;
  background: #0b0a08;
  padding: 28px 0 80px;
  border-top: 1px solid rgba(212,168,75,.18);
}
.lb-shelf { margin: 0 0 28px; }
.lb-shelf-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 18px; padding-left: max(18px, var(--sal)); margin-bottom: 12px;
}
.lb-shelf-head h2 { margin: 0; font: 700 1.15rem/1.2 Inter, system-ui, sans-serif; color: #fff; }
.lb-row {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; padding: 4px 18px 20px;
  padding-left: max(18px, var(--sal)); scrollbar-width: thin;
}
.lb-tile {
  flex: 0 0 auto; width: 148px; scroll-snap-align: start; text-decoration: none; color: inherit;
  background: #14110d; border: 1px solid rgba(212,168,75,.22); border-radius: 14px; overflow: hidden;
  transition: transform .2s ease;
  display: flex; flex-direction: column;
}
.lb-tile:hover, .lb-tile:focus-visible { transform: scale(1.04); outline: none; }
.lb-tile .cover {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #1a1510;
  overflow: hidden;
  position: relative;
}
.lb-tile .cover img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  display: block;
}
.lb-tile .meta {
  padding: 10px 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 92px;
}
.lb-tile .meta strong {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; color: #fff; line-height: 1.25;
}
.lb-tile .meta span { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; }
.lb-badge {
  display: inline-flex; align-self: flex-start; margin-top: auto;
  font: 700 10px/1.1 Inter, system-ui, sans-serif;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 8px; border-radius: 999px; white-space: nowrap;
  max-width: 100%;
}
.lb-badge.read { background: rgba(61,214,140,.15); color: #3dd68c; }
.lb-badge.link { background: rgba(212,168,75,.12); color: var(--gold); }
.lb-badge.soon { background: rgba(170,182,212,.12); color: var(--muted); }
.lb-badge.cover { background: rgba(255,255,255,.08); color: #d7dde8; }
footer.ys-foot {
  max-width: 1120px; margin: 0 auto; padding: 28px 18px 48px;
  color: var(--muted); font-size: 13px; border-top: 1px solid rgba(212,168,75,.18);
}
footer.ys-foot a { color: var(--gold); }
.page-mode .room { display: none; }
.page-mode .page-reader { display: block; }
.page-reader { display: none; max-width: 720px; margin: 0 auto; padding: 88px 18px 64px; }
.page-reader p { font-family: Georgia, serif; color: var(--warm); line-height: 1.7; font-size: 1.1rem; }
@media (max-width: 390px) {
  .lb-tile { width: 136px; }
  .lb-tile .meta { min-height: 98px; }
  .en { font-size: clamp(1rem, 4.6vw, 1.2rem); min-height: 6.2em; }
  body { overflow-x: hidden; }
  .exit { top: calc(64px + var(--sat)); }
  .stage-fixed { min-height: min(52dvh, 460px); }
}

/* Phone: shared yoga.org chrome nav overflows left over the wordmark at <=440px.
   Lightbrary-only fix: drop lowest-priority links so the nav fits beside the brand. */
@media (max-width: 440px) {
  .ys-top .ys-nav { min-width: 0; }
  .ys-top .ys-nav > a[href="https://schedule.yoga.org/#video"] { display: none !important; }
}
@media (max-width: 380px) {
  .ys-top .ys-nav > a[href="https://yoga.org/account"] { display: none !important; }
}
