/* Sentinel reader — STRUCTURAL scaffolding only.
   Intentionally plain (system/serif, warm paper) so the structure is legible;
   real typography/animation/theme come in the style phase. */

:root {
  /* Muted editorial cover tones, keyed to primary topic (image stand-ins). */
  --c-politics: #5b6b7a;
  --c-conflict: #9c5b4e;
  --c-technology: #4f7a72;
  --c-business: #94762f;
  --c-society: #6f7d5a;
  --c-climate: #5a7d63;
  --c-default: #7a7064;
}

* { box-sizing: border-box; }
body.reader-body {
  margin: 0;
  background: #f4f2ec;
  color: #1c1b19;
  font: 16px/1.6 Georgia, "Times New Roman", serif;
}

/* ---------- Hovering menu bar ---------- */
.menubar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  /* 3 columns so the brand sits centered regardless of the side widths. */
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 13px 22px;
  background: rgba(244, 242, 236, 0.82);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid #d9d4c9;
}
.menubar-brand { display: inline-flex; align-items: center; gap: 9px; justify-self: center;
  font-weight: 600; letter-spacing: 0.16em; text-decoration: none; color: inherit; }
.menubar-logo { height: 22px; width: auto; display: block; }
.menubar-updated { font-size: 13px; color: #6f6a61; justify-self: start; }
.menubar-nav a { text-decoration: none; color: inherit; font-size: 14px; }
.menubar-nav a:hover { text-decoration: underline; }

/* ---------- Reader / full-page slides ---------- */
.reader { position: relative; height: 100vh; overflow: hidden; }
/* Horizontal track: all slides loaded side-by-side; nav slides the track. The
   active index lives in --i; CSS transitions translateX for the animation. */
.slides {
  height: 100%; display: flex;
  transform: translateX(calc(var(--i, 0) * -100%));
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.slide { flex: 0 0 100%; height: 100vh; }
@media (prefers-reduced-motion: reduce) { .slides { transition: none; } }
.slide-scroll { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 84px 24px 88px;
  scrollbar-gutter: stable both-edges; }
/* Reading column matches the investigations article (640px centered). */
.slide-inner { max-width: 640px; margin: 0 auto; }

/* ---------- Topic-colored cover band (in place of images) ---------- */
.slide-cover {
  position: relative; overflow: hidden;
  --cover-tint: var(--c-default);
  /* Full-bleed: break out of the 640px column and the scroll padding so the
     cover image spans the whole page width and reaches the top edge. */
  margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  margin-top: -84px; margin-bottom: 30px;
  /* Fixed, capped height so the WIDTH always fills the full bleed (an
     aspect-ratio here would derive width from the capped height and strand the
     image left of the right edge). The image crops via background-size: cover. */
  height: clamp(300px, 40vw, 560px); padding: 20px max(24px, 50vw - 320px);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
  background-color: var(--cover-tint); color: #f7f4ee;
  background-size: cover; background-position: center;
}
/* Topic tint variable — shared by the reader cover and the home cards. */
.cover--politics   { --cover-tint: var(--c-politics); }
.cover--conflict   { --cover-tint: var(--c-conflict); }
.cover--technology { --cover-tint: var(--c-technology); }
.cover--business   { --cover-tint: var(--c-business); }
.cover--society    { --cover-tint: var(--c-society); }
.cover--climate    { --cover-tint: var(--c-climate); }
/* Image covers: a 15% category tint over the map, plus a bottom scrim for labels. */
.slide-cover.has-image::after,
.home-card-cover.has-image::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--cover-tint, var(--c-default)); opacity: 0.15;
}
.slide-cover.has-image::before,
.home-card-cover.has-image::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(20,18,16,0.62), rgba(20,18,16,0) 55%);
}
.slide-cover > span,
.home-card-cover > span { position: relative; z-index: 1; }
.cover-region { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.92; }
.cover-topic { display: flex; align-items: center; gap: 7px; font-size: 13px; opacity: 0.95; text-transform: capitalize; }
.cover-topic .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }

.slide-kicker { margin: 0; text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; color: #6f6a61; }
.slide-title { font-size: 34px; line-height: 1.2; margin: 8px 0 10px; }
.slide-meta { color: #6f6a61; font-size: 13.5px; margin: 0 0 26px; }
.slide-para { font-size: 18px; line-height: 1.72; margin: 0 0 18px; color: #2a2825; }

.slide-lens { margin: 26px 0; padding: 14px 18px; background: rgba(0,0,0,0.03); border-left: 3px solid #7a7064; }
.slide-lens h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: #6f6a61; margin: 0 0 6px; }
.slide-lens p { margin: 0; font-size: 15.5px; }

/* ---------- Arrows ---------- */
.reader-arrow {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 15;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid #d9d4c9; background: rgba(251, 250, 246, 0.92);
  font-size: 22px; line-height: 1; color: #1c1b19; cursor: pointer;
}
/* Consistent 64px buffer outside the 1142px column (571 half + 46 arrow + 64
   gap = 681). No floor: once that buffer can't fit, the arrows hide (below)
   rather than crowd the text — so the gap is always the same when they show. */
.reader-arrow--prev { left: calc(50% - 681px); }
.reader-arrow--next { right: calc(50% - 681px); }
@media (max-width: 1378px) {
  .reader-arrow { display: none; }
}
.reader-arrow:disabled { opacity: 0.25; cursor: default; }

/* ---------- Progress dots ---------- */
.reader-dots { position: fixed; bottom: 18px; left: 0; right: 0; z-index: 15;
  display: flex; justify-content: center; gap: 9px; }
.reader-dot { width: 8px; height: 8px; border-radius: 50%; border: none;
  background: #cfc9bd; padding: 0; cursor: pointer; }
.reader-dot.is-active { background: #1c1b19; }

/* ---------- Sources ---------- */
.sources { margin-top: 38px; border-top: 1px solid #d9d4c9; padding-top: 16px; }
.sources-toggle { background: none; border: none; font: inherit; font-size: 14px; cursor: pointer;
  color: #1c1b19; border-bottom: 1.5px solid #1c1b19; padding: 0 0 2px; }
.sources-list { list-style: none; margin: 16px 0 0; padding: 0; }
.sources-list li { padding: 10px 0; border-bottom: 1px solid #e3ded3; }
.sources-list a { color: #1c1b19; text-decoration: none; font-size: 16px; }
.sources-list a:hover { text-decoration: underline; }
.sources-meta { display: block; color: #6f6a61; font-size: 12.5px; margin-top: 2px; }

.reader--empty { display: flex; align-items: center; justify-content: center; color: #6f6a61; }

/* ---------- Archive list page ---------- */
.archive-page { max-width: 760px; margin: 0 auto; padding: 96px 24px 80px; }
.archive-title { text-align: center; letter-spacing: 0.18em; font-size: 19px; font-weight: 500; }
.archive-list { list-style: none; padding: 0; margin: 26px 0 0; }
.archive-item { border-bottom: 1px solid #d9d4c9; }
.archive-item a { display: flex; gap: 16px; align-items: baseline; padding: 12px 4px;
  text-decoration: none; color: #1c1b19; }
.archive-item a:hover { background: rgba(0,0,0,0.025); }
.archive-date { flex: 0 0 150px; color: #6f6a61; font-size: 13.5px; }
.archive-lead { font-size: 16px; }
.tag--breaking { background: #9c5b4e; color: #fff; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 2px 7px; border-radius: 2px; }
.empty { text-align: center; color: #6f6a61; padding: 40px; }

/* ---------- Home (card overview of the latest edition) ---------- */
.home { max-width: 1142px; margin: 0 auto; padding: 96px 24px 80px; }
/* Edition section is width-matched to the investigations feature (760px) and
   centered, so its left/right edges line up with the block above it. */
/* Strands feature — same card treatment as the Threads feature above. */
.home-strands { max-width: 760px; margin: 0 auto; padding: 4px 24px 52px; }
.home-head { text-align: center; margin-bottom: 28px; }
.home-kicker { margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.22em;
  font-size: 12px; color: #6f6a61; }
.home-date { margin: 0; font-family: Georgia, "Times New Roman", serif;
  font-weight: 500; font-size: 22px; }
/* Flex wrap + center: cards sit in one row within the 760px column, aligned
   under the investigations block; an incomplete last row stays centered. */
.home-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px;
  max-width: 760px; margin: 0 auto; }
.home-card { flex: 1 1 210px; max-width: 240px;
  display: flex; flex-direction: column; text-decoration: none;
  color: inherit; border: 1px solid #ddd8cc; background: #fbfaf6; }
.home-card-cover {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  display: flex; align-items: flex-end; padding: 12px 14px;
  background-color: var(--cover-tint, var(--c-default)); color: #f7f4ee;
  background-size: cover; background-position: center;
}
.home-card-body { padding: 16px 16px 18px; }
.home-card-title { margin: 0 0 8px; font-family: Georgia, "Times New Roman", serif;
  font-weight: 500; font-size: 20px; line-height: 1.25; }
.home-card-dek { margin: 0; font-size: 14px; line-height: 1.55; color: #3a3833;
  /* Reserve 3 lines so cards stay uniform. Summaries are WRITTEN to fit — never
     truncated with an ellipsis (house style); see _card_dek in app.py. */
  min-height: calc(1.55em * 3); }
.home-card:hover .home-card-title { text-decoration: underline; }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .slide-title { font-size: 27px; }
  .slide-para { font-size: 17px; }
  .menubar-updated { display: none; }
  .archive-item a { flex-direction: column; gap: 2px; }
  .archive-date { flex-basis: auto; }
}

/* ---------- Menubar: multiple nav links ---------- */
.menubar-nav { display: inline-flex; gap: 18px; justify-self: end; }

/* ---------- Home: investigations feature ---------- */
.home-investigations { max-width: 760px; margin: 0 auto; padding: 4px 24px 52px; }
.home-inv-head {
  text-align: center; font-family: Georgia, "Times New Roman", serif; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; font-size: 15px; color: #1c1b19;
  margin: 0 0 22px; position: relative;
}
.home-inv-head::before, .home-inv-head::after {
  content: ""; position: absolute; top: 50%; width: calc(50% - 90px); border-top: 1px solid #d9d4c9;
}
.home-inv-head::before { left: 0; } .home-inv-head::after { right: 0; }
.home-inv-head a { color: inherit; text-decoration: none; }
.home-inv-head a:hover { text-decoration: underline; }
.home-inv-card {
  display: flex; text-decoration: none; color: inherit;
  border: 1px solid #ddd8cc; background: #fbfaf6;
}
.home-inv-cover {
  flex: 0 0 44%; min-height: 200px; background-size: cover; background-position: center; background-color: #0f1220;
}
.home-inv-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 8px; }
.home-inv-kicker {
  font-size: 11px; letter-spacing: 0.11em; text-transform: uppercase; color: #6f6a61;
}
.home-inv-title {
  font-family: Georgia, "Times New Roman", serif; font-size: 24px; line-height: 1.22; color: #1c1b19;
  min-height: calc(1.22em * 2);  /* reserve 2 lines so titles don't unbalance card height */
}
.home-inv-dek { font-size: 15px; line-height: 1.55; color: #3a3833;
  /* Reserve 3 lines for uniform cards. The standfirst is WRITTEN to fit — never
     truncated with an ellipsis (house style). */
  min-height: calc(1.55em * 3); }
.home-inv-card:hover .home-inv-title { text-decoration: underline; }
@media (max-width: 620px) {
  .home-inv-card { flex-direction: column; }
  .home-inv-cover { flex-basis: auto; min-height: 190px; }
}

/* ---------- Investigation (long-form article) ---------- */
.inv-hero { margin: 0; width: 100%; background: #0f1220; border-bottom: 1px solid #d9d4c9; }
.inv-hero img { display: block; width: 100%; height: auto; max-height: 62vh; object-fit: cover; }
.inv { max-width: 1142px; margin: 0 auto; padding: 0 24px 90px; }
.inv-kicker { margin: 40px 0 0; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: #6f6a61; }
.inv-title { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 40px; line-height: 1.18; margin: 12px 0 16px; }
.inv-standfirst { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 21px; line-height: 1.5; color: #3a3833; margin: 0 0 18px; }
.inv-meta { color: #6f6a61; font-size: 13.5px; margin: 0 0 30px; padding-bottom: 22px; border-bottom: 1px solid #d9d4c9; }

/* Investigations index list */
.inv-list { list-style: none; margin: 26px 0 0; padding: 0; }
.inv-list-item { border-bottom: 1px solid #d9d4c9; }
.inv-list-item a { display: flex; gap: 20px; align-items: center; padding: 20px 4px; text-decoration: none; color: #1c1b19; }
.inv-list-item a:hover .inv-list-title { text-decoration: underline; }
.inv-thumb { flex: 0 0 132px; height: 86px; border: 1px solid #ddd8cc; background-size: cover; background-position: center; background-color: #0f1220; }
.inv-list-text { display: flex; flex-direction: column; gap: 5px; }
.inv-list-title { font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.25; }
.inv-list-dek { font-size: 14.5px; color: #3a3833; line-height: 1.5; }
.inv-list-date { font-size: 12.5px; color: #6f6a61; }

@media (max-width: 560px) {
  .inv-title { font-size: 30px; }
  .inv-standfirst { font-size: 18px; }
  .inv-thumb { flex-basis: 96px; height: 66px; }
}

/* ---------- Series (mini-book front page) ---------- */
.series { max-width: 760px; margin: 0 auto; padding: 40px 24px 80px; }
.series-kicker { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: #6f6a61; margin: 0 0 10px; }
.series-title { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 42px; line-height: 1.12; margin: 0 0 20px; }
.series-thesis { font-family: Georgia, "Times New Roman", serif; font-size: 19px; line-height: 1.6; color: #2a2825; margin: 0 0 34px; padding-bottom: 28px; border-bottom: 1px solid #d9d4c9; }
.series-chapters { list-style: none; margin: 0; padding: 0; }
.series-chapter { border-bottom: 1px solid #d9d4c9; }
.series-chapter a, .series-ch-inner { display: flex; gap: 22px; padding: 20px 4px; text-decoration: none; color: #1c1b19; }
.series-chapter a:hover .series-ch-title { text-decoration: underline; }
.series-ch-num { flex: 0 0 92px; font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: #6f6a61; padding-top: 4px; }
.series-ch-text { display: flex; flex-direction: column; gap: 6px; }
.series-ch-title { font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.22; }
.series-ch-title em { font-style: italic; color: #6f6a61; font-size: 13px; letter-spacing: 0.02em; }
.series-ch-dek { font-size: 15px; line-height: 1.5; color: #3a3833; }
.series-chapter.is-upcoming { opacity: 0.55; }

/* ---------- Chapter (centered story + bilateral margin notes) ---------- */
.chapter { max-width: 1180px; margin: 0 auto; padding: 0 24px 40px; }
.chapter-eyebrow { max-width: 640px; margin: 40px auto 0; font-size: 12.5px; letter-spacing: 0.04em; color: #6f6a61; }
.chapter-eyebrow a { color: #6f6a61; text-decoration: none; border-bottom: 1px solid #cfc9bd; }
.chapter-eyebrow a:hover { color: #1c1b19; }
.chapter-title { max-width: 640px; margin: 12px auto 16px; font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 40px; line-height: 1.16; }
.chapter-standfirst { max-width: 640px; margin: 0 auto 16px; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 21px; line-height: 1.5; color: #3a3833; }
.chapter-meta { max-width: 640px; margin: 0 auto 30px; padding-bottom: 22px; border-bottom: 1px solid #d9d4c9; color: #6f6a61; font-size: 13.5px; }

.chapter-canvas { position: relative; }
.chapter-prose { max-width: 640px; margin: 0 auto; }
.chapter-para { font-size: 18.5px; line-height: 1.75; color: #2a2825; margin: 0 0 22px; }

/* citation superscript + the linked term in the prose */
sup.cref { line-height: 0; font-size: 0.7em; }
sup.cref a { text-decoration: none; color: #9c5b4e; font-weight: 700; padding: 0 1px; }
sup.cref a:hover { text-decoration: underline; }
.anno { color: inherit; text-decoration: none; border-bottom: 1px solid #cbb4ae; }
.anno:hover { border-bottom-color: #9c5b4e; background: rgba(156, 91, 78, 0.06); }

/* the notes — stacked list by default, floated into gutters when wide */
.chapter-notes { max-width: 640px; margin: 40px auto 0; border-top: 1px solid #d9d4c9; padding-top: 20px; }
.note { margin: 0 0 16px; scroll-margin-top: 78px; }
.note-head { display: flex; align-items: center; gap: 8px; }
.note-back { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
  background: #ece7dc; color: #9c5b4e; font-size: 11px; font-weight: 700; text-decoration: none; flex: 0 0 auto; }
.note-back:hover { background: #9c5b4e; color: #fff; }
.note-body { margin-top: 8px; }
.note-text { margin: 0 0 8px; font-size: 14px; line-height: 1.55; color: #2a2825; }
.note-src { margin: 0 0 7px; font-size: 12.5px; line-height: 1.45; color: #6f6a61; }
.note-link { font-size: 12px; color: #6f6a61; text-decoration: none; border-bottom: 1px solid #cfc9bd; }
.note-link:hover { color: #1c1b19; }
.note:target { background: rgba(156, 91, 78, 0.1); border-radius: 4px; box-shadow: 0 0 0 8px rgba(156, 91, 78, 0.1); }

/* floated (wide): compact head only; detail reveals on hover of the note or its term */
.chapter-canvas.is-floated .chapter-notes { max-width: none; margin: 0; border: 0; padding: 0; }
.chapter-canvas.is-floated .note { position: absolute; margin: 0; padding: 9px 12px; border-top: 2px solid #d9d4c9;
  border-radius: 4px; background: transparent; transition: background 0.12s ease, box-shadow 0.12s ease; }
.chapter-canvas.is-floated .note-body { display: none; }
.chapter-canvas.is-floated .note-text { font-size: 13.5px; line-height: 1.5; }
.chapter-canvas.is-floated .note:hover,
.chapter-canvas.is-floated .note.is-active { z-index: 6; background: #fbfaf6; border-top-color: transparent;
  box-shadow: 0 8px 24px rgba(28, 27, 25, 0.16); }
.chapter-canvas.is-floated .note:hover .note-body,
.chapter-canvas.is-floated .note.is-active .note-body { display: block; }

/* the referenced term lights up when its note is active, and vice-versa */
.anno.ref-active { background: rgba(156, 91, 78, 0.14); border-bottom-color: #9c5b4e; }
sup.cref.ref-active a { background: rgba(156, 91, 78, 0.14); }

/* source tier badges */
.tier { display: inline-block; font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 700; padding: 2px 6px; border-radius: 2px; }
.tier--primary-doc, .tier--primary-testimony { background: #e3ede4; color: #3f6b4e; }
.tier--reporting { background: #e7e3d8; color: #6f6a61; }
.tier--analysis { background: #f1e7cf; color: #8a6d2c; }

/* ---------- Narrow / mobile source rail ----------
   Fixed bar at the bottom of the viewport (built by sidenotes.js on narrow
   screens). Shows the citation nearest the middle of the screen; tap to expand. */
.source-rail {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(244, 242, 236, 0.97);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid #d9d4c9; box-shadow: 0 -6px 20px rgba(20, 18, 16, 0.07);
}
.source-rail[hidden] { display: none; }
.source-rail-bar {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 11px 16px calc(11px + env(safe-area-inset-bottom, 0px));
  background: none; border: 0; cursor: pointer; font: inherit; color: #1c1b19; text-align: left;
}
.source-rail-num {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: #1c1b19; color: #f7f4ee;
  font-size: 12px; font-weight: 700;
}
.source-rail-tier { flex: 0 0 auto; }   /* inherits .tier / .tier--* pill styling */
.source-rail-hint { margin-left: auto; font-size: 12.5px; color: #6f6a61; }
.source-rail-caret { flex: 0 0 auto; font-size: 9px; color: #9c5b4e; transition: transform 0.2s; }
.source-rail.is-open .source-rail-caret { transform: rotate(180deg); }
.source-rail-panel {
  padding: 4px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e6e1d5; max-height: 46vh; overflow-y: auto;
}
.source-rail-panel .note-body { margin: 10px 0 0; }
body.has-source-rail { padding-bottom: 58px; }
/* Backstop: the rail is a narrow-screen affordance only. */
@media (min-width: 1160px) { .source-rail { display: none !important; } }

/* chapter nav */
.chapter-nav { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center;
  max-width: 640px; margin: 44px auto 0; padding-top: 22px; border-top: 1px solid #d9d4c9; font-size: 14px; }
.chapter-nav a { color: #1c1b19; text-decoration: none; }
.chapter-nav a:hover { text-decoration: underline; }
.chapter-nav-index { color: #6f6a61; }
.chapter-nav .is-upcoming { color: #a8a296; }
@media (max-width: 560px) {
  .chapter-title, .series-title { font-size: 30px; }
  .chapter-standfirst { font-size: 18px; }
  .series-ch-num { flex-basis: auto; }
  .series-chapter a, .series-ch-inner { flex-direction: column; gap: 8px; }
}

/* investigations index: series kicker + home multi-card spacing */
.inv-list-kicker { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #6f6a61; }
.home-inv-card + .home-inv-card { margin-top: 20px; }
