/* ==========================================================================
   chapters.css — longform chapter layout (theme layer over crm-core)
   ========================================================================== */
.ch-progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 50; background: transparent; }
.ch-progress__bar { display: block; height: 100%; width: 0; background: var(--crm-signal); transition: width .1s linear; }

/* ---- masthead: centred mark, toggle left, pledge right (not sticky) ---- */
.ch-masthead { max-width: 72rem; margin: 0 auto; padding: 1.4rem 1rem 1.1rem; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; border-bottom: 1px solid var(--crm-rule); }
.ch-masthead__toggle { justify-self: start; display: inline-flex; align-items: center; gap: .6rem; background: none; border: 0; font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .14em; font-size: 1rem; font-weight: 600; color: var(--crm-ink); cursor: pointer; padding: .4rem 0; }
.ch-masthead__bars { display: grid; gap: 4px; width: 22px; }
.ch-masthead__bars i { display: block; height: 2px; background: currentColor; transition: transform .25s; }
.ch-masthead__bars i:nth-child(2) { width: 70%; }
.ch-masthead__toggle[aria-expanded="true"] .ch-masthead__bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.ch-masthead__toggle[aria-expanded="true"] .ch-masthead__bars i:nth-child(2) { opacity: 0; }
.ch-masthead__toggle[aria-expanded="true"] .ch-masthead__bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.ch-masthead__mark { text-align: center; text-decoration: none; color: var(--crm-ink); display: grid; justify-items: center; }
.ch-masthead__over { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .3em; font-size: .78rem; color: var(--crm-muted); }
.ch-masthead__name { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: .02em; line-height: 1.05; }
.ch-masthead__waterline { display: block; width: 9rem; height: 8px; margin-top: .3rem; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 8'%3E%3Cpath d='M0 4 Q5 0 10 4 T20 4 T30 4 T40 4' fill='none' stroke='%232f6f8f' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x; background-size: 40px 8px; animation: ch-ripple 6s linear infinite; }
@keyframes ch-ripple { to { background-position-x: 40px; } }
.ch-masthead__pledge { justify-self: end; }
.ch-index { background: var(--crm-paper-2); border-bottom: 1px solid var(--crm-rule); }
.ch-index[hidden] { display: none; }
.ch-index__grid { max-width: 72rem; margin: 0 auto; padding: 1.6rem 1rem 2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.6rem; }
.ch-index__head { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .16em; font-size: .85rem; color: var(--crm-muted); margin: 0 0 .5rem; }
.ch-index__list, .ch-index__plain { list-style: none; margin: 0; padding: 0; }
.ch-index__list li, .ch-index__plain li { border-top: 1px solid var(--crm-rule); }
.ch-index__list a, .ch-index__plain a { display: flex; gap: .8rem; padding: .45rem 0; text-decoration: none; color: var(--crm-ink); font-size: 1.05rem; }
.ch-index__list a span { font-family: var(--crm-label); color: var(--crm-signal); min-width: 2rem; font-weight: 700; }
.ch-index a:hover { color: var(--crm-signal-dark); }

/* ---- home: opening ---- */
.ch-opening { position: relative; min-height: 78vh; display: grid; align-items: end; color: #fff; background: #0b1c27; overflow: hidden; }
.ch-opening__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.ch-opening::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,28,39,.15) 0%, rgba(11,28,39,.55) 45%, rgba(11,28,39,.92) 100%); }
.ch-opening__text { position: relative; z-index: 1; max-width: 72rem; width: 100%; margin: 0 auto; padding: 3rem 1rem 4rem; }
.ch-opening__kicker { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .3em; font-size: .95rem; color: #ffd3bf; margin: 0 0 1rem; }
.ch-opening h1 { font-size: clamp(2.4rem, 6.5vw, 5rem); margin: 0 0 1rem; max-width: 14ch; font-weight: 600; }
.ch-opening__line { font-size: clamp(1.1rem, 2vw, 1.35rem); max-width: 36rem; margin: 0 0 1.6rem; color: #e1ebef; }
.ch-opening__cue { color: #fff; font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .18em; text-decoration: none; display: inline-flex; gap: .6rem; align-items: center; }
.ch-opening__cue::after { content: "\2193"; display: inline-block; animation: ch-bob 2.2s ease-in-out infinite; }
@keyframes ch-bob { 50% { transform: translateY(6px); } }
.ch-opening__credit { z-index: 1; position: absolute; right: 1rem; bottom: .6rem; font-size: .75rem; color: rgba(255,255,255,.65); }

/* ---- chapter scaffold with left rail ---- */
.ch-book { max-width: 72rem; margin: 0 auto; padding: 0 1rem; display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 3rem; }
.ch-rail { position: sticky; top: 1.5rem; align-self: start; padding-top: 4rem; }
.ch-rail ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--crm-rule); }
.ch-rail a { display: block; padding: .35rem 0 .35rem .9rem; margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; color: var(--crm-muted); font-family: var(--crm-label); font-size: 1rem; letter-spacing: .04em; line-height: 1.2; }
.ch-rail a.is-current { color: var(--crm-ink); border-left-color: var(--crm-signal); }
.ch-rail__label { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .2em; font-size: .78rem; color: var(--crm-muted); margin: 0 0 .7rem; }
.ch-flow { min-width: 0; }
.ch-chapter { padding: 4.5rem 0 1rem; border-bottom: 1px solid var(--crm-rule); }
.ch-chapter:last-child { border-bottom: 0; }
.ch-chapter__num { font-family: var(--crm-label); font-weight: 700; color: var(--crm-signal); letter-spacing: .2em; text-transform: uppercase; font-size: 1rem; margin: 0 0 .4rem; }
.ch-chapter h2 { font-size: clamp(1.9rem, 4vw, 3rem); margin: 0 0 1.4rem; max-width: 22ch; }
.ch-chapter p, .ch-chapter ul, .ch-chapter ol { max-width: var(--crm-measure); }
.ch-dropcap::first-letter { float: left; font-size: 4.4rem; line-height: .82; padding: .3rem .6rem 0 0; font-weight: 700; color: var(--crm-river); }
.ch-pull { margin: 2.4rem 0; padding: 0 0 0 1.6rem; border-left: 6px solid var(--crm-signal); font-size: clamp(1.4rem, 2.8vw, 2rem); line-height: 1.3; font-style: italic; max-width: 34rem; color: var(--crm-river); }
.ch-pull p { margin: 0; }
.ch-figure { margin: 2rem 0; }
.ch-figure--bleed { margin-left: 0; margin-right: calc(-1 * min(6vw, 5rem)); }
.ch-figure figcaption { font-size: .9rem; color: var(--crm-muted); margin-top: .5rem; border-left: 2px solid var(--crm-rule); padding-left: .7rem; max-width: 40rem; }
.ch-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2rem 0; }
.ch-pair figure { margin: 0; }
.ch-pair img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.ch-steps { counter-reset: step; list-style: none; padding: 0; margin: 1.6rem 0; max-width: 44rem; }
.ch-steps > li { counter-increment: step; display: grid; grid-template-columns: 3.2rem 1fr; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--crm-rule); }
.ch-steps > li::before { content: counter(step, decimal-leading-zero); font-family: var(--crm-label); font-size: 2rem; font-weight: 700; color: var(--crm-moss); line-height: 1; }
.ch-steps h3 { margin: 0 0 .3rem; font-size: 1.25rem; }
.ch-steps p { margin: 0; }
.ch-route { list-style: none; padding: 0; margin: 1.5rem 0; max-width: 46rem; position: relative; }
.ch-route::before { content: ""; position: absolute; left: 39px; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--crm-river-2), var(--crm-river)); }
.ch-route li { display: grid; grid-template-columns: 80px 1fr; gap: 1.2rem; padding: .8rem 0; position: relative; }
.ch-route img { width: 80px; height: 80px; object-fit: cover; border-radius: 50%; border: 3px solid var(--crm-paper); box-shadow: 0 0 0 2px var(--crm-river); position: relative; }
.ch-route h3 { margin: .3rem 0 .2rem; font-size: 1.2rem; }
.ch-route h3 a { text-decoration: none; }
.ch-route p { margin: 0; font-size: 1rem; }
.ch-route .ch-route__where { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .1em; color: var(--crm-muted); font-size: .85rem; }
.ch-placelist { columns: 2 14rem; column-gap: 2rem; padding-left: 1.1rem; }
.ch-placelist li { break-inside: avoid; margin-bottom: .5rem; }
.ch-continue { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.ch-continue a::after { content: " \2192"; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-in, .no-js .reveal { opacity: 1; transform: none; }

/* ---- timeline (F8) ---- */
.feed-f8.ch-timeline { margin: 1.5rem 0; max-width: 44rem; }
.ch-timeline .feed-month { position: relative; padding-left: 2rem; margin: 0; padding-bottom: 1.4rem; border-left: 2px solid var(--crm-rule); }
.ch-timeline .feed-month::before { content: ""; position: absolute; left: -9px; top: .2rem; width: 16px; height: 16px; background: var(--crm-paper); border: 3px solid var(--crm-signal); border-radius: 50%; }
.ch-timeline .feed-month-label { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .16em; font-size: 1rem; color: var(--crm-signal-dark); margin: 0 0 .5rem; }
.ch-timeline .post-list { margin: 0; }
.ch-timeline .feed-row { display: block; border-bottom: 0; padding: .3rem 0 .7rem; }
.ch-timeline .feed-row a { font-size: 1.2rem; font-weight: 600; text-decoration: none; color: var(--crm-ink); }
.ch-timeline .feed-row a:hover { color: var(--crm-signal-dark); }
.ch-timeline .feed-meta { display: block; white-space: normal; font-size: .9rem; color: var(--crm-muted); opacity: 1; }
.ch-timeline .feed-dek { display: block; font-size: 1rem; color: #33444e; }

/* ---- inner pages ---- */
.ch-page { max-width: 72rem; margin: 0 auto; padding: 3rem 1rem 0; display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 3.5rem; }
.ch-page--wide { grid-template-columns: minmax(0, 1fr); }
.ch-page__head { grid-column: 1 / -1; border-bottom: 1px solid var(--crm-rule); padding-bottom: 1.6rem; }
.ch-page__kicker { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .2em; color: var(--crm-signal-dark); font-weight: 600; margin: 0 0 .5rem; }
.ch-page__head h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); margin: 0 0 .8rem; max-width: 20ch; }
.ch-page__dek { font-size: 1.25rem; color: #33444e; max-width: 40rem; margin: 0; font-style: italic; }
.ch-prose { min-width: 0; }
.ch-prose > p, .ch-prose > ul, .ch-prose > ol, .ch-prose > h2, .ch-prose > h3, .ch-prose > dl { max-width: var(--crm-measure); }
.ch-prose h2 { font-size: 1.7rem; margin: 2.4rem 0 .8rem; }
.ch-prose h3 { font-size: 1.3rem; margin: 1.8rem 0 .5rem; }
.ch-prose figure { margin: 1.8rem 0; }
.ch-prose figcaption { font-size: .9rem; color: var(--crm-muted); margin-top: .5rem; }
.ch-prose li { margin-bottom: .4rem; }
.ch-facts { display: grid; grid-template-columns: 9rem 1fr; gap: .4rem 1rem; padding: 1rem 0; border-top: 3px solid var(--crm-river); border-bottom: 1px solid var(--crm-rule); margin: 1.6rem 0; max-width: var(--crm-measure); }
.ch-facts dt { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .1em; font-size: .9rem; color: var(--crm-muted); padding-top: .15rem; }
.ch-facts dd { margin: 0; }
.ch-aside { font-size: 1rem; padding-top: .4rem; }
.ch-aside__block { border-top: 3px solid var(--crm-ink); padding-top: .8rem; margin-bottom: 2rem; }
.ch-aside__block h2 { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .14em; font-size: .95rem; margin: 0 0 .6rem; }
.ch-aside__block ul { list-style: none; margin: 0; padding: 0; }
.ch-aside__block li { padding: .3rem 0; border-bottom: 1px solid var(--crm-rule); line-height: 1.35; }
.ch-aside__block a { text-decoration: none; }
.ch-hublist { list-style: none; padding: 0; margin: 1.5rem 0; max-width: 48rem; }
.ch-hublist li { display: grid; grid-template-columns: 9rem 1fr; gap: 1.2rem; padding: 1.1rem 0; border-top: 1px solid var(--crm-rule); }
.ch-hublist img { width: 9rem; aspect-ratio: 4 / 3; object-fit: cover; }
.ch-hublist h2, .ch-hublist h3 { font-size: 1.3rem; margin: 0 0 .3rem; }
.ch-hublist h2 a, .ch-hublist h3 a { text-decoration: none; }
.ch-hublist p { margin: 0; font-size: 1rem; }
.ch-hublist--numbered { counter-reset: hub; }
.ch-hublist--numbered li { grid-template-columns: 3rem 1fr; }
.ch-hublist--numbered li::before { counter-increment: hub; content: counter(hub, upper-roman); font-family: var(--crm-label); font-weight: 700; font-size: 1.4rem; color: var(--crm-signal); }
.ch-results { list-style: none; padding: 0; max-width: 44rem; }
.ch-results li { padding: 1rem 0; border-top: 1px solid var(--crm-rule); }
.ch-results a { font-size: 1.25rem; font-weight: 600; }
.ch-results small { display: block; font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .1em; color: var(--crm-muted); }
.ch-results p { margin: .3rem 0 0; font-size: 1rem; }
.ch-noresults { padding: 1rem 1.2rem; background: #fff; border-left: 5px solid var(--crm-signal); max-width: 40rem; }
.ch-credits { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ch-credits th, .ch-credits td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--crm-rule); vertical-align: top; }
.ch-credits img { width: 72px; height: 54px; object-fit: cover; }
.ch-sitemap { columns: 2 18rem; column-gap: 2.5rem; }
.ch-sitemap section { break-inside: avoid; margin-bottom: 1.6rem; }
.ch-sitemap h2 { font-size: 1.2rem; margin: 0 0 .4rem; }
.ch-sitemap ul { margin: 0; padding-left: 1.1rem; }
.ch-note-meta { font-family: var(--crm-label); text-transform: uppercase; letter-spacing: .12em; color: var(--crm-muted); font-size: .95rem; }

@media (max-width: 900px) {
  .ch-book { grid-template-columns: 1fr; gap: 0; }
  .ch-rail { display: none; }
  .ch-page { grid-template-columns: 1fr; gap: 1.5rem; }
  .ch-figure--bleed { margin-right: 0; }
}
@media (max-width: 600px) {
  body { font-size: 1.05rem; }
  .ch-masthead { grid-template-columns: auto 1fr; }
  .ch-masthead__mark { grid-column: 1 / -1; grid-row: 1; }
  .ch-masthead__pledge { grid-row: 2; }
  .ch-masthead__toggle { grid-row: 2; }
  .ch-pair { grid-template-columns: 1fr; }
  .ch-hublist li { grid-template-columns: 1fr; }
  .ch-hublist img { width: 100%; }
  .ch-facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .ch-masthead__waterline, .ch-opening__cue::after { animation: none; }
}
