/* research-mobile.css — shared mobile accessibility layer for gis.woodfinegroup.com/research
   Linked by all research-*.html pages. Pairs with section-collapse.js.
   Desktop is unaffected; all rules are mobile-first or guarded by @media (max-width:768px). */

/* Enable height:auto animation where the browser supports it (progressive enhancement). */
:root { interpolate-size: allow-keywords; }

/* ── Cross-page research navigation bar ──────────────────────────────────────── */
.research-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  gap: 2px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #0f2a4a;
  padding: 0 4px;
  scrollbar-width: none;
}
.research-nav::-webkit-scrollbar { display: none; }
.research-nav a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: #cdd9ea;
  text-decoration: none;
  font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.research-nav a:hover { color: #fff; }
.research-nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: #f5b301;
}
.research-nav a.rn-home { color: #fff; font-weight: 700; }

/* ── Collapsible sections (Wikipedia-mobile pattern) ─────────────────────────── */
/* The toggle button replaces the section heading; the panel holds the section body.
   On desktop the toggle renders as a plain heading and the panel is always shown. */
.sc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 4px;
  min-height: 44px;
  background: none;
  border: none;
  border-bottom: 1px solid #d8dee6;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
.sc-toggle:focus-visible {
  outline: 2px solid #3366cc;
  outline-offset: 2px;
}
.sc-toggle .sc-title { display: block; }
.sc-chevron {
  flex: none;
  width: 0.6em;
  height: 0.6em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);            /* points down when collapsed */
  transition: transform 0.25s ease;
  opacity: 0.6;
}
.sc-toggle[aria-expanded="true"] .sc-chevron {
  transform: rotate(-135deg);          /* points up when expanded */
}
.sc-panel {
  overflow: hidden;
}
.sc-panel[hidden] { display: none; }

/* Expand-all / collapse-all control (mobile only) */
.sc-allctl {
  display: none;
  gap: 8px;
  margin: 8px 0 4px;
}
.sc-allctl button {
  flex: 1;
  min-height: 40px;
  border: 1px solid #c8ccd1;
  border-radius: 6px;
  background: #f4f6f9;
  color: #1f3a5f;
  font: 600 13px/1 system-ui, sans-serif;
  cursor: pointer;
}

/* ── Mobile-only adjustments ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Readability floor — nothing below 13px on phones */
  .research-mobile, .research-mobile p, .research-mobile li { font-size: 17px; line-height: 1.6; }

  /* Wide tables scroll inside their own box, never the page */
  .research-mobile table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sc-allctl { display: flex; }
}

/* ── Print-doc pages (Summary, Regional Markets) — mobile fixes ──────────────── */
/* These two pages are built from a fixed 10-inch print template; the per-page reflow
   unlocks width + stacks grids + scales primary fonts. This block fixes the second tier:
   header/footer crush, remaining sub-12px text, fixed-inch widths, pipeline arrows, spacing.
   Class names are unique to the print-doc pages — no collision with article pages. */
@media (max-width: 768px) {
  /* 1 — Header + footer stop crushing: stack the brand/title/meta vertically */
  .pg-hd {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom-width: 2px;
  }
  .pg-hd .org  { font-size: 12px !important; font-weight: 700; letter-spacing: 0.08em;
                 text-transform: uppercase; color: #1a3a6b; }
  .pg-hd .ttl  { font-size: 21px !important; font-weight: 800; line-height: 1.25; text-align: left; }
  .pg-hd .meta { font-size: 12px !important; text-align: left !important; color: #666; }
  .pg-ft {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px !important;
  }

  /* 2 — Complete the font floor (print-point text the reflow missed) */
  .comp-lbl, .comp-pct, .comp-fill, .comp-note,
  .res-box li, .res-box h4, .cites, .data-note p,
  .pipe-body, .pipe-tag, .tc, .cc-mem {
    font-size: 13px !important;
    line-height: 1.45;
  }

  /* 3 — Unlock fixed-inch widths so the T2 composition rows wrap */
  .comp-lbl { min-width: 0 !important; }
  .comp-pct { width: auto !important; white-space: normal !important; }

  /* 4 — Pipeline connector arrows: point DOWN between vertically-stacked stages */
  .pipe-stage { position: relative; }
  .pipe-stage::after {
    content: "↓" !important;
    right: 50% !important;
    left: auto !important;
    top: auto !important;
    bottom: -8px !important;
    transform: translateX(50%) !important;
  }
  .pipe-stage:last-child::after { display: none !important; }

  /* 5 — Spacing / legibility polish */
  .data-note { padding: 10px 12px !important; }
  .tb { height: 12px !important; }
  .cc { padding: 8px 10px !important; }
  .tc { gap: 10px !important; }

  /* 6 — Drop the "Page N of N" print fragment on the reflowed single-column mobile view */
  .pg-num { display: none !important; }
}

/* ── Desktop: sections always open, no toggle affordance ─────────────────────── */
@media (min-width: 769px) {
  .sc-toggle {
    cursor: default;
    border-bottom: none;
    padding-left: 0;
    padding-right: 0;
  }
  .sc-chevron { display: none; }
  .sc-panel { display: block !important; }
  .sc-allctl { display: none; }
  /* The research nav is useful on desktop too, but render inline-block, not sticky-overlay */
  .research-nav { position: static; }
}
