/* The class player, from the paged prototype (design/build_class_wcf01.py): syllabus beside the
   step, one step per page, stepnav at the foot. */
.shell {
  display: grid; grid-template-columns: 270px minmax(0, 1fr); margin-top: var(--space-4);
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 18px 40px -30px rgba(23, 33, 43, .35);
}
.syllabus { background: var(--vellum); border-right: 1px solid var(--rule); padding: 22px 0 28px; font-family: var(--ui); font-size: .9rem; }
.syllabus-toggle { display: none; }
.syl-head { padding: 0 20px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--rule); display: grid; gap: 6px; }
.syl-head b { font-family: var(--display); font-weight: 400; font-size: 1.12rem; line-height: 1.25; }
.syl-unit { margin: 16px 20px 6px; font-family: var(--ui); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.syllabus ol { list-style: none; margin: 0; padding: 0; }
.syl-step { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 20px; color: var(--muted); text-decoration: none; line-height: 1.35; }
.syl-step:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.syl-step .dot { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 1.5px solid var(--muted); }
.syl-step.done { color: var(--ink); }
.syl-step.done .dot { background: var(--saltire); border-color: var(--saltire); }
.syl-step.now { background: var(--sheet); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--oranje); }
.syl-step:focus-visible { outline-offset: -2px; }

.player-main { padding: 30px 36px 32px; min-width: 0; }
.player-main > h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); margin: 10px 0 var(--space-4); }
.step-eyebrow { display: block; }

.stepnav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rule); }
.stepnav .next { font-family: var(--ui); font-size: .86rem; color: var(--muted); max-width: 40ch; }
.stepnav .next b { display: block; color: var(--ink); font-weight: 600; }
.stepnav .in-prep { display: block; margin-top: 2px; }
.stepnav-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.player-main .textbox { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 28px; }
.task { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 20px 24px; }
.submission { margin-top: var(--space-6); display: grid; gap: var(--space-4); max-width: 760px; }
.submission-head { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.feedback { background: var(--saltire-wash); border-left: 3px solid var(--saltire); border-radius: var(--radius); padding: 12px 16px; }
.feedback .label { display: block; margin-bottom: 4px; }
.feedback p { margin: 0 0 6px; }
.feedback-old { background: var(--vellum); border-left-color: var(--rule); }

@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .syllabus { border-right: 0; border-bottom: 1px solid var(--rule); padding: 0; }
  .syllabus-toggle {
    display: flex; justify-content: space-between; gap: var(--space-3); align-items: center; cursor: pointer;
    padding: 14px 16px; font-weight: 600; min-height: 48px; list-style: none;
  }
  .syllabus-toggle::-webkit-details-marker { display: none; }
  .syllabus-toggle::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-left: auto; }
  .syllabus[open] .syllabus-toggle::after { transform: rotate(-135deg); }
  .syllabus-count { font-weight: 400; color: var(--muted); }
  .syllabus[open] > nav { padding-bottom: 12px; }
  .syl-head { padding: 0 16px 14px; }
  .syl-unit { margin: 12px 16px 6px; }
  .syllabus ol { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; }
  .syl-step { grid-template-columns: 10px auto; gap: 6px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); font-size: .84rem; min-height: 36px; align-items: center; }
  .syl-step.now { box-shadow: none; border-color: var(--oranje); }
  .syl-step .dot { width: 9px; height: 9px; margin-top: 0; }
}
@media (max-width: 560px) {
  .player-main { padding: 22px 16px 24px; }
  .player-main .textbox { padding: 4px 14px; }
  .task { padding: 16px; }
  .stepnav-actions { width: 100%; }
  .stepnav-actions > * { flex: 1 1 auto; }
  .stepnav-actions .inline-form .button { width: 100%; }
}

/* The item page of a section-based course: the course syllabus (long; it scrolls on its own and
   opens at the current item), the source embedded in the centre, the notes, the stepnav. */
.syllabus-course > nav { position: sticky; top: 0; }
.syl-scroll { position: relative; max-height: calc(100vh - 170px); overflow-y: auto; overscroll-behavior: contain; padding-bottom: 8px; }
.syl-group { margin: 20px 20px 4px; font-family: var(--display); font-weight: 400; font-size: 1rem; line-height: 1.3; color: var(--ink); }
.syl-head a { color: inherit; text-decoration: none; }
.syl-head a:hover { text-decoration: underline; }
.syl-step.dead > span:last-child { text-decoration: line-through; text-decoration-color: var(--brick); }
.syl-dead { color: var(--brick); text-decoration: none; display: inline-block; }

.item-page > h1 { margin-bottom: var(--space-2); }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 var(--space-3); color: var(--muted); }
.item-meta .item-by { color: var(--ink); }
.item-page .item-marks { display: flex; margin: 0 0 var(--space-3); }
.item-page .item-conformity { margin: 0 0 var(--space-3); }
.badge-dead { background: var(--brick-wash); color: var(--brick); border: 1px solid var(--brick); }

.source { margin: var(--space-5) 0 var(--space-4); }
.embed { position: relative; background: var(--vellum); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.embed-frame, .embed video { display: block; width: 100%; height: 100%; border: 0; }
.embed-youtube, .embed-vimeo, .embed-video { aspect-ratio: 16 / 9; }
.embed-sermonaudio { height: 170px; }
.embed-archive, .embed-drive { aspect-ratio: 4 / 3; max-height: 80vh; }
.embed-drive_folder { height: 420px; }
.embed-pdf, .embed-page, .embed-drive_doc { height: min(80vh, 900px); min-height: 420px; }
.source > .small { margin-top: var(--space-2); }
.audio-card { background: var(--vellum); border: 1px solid var(--rule); border-left: 4px solid var(--saltire); border-radius: 8px; padding: 14px 18px; }
.audio-card audio { display: block; width: 100%; }
.audio-title { margin: 0; font-weight: 600; }
.audio-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 2px 0 var(--space-2); }
.audio-actions { margin: var(--space-2) 0 0; }
.audio-tracks { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.audio-tracks li { display: grid; gap: 4px; padding-top: var(--space-2); border-top: 1px solid var(--rule); }
.audio-tracks .track-title { font-size: 0.95rem; }
.audio-download { color: var(--saltire); }
.audio-download:focus-visible, .audio-card audio:focus-visible { outline: 2px solid var(--saltire); outline-offset: 2px; }
.source-panel { border: 1px solid var(--rule); border-radius: 8px; padding: 18px 22px; background: var(--sheet); }
.source-panel .panel-h { margin: 0 0 var(--space-2); font-size: 1.2rem; }
.source-panel p { margin: 0 0 var(--space-3); max-width: var(--measure); }
.source-panel p:last-child { margin-bottom: 0; }
.panel-dead { background: var(--brick-wash); border-color: var(--brick); }
.panel-dead .panel-h { color: var(--brick); }
.panel-list, .panel-external { background: var(--saltire-wash); border-color: var(--saltire-wash); }
.panel-none { background: var(--vellum); }
.url-text { font-size: .84rem; overflow-wrap: anywhere; word-break: break-all; }
.also-links { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-family: var(--ui); font-size: .9rem; margin: var(--space-3) 0 0; }

.about { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: var(--space-5); margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--rule); }
.about h2.label { margin: 0 0 var(--space-2); }
.about p { margin: 0 0 var(--space-3); max-width: var(--measure); }
.margin-ref { display: grid; gap: 6px; align-content: start; font-family: var(--ui); font-size: .84rem; color: var(--muted); border-left: 2px solid var(--oranje); padding-left: 12px; }

@media (max-width: 920px) {
  .syllabus-course > nav { position: static; }
  .syl-scroll { max-height: 60vh; }
  .syllabus-course ol { display: block; padding: 0; }
  .syllabus-course .syl-step { grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 8px 16px; border: 0; border-radius: 0; background: none; min-height: 0; align-items: start; }
  .syllabus-course .syl-step.now { background: var(--sheet); box-shadow: inset 3px 0 0 var(--oranje); }
  .syllabus-course .syl-step .dot { width: 12px; height: 12px; margin-top: 3px; }
  .syl-group { margin: 14px 16px 4px; }
  .about { grid-template-columns: minmax(0, 1fr); }
}

/* A series item (SermonAudio sermons, lessons, lectures, playlist videos): the series link, the player
   of the current part with its own links (manuscript, study guide, audio only), the ordered parts. */
.series-link { margin: 0 0 var(--space-2); }
.series-link a { color: var(--saltire); }
.series-summary { font-family: var(--ui); }
.series-former { margin: 0 0 var(--space-2); }
.part-variant[hidden] { display: none; }
.part-links { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; font-family: var(--ui); margin: var(--space-2) 0 0; }
.part-links a { color: var(--saltire); }
.part-toggle { font-weight: 600; }
.series-now { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; justify-content: space-between; margin: var(--space-3) 0; }
.series-now-title { margin: 0; font-weight: 600; max-width: var(--measure); }
.series-now-title .label { margin-right: 6px; }
.series-next { margin: 0; }
.series-next[hidden], .series-next a[hidden] { display: none; }
.series-parts { list-style: none; margin: 0 0 var(--space-4); padding: 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--sheet); max-height: 22rem; overflow-y: auto; }
.series-parts li + li { border-top: 1px solid var(--rule); }
.series-part { font-weight: 400; font-family: var(--ui); display: grid; grid-template-columns: 2rem 1fr auto; gap: var(--space-2); align-items: baseline; padding: 9px 14px; color: inherit; text-decoration: none; }
.series-part:hover { background: var(--saltire-wash); }
.series-part[aria-current="true"] { background: var(--saltire-wash); box-shadow: inset 4px 0 0 var(--saltire); font-weight: 600; }
.series-part:focus-visible { outline: 2px solid var(--saltire); outline-offset: -2px; }
.part-n { font-variant-numeric: tabular-nums; color: var(--muted, inherit); }
.part-time { font-variant-numeric: tabular-nums; }

/* The Internet Archive reader: tall single-page viewer, full screen wrapper, and the /read page. */
.book-reader { background: #fff; }
.book-reader [hidden] { display: none; }
.reader-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: var(--space-2); }
.book-reader .embed-archive { aspect-ratio: auto; max-height: none; height: min(88vh, 1100px); min-height: 480px; }
.reader-ocr { margin-top: var(--space-2); }
.book-reader:fullscreen { display: flex; flex-direction: column; padding: 8px 12px; background: #fff; }
.book-reader:fullscreen .embed-archive { flex: 1; height: auto; min-height: 0; }
.reader-page { margin: 0; padding: 0; background: #fff; color: var(--ink); }
.reader-topbar { display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 12px; box-sizing: border-box; border-bottom: 1px solid var(--rule); background: var(--vellum); }
.reader-topbar-text { min-width: 0; }
.reader-topbar-title { margin: 0; font: 600 .95rem/1.25 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-topbar .small { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-page .reader-full { height: calc(100vh - 56px); height: calc(100dvh - 56px); max-height: none; aspect-ratio: auto; border: 0; border-radius: 0; }

/* Long titles (founder feedback 2026-10-06): the syllabus clamps an entry to two lines (the full
   title is in the link's title and for screen readers), the item heading scales down and sets a
   subtitle line, and the reader shows where the student stopped. */
.syl-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.reading-mark { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--saltire-wash); color: var(--saltire); font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-page > h1.title-long { font-size: clamp(1.5rem, 3.2vw, 2.1rem); line-height: 1.2; }
.item-page > h1 .item-subtitle { display: block; margin-top: 6px; font-family: var(--ui); font-size: .42em; font-weight: 500; line-height: 1.35; color: var(--muted); letter-spacing: 0; }
.reading-list { display: grid; gap: var(--space-2); }
.reading-row { display: grid; gap: 2px; }
.reading-link { font-weight: 600; overflow-wrap: anywhere; }
.bk-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 7px 14px; border-bottom: 1px solid var(--rule); font-family: var(--ui); background: var(--vellum); }
.bk-progress-all { width: min(160px, 30vw); }
.bk-resume { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.bk-resume[hidden] { display: none; }
