/* =============================================================================
 * Chronological Study of the Bible — Advanced (instructor) edition.
 * Shared by every page under course/advanced/.
 *
 * From v1.27.0 these pages wear the site's one look: the palette, type and
 * base come from css/site.css, imported here rather than linked from each of
 * the forty-five pages, so the manual's HTML — which is the manual's content —
 * did not have to be touched to change how it looks. What is below is this
 * edition's own furniture, named against site.css's custom properties.
 *
 * The phone was the reason for most of it. Measured at 390px wide:
 *   - the contents page was 38 full-width cards of about 100px each, with no
 *     way to jump from the front matter to Deuteronomy;
 *   - a lesson's four-level outline narrowed its deepest lines to ~290px, and
 *     the class timeline read as a wall of bullets rather than a timetable;
 *   - the links that move between pages (Contents, the previous and next
 *     lesson, the simple edition) were 15 to 20px tall.
 * app.js adds the parts that need behaviour — the "on this page" row, the
 * time rail's minutes, the settings sheet — and this file lays them out.
 * ========================================================================== */
@import url('../../css/site.css');

:root {
  /* The names this stylesheet used before site.css, kept as aliases so any
     rule that still says --cream or --gold-ink means the new palette. */
  --gold-ink: var(--gold);
  --cream: var(--paper-2);
  --ok: var(--good);
  /* The height of the sticky "on this page" row, which headings scroll clear
     of. app.js measures the real one and writes it here. */
  --onpage-h: 60px;
}

body { line-height: 1.55; }
a { color: var(--navy); }

/* ------------------------------------------------------------------- header */
header.hero { max-width: var(--w-main); margin: 0 auto; padding: 26px 16px 14px; }
header.hero .org {
  font: 600 .78rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
}
header.hero h1 {
  font-size: clamp(1.5rem, 4.4vw, 2.2rem); line-height: 1.12; margin: 6px 0 4px;
  color: var(--navy); letter-spacing: -.01em;
}
header.hero .sub { font: 500 1.08rem/1.35 var(--serif); margin: 0; }
header.hero .tag { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------------------- breadcrumb
   Both links are whole 44px targets; they were 15 and 20px of text. */
.crumb { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--card); }
.crumb .inner {
  max-width: var(--w-main); margin: 0 auto; padding: 0 16px;
  display: flex; flex-wrap: wrap; gap: 0 16px; align-items: center; justify-content: space-between;
  font-size: .92rem;
}
.crumb a {
  display: inline-flex; align-items: center; min-height: var(--tap);
  color: var(--navy); font-weight: 600; text-decoration: none;
}
.crumb a:hover { text-decoration: underline; }
.crumb > .inner > span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--faint); }
.crumb > .inner > span > a:first-child { padding-right: 4px; }
.crumb .here { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------ on this page (app.js)
   One row of chips that scrolls sideways, stuck to the top of the screen, so
   a teacher halfway down a timeline is one tap from the quiz. */
.onpage {
  position: sticky; top: 0; z-index: 30;
  background: var(--paper); border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 14px -12px rgba(22, 35, 58, .35);
}
.onpage .inner {
  max-width: var(--w-main); margin: 0 auto; padding: 8px 16px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.onpage .inner::-webkit-scrollbar { display: none; }
.onpage a {
  flex: 0 0 auto; display: block; padding: 0 16px;
  max-width: 16rem; overflow: hidden; text-overflow: ellipsis;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: 500 .95rem var(--sans); text-decoration: none; white-space: nowrap;
  /* After the font shorthand, which would otherwise reset it. */
  line-height: calc(var(--tap) - 2px);
}
.onpage a[aria-current="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
/* On the contents page the row is the three parts of the manual, and reads
   as one segmented control. */
.onpage.segmented .inner { padding: 8px 16px; }
.onpage.segmented .seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; flex: 1 1 auto;
  background: var(--paper-2); border-radius: 12px; padding: 4px;
}
.onpage.segmented a {
  display: flex; align-items: center; min-height: var(--tap); line-height: 1.2; max-width: none;
  justify-content: center; border: 0; background: none; border-radius: 9px; padding: 0 8px;
  font-weight: 600; color: var(--muted);
}
.onpage.segmented a[aria-current="true"] { background: var(--card); color: var(--navy); box-shadow: 0 1px 3px rgba(22, 35, 58, .18); }

h2[id], h3[id], .focus[id] { scroll-margin-top: calc(var(--onpage-h) + 12px); }

/* ------------------------------------------------------------------- main */
main { max-width: var(--w-main); margin: 0 auto; padding: 20px 16px 32px; }
h2 { font-size: 1.6rem; line-height: 1.2; color: var(--navy); margin: 28px 0 10px; }
main > h2:first-child { margin-top: 8px; }
h3 { font-size: 1.25rem; line-height: 1.25; margin: 26px 0 8px; }
h4 { font: 600 .92rem var(--sans); color: var(--muted); margin: 16px 0 4px; }
p { margin: .5rem 0 .8rem; }
.lead { font-size: 1.05rem; }
/* A bare video URL, or a line of underscores left for a student to write on,
   is one unbreakable word wider than a phone. Let it break rather than push
   the whole page sideways. */
main p, main li { overflow-wrap: anywhere; }
main td { overflow-wrap: break-word; }

/* nested outline lists, mirroring the manual's ● ○ ▪ ▫ levels.
   Four, not three: Lesson 1 nests the class president's duties under the role
   that names them, under the roles discussion, under the Class Admin block.
   The levels are classes on flat <li>s, not nested lists, so an indent is a
   margin and a phone can have smaller ones. */
ul.outline { list-style: none; margin: .4rem 0 1rem; padding: 0; }
ul.outline li { position: relative; margin: .35rem 0; padding-left: 1.15rem; }
ul.outline li::before { position: absolute; left: .1rem; color: var(--gold); font-size: .75em; top: .42em; }
ul.outline li.l1 { margin-left: 0; }
ul.outline li.l2 { margin-left: 1.4rem; }
ul.outline li.l3 { margin-left: 2.8rem; }
ul.outline li.l4 { margin-left: 4.2rem; }
ul.outline li.l1::before { content: "\25CF"; }
ul.outline li.l2::before { content: "\25CB"; color: var(--navy-2); }
ul.outline li.l3::before { content: "\25AA"; color: var(--faint); }
ul.outline li.l4::before { content: "\25AB"; color: var(--faint); }
ul.outline li.l2, ul.outline li.l3, ul.outline li.l4 { font-size: .96rem; }

/* The class timeline as a time rail (app.js marks it and splits the minutes
   off each top-level step): minutes on the left, the step on the right, and
   the step's details beneath it. */
ul.outline.timeline li.l1 {
  display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 0 14px;
  padding: 12px 0 2px; margin: 0; border-top: 1px solid var(--line);
}
ul.outline.timeline li.l1:first-child { border-top: 0; }
ul.outline.timeline li.l1::before { content: none; }
ul.outline.timeline .mins { font: 600 .85rem/1.6 var(--mono); color: var(--gold); white-space: nowrap; }
ul.outline.timeline .step { font-weight: 600; min-width: 0; }
ul.outline.timeline li.l2 { margin-left: calc(4.2rem + 14px + 0rem); }
ul.outline.timeline li.l3 { margin-left: calc(4.2rem + 14px + 1.2rem); }
ul.outline.timeline li.l4 { margin-left: calc(4.2rem + 14px + 2.4rem); }
.tl-more {
  display: none; grid-column: 2; justify-self: start;
  min-height: var(--tap); padding: 0; background: none; border: 0; cursor: pointer;
  color: var(--navy); font: 600 .92rem var(--sans);
}

/* numbered steps, with the outline bullets nesting underneath them */
ol.steps { margin: .4rem 0 1rem; padding-left: 1.75rem; }
ol.steps > li { margin: .45rem 0; padding-left: .2rem; }
ol.steps > li::marker { font-family: var(--sans); font-weight: 700; color: var(--navy-2); }
ol.steps ul.outline { margin: .3rem 0 .6rem; }

.focus {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: var(--radius); padding: 14px 16px; margin: 14px 0 18px;
}
.focus .label {
  font: 600 .8rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold);
}
.focus p { margin: .35rem 0 0; font: 1.06rem/1.55 var(--serif); }

.note { font-style: italic; color: var(--muted); font-size: .95rem; }
.footnotes {
  border-top: 1px solid var(--line); margin-top: 2rem; padding-top: .7rem;
  font-size: .88rem; color: var(--muted);
}
.footnotes sup { color: var(--gold); font-weight: 700; }

/* ------------------------------------------------------------ quiz launcher */
.quiz {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 12px 0 6px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
}
.quiz .rng { flex: 1 1 14rem; font-size: .95rem; color: var(--ink); }
.quiz .rng span { display: block; font: 600 .85rem var(--sans); color: var(--muted); }
.quiz .rng b { font-weight: 600; }
.test-btn {
  min-height: 48px; padding: 0 20px; border-radius: 12px; cursor: pointer;
  font: 600 1rem var(--sans); background: var(--navy); color: #fff; border: 1px solid var(--navy);
}
.test-btn:hover { background: var(--navy-2); }
.test-btn.secondary { background: var(--card); color: var(--navy); }
.test-btn.secondary:hover { background: var(--navy-soft); }
.quiz.empty { color: var(--muted); font-size: .95rem; display: block; }
.popup-warning {
  flex: 1 1 100%; font-size: .88rem; background: var(--warn-soft); border: 1px solid #E6C98B;
  border-radius: 10px; padding: 8px 12px; color: var(--warn);
}
.popup-warning a { color: var(--warn); font-weight: 600; }

/* ----------------------------------------------------------- settings bar
   On the lesson pages that open a test. app.js folds the controls into a
   sheet behind one line naming them — the same pattern, and the same stored
   settings, as the simple edition's course list. */
.settings-bar { border-bottom: 1px solid var(--line); }
.settings-line {
  max-width: var(--w-main); margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 48px; font-size: .87rem; color: var(--muted);
}
.settings-line .line-text { min-width: 0; line-height: 1.3; }
.settings-line b { color: var(--ink); font-weight: 600; }
.change-btn {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 0 0 8px; background: none; border: 0;
  cursor: pointer; color: var(--navy); font: 600 .95rem var(--sans);
}
.settings-scrim, .settings-panel { display: none; }
/* No JavaScript, no sheet: the controls simply show, as they always did. */
.settings-bar:not(.js) .settings-inner { max-width: var(--w-main); margin: 0 auto; padding: 8px 16px; }
.settings-bar.open { position: relative; z-index: 2147481990; }
.settings-bar.open .settings-scrim { display: block; position: fixed; inset: 0; z-index: 1; background: rgba(15, 26, 44, .45); }
.settings-bar.open .settings-panel {
  display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 2;
  max-height: 88vh; overflow-y: auto; background: var(--card); color: var(--ink);
  border-radius: 20px 20px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 30px rgba(15, 26, 44, .25);
}
.settings-panel .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.settings-panel h2 { font-size: 1.3rem; margin: 0 0 4px; }
.setting { margin: 14px 0 0; }
.s-label { display: block; font: 600 .85rem var(--sans); color: var(--muted); margin: 0 0 8px; }
.settings-bar:not(.js) .setting { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0; }
.settings-bar:not(.js) .s-label { margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: var(--tap); padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 500 .95rem var(--sans);
}
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
#countChips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; background: var(--paper-2); border-radius: 12px; padding: 4px; }
#countChips .chip { border: 0; background: none; border-radius: 9px; font-weight: 600; padding: 0 10px; }
#countChips .chip[aria-pressed="true"] { background: var(--card); color: var(--navy); box-shadow: 0 1px 3px rgba(22, 35, 58, .18); }
.num-input {
  width: 6.5rem; min-height: var(--tap); padding: 0 12px; margin-top: 8px;
  font: 16px var(--sans); border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.settings-summary { margin: 14px 0 12px; font-size: .88rem; color: var(--muted); }
.settings-summary b { color: var(--ink); font-weight: 600; }
.settings-bar:not(.js) .settings-summary { max-width: var(--w-main); margin: 0 auto; padding: 0 16px 10px; }
.done-btn {
  width: 100%; min-height: 50px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--navy); color: #fff; font: 600 1rem var(--sans);
}
@media (min-width: 721px) {
  .settings-bar.open .settings-scrim { background: rgba(15, 26, 44, .18); }
  .settings-bar.open .settings-panel {
    position: absolute; left: auto; bottom: auto; top: calc(100% + 6px);
    right: max(16px, calc(50% - 434px)); width: 440px;
    border-radius: 16px; border: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(15, 26, 44, .22); padding: 18px 20px 20px;
  }
  .settings-panel .grab { display: none; }
}

/* ------------------------------------------------------------------- ToC
   The contents as a list of rows under sticky unit headings, rather than 38
   cards each the width of the screen. The number comes from a counter: the
   lessons are listed in order, one to thirty-eight, and "Lesson Twenty-Three"
   stays in the row for anybody reading it aloud. */
main { counter-reset: lesson; }
.toc-section { margin: 1.8rem 0; }
.toc-list {
  list-style: none; margin: 0 0 8px; padding: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.toc-list li { counter-increment: lesson; }
.toc-list li + li { border-top: 1px solid var(--line); }
.toc-list a {
  display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; align-items: center; gap: 0 10px;
  min-height: 60px; padding: 8px 14px; text-decoration: none; color: var(--ink);
}
.toc-list a:hover { background: var(--navy-soft); }
.toc-list a::before {
  content: counter(lesson); grid-row: 1 / span 2;
  font: 600 1rem var(--sans); color: var(--gold); text-align: center;
}
.toc-list a::after { content: "\203A"; grid-column: 3; grid-row: 1 / span 2; font-size: 1.4rem; color: var(--faint); }
.toc-list .n {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.toc-list .t { grid-column: 2; font-weight: 600; font-size: 1rem; line-height: 1.3; }
.toc-list .r { grid-column: 2; font: .85rem var(--mono); color: var(--muted); }
.unit-head {
  position: sticky; top: var(--onpage-h); z-index: 5;
  font: 600 .82rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
  background: var(--paper); padding: 14px 0 8px; margin: 0;
}

/* Downloadable companion file (Appendix II worksheet) */
.download {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: var(--radius); padding: 14px 16px; margin: 12px 0 20px;
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
}
.download .dl-text { flex: 1 1 20rem; min-width: 0; }
.download .dl-text b { display: block; font-size: 1rem; color: var(--navy); }
.download .dl-text span { display: block; font-size: .9rem; color: var(--muted); margin-top: .2rem; }
.download .front-links { margin: 0; flex: 0 0 auto; }

.front-links { display: flex; flex-wrap: wrap; gap: 8px; margin: .6rem 0 0; }
.front-links a {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 16px;
  font-weight: 600; text-decoration: none; background: var(--navy); color: #fff;
  border: 1px solid var(--navy); border-radius: 12px;
}
.front-links a.alt { background: var(--card); color: var(--navy); }
.front-links a:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }

/* ------------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--card); margin: .6rem 0 1.4rem; border: 1px solid var(--line); }
th { background: var(--paper-2); color: var(--ink); text-align: left; padding: 8px 10px; font-weight: 600; font-size: .88rem; }
td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
td.grade { font: 600 1.1rem var(--serif); color: var(--navy); width: 3.5rem; text-align: center; }
td ul { margin: 0; padding-left: 1.1rem; }
td li { margin: .2rem 0; }

/* ------------------------------------------------------------------ video */
/* An embed, not an upload: the videos live on YouTube and the school hosts no
   copy. youtube-nocookie.com is the privacy-enhanced host — it sets nothing
   until the reader actually presses play, which matters on a page a student is
   sent to as homework. Every embed keeps a plain link beside it, because a
   school or country that blocks the player does not block the page, and a
   silent grey rectangle is worse than a link that says where the video is. */
.videos { display: grid; gap: 1.2rem; margin: 1.2rem 0 1.6rem; }
@media (min-width: 760px) { .videos.two { grid-template-columns: 1fr 1fr; } }
.video { margin: 0; }
.video .frame {
  position: relative; aspect-ratio: 16/9; background: #0e1726;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.video .frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video figcaption { font-size: .85rem; color: var(--muted); margin-top: .35rem; text-align: left; }
.video figcaption a { color: var(--navy); }

figure { margin: 1.2rem 0; text-align: center; }
figure img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: .35rem; }

/* --------------------------------------------------------------- page nav */
.pagenav {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
  border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1rem;
}
.pagenav a {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px;
  font-weight: 600; text-decoration: none; color: var(--navy);
  border: 1px solid var(--line); background: var(--card); border-radius: 12px;
}
.pagenav a:last-child { border-color: var(--navy); }
.pagenav a:hover { border-color: var(--navy); background: var(--navy-soft); }
.pagenav .spacer { flex: 1; }

footer { max-width: var(--w-main); margin: 0 auto; padding: 0 16px 28px; color: var(--muted); font-size: .86rem; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 720px) {
  header.hero { padding: 18px 16px 12px; }
  header.hero h1 { font-size: 1.45rem; }
  header.hero .tag { font-size: .85rem; }
  h2 { font-size: 1.4rem; }

  /* Smaller steps between the outline's levels: the deepest line keeps
     most of the width of the screen instead of 290px of it. */
  ul.outline li { padding-left: .95rem; }
  ul.outline li.l2 { margin-left: .75rem; }
  ul.outline li.l3 { margin-left: 1.5rem; }
  ul.outline li.l4 { margin-left: 2.1rem; }
  ol.steps { padding-left: 1.35rem; }

  /* The rail is narrower, and a step's details sit under the whole width
     rather than under the step, folded until asked for. */
  ul.outline.timeline li.l1 { grid-template-columns: 3.4rem minmax(0, 1fr); gap: 0 10px; }
  ul.outline.timeline .mins { font-size: .8rem; }
  ul.outline.timeline li.l2 { margin-left: 0; }
  ul.outline.timeline li.l3 { margin-left: .75rem; }
  ul.outline.timeline li.l4 { margin-left: 1.5rem; }
  ul.outline.timeline li.tl-detail.shut { display: none; }
  .tl-more { display: inline-flex; align-items: center; }

  /* The contents' front matter and appendices as rows, like the lessons. */
  main > .front-links {
    display: block; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
  }
  main > .front-links a, main > .front-links a.alt {
    display: flex; min-height: 56px; border: 0; border-radius: 0; background: none; color: var(--ink);
  }
  main > .front-links a + a { border-top: 1px solid var(--line); }
  main > .front-links a::after { content: "\203A"; margin-left: auto; padding-left: 10px; font-size: 1.4rem; color: var(--faint); }
  main > .front-links a:hover { background: var(--navy-soft); color: var(--ink); }

  .test-btn { flex: 1 1 100%; }

  /* Previous and next, pinned to the foot of the screen — above the tab bar
     for somebody signed in — for as long as the lesson is on it. */
  .pagenav {
    position: sticky; bottom: var(--tabs-h); z-index: 20;
    margin: 2rem -16px 0; padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--paper); flex-wrap: nowrap;
    box-shadow: 0 -6px 14px -12px rgba(22, 35, 58, .35);
  }
  body.has-tabs .pagenav { padding-bottom: 8px; }
  .pagenav .spacer { display: none; }
  .pagenav a { flex: 1 1 0; min-width: 0; padding: 0 10px; text-align: center; line-height: 1.2; }
}

@media print {
  .crumb, .settings-bar, .settings-summary, .pagenav, .test-btn, .onpage, .tl-more { display: none !important; }
  ul.outline.timeline li.tl-detail { display: list-item !important; }
  /* A video cannot print. The link under it can, and is the whole of what a
     printed copy can honestly offer. */
  .video .frame { display: none; }
  .videos { display: block; }
  .quiz { background: #fff; border: 1px solid #999; }
  .unit-head { position: static; }
}
