/* Radar page layout
 *
 * The status radar is the longest page on the site and its only long page
 * without a table of contents. This file holds what was added to fix that: the
 * overview panel and section jump bar that fill the first screen, the bounded
 * scrolling matrix table, and the changelog density strip with its month
 * archive.
 *
 * It is loaded by /tools/status-radar/ alone. The shared furniture it sits on
 * top of - lifecycle bar, alert banner, changelog timeline - is in
 * /status-radar.css, which the 135 card pages load too and which must not carry
 * rules they can never match.
 */

/* ---------------------------------------------------------------------------
   Radar overview panel

   Replaces the five KPI boxes that used to open the page. Those answered
   "how many cards are in each stage" and nothing else; this panel answers the
   same question with the same five numbers, plus how many alerts and changelog
   entries are waiting below, and every figure is a jump link that pre-selects
   the filter it counts. It is the first thing under the headline, so the page
   says what it contains before the reader starts scrolling.
   --------------------------------------------------------------------------- */
.radar-overview {
  margin: 0 0 16px;
  padding: 16px 18px 14px;
  border: 1px solid #cfe0cd;
  border-radius: 10px;
  background: linear-gradient(180deg, #f4f8f4 0%, #eef5ee 100%);
}

.radar-overview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.radar-overview-head h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--deep);
}

.radar-overview-icon {
  font-size: 15px;
}

.radar-overview-baseline {
  font-size: 12.5px;
  color: var(--muted);
}

.radar-overview-baseline time {
  font-family: monospace;
}

.radar-overview-stages {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.radar-stage-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon label" "icon count";
  align-items: center;
  column-gap: 8px;
  min-height: 46px;
  padding: 7px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
}

.radar-stage-link:hover {
  border-color: #8fae86;
  background: #fbfdfa;
}

.radar-stage-icon {
  grid-area: icon;
  font-size: 15px;
  line-height: 1;
}

.radar-stage-label {
  grid-area: label;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--muted);
}

.radar-stage-count {
  grid-area: count;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15;
}

.radar-stage-link.stage-active .radar-stage-count { color: #0d632f; }
.radar-stage-link.stage-degraded .radar-stage-count { color: #b45309; }
.radar-stage-link.stage-paused .radar-stage-count { color: #1d4ed8; }
.radar-stage-link.stage-winddown .radar-stage-count { color: #c2410c; }
.radar-stage-link.stage-closed .radar-stage-count { color: #b91c1c; }

.radar-overview-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.radar-overview-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  text-decoration: none;
}

.radar-overview-link:hover {
  border-color: #8fae86;
}

.radar-overview-link strong {
  font-size: 17px;
  font-weight: 800;
}

.radar-overview-link-unit {
  color: var(--muted);
}

.radar-overview-link-go {
  margin-left: auto;
  color: var(--muted);
}

.radar-overview-link.is-alert {
  background: #fff8f8;
  border-color: #f0c4c4;
}

.radar-overview-link.is-alert strong {
  color: #b91c1c;
}

/* ---------------------------------------------------------------------------
   Section jump bar

   position: sticky against the viewport, which works because the site header
   is not itself sticky. z-index stays under the push prompt bar (60) so the
   notification prompt is never covered.
   --------------------------------------------------------------------------- */
.radar-jump {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  padding: 6px 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.radar-jump.is-stuck {
  box-shadow: 0 8px 14px -10px rgba(20, 44, 41, 0.45);
}

.radar-jump ul {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.radar-jump ul::-webkit-scrollbar {
  display: none;
}

.radar-jump a {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid #cbd8c4;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.radar-jump a:hover {
  border-color: #38704c;
  background: #edf4eb;
  color: var(--ink);
}

.radar-jump a.is-current {
  background: var(--deep);
  border-color: var(--deep);
  color: #fff;
}

.radar-top-link {
  flex: 0 0 auto;
  margin-left: auto;
}

/* Anchor targets clear the sticky bar instead of landing underneath it. */
#radar-overview,
#radar-freshness,
#radar-alerts,
#radar-matrix,
#radar-feed,
#radar-recent,
#questions,
.radar-feed-month {
  scroll-margin-top: 62px;
}
/* ---------------------------------------------------------------------------
   Section headings

   These three sections used to carry their typography in inline style
   attributes, which outrank every stylesheet rule and had to be repeated on
   each element. They are plain classes now.
   --------------------------------------------------------------------------- */
.radar-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
}

.radar-section-icon {
  font-size: 17px;
}

.radar-section-note {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.radar-section-sub {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Alerts
   --------------------------------------------------------------------------- */
.radar-alert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

/* The banner keeps a margin for standalone use, but inside the grid the gap
   already separates them. */
.radar-alert-grid .radar-alert-banner {
  margin: 0;
}

.radar-alert-card-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------------------
   Card status matrix

   The table is 135 rows deep. It used to run the full length of the page with
   its header scrolling away at row 3, and every cell carried its own inline
   padding. It is a bounded scroll box now, so the header stays pinned, and the
   long prose columns clamp to two lines. The full text is still in the markup
   for crawlers and for the reader who follows the card link; the clamp is
   presentation only, deliberately applied without a title attribute, because a
   per-row tooltip would add 135 untranslated strings to the localisation
   dictionary.
   --------------------------------------------------------------------------- */
.radar-matrix-section {
  margin: 36px 0;
}

.radar-matrix-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  margin: 14px 0 10px;
}

.radar-field {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 340px;
}

.radar-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.radar-field input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #c7d2c5;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}

.radar-pill-row {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 7px;
}

.radar-pill-row .hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.radar-pill-row .hero-pill strong {
  font-weight: 800;
}

.radar-matrix-count {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.radar-matrix-count strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.radar-matrix-wrap {
  margin: 0 0 10px;
  max-height: min(72vh, 880px);
  overflow: auto;
}

.radar-matrix-table {
  width: 100%;
  border-collapse: collapse;
}

/* Sticky needs the background on the th itself: the row carries none. */
.radar-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 12px;
  background: #f4f7f4;
  border-bottom: 2px solid #dce5da;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--deep);
  text-align: left;
  white-space: nowrap;
}

.radar-matrix-table tbody th,
.radar-matrix-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}

.radar-matrix-table tbody tr:last-child th,
.radar-matrix-table tbody tr:last-child td {
  border-bottom: 0;
}

.radar-matrix-table tbody tr:hover {
  background: #fbfdfa;
}

.radar-matrix-table tbody tr[hidden] {
  display: none;
}

.radar-cell-name {
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.radar-cell-name a {
  color: #2b5536;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.radar-cell-stage,
.radar-cell-link {
  white-space: nowrap;
}

.radar-cell-date {
  font-family: monospace;
  font-size: 12.5px;
  white-space: nowrap;
}

.radar-cell-network,
.radar-cell-model {
  min-width: 150px;
}

.radar-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.radar-matrix-noscript {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Changelog: density strip, opening block, month archive

   264 entries at roughly 128px each ran 33,900px down the page. The newest 24
   are laid out in the open and the remaining 240 sit behind one <details> per
   month. The split is made at build time, not by script, so the collapsed
   state is the state that ships: nothing has to run before the page settles
   and every entry is still in the served HTML.
   --------------------------------------------------------------------------- */
.radar-feed-section {
  margin: 40px 0;
}

.radar-feed-count {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.radar-feed-count strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.radar-feed-density {
  margin: 16px 0 22px;
  padding: 12px 14px 10px;
  border: 1px solid #dce5da;
  border-radius: 8px;
  background: #f7faf6;
}

.radar-feed-density-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.radar-feed-density-range {
  font-family: monospace;
}

.radar-feed-bars {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 92px;
}

/* The column is the link; the bar is painted by ::after. Sizing the link to the
   full strip rather than to the bar keeps a short month (a single entry is 9px
   tall) from becoming a 9px tap target, while the drawn bar still scales with
   the count. */
.radar-feed-bar {
  position: relative;
  display: flex;
  flex: 1 1 0;
  align-items: flex-end;
  justify-content: center;
  min-width: 9px;
  height: 100%;
}

.radar-feed-bar::after {
  content: "";
  width: 100%;
  height: var(--bar-height, 10%);
  background: #b7ceba;
  border-radius: 3px 3px 0 0;
}

.radar-feed-bar:hover::after {
  background: #38704c;
}

.radar-feed-bar-count {
  position: absolute;
  bottom: var(--bar-height, 10%);
  left: 50%;
  transform: translateX(-50%);
  padding-bottom: 3px;
  font-size: 10.5px;
  line-height: 1;
  color: #4b6b53;
}

.radar-feed-subhead {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin: 22px 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--deep);
}

.radar-feed-subhead strong {
  font-size: 17px;
  font-weight: 800;
}

.radar-feed-subhead-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.radar-feed-subhead-archive {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* Scheduled block: deadlines that are announced but have not arrived. Tinted
   rather than merely labelled, because the entries are visually identical to
   the "recent updates" below and a reader scanning dates would otherwise take
   a 2027 shutdown for something that already happened. */
.radar-feed-subhead-scheduled {
  color: #7a4a12;
}

.radar-feed-scheduled-note {
  margin: -4px 0 12px;
  padding: 9px 12px;
  border-left: 3px solid #d8a24a;
  border-radius: 0 6px 6px 0;
  background: #fdf7ec;
  font-size: 12.5px;
  line-height: 1.65;
  color: #6b5233;
}

.changelog-timeline-scheduled .changelog-item {
  background: #fdfaf3;
}

.radar-feed-archive {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radar-feed-month {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
}

.radar-feed-month > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--deep);
}

.radar-feed-month > summary::-webkit-details-marker {
  display: none;
}

.radar-feed-month > summary::before {
  content: "\25B8";
  font-size: 11px;
  color: #6b7d70;
}

.radar-feed-month[open] > summary::before {
  content: "\25BE";
}

.radar-feed-month-label {
  font-family: monospace;
}

.radar-feed-month-count {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.radar-feed-month-count strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.radar-feed-month > .changelog-timeline {
  padding: 6px 16px 16px 22px;
}

/* The card link lost its inline font-size when the table markup moved to
   classes. */
.changelog-card {
  font-size: 13px;
  font-weight: 700;
  color: #285741;
}

/* ---------------------------------------------------------------------------
   FAQ and cross navigation
   --------------------------------------------------------------------------- */
.radar-faq-section {
  margin: 36px 0;
}

.radar-faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.radar-faq-list .faq-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.radar-faq-list .faq-item h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.radar-faq-list .faq-item p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.radar-cross-nav {
  margin: 28px 0;
  padding: 20px;
  border: 1px solid #d8e5d6;
  border-radius: 8px;
  background: #f7faf7;
  text-align: center;
}

.radar-cross-nav strong {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.radar-cross-nav p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.radar-feed-month,
.radar-faq-list .faq-item {
  content-visibility: auto;
  contain-intrinsic-size: auto 72px;
}

@media (max-width: 900px) {
  .radar-overview-stages {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 740px) {
  .radar-overview {
    padding: 14px 14px 12px;
  }

  /* Five tiles across leaves a 2+2+1 orphan row; three across wraps evenly. */
  .radar-overview-stages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .radar-overview-links {
    grid-template-columns: 1fr;
  }

  .radar-jump {
    gap: 8px;
  }

  /* Below the desktop breakpoint the table scrolls in both directions, so the
     bounded box would trap the reader in a pane inside a pane. */
  .radar-matrix-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
  }

  .radar-matrix-controls {
    align-items: stretch;
  }

  .radar-field {
    max-width: none;
  }

  .radar-feed-bars {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .radar-feed-bar {
    flex: 0 0 34px;
    min-width: 34px;
  }

  .radar-feed-bar-count {
    font-size: 13px;
  }

  .radar-feed-month > summary {
    font-size: 13px;
  }

  .radar-feed-month > .changelog-timeline {
    padding: 6px 12px 14px 20px;
  }

  /* 13px floor for labels that carry information, matching the rest of the
     site below 740px. Everything left in this list is scoped to the radar
     page; the three selectors that also match card pages are lifted in
     status-radar.css instead. */
  .radar-stage-label,
  .radar-section-note,
  .radar-field label,
  .radar-matrix-count,
  .radar-matrix-count-unit,
  .radar-feed-density-head,
  .radar-feed-month-unit,
  .radar-feed-month-count,
  .radar-matrix-table thead th,
  .radar-matrix-table tbody th,
  .radar-matrix-table tbody td,
  .radar-cell-date,
  .radar-overview-baseline,
  .radar-overview-baseline time,
  .radar-pill-row .hero-pill,
  .radar-freshness-card .metric-label,
  .radar-freshness-card .metric-sub,
  .radar-freshness-badge span {
    font-size: 13px;
  }
}


/* --- Radar Page Dark Mode Overrides --- */
html[data-theme="dark"] .radar-overview {
  background: linear-gradient(180deg, #13221d 0%, #172822 100%);
  border-color: #243d33;
}
html[data-theme="dark"] .radar-stage-link,
html[data-theme="dark"] .radar-overview-link,
html[data-theme="dark"] .radar-jump a,
html[data-theme="dark"] .radar-faq-list .faq-item,
html[data-theme="dark"] .radar-filter-input {
  background: var(--card) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}
html[data-theme="dark"] .radar-stage-link:hover {
  background: var(--subtle) !important;
  border-color: var(--green) !important;
}
html[data-theme="dark"] .radar-matrix-table thead th,
html[data-theme="dark"] .radar-feed-density,
html[data-theme="dark"] .radar-cross-nav,
html[data-theme="dark"] .radar-feed-month {
  background: var(--subtle) !important;
  border-color: var(--line) !important;
}
html[data-theme="dark"] .radar-matrix-table tbody tr:hover {
  background: rgba(196, 240, 107, 0.05);
}
html[data-theme="dark"] .changelog-timeline-scheduled .changelog-item {
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.25) !important;
}
html[data-theme="dark"] .radar-feed-bar-count,
html[data-theme="dark"] .radar-feed-density-head {
  color: var(--muted) !important;
}
html[data-theme="dark"] .radar-feed-scheduled-note {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
}
html[data-theme="dark"] .radar-stage-link.stage-active .radar-stage-count { color: var(--c-grn) !important; }
html[data-theme="dark"] .radar-stage-link.stage-degraded .radar-stage-count { color: var(--c-amb) !important; }
html[data-theme="dark"] .radar-stage-link.stage-paused .radar-stage-count { color: var(--c-blu) !important; }
html[data-theme="dark"] .radar-stage-link.stage-winddown .radar-stage-count { color: var(--c-amb) !important; }
html[data-theme="dark"] .radar-stage-link.stage-closed .radar-stage-count { color: var(--c-red) !important; }
html[data-theme="dark"] .radar-overview-link.is-alert strong { color: var(--c-red) !important; }
html[data-theme="dark"] .radar-feed-subhead.radar-feed-subhead-scheduled { color: var(--c-amb) !important; }
