/* chapter-hub.css — the public chapter hubs: the pages generated at build
   by scripts/chapter-page.js and the React ChapterPage (chapters created
   since the last deploy). Loads after theme-tokens.css. Mirrored to public/assets/css/ by
   scripts/sync-styles.js.

   A chapter hub is one large window on the desk: a title bar, then a white
   pane holding the masthead, a sticky section nav, and the sections. The
   hydration hooks (data-chapter-*, data-nav-target, .ch-nav, .ch-lp-grid,
   .ch-county, .ch-hero__photo img, .ch-hero__caption, .ch-gallery__*) are
   read by public/assets/js/chapter-hydration.js — keep them. */

.ch-page,
.ch-page *,
.ch-page *::before,
.ch-page *::after { box-sizing: border-box; }

.ch-page {
  margin: 0;
  min-height: 100vh;
  background: var(--wallpaper);
  color: var(--mb-ink);
  font-family: var(--font-content);
  line-height: 1.55;
}

/* ── WINDOW ─────────────────────────────────────────────────────────── */
.ch-window {
  max-width: 1180px;
  margin: 28px auto calc(var(--taskbar-h) + 36px);
  background: var(--chrome-face);
  border: 1px solid var(--chrome-outline);
  border-radius: var(--r-window);
  box-shadow: var(--float);
}
/* Not draggable — it's a page. The close box goes back to the desktop. */
.ch-titlebar { cursor: default; }
.ch-titlebar a.win95-close-btn { text-decoration: none; }
.ch-titlebar a.win95-close-btn:visited { color: var(--chrome-outline); }

.ch-pane {
  margin: 0 5px;
  background: var(--chrome-highlight);
  border: 1px solid var(--chrome-outline);
  border-radius: var(--r-pane);
}

/* ── MASTHEAD ───────────────────────────────────────────────────────── */
.ch-masthead {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 44px;
  align-items: center;
  padding: 52px 52px 44px;
  background: var(--mb-magenta-wash);
  border-radius: var(--r-pane) var(--r-pane) 0 0;
}
.ch-masthead__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
}
.ch-masthead__title {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.4vw, 54px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.015em;
  color: var(--mb-ink);
}
.ch-masthead__lede {
  max-width: 46ch;
  margin: 0 0 26px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--mb-ink);
}
.ch-masthead__lede strong { font-weight: 700; }
.ch-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ch-masthead__note {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--mb-ink-60);
}

/* The hero photo — mounted like a print. Its <img src> is never touched by
   JS (anti-flash rule); only the caption hydrates. */
.ch-hero__photo {
  margin: 0;
  padding: 8px 8px 0;
  background: var(--mb-chalk);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-chip);
  box-shadow: var(--shadow-card);
}
/* The photo sits in a frame that carries the dot screen (.mb-screen) */
.ch-hero__frame { display: block; overflow: hidden; border-radius: 2px; }
.ch-hero__photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 460px;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: 2px;
  background: var(--mb-paper-deep);
  filter: var(--film-grade);
}
.ch-hero__caption {
  padding: 8px 4px 10px;
  font-family: var(--font-chrome);
  font-size: var(--tc-label);
  font-weight: 600;
  color: var(--mb-ink-60);
}

/* ── SECTION NAV — sticky; scrollspy (chapter-hydration.js / ChapterPage)
   sets aria-current on the link whose section is in view ─────────────── */
.ch-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: color-mix(in srgb, var(--chrome-face) 94%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--mb-line-strong);
  border-bottom: 1px solid var(--mb-line-strong);
  overflow-x: auto;
  scrollbar-width: none;
}
.ch-nav::-webkit-scrollbar { display: none; }
.ch-nav a {
  flex: none;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font-family: var(--font-chrome);
  font-size: var(--tc-ui);
  font-weight: 600;
  color: var(--mb-ink);
  text-decoration: none;
  white-space: nowrap;
}
.ch-nav a:visited { color: var(--mb-ink); }
.ch-nav a:hover { background: var(--chrome-face-hover); }
.ch-nav a[aria-current="page"] {
  background: var(--select);
  border-color: var(--chrome-outline);
  font-weight: 700;
}
.ch-nav a:focus-visible { outline: var(--focus-outline); outline-offset: 1px; }
/* The nav's own call to action, pinned right */
.ch-nav a.ch-nav__cta {
  margin-left: auto;
  background: var(--mb-magenta-pastel);
  border-color: var(--chrome-outline);
  box-shadow: var(--lift);
  font-weight: 700;
}
.ch-nav a.ch-nav__cta:hover { background: var(--select-hover); }

/* ── SECTIONS ───────────────────────────────────────────────────────── */
.ch-section {
  padding: 60px 52px;
  border-top: 1px solid var(--mb-line);
  scroll-margin-top: 64px;
}
.ch-nav + .ch-section { border-top: none; }
.ch-section--paper { background: var(--mb-paper); }
.ch-section--aqua  { background: var(--mb-aqua-wash); }
.ch-section--grape { background: var(--mb-grape-wash); }
.ch-section--butter { background: var(--mb-butter-wash); }
.ch-section__head { margin: 0 0 28px; }
/* Page heading of the simpler generated pages (the blog index, /faq). */
.ch-pagehead {
  padding: 56px 56px 32px;
  border-bottom: 1px solid var(--mb-line);
}
.ch-pagehead__title {
  margin: 10px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 60px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.015em;
}
.ch-pagehead__lede { max-width: 60ch; margin: 0; font-size: 17px; line-height: 1.55; color: var(--mb-ink-60); }
.ch-eyebrow {
  display: block;
  margin: 0 0 8px;
  font-family: var(--font-chrome);
  font-size: var(--tc-ui);
  font-weight: 700;
  color: var(--mb-magenta-deep);
}
.ch-h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--mb-ink);
}
.ch-h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--mb-ink);
}
.ch-intro {
  max-width: 62ch;
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--mb-ink);
}
.ch-muted { color: var(--mb-ink-60); }

/* ── APPLY: steps + eligibility ─────────────────────────────────────── */
.ch-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.ch-step {
  padding: 20px 20px 22px;
  background: var(--mb-chalk);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-pane);
  box-shadow: var(--shadow-card);
}
.ch-step__num {
  display: block;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1;
  color: var(--mb-magenta-deep);
  font-variant-numeric: lining-nums;
}
.ch-step h3 {
  margin: 14px 0 6px;
  font-family: var(--font-chrome);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}
.ch-step p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--mb-ink-60); }

.ch-eligibility {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 28px;
  margin-top: 28px;
  padding: 26px;
  background: var(--mb-paper);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-pane);
}
.ch-eligibility p { margin: 0; font-size: 15px; line-height: 1.6; }
.ch-counties {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
}
.ch-county {
  padding: 6px 12px;
  background: var(--mb-chalk);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-chip);
  font-family: var(--font-chrome);
  font-size: var(--tc-ui);
  font-weight: 600;
  line-height: 1.3;
  color: var(--mb-ink);
}
.ch-apply-cta { margin-top: 28px; }

/* ── IMPACT ─────────────────────────────────────────────────────────── */
.ch-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.ch-stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  padding: 22px 20px;
  background: var(--mb-chalk);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-pane);
}
/* Locked height + tabular figures: the slot never resizes when hydration
   swaps the snapshot for the live count. */
.ch-stat__num {
  min-height: 46px;
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
}
.ch-stat__num--magenta { color: var(--mb-magenta-deep); }
.ch-stat__num--aqua    { color: var(--mb-aqua-deep); }
.ch-stat__num--grape   { color: var(--mb-grape-deep); }
.ch-stat__num--tangerine { color: var(--mb-tangerine-deep); }
.ch-stat p { margin: 14px 0 0; font-size: 14px; line-height: 1.4; color: var(--mb-ink-60); }

/* Awardee photos (grid rendered by hydration / GrantAwardees) get the film finish */
[data-awardees-grid] img { filter: var(--film-grade); }

/* ── LP ROSTER (cards rendered by hydration / ChapterPage) ──────────── */
/* A compact grid: photo, name and title. The whole card is a button that
   opens the full bio and links in a modal (.ch-lp-modal). Photos sit in a
   .mb-screen frame, so they take the dot screen like every chapter photo. */
.ch-lp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
.ch-lp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 14px;
  background: var(--mb-chalk);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-pane);
  box-shadow: var(--shadow-card);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.ch-lp-card:hover { background: var(--mb-paper); }
.ch-lp-card:focus-visible { outline: var(--focus-outline); outline-offset: var(--focus-offset); }
.ch-lp-card__photo,
.ch-lp-modal__photo {
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-chip);
  background: var(--mb-paper-deep);
}
.ch-lp-card__photo img,
.ch-lp-modal__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--film-grade);
}
.ch-lp-card__placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}
.ch-lp-card__placeholder svg { width: 42%; height: auto; fill: var(--chrome-shade); }
.ch-lp-card__tag { position: absolute; top: 18px; left: 18px; z-index: 3; }
.ch-lp-card__name {
  margin: 10px 4px 2px;
  font-family: var(--font-chrome);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}
.ch-lp-card__role { margin: 0 4px; font-size: 12px; line-height: 1.4; color: var(--mb-ink-60); }

/* The LP modal: photo beside the text, stacked on phones */
.ch-lp-modal {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}
.ch-lp-modal__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.ch-lp-modal__role { margin: 6px 0 0; font-size: 13px; color: var(--mb-ink-60); }
.ch-lp-modal__bio {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.ch-lp-modal__link { margin-top: 16px; }
@media (max-width: 560px) {
  .ch-lp-modal { grid-template-columns: 1fr; }
  .ch-lp-modal__photo { max-width: 220px; }
}

/* ── JOIN ───────────────────────────────────────────────────────────── */
.ch-join {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.ch-join__list {
  margin: 0;
  padding: 22px 24px;
  list-style: none;
  display: grid;
  gap: 14px;
  background: var(--mb-chalk);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-pane);
}
.ch-join__list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 15px;
  line-height: 1.5;
}
.ch-join__list li::before {
  content: "\2713";
  flex: none;
  font-weight: 700;
  color: var(--mb-grape-deep);
}

/* ── GALLERY ────────────────────────────────────────────────────────── */
.ch-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.ch-gallery__item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--mb-paper-deep);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-chip);
}
/* Gallery tiles take the same dot screen as every photo */
.ch-gallery__item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: var(--film-dots);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}
.ch-gallery__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--film-grade);
}
.ch-gallery__marquee { overflow: hidden; }
.ch-gallery__track {
  display: flex;
  gap: 12px;
  width: max-content;
  animation: ch-marquee 60s linear infinite;
}
.ch-gallery__track .ch-gallery__item { width: 280px; flex: none; }
.ch-gallery__marquee:hover .ch-gallery__track { animation-play-state: paused; }
@keyframes ch-marquee { to { transform: translateX(-50%); } }

/* ── FAQ (mirrors the page's FAQPage structured data) ───────────────── */
.ch-faq { display: grid; gap: 8px; max-width: 880px; }
.ch-faq__item {
  background: var(--mb-chalk);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-pane);
}
.ch-faq__item summary {
  position: relative;
  padding: 16px 52px 16px 18px;
  list-style: none;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}
.ch-faq__item summary::-webkit-details-marker { display: none; }
.ch-faq__item summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 400;
  color: var(--mb-ink-60);
}
.ch-faq__item[open] summary::after { content: "\2013"; }
.ch-faq__item summary:focus-visible { outline: var(--focus-outline); outline-offset: -2px; border-radius: var(--r-pane); }
.ch-faq__item p { margin: 0; padding: 0 18px 18px; font-size: 15px; line-height: 1.65; }

/* Founder resources: the chapter's Resource Navigator entries, grouped by
   type (resourcesHtml in scripts/chapter-page.js). */
.ch-resources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px 48px;
  align-items: start;
}
.ch-resources__title {
  margin: 0 0 14px;
  font-family: var(--font-chrome);
  font-size: var(--tc-ui);
  font-weight: 700;
  color: var(--mb-ink-60);
}
.ch-resources__list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.ch-resources__list li { display: grid; gap: 3px; }
.ch-resources__list a,
.ch-resources__list strong { font-size: 15px; font-weight: 600; line-height: 1.4; }
.ch-resources__list span { font-size: 14px; line-height: 1.5; color: var(--mb-ink-60); }
.ch-resources__more { margin-top: 14px; }
/* "Show N more" expands the list for good, so the summary goes once open. */
.ch-resources__more summary {
  width: fit-content;
  list-style: none;
  font-family: var(--font-chrome);
  font-size: var(--tc-ui);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.ch-resources__more summary::-webkit-details-marker { display: none; }
.ch-resources__more summary:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
.ch-resources__more[open] summary { display: none; }

/* /funded-badge: each chapter's awardee badge with its embed code
   (scripts/badge-page.js). */
.ch-badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 36px 40px;
}
.ch-badge { display: grid; gap: 14px; align-content: start; margin: 0; }
.ch-badge img { display: block; width: 240px; height: 80px; }
.ch-badge figcaption { display: grid; gap: 8px; justify-items: start; }
.ch-badge__label {
  font-family: var(--font-chrome);
  font-size: var(--tc-ui);
  font-weight: 700;
  color: var(--mb-ink-60);
}
.ch-badge__code {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--mb-line);
  border-radius: var(--r-control);
  background: var(--mb-paper);
  color: var(--mb-ink);
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.5;
  resize: none;
}
.ch-badge__code:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }

/* ── CLOSING CTA + CONTACT ──────────────────────────────────────────── */
.ch-closing { text-align: center; }
.ch-closing .ch-intro { margin: 12px auto 24px; }
.ch-closing .ch-actions { justify-content: center; }

.ch-contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 32px;
}
.ch-chapters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ch-chapters a {
  padding: 7px 12px;
  background: var(--mb-chalk);
  border: 1px solid var(--mb-line-strong);
  border-radius: var(--r-control);
  font-family: var(--font-chrome);
  font-size: var(--tc-ui);
  font-weight: 600;
  color: var(--mb-ink);
  text-decoration: none;
}
.ch-chapters a:visited { color: var(--mb-ink); }
.ch-chapters a:hover { border-color: var(--chrome-outline); background: var(--chrome-face); }

/* ── FOOTER — the window's status bar ───────────────────────────────── */
.ch-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 7px 14px 8px;
  font-family: var(--font-chrome);
  font-size: var(--tc-label);
  color: var(--chrome-text-soft);
}
.ch-footer nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ch-footer a { color: var(--chrome-text-soft); }

/* ── TOUCH + SMALL SCREENS ──────────────────────────────────────────── */
@media (pointer: coarse) {
  .ch-nav a { padding: 10px 14px; }
  .ch-faq__item summary { padding-top: 18px; padding-bottom: 18px; }
  .ch-chapters a { padding: 10px 14px; }
}

@media (max-width: 960px) {
  .ch-masthead { gap: 32px; padding: 40px 32px 36px; }
  .ch-section { padding: 48px 32px; }
  .ch-join,
  .ch-contact,
  .ch-eligibility { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 768px) {
  /* The hub becomes the whole screen above the taskbar */
  .ch-window {
    margin: 0 0 var(--taskbar-h);
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
  }
  .ch-titlebar { border-radius: 0; }
  .ch-pane { margin: 0; border-width: 1px 0; border-radius: 0; }
  .ch-masthead {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 28px 18px 26px;
    border-radius: 0;
  }
  .ch-hero__photo img { max-height: 340px; }
  .ch-nav { padding: 8px 10px; }
  .ch-nav a.ch-nav__cta { margin-left: 8px; }
  .ch-section { padding: 40px 18px; }
  .ch-pagehead { padding: 36px 20px 22px; }
  .ch-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ch-stat { min-height: 120px; padding: 16px 14px; }
  .ch-stat__num { font-size: 36px; min-height: 36px; }
  .ch-lp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

@media (max-width: 420px) {
  .ch-actions .mb-btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ch-gallery__track { animation: none; }
}
