/* =====================================================================
   acuity_pages.css
   ---------------------------------------------------------------------
   Shared styling for the OPTN acuity-circle pages under
   /liver-transplant-waiting-list/:
     - /donor-supply-by-center/   (raw donor counts inside 150/250/500 NM)
     - /mmat-topography/          (the MMAT terrain inside each band)

   Builds on /assets/styles.css. Page-scoped via `body.nf-acuity-page`.
   Does NOT touch any selector owned by the map module
   (.nf-map-*, .nf-nav-*, .nf-fit-*, .nf-pin-*, .nf-mini-*, .nf-deck-*).
   ===================================================================== */

body.nf-acuity-page .page {
  padding-bottom: 24px;
}

/* --- Hero band ------------------------------------------------------- */
body.nf-acuity-page .hero-band {
  margin-bottom: 16px;
}
body.nf-acuity-page .hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
}
@media (max-width: 880px) {
  body.nf-acuity-page .hero-grid {
    grid-template-columns: 1fr;
  }
}
body.nf-acuity-page .hero-band h1 {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.18;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
body.nf-acuity-page .hero-band p.lede {
  font-size: 17px;
  line-height: 1.55;
  color: rgba(246, 247, 255, 0.94);
  max-width: 68ch;
}
body.nf-acuity-page .hero-band .acuity-art {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 320px;
  margin-left: auto;
}
body.nf-acuity-page .hero-band .acuity-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Section frames matching the hub --------------------------------- */
body.nf-acuity-page .nf-frame {
  background: var(--nf-card-soft, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--nf-border, rgba(255, 255, 255, 0.16));
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: var(--nf-shadow, 0 6px 24px rgba(0, 0, 0, 0.22));
  margin-bottom: 16px;
}
body.nf-acuity-page .nf-frame h2 {
  margin-top: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: #f3f7ff;
}
body.nf-acuity-page .nf-frame h3 {
  font-size: 17px;
  color: #e7ecfa;
  margin: 18px 0 6px;
}
body.nf-acuity-page .nf-frame p {
  color: rgba(225, 232, 248, 0.92);
  line-height: 1.55;
  max-width: 78ch;
}
body.nf-acuity-page .nf-frame ul {
  color: rgba(225, 232, 248, 0.92);
  line-height: 1.55;
  padding-left: 20px;
}

/* --- Stat strip (hero supporting numbers) ---------------------------- */
.acuity-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 14px 0 0;
}
@media (max-width: 720px) {
  .acuity-stat-strip { grid-template-columns: repeat(2, 1fr); }
}
.acuity-stat-strip .stat {
  background: rgba(0, 168, 150, 0.10);
  border: 1px solid rgba(0, 168, 150, 0.40);
  border-radius: 12px;
  padding: 12px 14px;
}
.acuity-stat-strip .stat .stat-num {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: #5ee7d5;
  letter-spacing: -0.01em;
  line-height: 1.05;
}
.acuity-stat-strip .stat .stat-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(223, 233, 255, 0.78);
  margin-top: 4px;
}

/* --- The data table -------------------------------------------------- */
.acuity-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--nf-border, rgba(255, 255, 255, 0.14));
  background: rgba(12, 18, 36, 0.38);
}
.acuity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.acuity-table thead th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #14213a 0%, #0e1830 100%);
  color: #f3f7ff;
  text-align: left;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 2px solid rgba(0, 168, 150, 0.55);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.acuity-table thead th[data-sort] {
  cursor: pointer;
  user-select: none;
}
.acuity-table thead th[data-sort]:hover {
  color: #5ee7d5;
}
.acuity-table thead th[data-sort]::after {
  content: " ↕";
  opacity: 0.45;
  font-size: 11px;
}
.acuity-table thead th[data-sort][aria-sort="ascending"]::after {
  content: " ↑";
  opacity: 1;
  color: #5ee7d5;
}
.acuity-table thead th[data-sort][aria-sort="descending"]::after {
  content: " ↓";
  opacity: 1;
  color: #5ee7d5;
}
.acuity-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(232, 238, 255, 0.92);
  vertical-align: middle;
}
.acuity-table tbody tr:hover {
  background: rgba(0, 168, 150, 0.05);
}
.acuity-table tbody tr:last-child td {
  border-bottom: none;
}
.acuity-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.acuity-table .center-name {
  font-weight: 600;
  color: #f6f7ff;
  min-width: 240px;
}
.acuity-table .state-cell {
  color: rgba(223, 233, 255, 0.78);
  font-size: 13px;
  font-weight: 600;
}
.acuity-table .wait-cell {
  font-variant-numeric: tabular-nums;
}
.acuity-table .wait-cell.wait-fast { color: #5ee7d5; font-weight: 600; }
.acuity-table .wait-cell.wait-slow { color: #ffb88a; font-weight: 600; }

/* --- Color-graded donor-count cells --------------------------------- */
.acuity-table .donors-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.acuity-table .donors-cell.tier-0 { color: rgba(232, 238, 255, 0.55); }    /* < 10 */
.acuity-table .donors-cell.tier-1 { color: rgba(232, 238, 255, 0.82); }    /* 10-49 */
.acuity-table .donors-cell.tier-2 { color: #b6e6dd; }                       /* 50-99 */
.acuity-table .donors-cell.tier-3 { color: #5ee7d5; }                       /* 100-199 */
.acuity-table .donors-cell.tier-4 { color: #fde79e; font-weight: 700; }     /* 200+ */
.acuity-table .donors-cell.tier-5 { color: #ffc66b; font-weight: 800; }     /* 500+ */

/* --- Table controls -------------------------------------------------- */
.acuity-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin: 8px 0 14px;
  font-size: 13px;
  color: rgba(225, 232, 248, 0.86);
}
.acuity-controls input[type="search"] {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 8px 12px;
  color: #f3f7ff;
  font-size: 14px;
  min-width: 220px;
}
.acuity-controls input[type="search"]::placeholder {
  color: rgba(223, 233, 255, 0.55);
}
.acuity-controls select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 8px 10px;
  color: #f3f7ff;
  font-size: 14px;
}
.acuity-controls .row-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: rgba(223, 233, 255, 0.72);
  font-size: 12px;
}

/* --- Topography stacked bar (page 2) -------------------------------- */
.terrain-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
}
.terrain-bar .seg {
  height: 100%;
  transition: filter 0.15s ease;
}
.terrain-bar .seg:hover { filter: brightness(1.2); }
/* Weather-terrain palette: cold valleys (low MMAT, easier offers)
   warm peaks (high MMAT, only sickest reached transplant).            */
.terrain-bar .seg.deep_valley { background: #2a9df4; }   /* ice-blue valley floor */
.terrain-bar .seg.valley      { background: #6cc1f0; }   /* cool valley            */
.terrain-bar .seg.plain       { background: #b8c9d4; }   /* neutral plain          */
.terrain-bar .seg.ridge       { background: #ffb84d; }   /* warm ridge             */
.terrain-bar .seg.peak        { background: #e85a3a; }   /* hot peak               */

.terrain-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 12px;
  color: rgba(225, 232, 248, 0.86);
  margin: 10px 0 14px;
}
.terrain-legend .swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.terrain-legend .swatch.deep_valley { background: #2a9df4; }
.terrain-legend .swatch.valley      { background: #6cc1f0; }
.terrain-legend .swatch.plain       { background: #b8c9d4; }
.terrain-legend .swatch.ridge       { background: #ffb84d; }
.terrain-legend .swatch.peak        { background: #e85a3a; }

.terrain-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
}
.terrain-bar-wrap .band-label {
  font-size: 11px;
  color: rgba(223, 233, 255, 0.72);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.terrain-cell {
  min-width: 280px;
}
.terrain-cell .terrain-bar-wrap + .terrain-bar-wrap { margin-top: 6px; }
.terrain-cell .donor-n {
  font-size: 11px;
  color: rgba(223, 233, 255, 0.65);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

/* --- About this content (matches clinical pages pattern) ------------ */
body.nf-acuity-page .nf-about-content {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(17, 25, 45, 0.55);
}
body.nf-acuity-page .nf-about-content summary {
  cursor: pointer;
  font-weight: 600;
  color: #e7ecfa;
}
body.nf-acuity-page .nf-about-content p {
  color: rgba(225, 232, 248, 0.86);
  font-size: 14px;
}

/* --- "Read on the hub" cross-link bar -------------------------------- */
.acuity-related {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}
@media (max-width: 880px) {
  .acuity-related { grid-template-columns: 1fr; }
}
.acuity-related a {
  display: block;
  padding: 14px 16px;
  background: rgba(0, 168, 150, 0.08);
  border: 1px solid rgba(0, 168, 150, 0.32);
  border-radius: 12px;
  color: #f3f7ff;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.acuity-related a:hover {
  background: rgba(0, 168, 150, 0.16);
  border-color: rgba(0, 168, 150, 0.55);
  transform: translateY(-1px);
}
.acuity-related a strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}
.acuity-related a span {
  display: block;
  font-size: 13px;
  color: rgba(223, 233, 255, 0.78);
  line-height: 1.4;
}

/* --- Per-band acuity ring SVG decoration in hero ---------------------- */
.acuity-rings {
  width: 100%;
  height: 100%;
}

/* --- Disclaimer foot ------------------------------------------------- */
.acuity-disclaimer {
  margin-top: 16px;
  font-size: 13px;
  color: rgba(223, 233, 255, 0.65);
  text-align: center;
  line-height: 1.5;
}
.acuity-disclaimer strong { color: rgba(223, 233, 255, 0.86); }
