/* Lecture 5 web book: book-specific layer on the Editorial design system.
   Load after colors_and_type.css, color-schemes.css and components.css; body has class="ed".
   Orange stays rationed: the heavy rule's lead on the chapter opener and on the quiz is the only orange. */

.bk-mast { position: relative; z-index: 2; }
.bk-mast .ed-masthead__brand { font-size: 1.35rem; }
.bk-mast .ed-masthead__nav { gap: 0.95rem; flex-wrap: nowrap; white-space: nowrap; }
@media (min-width: 861px) {
  .bk-mast .ed-masthead__row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
}
@media (min-width: 861px) and (max-width: 1200px) {
  .bk-mast .ed-masthead__motto { visibility: hidden; }
  .bk-mast .ed-masthead__nav { gap: 0.5rem; }
}

/* ---- cover ---------------------------------------------------------------- */
.bk-cover {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--ed-column-gap, 24px);
  padding-block: clamp(40px, 7vh, 88px) clamp(32px, 5vh, 64px);
}
.bk-cover__plate {
  grid-column: 1 / span 7;
  display: flex;
  flex-direction: column;
  min-height: clamp(460px, 64vh, 680px);
  padding: clamp(28px, 4vw, 52px);
  background: var(--ed-paper-2);
  border: 1.5px solid var(--ed-ink);
}
.bk-cover__plate .ed-label { color: var(--ed-ink-3); }
.bk-cover__title {
  margin-top: 26px;
  font: 860 clamp(56px, 8.6vw, 128px) / 0.86 var(--ed-font-display);
  font-variation-settings: var(--ed-voice-heavy);
  letter-spacing: -0.045em;
}
.bk-cover__title em {
  font-style: normal;
  font-weight: 380;
  font-variation-settings: var(--ed-voice-soft);
}
.bk-cover__dek {
  margin-top: 26px;
  max-width: 22em;
  font: 380 var(--ed-size-deck) / 1.2 var(--ed-font-display);
  font-variation-settings: var(--ed-voice-deck);
}
.bk-cover__by { margin-top: auto; padding-top: 32px; display: grid; gap: 4px; font-size: 15px; }
.bk-cover__by b { font-weight: 700; }
.bk-cover__aside {
  grid-column: 9 / span 4;
  align-self: end;
  display: grid;
  gap: 18px;
  font-size: 15.5px;
  color: var(--ed-ink-2);
}
.bk-cover__aside p + p { margin-top: 0; }

.bk-contents { padding-bottom: clamp(48px, 8vh, 96px); }
.bk-contents__head { display: flex; justify-content: space-between; align-items: end; padding-bottom: 10px; border-bottom: 3px solid var(--ed-ink); }
.bk-contents ol { list-style: none; margin: 0; padding: 0; }
.bk-row {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr) 11rem;
  gap: 8px 28px;
  align-items: baseline;
  padding: 22px 0 24px;
  border-bottom: 1px solid var(--ed-hair);
  text-decoration: none;
}
a.bk-row:hover .bk-row__title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.12em; }
.bk-row__kicker { font: 600 12px / 1.2 var(--ed-font-text); letter-spacing: var(--ed-track-label); text-transform: uppercase; color: var(--ed-ink-3); }
.bk-row__title { font: 760 clamp(26px, 2.6vw, 38px) / 1.02 var(--ed-font-display); font-variation-settings: var(--ed-voice-cover); letter-spacing: -0.03em; }
.bk-row__deck { grid-column: 2; margin-top: 6px; max-width: 40em; color: var(--ed-ink-2); }
.bk-row__meta { grid-row: 1; grid-column: 3; justify-self: end; font-size: 14px; color: var(--ed-ink-3); }
.bk-row.is-later { color: var(--ed-ink-4); }
.bk-row.is-later .bk-row__deck, .bk-row.is-later .bk-row__kicker, .bk-row.is-later .bk-row__meta { color: var(--ed-ink-4); }

/* ---- chapter opener ------------------------------------------------------- */
.bk-opener {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--ed-column-gap, 24px);
  align-content: start;
  min-height: min(calc(100svh - 5rem), 980px);
  padding-top: clamp(28px, 5vh, 56px);
  isolation: isolate;
}
.bk-opener > .ed-rule { grid-column: 1 / -1; margin-bottom: clamp(28px, 5vh, 56px); }
.bk-opener__numeral {
  position: absolute;
  right: 0;
  top: clamp(40px, 8vh, 96px);
  z-index: -1;
  font: 900 clamp(220px, 30vw, 440px) / 0.78 var(--ed-font-display);
  font-variation-settings: var(--ed-voice-mark);
  letter-spacing: -0.06em;
  color: var(--ed-numeral);
  pointer-events: none;
}
.bk-opener__main { grid-column: 1 / span 9; }
.bk-opener__title {
  margin-top: 22px;
  max-width: 13ch;
  font: 860 clamp(58px, 9vw, 136px) / 0.88 var(--ed-font-display);
  font-variation-settings: var(--ed-voice-heavy);
  letter-spacing: -0.045em;
}
.bk-opener__deck {
  margin-top: 28px;
  max-width: 20em;
  font: 420 var(--ed-size-deck) / 1.18 var(--ed-font-display);
  font-variation-settings: var(--ed-voice-deck);
}
.bk-opener__panel {
  grid-column: 1 / span 7;
  margin-top: clamp(36px, 6vh, 72px);
  padding-top: 16px;
  border-top: 1px solid var(--ed-hair-firm);
}
.bk-opener__panel ol { list-style: decimal; margin: 12px 0 0; padding-left: 1.3em; display: grid; gap: 6px; max-width: 40em; }
.bk-opener__meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 22px; font-size: 14px; color: var(--ed-ink-3); }
.bk-opener__start { margin-top: 26px; }

/* ---- reading layout ------------------------------------------------------- */
.bk-read {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--ed-column-gap, 24px);
  padding-top: clamp(40px, 6vh, 72px);
  border-top: 3px solid var(--ed-ink);
}
.bk-side { grid-column: 1 / span 3; }
.bk-side__inner { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; padding-bottom: 24px; }
.bk-toc { list-style: none; margin: 14px 0 0; padding: 0; counter-reset: none; }
.bk-toc li { border-top: 1px solid var(--ed-hair); }
.bk-toc a { display: grid; grid-template-columns: 2.4rem 1fr; gap: 6px; padding: 9px 0; font-size: 14px; line-height: 1.35; text-decoration: none; color: var(--ed-ink-2); }
.bk-toc a:hover, .bk-toc a[aria-current="true"] { color: var(--ed-ink); }
.bk-toc a[aria-current="true"] span:last-child { text-decoration: underline; text-underline-offset: 0.25em; }
.bk-toc__n { color: var(--ed-ink-4); font-variant-numeric: tabular-nums; }
.bk-body { grid-column: 5 / span 8; min-width: 0; }
.bk-body > * + * { margin-top: 0; }
.bk-measure { max-width: 42rem; }

.bk-lede { max-width: 42rem; }
.bk-section { padding-block: clamp(36px, 5vh, 56px) 8px; border-top: 1px solid var(--ed-hair); }
.bk-section:first-of-type { border-top: 0; padding-top: 28px; }
.bk-section__n { color: var(--ed-ink-3); }
.bk-section h2 {
  margin-top: 10px;
  max-width: 18em;
  font: 720 var(--ed-size-article) / 1.08 var(--ed-font-display);
  font-variation-settings: var(--ed-voice-article);
  letter-spacing: -0.025em;
}
.bk-prose { max-width: 42rem; margin-top: 18px; }
.bk-prose > * + * { margin-top: 1em; }
.bk-prose ul, .bk-prose ol { list-style: revert; padding-left: 1.25em; }
.bk-prose li + li { margin-top: 0.35em; }
.bk-prose strong { font-weight: 700; }
.bk-prose em { font-style: italic; }
.bk-prose code, .bk-check code, .bk-quiz code, .bk-analogy code {
  font: 0.86em / 1 var(--ed-font-mono);
  padding: 0.1em 0.28em;
  background: var(--ed-wash);
}
.bk-prose pre { overflow: auto; padding: 14px 16px; background: var(--ed-paper-2); font: 13.5px / 1.5 var(--ed-font-mono); }
.bk-prose pre code { padding: 0; background: none; }
.bk-prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.bk-prose th, .bk-prose td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--ed-hair); text-align: left; vertical-align: top; }
.bk-prose th { border-bottom: 1.5px solid var(--ed-ink); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; }
.bk-prose blockquote { padding-left: 18px; border-left: 3px solid var(--ed-ink); font-family: var(--ed-font-display); font-variation-settings: var(--ed-voice-quote); font-size: 1.15em; line-height: 1.4; }
.bk-prose a, .bk-notes a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.bk-cite { font-size: 0.68em; line-height: 0; vertical-align: super; margin-left: 1px; }
.bk-cite a { text-decoration: none; color: var(--ed-ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.bk-cite a:hover { color: var(--ed-ink); text-decoration: underline; }

/* ---- figure --------------------------------------------------------------- */
.bk-fig { margin: 22px 0 6px; max-width: 46rem; }
.bk-fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.bk-fig figcaption { margin-top: 10px; padding: 10px 0 12px; border-top: 1px solid var(--ed-hair); border-bottom: 3px solid var(--ed-ink); font-size: var(--ed-size-small); line-height: 1.5; color: var(--ed-ink-2); }
.bk-fig figcaption b { color: var(--ed-ink); font-weight: 600; }
.bk-fig .t { font: 400 15px var(--ed-font-text); fill: var(--ed-ink); }
.bk-fig .t2 { font: 400 15px var(--ed-font-text); fill: var(--ed-ink-2); }
.bk-fig .t3 { font: 400 13px var(--ed-font-text); fill: var(--ed-ink-3); }
.bk-fig .lab { font: 600 12px var(--ed-font-text); letter-spacing: 0.16em; text-transform: uppercase; fill: var(--ed-ink-3); }
.bk-fig .ttl { font: 860 22px var(--ed-font-display); font-variation-settings: var(--ed-voice-heavy); letter-spacing: -0.02em; fill: var(--ed-ink); }
.bk-fig .num { font: 800 28px var(--ed-font-display); font-variation-settings: var(--ed-voice-bold); fill: var(--ed-ink); }
.bk-fig .from { font: 300 28px var(--ed-font-display); font-variation-settings: var(--ed-voice-from); fill: var(--ed-ink-4); }
.bk-fig .mono { font: 400 13.5px var(--ed-font-mono); fill: var(--ed-ink); }
.bk-fig .box { fill: var(--ed-paper-2); stroke: none; }
.bk-fig .well { fill: var(--ed-paper-3); stroke: none; }
.bk-fig .frame { fill: none; stroke: var(--ed-ink); stroke-width: 1.5; }
.bk-fig .rule { fill: none; stroke: var(--ed-ink); stroke-width: 3; }
.bk-fig .line { fill: none; stroke: var(--ed-ink); stroke-width: 1.5; }
.bk-fig .line2 { fill: none; stroke: var(--ed-ink-3); stroke-width: 1.2; }
.bk-fig .dash { fill: none; stroke: var(--ed-ink-3); stroke-width: 1.2; stroke-dasharray: 5 4; }
.bk-fig .hair { fill: none; stroke: var(--ed-hair); stroke-width: 1; }
.bk-fig .ah { fill: var(--ed-ink); stroke: none; }
.bk-fig .acc { fill: var(--ed-orange); stroke: none; }
.bk-fig .acc-line { fill: none; stroke: var(--ed-orange); stroke-width: 3; }
.bk-fig .inv { fill: var(--ed-ink); stroke: none; }
.bk-fig .invt { font: 500 15px var(--ed-font-text); fill: var(--ed-paper); }
.bk-fig text { dominant-baseline: auto; }

/* ---- analogy and check ---------------------------------------------------- */
.bk-analogy { max-width: 42rem; margin-top: 22px; padding: 18px 22px 20px; background: var(--ed-paper-2); }
.bk-analogy .ed-label { color: var(--ed-ink-3); }
.bk-analogy__text { margin-top: 10px; font: 400 1.06em / 1.55 var(--ed-font-text); }

.bk-check { max-width: 42rem; margin-top: 24px; border-top: 1.5px solid var(--ed-ink); border-bottom: 1px solid var(--ed-hair); }
.bk-check summary { list-style: none; cursor: pointer; display: grid; gap: 8px; padding: 14px 0 16px; }
.bk-check summary::-webkit-details-marker { display: none; }
.bk-check summary .ed-label { color: var(--ed-ink-3); display: flex; justify-content: space-between; }
.bk-check summary .ed-label::after { content: "Show answer"; letter-spacing: 0.08em; }
.bk-check[open] summary .ed-label::after { content: "Hide answer"; }
.bk-check__q { font: 420 1.2em / 1.35 var(--ed-font-display); font-variation-settings: var(--ed-voice-deck); }
.bk-check__a { padding: 0 0 18px; color: var(--ed-ink-2); }
.bk-check__a > * + * { margin-top: 0.8em; }

/* ---- quiz ----------------------------------------------------------------- */
.bk-quiz { margin-top: clamp(48px, 8vh, 96px); }
.bk-quiz > .ed-rule { margin-bottom: 26px; }
.bk-quiz__head h2 { margin-top: 10px; font: 860 var(--ed-size-section) / 0.9 var(--ed-font-display); font-variation-settings: var(--ed-voice-heavy); letter-spacing: -0.045em; }
.bk-quiz__intro { margin-top: 18px; max-width: 42rem; color: var(--ed-ink-2); }
.bk-q { max-width: 44rem; margin: 36px 0 0; padding: 18px 0 0; border: 0; border-top: 1.5px solid var(--ed-ink); min-width: 0; }
.bk-q legend { float: left; width: 100%; padding: 0; }
.bk-q legend + * { clear: both; }
.bk-q__n { display: block; color: var(--ed-ink-3); }
.bk-q__text { display: block; margin-top: 8px; font: 420 1.22em / 1.32 var(--ed-font-display); font-variation-settings: var(--ed-voice-deck); }
.bk-q__hint { display: block; margin-top: 8px; font-size: 14px; color: var(--ed-ink-3); }
.bk-opts { display: grid; gap: 0; margin-top: 14px; }
.bk-opt { position: relative; display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px 0; border-top: 1px solid var(--ed-hair); cursor: pointer; }
.bk-opt input { appearance: none; -webkit-appearance: none; width: 1.05rem; height: 1.05rem; margin: 0.2em 0 0; border: 1.5px solid var(--ed-ink); border-radius: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }

.bk-opt input:checked { background: var(--ed-ink); box-shadow: inset 0 0 0 3px var(--ed-paper); }
.bk-opt.is-correct { font-weight: 600; }
.bk-opt.is-correct::after, .bk-opt.is-missed::after, .bk-opt.is-wrong::after { position: absolute; right: 0; top: 12px; font: 600 11px / 1 var(--ed-font-text); letter-spacing: 0.14em; text-transform: uppercase; }
.bk-opt.is-correct::after { content: "Right"; color: var(--ed-ink); }
.bk-opt.is-missed { outline: 1.5px dashed var(--ed-ink-3); outline-offset: -1px; padding-inline: 8px; margin-inline: -8px; }
.bk-opt.is-missed::after { content: "Missed"; color: var(--ed-ink-2); right: 8px; }
.bk-opt.is-wrong { color: var(--ed-ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.bk-opt.is-wrong::after { content: "Not this one"; color: var(--ed-ink-3); text-decoration: none; }
.bk-q__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 16px; }
.bk-q__result { font-size: 15px; font-weight: 600; }
.bk-q__answer { margin-top: 14px; border-top: 1px solid var(--ed-hair); }
.bk-q__answer summary { cursor: pointer; padding: 12px 0; font: 600 12px / 1 var(--ed-font-text); letter-spacing: var(--ed-track-label); text-transform: uppercase; color: var(--ed-ink-3); }
.bk-q__answer ul { list-style: none; padding: 0 0 8px; display: grid; gap: 10px; }
.bk-q__answer li { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); gap: 10px; font-size: 15px; color: var(--ed-ink-2); }
.bk-q__answer li b { font: 600 11px / 1.6 var(--ed-font-text); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ed-ink); }
.bk-quiz__score { max-width: 44rem; margin-top: 36px; padding: 18px 0; border-top: 3px solid var(--ed-ink); font: 420 1.2em / 1.3 var(--ed-font-display); font-variation-settings: var(--ed-voice-deck); }

/* ---- close, notes, pager -------------------------------------------------- */
.bk-notes { margin-top: clamp(48px, 8vh, 88px); padding-top: 14px; border-top: 1px solid var(--ed-hair-firm); max-width: 44rem; }
.bk-notes ol { margin-top: 14px; padding-left: 1.6em; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--ed-ink-2); }
.bk-notes li::marker { font-variant-numeric: tabular-nums; color: var(--ed-ink-3); }
.bk-notes a { overflow-wrap: anywhere; }
.bk-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 56px; padding: 22px 0 8px; border-top: 3px solid var(--ed-ink); }
.bk-pager a { display: grid; gap: 6px; text-decoration: none; }
.bk-pager a:last-child { text-align: right; justify-self: end; }
.bk-pager span:last-child { font: 760 clamp(22px, 2.2vw, 30px) / 1.05 var(--ed-font-display); font-variation-settings: var(--ed-voice-cover); letter-spacing: -0.025em; }
.bk-pager a:hover span:last-child { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.12em; }

.bk-foot { margin-top: clamp(56px, 10vh, 120px); }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 900px) {
  .bk-cover__plate, .bk-cover__aside { grid-column: 1 / -1; }
  .bk-cover__aside { margin-top: 28px; }
  .bk-row { grid-template-columns: 1fr; }
  .bk-row__deck, .bk-row__meta { grid-column: 1; grid-row: auto; justify-self: start; }
  .bk-opener { min-height: 0; padding-bottom: 48px; }
  .bk-opener__main, .bk-opener__panel { grid-column: 1 / -1; }
  .bk-side, .bk-body { grid-column: 1 / -1; }
  .bk-side__inner { position: static; max-height: none; }
  .bk-side { margin-bottom: 28px; }
  .bk-pager { grid-template-columns: 1fr; }
  .bk-pager a:last-child { justify-self: start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .bk-read *, .bk-opener * { transition: none !important; animation: none !important; }
}
@media print {
  .bk-mast, .bk-side, .bk-pager, .bk-q__actions, .bk-foot nav { display: none; }
  .bk-body { grid-column: 1 / -1; }
  .bk-check[open] summary .ed-label::after { content: ""; }
}
