/* ————— LMS — full-black theater ————— */
:root {
  --black: #0a0a09;
  --black-2: #111110;
  --black-3: #191917;
  --white: #f5f2ea;
  --dim: rgba(245, 242, 234, 0.55);
  --faint: rgba(245, 242, 234, 0.3);
  --gold: #c3a25f;
  --gold-dim: rgba(195, 162, 95, 0.35);
  --hairline: rgba(245, 242, 234, 0.1);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: 0.35s; }
::view-transition-new(root) { animation-duration: 0.55s; }

* { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: var(--gold); color: var(--black); }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--black);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; background: none; border: 0; }

.lms {
  display: grid;
  grid-template-rows: 64px 1fr;
  grid-template-columns: 312px 1fr;
  grid-template-areas: "top top" "side main";
  height: 100vh;
  height: 100dvh;
}

/* ————— Top bar ————— */
.lms-top {
  grid-area: top;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--hairline);
  background: var(--black);
  z-index: 10;
}
.lms-brand {
  font-family: var(--serif);
  font-size: 19px; font-weight: 600; letter-spacing: 0.02em;
}
.lms-brand em { font-style: italic; color: var(--gold); }
.lms-top-right { display: flex; align-items: center; gap: 26px; }
.lms-top-right a, .lms-top-right span {
  font-size: 10.5px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--dim);
  transition: color 0.25s;
}
.lms-top-right a:hover { color: var(--gold); }

/* ————— Sidebar ————— */
.lms-side {
  grid-area: side;
  border-right: 1px solid var(--hairline);
  overflow-y: auto;
  background: var(--black-2);
  scrollbar-width: thin;
  scrollbar-color: var(--black-3) transparent;
}
.side-label {
  padding: 26px 28px 14px;
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--faint);
}

.course-group { border-bottom: 1px solid var(--hairline); }
.course-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 24px 18px 20px;
  text-align: left;
  transition: background 0.25s;
}
.course-toggle:hover { background: rgba(245, 242, 234, 0.03); }

/* progress ring around the course number */
.ct-ring {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--gold) calc(var(--pct, 0) * 1%), rgba(245, 242, 234, 0.12) 0);
  display: grid; place-items: center;
  transition: background 0.5s;
}
.ct-ring::before {
  content: "";
  position: absolute; inset: 2px;
  border-radius: 50%;
  background: var(--black-2);
}
.course-toggle:hover .ct-ring::before { background: #141412; }
.ct-num {
  position: relative;
  font-size: 11px; font-weight: 600;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
.course-group.open .ct-num, .course-group.playing .ct-num { color: var(--gold); }
.ct-body { flex: 1; min-width: 0; }
.ct-title {
  display: block;
  font-size: 14px; font-weight: 600; line-height: 1.35;
  letter-spacing: 0.01em;
}
.ct-meta {
  display: block;
  margin-top: 3px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--faint);
}
.ct-chev {
  color: var(--faint);
  font-size: 10px;
  transition: transform 0.35s var(--ease), color 0.35s;
}
.course-group.open .ct-chev { transform: rotate(90deg); color: var(--gold); }

.lesson-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease);
  background: var(--black);
}
.course-group.open .lesson-list { max-height: 600px; }

.lesson-item {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px 12px 30px;
  text-align: left;
  transition: background 0.2s;
  position: relative;
}
.lesson-item:hover { background: rgba(245, 242, 234, 0.04); }
.lesson-item.active { background: rgba(195, 162, 95, 0.08); }
.lesson-item.active::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--gold);
}
.li-state {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  font-size: 8.5px;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.3s;
}
.lesson-item.done .li-state { border-color: var(--gold); background: var(--gold); color: var(--black); }
.lesson-item.active .li-state { border-color: var(--gold); color: var(--gold); }
.lesson-item.active:not(.done) .li-state::after { content: "▶"; font-size: 7px; color: var(--gold); }
.lesson-item.done .li-state::after { content: none; }
.li-title { flex: 1; font-size: 13px; font-weight: 500; color: rgba(245, 242, 234, 0.75); line-height: 1.45; transition: color 0.2s; }
.lesson-item:hover .li-title, .lesson-item.active .li-title { color: var(--white); }
.li-num { font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* equalizer bars on the playing lesson */
.li-eq {
  display: none;
  align-items: flex-end; gap: 2px;
  height: 12px; margin-left: 4px;
}
.lesson-item.active.playing .li-eq { display: inline-flex; }
.li-eq i {
  width: 2px; background: var(--gold);
  animation: eq 0.9s ease-in-out infinite;
}
.li-eq i:nth-child(1) { height: 40%; animation-delay: 0s; }
.li-eq i:nth-child(2) { height: 90%; animation-delay: 0.22s; }
.li-eq i:nth-child(3) { height: 60%; animation-delay: 0.44s; }
@keyframes eq {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* ————— Main / theater ————— */
.lms-main {
  grid-area: main;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--black);
}
.theater {
  padding: clamp(12px, 2vh, 24px) clamp(14px, 2vw, 32px) 0;
}

/* ambient glow — the video bleeds light into the room */
.ambient-wrap { position: relative; }
#ambient {
  position: absolute;
  inset: -6% -4%;
  width: 108%; height: 112%;
  filter: blur(70px) saturate(1.6) brightness(0.85);
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
  z-index: 0;
}
.ambient-wrap.lit #ambient { opacity: 0.55; }

.player-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 64px - 118px);
  background: #000;
  box-shadow: 0 60px 120px -60px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--hairline);
}
.player-shell video {
  width: 100%; height: 100%;
  display: block;
  object-fit: contain;
}

/* start overlay — the invitation */
.start-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(60% 60% at 50% 50%, rgba(10, 10, 9, 0.25), rgba(10, 10, 9, 0.72));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
  z-index: 3;
}
.start-overlay.show { opacity: 1; pointer-events: auto; }
.so-ring {
  width: 96px; height: 96px; border-radius: 50%;
  border: 1px solid rgba(195, 162, 95, 0.55);
  display: grid; place-items: center;
  position: relative;
  transition: transform 0.4s var(--ease), background 0.4s;
}
.so-ring::before {
  content: "";
  position: absolute; inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(195, 162, 95, 0.18);
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.4; }
}
.so-tri { color: var(--gold); font-size: 26px; padding-left: 6px; transition: color 0.3s; }
.start-overlay:hover .so-ring { transform: scale(1.06); background: var(--gold); }
.start-overlay:hover .so-tri { color: var(--black); }
.so-label {
  font-size: 10px; letter-spacing: 0.4em; text-transform: uppercase;
  color: var(--dim);
}

/* up-next + complete overlays */
.upnext-overlay, .complete-overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(10, 10, 9, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
  z-index: 4;
  text-align: center;
}
.upnext-overlay.show, .complete-overlay.show { opacity: 1; pointer-events: auto; }
.un-card, .co-card { padding: 30px; max-width: 560px; }
.un-kicker, .co-kicker {
  font-size: 10px; letter-spacing: 0.4em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 16px;
}
.un-title {
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 44px);
  font-weight: 500; font-style: italic;
  line-height: 1.1;
  margin-bottom: 30px;
}
.un-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.un-count {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px;
  margin-left: 8px;
  border-radius: 50%;
  border: 1px solid rgba(10, 10, 9, 0.4);
  font-size: 10px;
}
.co-rule { color: var(--gold); font-size: 18px; margin-bottom: 18px; }
.co-title {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 52px);
  font-weight: 500;
  line-height: 1.05;
  margin-bottom: 14px;
}
.co-title em { font-style: italic; color: var(--gold); }
.co-sub { font-size: 13.5px; color: var(--dim); font-weight: 300; margin-bottom: 30px; max-width: 44ch; margin-inline: auto; }

.player-error {
  position: absolute; inset: 0;
  display: none; place-items: center;
  text-align: center; padding: 30px;
  background: linear-gradient(160deg, #141412, #0a0a09);
  z-index: 5;
}
.player-shell.errored .player-error { display: grid; }
.player-error .pe-title {
  font-family: var(--serif); font-style: italic;
  font-size: 24px; margin-bottom: 10px;
}
.player-error p { font-size: 13px; color: var(--dim); font-weight: 300; }

/* ————— Under-player strip ————— */
.lesson-bar {
  padding: 20px clamp(14px, 2vw, 32px) 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.lb-eyebrow {
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}
.lb-title {
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.lb-blurb {
  margin-top: 8px;
  font-size: 14px; font-weight: 400;
  color: var(--dim);
  max-width: 62ch; line-height: 1.6;
}
.lb-actions { display: flex; gap: 12px; flex-shrink: 0; }
.lms-btn {
  padding: 13px 26px;
  font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 600;
  border: 1px solid rgba(245, 242, 234, 0.25);
  color: var(--white);
  transition: all 0.3s var(--ease);
  white-space: nowrap;
}
.lms-btn:hover { border-color: var(--gold); color: var(--gold); }
.lms-btn.primary {
  background: var(--gold); border-color: var(--gold); color: var(--black);
  position: relative; overflow: hidden;
}
.lms-btn.primary::before {
  content: "";
  position: absolute; top: 0; bottom: 0; left: -80%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  transition: left 0.7s var(--ease);
}
.lms-btn.primary:hover::before { left: 130%; }
.lms-btn.primary:hover { background: var(--white); border-color: var(--white); color: var(--black); }
.lms-btn[disabled] { opacity: 0.25; pointer-events: none; }
#speedBtn { min-width: 74px; text-align: center; }

/* keyboard shortcut strip */
.shortcut-strip {
  margin-top: auto;
  padding: 14px clamp(14px, 2vw, 32px) 18px;
  display: flex; gap: 26px; flex-wrap: wrap;
  border-top: 1px solid var(--hairline);
}
.shortcut-strip span { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.shortcut-strip b {
  font-weight: 600; color: var(--dim);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 2px 7px;
  margin-right: 6px;
  font-size: 9.5px;
}

/* top-bar progress */
.top-progress { display: flex; align-items: center; gap: 14px; }
.tp-bar { width: 120px; height: 1px; background: var(--hairline); position: relative; }
.tp-bar i { position: absolute; inset: 0 auto 0 0; background: var(--gold); transition: width 0.6s var(--ease); }

/* lesson-change cinematic swap */
.swap-in .ambient-wrap { animation: theaterIn 0.7s var(--ease) both; }
.swap-in .lesson-bar > div:first-child { animation: textIn 0.7s var(--ease) both 0.1s; }
@keyframes theaterIn {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes textIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* sidebar scrollbar, whisper-quiet */
.lms-side::-webkit-scrollbar { width: 5px; }
.lms-side::-webkit-scrollbar-thumb { background: var(--black-3); border-radius: 3px; }
.lms-side::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

@media (prefers-reduced-motion: reduce) {
  .swap-in .ambient-wrap, .swap-in .lesson-bar > div:first-child { animation: none; }
  .so-ring::before, .li-eq i { animation: none; }
}

/* drawer chrome — desktop never sees these */
.drawer-backdrop, .drawer-fab { display: none; }

/* ————— Mobile — bottom-sheet curriculum, edge-to-edge theater ————— */
@media (max-width: 900px) {
  body { overflow: auto; }
  .lms {
    display: flex; flex-direction: column;
    height: auto; min-height: 100dvh;
  }

  /* compact sticky top bar */
  .lms-top {
    position: sticky; top: 0;
    height: 56px;
    padding: 0 18px;
    background: rgba(10, 10, 9, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 40;
  }
  .lms-brand { font-size: 17px; }
  .top-progress { display: none; }

  /* theater: full-bleed, flush under the bar */
  .lms-main { overflow: visible; }
  .theater { padding: 0; }
  #ambient { display: none; }
  .player-shell {
    max-height: none;
    box-shadow: none;
    z-index: 1;
  }
  /* the native player already shows its own big play button on mobile —
     our overlay would double it up, so let the native one own the stage */
  .start-overlay { display: none; }

  /* lesson info stacks; controls become a full-width row */
  .lesson-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    padding: 22px 20px 26px;
  }
  .lb-title { font-size: 24px; }
  .lb-actions { width: 100%; gap: 10px; }
  .lb-actions .lms-btn { flex: 1; padding: 15px 10px; text-align: center; }
  #speedBtn { flex: 0 0 74px; }

  .shortcut-strip { display: none; }

  /* curriculum becomes a bottom sheet */
  .lms-side {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    max-height: 78dvh;
    border-right: 0;
    border-top: 1px solid rgba(195, 162, 95, 0.3);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -30px 80px rgba(0, 0, 0, 0.7);
    transform: translateY(102%);
    transition: transform 0.5s var(--ease);
    z-index: 70;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .lms-side.open { transform: none; }
  .side-label {
    position: sticky; top: 0;
    background: var(--black-2);
    padding: 30px 24px 14px;
    z-index: 1;
  }
  /* grab handle */
  .side-label::before {
    content: "";
    position: absolute; top: 10px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 4px;
    border-radius: 2px;
    background: rgba(245, 242, 234, 0.22);
  }
  .lesson-item { padding: 15px 24px 15px 30px; }

  .drawer-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(10, 10, 9, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    z-index: 65;
  }
  .drawer-backdrop.show { opacity: 1; pointer-events: auto; }

  /* floating curriculum button */
  .drawer-fab {
    display: inline-flex;
    align-items: center; gap: 12px;
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    border-radius: 100px;
    background: var(--gold);
    color: var(--black);
    font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 600;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(245, 242, 234, 0.12);
    z-index: 60;
    transition: transform 0.3s var(--ease), opacity 0.3s;
  }
  .drawer-fab:active { transform: translateX(-50%) scale(0.96); }
  .drawer-fab.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(20px); }
  .fab-bars { display: inline-flex; flex-direction: column; gap: 3px; }
  .fab-bars i { width: 14px; height: 1.5px; background: var(--black); }
}
