/* Shared navigation and a quiet reading layout. No external fonts or assets. */
.site-nav { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-nav-inner { display: flex; align-items: center; gap: 30px; min-height: 74px; }
.site-brand { display: flex; align-items: baseline; gap: 14px; color: var(--navy); text-decoration: none; font: 900 20px/1 ui-monospace, monospace; letter-spacing: -.04em; }
.site-brand span { color: var(--muted); font: 700 10px/1.4 ui-monospace, monospace; letter-spacing: .1em; }
.site-nav-links { display: flex; gap: 24px; margin-left: auto; }
.site-nav-links a { padding: 26px 0; color: var(--muted); font-size: 14px; font-weight: 750; text-decoration: none; border-bottom: 2px solid transparent; }
.site-nav-links a[aria-current], .site-nav-links a:hover { color: var(--accent-dark); border-bottom-color: var(--accent); }
.reader-languages { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; }
.reader-languages a { padding: 7px 9px; color: var(--muted); text-decoration: none; border-radius: 4px; font: 800 11px/1 ui-monospace, monospace; }
.reader-languages a[aria-current] { color: white; background: var(--navy); }
a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 40; padding: 12px; color: white; background: var(--navy); }
.skip-link:focus { top: 12px; }
.reader-shell { width: min(1200px, calc(100% - 48px)); margin-inline: auto; }
.library-main { padding-bottom: 64px; }
.library-hero { display: grid; grid-template-columns: 1fr 220px; gap: 60px; align-items: center; padding: 64px 0 44px; }
.library-hero h1 { max-width: 760px; font-size: clamp(46px, 6.8vw, 82px); line-height: 1.02; }
.library-hero .lede { max-width: 680px; }
.reading-features { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 23px 0 28px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.reading-features li::before { content: '•'; padding-right: 7px; color: var(--accent); }
.reader-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 32px; padding: 15px 20px; border-radius: 6px; color: white; background: var(--navy); text-decoration: none; font-size: 14px; font-weight: 800; }
.reader-button:hover { background: #244965; }
.book-mark { display: grid; align-content: space-between; padding: 25px; height: 260px; color: white; background: var(--navy); border-radius: 5px 12px 12px 5px; border-left: 7px solid var(--accent); box-shadow: 6px 6px 0 #e3dccf, 12px 12px 0 #ece6da; transform: rotate(4deg); }
.book-mark > span { font: 800 130px/.9 Georgia, serif; }
.book-mark small { color: #c9d4dd; font: 700 10px/1.7 ui-monospace, monospace; letter-spacing: .1em; }
.chapter-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.chapter-card { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 28px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; text-decoration: none; transition: border-color .15s, transform .15s; }
.chapter-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-kicker { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font: 750 11px/1.4 ui-monospace, monospace; }
.card-kicker > span:first-child { color: var(--accent-dark); }
.chapter-card h2 { margin: 0; max-width: 480px; font: 750 30px/1.13 Georgia, serif; letter-spacing: -.025em; }
.chapter-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.chapter-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.chapter-tags span { padding: 5px 8px; background: #f0eee7; color: var(--muted); border-radius: 4px; font: 600 11px/1.4 ui-monospace, monospace; }
.read-link { display: flex; justify-content: space-between; padding-top: 10px; color: var(--navy); font-size: 13px; font-weight: 800; }
.read-link > span { color: var(--accent-dark); font-size: 21px; line-height: .8; }
.chapter-card:last-child { grid-column: 1 / -1; }
.reading-route { display: flex; gap: 30px; margin-top: 28px; padding: 28px; border-top: 1px solid var(--line); }
.route-symbol { flex: 0 0 auto; color: var(--accent-dark); font: 800 19px/1.5 ui-monospace, monospace; }
.reading-route h2 { margin-bottom: 9px; font: 700 24px/1.2 Georgia, serif; }
.reading-route p { margin: 0; max-width: 740px; color: var(--muted); line-height: 1.7; }
.chapter-layout { display: grid; grid-template-columns: 230px minmax(0,1fr); align-items: start; gap: 44px; padding-top: 42px; padding-bottom: 64px; }
.chapter-sidebar { position: sticky; top: 22px; max-height: calc(100vh - 44px); overflow-y: auto; scrollbar-width: thin; padding-right: 8px; }
.all-chapters { display: inline-block; margin-bottom: 26px; color: var(--navy); font-size: 13px; font-weight: 800; text-decoration: none; }
.sidebar-details { margin-bottom: 22px; }
.sidebar-details > summary { margin-bottom: 13px; color: var(--muted); cursor: pointer; font: 800 11px/1.4 ui-monospace, monospace; letter-spacing: .07em; text-transform: uppercase; }
.chapter-list, .toc-list { margin: 0; padding: 0; list-style: none; }
.chapter-list { display: grid; gap: 5px; }
.chapter-list a { display: flex; align-items: start; gap: 9px; padding: 9px 10px; border-radius: 5px; color: var(--muted); font-size: 12px; line-height: 1.6; text-decoration: none; }
.chapter-list a > span { flex: 0 0 auto; font: 700 10px/1.9 ui-monospace, monospace; }
.chapter-list a[aria-current] { color: var(--navy); background: #e8edf0; font-weight: 800; }
.chapter-list a:hover, .toc-list a:hover { color: var(--accent-dark); }
.toc-details { padding-top: 18px; border-top: 1px solid var(--line); }
.toc-list { display: grid; gap: 11px; }
.toc-list a { display: block; color: var(--muted); text-decoration: none; font-size: 12px; line-height: 1.5; }
.chapter-main { min-width: 0; }
.chapter-hero { padding: 4px 0 32px; }
.chapter-meta { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 18px; color: var(--muted); font: 750 11px/1.5 ui-monospace, monospace; }
.chapter-meta span:first-child { color: var(--accent-dark); }
.chapter-hero h1 { margin-bottom: 22px; font-size: clamp(37px,4.5vw,61px); line-height: 1.04; }
.chapter-hero .lede { max-width: 720px; font-size: 17px; }
.theory-article { padding: 12px 36px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.reading-section { position: relative; padding: 32px 0; scroll-margin-top: 20px; }
.reading-section + .reading-section { border-top: 1px solid var(--line); }
.section-number { margin-bottom: 10px; color: var(--accent-dark); font: 800 11px/1.2 ui-monospace, monospace; }
.reading-section h2, .chapter-recap h2 { margin-bottom: 20px; font: 700 29px/1.2 Georgia, serif; letter-spacing: -.02em; }
.theory-article p, .theory-article li, .theory-article aside { font-size: 16px; line-height: 1.85; }
.theory-article p { margin-bottom: 17px; }
.theory-article p:last-child { margin-bottom: 0; }
.theory-article li + li { margin-top: 7px; }
.theory-article ul, .theory-article ol { padding-left: 23px; margin-bottom: 20px; }
.theory-article :not(pre) > code { padding: 2px 4px; color: #183b53; background: #edf0f0; border-radius: 3px; overflow-wrap: anywhere; font-size: .88em; }
.theory-article pre { margin: 23px 0; font-size: 12.5px; line-height: 1.8; }
.table-scroll { overflow-x: auto; margin-block: 23px; }
.theory-article table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.6; }
.theory-article th { text-align: left; background: #f1efe9; color: var(--navy); }
.theory-article th, .theory-article td { padding: 12px; border: 1px solid var(--line); vertical-align: top; min-width: 130px; }
.theory-article .key-idea, .theory-article .pitfall { margin: 22px 0; padding: 17px 20px; border-left: 3px solid var(--accent); border-radius: 0 5px 5px 0; background: #f8eee1; font-size: 14px; line-height: 1.8; }
.theory-article .key-idea { border-left-color: var(--navy); background: #edf2f4; }
.memory-diagram { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin: 24px 0; padding: 20px; background: #edf2f4; border-radius: 6px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.memory-diagram strong { color: var(--navy); font: 700 12px/1.8 ui-monospace, monospace; overflow-wrap: anywhere; }
.chapter-recap { margin: 0 -12px; padding: 24px; background: #eef3ed; border-radius: 6px; }
.chapter-recap h2 { font-size: 25px; }
.chapter-recap ul { margin-bottom: 0; }
.chapter-recap li { font-size: 14px; }
.self-check-section { padding-bottom: 12px; }
.self-check-section .eyebrow { font-size: 10px; }
.understanding-check { margin: 10px 0; border: 1px solid var(--line); border-radius: 6px; }
.understanding-check summary { padding: 16px 18px; color: var(--navy); font-size: 14px; font-weight: 750; line-height: 1.6; cursor: pointer; }
.understanding-check[open] { background: #f2f5f4; }
.understanding-check p { padding: 0 18px 18px; font-size: 14px; }
.theory-article .chapter-note { padding-top: 20px; margin-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.chapter-pagination { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.chapter-pagination a { flex: 1 1 220px; display: grid; gap: 9px; padding: 20px; color: var(--navy); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; text-decoration: none; }
.chapter-pagination a > span { color: var(--muted); font-size: 11px; }
.chapter-pagination a strong { font: 700 21px/1.3 Georgia, serif; }
.reading-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; margin-top: 24px; }
.reading-actions a { color: var(--navy); font-size: 13px; text-underline-offset: 4px; }
.reader-footer { min-height: 80px; align-items: center; }
/* Entry points on the existing trainer page. */
.theory-entry { display: flex; gap: 24px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); }
.theory-entry > div { flex: 0 0 205px; }
.theory-entry .eyebrow { margin-bottom: 6px; font-size: 10px; }
.theory-entry h2 { margin: 0; font: 700 23px/1.2 Georgia, serif; }
.theory-entry h2 a { color: var(--navy); text-decoration: none; }
.theory-topic-links { display: flex; flex-wrap: wrap; gap: 8px; }
.theory-topic-links a { padding: 8px 11px; color: var(--navy); border: 1px solid var(--line); border-radius: 5px; background: var(--surface); text-decoration: none; font-size: 12px; line-height: 1.5; }
.theory-topic-links a:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .chapter-card { transition: none; } }
@media (max-width: 1000px) { .chapter-layout { gap: 24px; grid-template-columns: 200px minmax(0,1fr); } .theory-article { padding-inline: 25px; } .library-hero { gap: 40px; } }
@media (max-width: 760px) {
  .reader-shell { width: calc(100% - 32px); }
  .site-brand span { display: none; }
  .site-nav-inner { min-height: 65px; gap: 18px; }
  .site-nav-links { gap: 16px; }
  .site-nav-links a { font-size: 13px; padding-block: 22px; }
  .library-hero { grid-template-columns: 1fr; padding-top: 40px; }
  .book-mark { display: none; }
  .chapter-grid { grid-template-columns: 1fr; }
  .chapter-card:last-child { grid-column: auto; }
  .chapter-card { padding: 23px; }
  .chapter-layout { grid-template-columns: 1fr; gap: 16px; padding-top: 24px; }
  .chapter-sidebar { position: static; max-height: none; overflow: visible; padding: 0; }
  .all-chapters { margin-bottom: 16px; }
  .sidebar-details { margin-bottom: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
  .sidebar-details > summary { margin-bottom: 8px; }
  .toc-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 16px; }
  .chapter-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .chapter-hero { padding-top: 12px; }
  .chapter-hero h1 { font-size: 40px; }
  .reading-route { padding: 22px 0; gap: 20px; }
  .theory-entry { align-items: start; flex-direction: column; gap: 15px; }
  .theory-entry > div { flex-basis: auto; }
}
@media (max-width: 440px) {
  .site-nav-inner { gap: 12px; }
  .site-brand { font-size: 17px; }
  .site-nav-links { gap: 12px; }
  .reader-languages a { padding: 7px; }
  .theory-article { padding-inline: 18px; }
  .chapter-hero h1 { font-size: 36px; }
  .reading-section h2 { font-size: 26px; }
  .theory-article p, .theory-article li { font-size: 15px; }
  .chapter-recap { margin-inline: -6px; padding: 18px; }
  .toc-list, .chapter-list { grid-template-columns: 1fr; }
  .reading-route { flex-direction: column; gap: 12px; }
}
@media print {
  .site-nav, .skip-link, .chapter-sidebar, .chapter-pagination, .reading-actions, .reading-features, .reader-button, .reader-footer, .theory-entry { display: none !important; }
  .reader-shell { width: 100%; }
  .chapter-layout, .library-hero { display: block; padding: 0; }
  .theory-article { border: 0; padding: 0; }
  .chapter-hero h1 { font-size: 32px; }
  .reading-section { padding-block: 20px; }
  .theory-article pre { white-space: pre-wrap; color: black; background: #f2f2f2; break-inside: avoid; }
  .reading-section h2 { break-after: avoid; }
  .chapter-recap, .understanding-check { break-inside: avoid; }
  .theory-body .book-mark { display: none; }
}
.mobile-contents { display: none; }
@media (max-width: 760px) {
  .chapter-sidebar { display: none; }
  .mobile-contents { display: block; padding: 16px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
  .mobile-contents > summary { color: var(--navy); font-size: 14px; font-weight: 800; cursor: pointer; }
  .mobile-contents[open] > summary { margin-bottom: 20px; }
  .mobile-contents h2 { margin: 20px 0 10px; font-size: 15px; }
}
@media print { .mobile-contents { display: none; } }
