/* =========================================================================
   INSIGHTS PAGE: full-viewport view over the map, styled to stevenstills.com.
   White page, Poppins, grey 24px panels with no border, lime buttons, mint
   data marks, deep teal numerals. Alert red marks stress only.
   ========================================================================= */

/* ---- entry points on the map ---- */
.insights-banner {
  display: block;
  width: calc(100% - 20px);
  margin: 0 10px 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--so-night);
  background: var(--so-electric);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.insights-banner::after { content: " \2197"; }
.insights-banner:hover { filter: brightness(1.06); }

.hl-head-tools { display: flex; align-items: center; gap: 10px; }
.feed-expand {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  font-size: 13px; line-height: 1;
  color: var(--panel-fg); background: var(--panel-hover);
  border: 1px solid var(--panel-border); border-radius: 7px;
}
.feed-expand:hover { color: var(--accent); }

/* ---- the sliding page ---- */
#insightsPage {
  --ins-ink: #29494F;       /* night: headings and body */
  --ins-deep: #183036;      /* midnight: numerals       */
  --ins-muted: #6F8488;     /* dusk: labels             */
  --ins-rule: rgba(41, 73, 79, 0.14);
  --ins-paper: #FFFFFF;
  --ins-mist: #F1F2F1;      /* panel fill               */
  --ins-accent: #E1FE73;    /* lime: buttons            */
  --ins-signal: #FF646D;    /* alert: stress only       */
  --ins-r: 24px;
  position: fixed; inset: 0; z-index: 2000;
  background: var(--ins-paper); color: var(--ins-ink);
  transform: translateX(100%);
  /* visibility is discrete, so it holds until the slide-out ends */
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s;
  visibility: hidden;
  font-family: "Poppins", "Helvetica Neue", Arial, system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
#insightsPage.open { transform: translateX(0); visibility: visible; }
@media (prefers-reduced-motion: reduce) {
  #insightsPage { transition: none; }
}

/* inner scroller keeps the back button fixed on screen */
#insightsScroll {
  height: 100%; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--ins-rule) transparent;
}
#insightsScroll::-webkit-scrollbar { width: 9px; }
#insightsScroll::-webkit-scrollbar-thumb { background: var(--ins-rule); border-radius: 9px; }

/* pill buttons, as on the site */
#insightsBack, .ins-jump {
  padding: 11px 24px; border: none; border-radius: 999px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--ins-ink); cursor: pointer;
}
#insightsBack { position: absolute; top: 18px; left: 20px; z-index: 10; background: var(--ins-mist); }
.ins-jump { margin-top: 1.4rem; background: var(--ins-accent); }
#insightsBack:hover, .ins-jump:hover { opacity: 0.88; }

.ins-wrap {
  max-width: 76rem; margin: 0 auto;
  padding: 84px clamp(16px, 4vw, 32px) 48px;
}

/* ---- shared type ---- */
.ins-kicker { font-size: 0.9375rem; font-weight: 500; color: var(--ins-muted); margin: 0 0 14px; }
.ins-masthead h1 {
  font-weight: 700; font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.1;
  letter-spacing: -0.02em; margin: 0;
}
.ins-lede { font-size: clamp(1.05rem, 2.2vw, 1.25rem); line-height: 1.7; letter-spacing: -0.01em; margin: 18px 0 0; }
.ins-standfirst { font-size: 1rem; font-weight: 600; line-height: 1.5; margin: 0.9rem 0 0; }
.ins-section { margin-top: 20px; }
/* panel header: title left, unit right, one hairline under it */
.ins-label, .ins-box h2 {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 15px; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--ins-ink);
  padding-bottom: 13px; border-bottom: 1px solid var(--ins-rule); margin: 0 0 18px;
}
.ins-unit { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--ins-muted); }
.ins-foot a { color: var(--ins-ink); }

/* ---- panels ---- */
.ins-box { background: var(--ins-mist); border-radius: var(--ins-r); padding: 20px 24px; }

/* ---- closure counter ---- */
.ins-counter-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ins-pill {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--ins-signal); color: var(--ins-deep);
}
.ins-pill.open-state { background: var(--ins-accent); }
.ins-counter-caption { font-size: 13px; font-weight: 500; color: var(--ins-muted); }
.ins-counter {
  display: flex; align-items: baseline; gap: clamp(10px, 3vw, 26px);
  margin-top: 0.9rem; flex-wrap: wrap;
}
.ins-count-seg { display: flex; flex-direction: column; }
.ins-count-num {
  font-weight: 600; font-size: clamp(2.4rem, 7vw, 4rem); line-height: 1;
  letter-spacing: -0.02em; color: var(--ins-deep);
}
.ins-count-unit { margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--ins-muted); }
.ins-count-sep { font-size: clamp(1.8rem, 5vw, 3rem); color: var(--ins-rule); }

/* ---- kpi cards: white tiles inside the grey panel ---- */
.ins-kpis, .ins-impact-head {
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.ins-kpi {
  background: var(--ins-paper); border: none; border-radius: 18px;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.ins-kpi-label { font-size: 13px; font-weight: 500; color: var(--ins-muted); }
.ins-kpi-value {
  font-weight: 600; font-size: 1.7rem; line-height: 1.1;
  letter-spacing: -0.02em; color: var(--ins-deep);
}
.ins-kpi-value .ins-red { color: var(--ins-signal); }
.ins-kpi-sub { font-size: 0.78rem; line-height: 1.4; color: var(--ins-muted); }
.ins-kpi-spark { margin-top: 6px; align-self: stretch; }
.ins-kpi-spark svg { display: block; width: 100%; height: 34px; }
.ins-kpi.wide { grid-column: span 2; }
@media (max-width: 560px) {
  .ins-kpis, .ins-impact-head { gap: 10px; }
  .ins-kpi { padding: 12px 12px; }
  .ins-kpi-value { font-size: 1.4rem; }
  .ins-kpi.wide { grid-column: span 2; }
}

/* the headline card doubles as a link down to the feeds */
.ins-kpi.headline { cursor: pointer; font-family: inherit; text-align: left; }
.ins-kpi.headline:hover { opacity: 0.88; }
.ins-kpi-headline { font-size: 0.92rem; font-weight: 600; line-height: 1.35; color: var(--ins-ink); }

/* ---- charts ---- */
.ins-chart svg { width: 100%; height: auto; display: block; }
.ins-chart-empty { padding: 30px 0; text-align: center; color: var(--ins-muted); font-size: 0.85rem; }

/* ---- incidents ---- */
.ins-tallies {
  display: grid; gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.ins-tally {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--ins-paper); border-radius: 18px; padding: 14px 16px;
}
.ins-tally-num { font-weight: 600; font-size: 1.6rem; letter-spacing: -0.02em; color: var(--ins-deep); }
.ins-tally-num.ins-red { color: var(--ins-signal); }
.ins-tally-label { font-size: 13px; font-weight: 500; color: var(--ins-muted); }

.ins-incident-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ins-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--ins-paper); color: var(--ins-muted); border: none;
}
.ins-badge.attack, .ins-badge.sunk, .ins-badge.critical { color: var(--ins-signal); }
.ins-badge.seizure, .ins-badge.high { color: var(--ins-ink); }
.ins-badge.held { background: var(--ins-signal); color: var(--ins-deep); }
.ins-flag { font-weight: 400; color: var(--ins-muted); font-size: 0.85rem; }
.ins-incident-cas { font-size: 0.8rem; font-weight: 600; color: var(--ins-signal); margin: 5px 0 0; }

/* ---- impact ---- */
.ins-impact-block { margin-top: 20px; }
.ins-regions {
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.ins-region {
  background: var(--ins-paper); border-radius: 18px; padding: 14px 16px;
  display: flex; flex-direction: column;
}
.ins-region-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.ins-region-name { font-weight: 600; font-size: 0.95rem; }
.ins-region-dep { font-size: 0.78rem; color: var(--ins-muted); margin: 4px 0 6px; }
.ins-region-desc { font-size: 0.82rem; line-height: 1.5; margin: 0; }
.ins-notes {
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 760px) { .ins-notes { grid-template-columns: minmax(0, 1fr); } }
.ins-note {
  background: var(--ins-paper); border-radius: 18px; padding: 14px 16px;
  font-size: 0.9rem; line-height: 1.6;
}

/* ---- feed columns: incidents, news, truth social ---- */
.ins-news-cols {
  display: grid; gap: 20px; margin-top: 20px; align-items: start;
  /* minmax(0) stops long content widening a track */
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ins-news-col { min-width: 0; height: 640px; display: flex; flex-direction: column; }
.ins-news-col > div { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--ins-rule) transparent; }
.ins-news-col h2 { margin-bottom: 0; }
.ins-news-col .ins-news-item:first-of-type { border-top: none; }
.ins-news-item, .ins-news-desc { overflow-wrap: anywhere; }
.ins-truth-text { -webkit-line-clamp: 5; }
.ins-news-item { display: block; padding: 11px 2px; border-top: 1px solid var(--ins-rule); text-decoration: none; color: var(--ins-ink); }
.ins-news-item:hover .ins-news-title { text-decoration: underline; text-underline-offset: 3px; }
.ins-news-src { font-size: 12px; font-weight: 500; color: var(--ins-muted); }
.ins-news-item.primary .ins-news-src { color: var(--ins-ink); font-weight: 600; }
.ins-news-title { font-size: 0.92rem; font-weight: 600; line-height: 1.35; margin-top: 2px; }
.ins-news-desc {
  font-size: 0.8rem; line-height: 1.45; color: var(--ins-muted); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.ins-news-time { font-size: 11px; color: var(--ins-muted); margin-top: 4px; }
.ins-news-empty { padding: 10px 0; font-size: 0.85rem; color: var(--ins-muted); }

/* ---- footer ---- */
.ins-foot {
  margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--ins-rule);
  display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: space-between;
  font-size: 0.86rem; color: var(--ins-muted);
}

/* ---- narrower screens, last so they beat the base grids above ---- */
@media (max-width: 900px) {
  .ins-kpis, .ins-impact-head, .ins-regions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ins-tallies { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ins-news-cols { grid-template-columns: minmax(0, 1fr); }
  .ins-news-col { height: 480px; }
}
@media (max-width: 560px) {
  .ins-tallies { gap: 10px; }
  .ins-tally { padding: 12px 10px; }
  .ins-tally-num { font-size: 1.35rem; }
  .ins-box { padding: 16px; }
  .ins-regions { grid-template-columns: minmax(0, 1fr); }
  .ins-wrap { padding-top: 72px; }
}
