/* ============================================================
   Ember Economics — Global Styles
   Color tokens, typography, layout, components
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Darkened blues — "darkness with the ember showing the light" */
  --blue-dark:   #0A1628;
  --blue-mid:    #1B4F8A;
  --blue-light:  #D6E8F7;
  --gray-light:  #EFF3F7;
  --gray-mid:    #6C757D;
  --gray-border: #CDD5DE;
  --white:       #FFFFFF;
  --ember:       #F4511E;
  --ember-light: #FFF0EB;
  --ember-dark:  #C73D12;
  --text-dark:   #0D1F33;
  --text-body:   #3A4D5C;

  --font-body:    'Roboto', sans-serif;
  --font-heading: 'Roboto Slab', serif;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.13);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);

  --nav-height:  64px;
  --content-max: 1100px;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--gray-light);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-dark);
  line-height: 1.25;
}

a {
  color: var(--blue-mid);
  text-decoration: none;
}

a:hover { color: var(--ember); }

img, svg { display: block; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: var(--blue-dark);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}

/* Inline SVG ember logo */
.ember-logo {
  width: 36px;
  height: 43px;
  flex-shrink: 0;
  overflow: visible;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.brand-name span { color: var(--ember); }

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-links a {
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  letter-spacing: 0.02em;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--white);
  background: rgba(255,255,255,0.08);
}

.nav-links a.active { color: var(--ember); }

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  margin: 5px 0;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ── Page Wrapper ───────────────────────────────────────────── */
.page-content {
  margin-top: var(--nav-height);
  min-height: calc(100vh - var(--nav-height));
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(140deg, var(--blue-dark) 0%, #142947 100%);
  color: var(--white);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.hero-inner { max-width: 720px; margin: 0 auto; }

.hero h1 {
  color: var(--white);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 1rem;
}

.hero h1 em { color: var(--ember); font-style: normal; }

.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.82);
  margin-bottom: 0;
  line-height: 1.7;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }

.btn-ember {
  background: var(--ember);
  color: var(--white);
  border-color: var(--ember);
}

.btn-ember:hover {
  background: var(--ember-dark);
  border-color: var(--ember-dark);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--blue-mid);
  border-color: var(--blue-mid);
}

.btn-outline:hover {
  background: var(--blue-light);
  color: var(--blue-dark);
}

/* ── Section Layout ─────────────────────────────────────────── */
.section { padding: 2rem 1.5rem 0; }

.section-title {
  font-size: 1.6rem;
  margin-bottom: 1.25rem;
  color: var(--blue-dark);
}

.section-subtitle {
  color: var(--gray-mid);
  margin-bottom: 2.5rem;
  font-size: 1rem;
}

/* ── Featured Chart section (home page) ────────────────────── */
.featured-chart-section { padding-bottom: 2rem; }

.featured-chart-header {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.featured-chart-header .section-title { margin-bottom: 0; }

.featured-chart-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue-mid);
  text-decoration: none;
  white-space: nowrap;
}
.featured-chart-link:hover { color: var(--ember); text-decoration: underline; }

/* ── Home Page Cards ────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-border);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  background: var(--ember-light);
  border-color: var(--ember);
}

.card-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.card-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.card-icon.blue  { background: var(--blue-light); }
.card-icon.ember { background: var(--ember-light); }
.card-icon.gray  { background: var(--gray-light); }

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 0;
  color: var(--blue-dark);
}

.card p {
  color: var(--gray-mid);
  font-size: 0.92rem;
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1.5rem;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--blue-mid);
  margin-top: auto;
}

.card-link:hover { color: var(--ember); }

.card.coming-soon { opacity: 0.7; cursor: default; }
.card.coming-soon:hover { transform: none; box-shadow: var(--shadow-md); }

.badge-soon {
  display: inline-block;
  background: var(--gray-light);
  color: var(--gray-mid);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ── Sticky controls wrapper (data-viz page) ────────────────── */
.data-controls-sticky {
  position: sticky;
  top: var(--nav-height);
  z-index: 90;
  background: var(--gray-light);
  padding: 0;
}

/* Border lives on the inner container so it never exceeds the content max-width */
.data-controls-sticky > .container {
  border-bottom: 1px solid var(--gray-border);
}

/* ── Shared visibility rules ─────────────────────────────────── */
/* Hide national-only row when state section is active */
.data-controls-sticky.state-active .national-only { display: none; }
/* Hide state-only row when national section is active */
.data-controls-sticky:not(.state-active) .state-only { display: none; }

/* Section content panels */
.section-panel { display: none; }
.section-panel.active { display: block; }

/* ── Shared nav pill base — used by all three rows ───────────── */
/* Every row is a flex strip of pill buttons.                     */
.section-nav,
.tabs-nav,
.horizon-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar,
.tabs-nav::-webkit-scrollbar { display: none; }

/* Row prefix labels — "Region:", "Category:", "Time Period:" */
.nav-row-label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-dark);
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: 0.1rem;
}

/* Shared pill button look — ALL options get a white bubble */
.section-btn,
.tab-btn,
.state-tab-btn,
.horizon-btn {
  background: var(--white);
  border: 1.5px solid var(--gray-border);
  border-radius: 999px;
  padding: 0.28rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}

/* Hover state */
.section-btn:hover:not(.active),
.tab-btn:hover:not(.active),
.state-tab-btn:hover:not(.active),
.horizon-btn:hover:not(.active) {
  border-color: var(--ember);
  box-shadow: 0 0 0 1px var(--ember);
}

/* Active state — orange pill */
.section-btn.active,
.tab-btn.active,
.state-tab-btn.active,
.horizon-btn.active {
  background: var(--ember);
  color: var(--white);
  border-color: var(--ember);
}

/* Subtle dividers between Region / Category / Time Period rows */
.tabs-nav,
.horizon-bar {
  border-top: 1px solid var(--gray-border);
}

/* Row 3: extra bottom padding above first chart */
.horizon-bar {
  padding-bottom: 0.5rem;
}

/* Horizon buttons flex container */
.horizon-buttons {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* ── State data tab panels ───────────────────────────────────── */
.state-tab-panel { display: none; }
.state-tab-panel.active { display: block; padding-top: 0.75rem; }

/* ── Tab panels (national) ───────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; padding-top: 0.75rem; }

/* ── Section for charts (reduced top padding) ───────────────── */
.section-charts {
  padding-top: 0.75rem;
}

/* ── Chart group heading (within a tab) ─────────────────────── */
.chart-group {
  margin-bottom: 1rem;
}

.chart-group-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.4rem 0;
  border-bottom: 2px solid var(--blue-light);
  margin-bottom: 1.5rem;
}

/* Two-column chart grid for component detail charts */
.charts-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .charts-two-col { grid-template-columns: 1fr; }
  .tab-btn,
  .state-tab-btn { padding: 0.25rem 0.7rem; font-size: 0.8rem; }
}

/* ── Chart Sections (data-viz page) ─────────────────────────── */
.chart-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-border);
  margin-bottom: 2rem;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.chart-header-left { flex: 1; }

.chart-header-left h2 {
  font-size: 1.1rem;
  color: var(--blue-dark);
  margin-bottom: 0.3rem;
}

/* Definition always visible under chart title */
.chart-definition {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.5;
  font-style: italic;
}

/* Seasonally adjusted badge + tooltip */
.chart-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--gray-mid);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.sa-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.sa-info-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue-mid);
  font-size: 0.8rem;
  padding: 0;
  line-height: 1;
  display: inline-flex;
}

.sa-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  /* Align left so tooltip stays within the card rather than spilling right */
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  max-width: min(240px, calc(100vw - 3rem));
  white-space: normal;
  background: var(--blue-dark);
  color: rgba(255,255,255,0.9);
  font-size: 0.78rem;
  line-height: 1.55;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  /* Stay within main content — clipped by nearest positioned ancestor */
  z-index: 200;
  pointer-events: none;
}

.sa-wrap:hover .sa-tooltip,
.sa-wrap:focus-within .sa-tooltip {
  display: block;
}

/* ── Latest observation badge (hidden — data shown in Quick Facts) */
.latest-badge { display: none; }


.chart-container {
  position: relative;
  height: 260px;
  margin-bottom: 0.75rem;
  /* allow Chart.js tooltip to overflow card boundary */
  overflow: visible;
}

/* Section divider inside Quick Facts panels (e.g. GDP component breakdown) */
.qf-section-divider {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-mid);
  margin: 0.55rem 0 0.15rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(0,0,0,0.08);
}

/* Source note below each chart */
.chart-source {
  font-size: 0.78rem;
  color: var(--gray-mid);
  margin-bottom: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-border);
}

.chart-source a {
  color: var(--blue-mid);
  font-weight: 500;
}

.chart-refreshed {
  display: block;
  color: var(--gray-mid);
  opacity: 0.75;
  margin-top: 0.2rem;
}

/* Series codes in explainer panes — use body font for visual consistency */
.explainer-body code {
  font-family: var(--font-body);
  font-size: inherit;
  background: none;
  padding: 0;
}

/* Expand/collapse explainer */
.explainer { margin-top: 0; }

.explainer-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.65rem 0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-mid);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  text-align: left;
}

.explainer-toggle:hover { color: var(--ember); }

.explainer-arrow {
  font-size: 0.7rem;
  transition: transform 0.25s ease;
  display: inline-block;
}

.explainer-toggle[aria-expanded="true"] .explainer-arrow {
  transform: rotate(90deg);
}

.explainer-body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.explainer-body.open {
  max-height: 3000px;   /* enough for 6 FAQs; transition still smooth */
  opacity: 1;
}

.explainer-body ul {
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.7;
  margin-bottom: 0.35rem;
}

.explainer-body ul li { margin-bottom: 0.35rem; }
.explainer-body ul ul { margin-top: 0.25rem; margin-bottom: 0.15rem; padding-left: 1rem; }
.explainer-body ul ul li { margin-bottom: 0.2rem; }

.explainer-body p {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.7;
  margin: 0 0 0.5rem;
}

/* Copy-data link inside More Context panes */
.copy-data-link {
  display: inline-block;
  margin: 6px 0 2px 1.2rem;
  font-size: 0.82rem;
  color: var(--blue-mid);
  text-decoration: underline;
  cursor: pointer;
  opacity: 0.75;
  transition: color 0.15s, opacity 0.15s;
}
.copy-data-link:hover { color: var(--ember); opacity: 1; }

/* Series metadata in explainer */
.series-meta {
  background: var(--gray-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--gray-mid);
  line-height: 1.8;
}

.series-meta a { color: var(--blue-mid); font-weight: 500; }

.series-meta strong {
  color: var(--text-dark);
  font-weight: 600;
}

/* ── Calendar Page ──────────────────────────────────────────── */
/* ── Calendar — two-week list view ──────────────────────────── */

.cal-stale-warn {
  font-size: 0.83rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1.25rem;
}

/* Filter nav */
.cal-filter-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.cal-filter-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-mid);
  margin-right: 0.15rem;
  white-space: nowrap;
}

.cal-filter-btn {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--gray-border);
  border-radius: 999px;
  background: var(--white);
  color: var(--gray-mid);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.cal-filter-btn:hover {
  background: var(--blue-light);
  border-color: var(--blue-mid);
  color: var(--blue-dark);
}

.cal-filter-btn.active {
  background: var(--blue-mid);
  border-color: var(--blue-mid);
  color: var(--white);
}

/* Colored topic filter buttons */
.cal-filter-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}

.cal-filter-btn--topic:hover {
  background: color-mix(in srgb, var(--filter-color) 12%, var(--white, #fff));
  border-color: var(--filter-color);
  color: var(--gray-dark);
}

.cal-filter-btn--topic.active {
  background: color-mix(in srgb, var(--filter-color) 20%, var(--white, #fff));
  border-color: var(--filter-color);
  color: var(--gray-dark);
}

/* Week sections */
.cal-week-section {
  margin-bottom: 2.25rem;
}

.cal-week-title {
  font-family: var(--font-slab);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.6rem;
}

.cal-week-range {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--gray-mid);
}

.cal-day-group {
  margin-bottom: 0.75rem;
}

.cal-day-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-mid);
  margin-bottom: 0.35rem;
}

/* Release list */
.cal-release-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--white);
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.cal-release-item {
  border-bottom: 1px solid var(--gray-border);
  transition: background 0.15s, box-shadow 0.15s;
}

.cal-release-item:last-child { border-bottom: none; }

.cal-release-item:hover {
  background: #E2E8EF;
}

.cal-release-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
  text-decoration: none;
  color: inherit;
}

.cal-release-link:focus-visible {
  outline: 2px solid var(--blue-mid);
  outline-offset: -2px;
}

.cal-release-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--blue-dark);
  font-weight: 500;
  line-height: 1.4;
}

.cal-release-agency {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--gray-mid);
}

.cal-release-note {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--gray-mid);
  margin-top: 0.1rem;
  font-style: italic;
}

.cal-release-description {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--gray-mid);
  margin-top: 0.25rem;
  line-height: 1.45;
}

.cal-release-tags {
  display: flex;
  flex-shrink: 0;
  gap: 0.3rem;
  align-items: center;
}

/* Topic tags */
.cal-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.cal-tag--employment      { background: #DBEAFE; color: #1e40af; }
.cal-tag--inflation       { background: #FEF3C7; color: #92400e; }
.cal-tag--gdp             { background: #EDE9FE; color: #5b21b6; }
.cal-tag--construction    { background: #D1FAE5; color: #065f46; }
.cal-tag--trade           { background: #CFFAFE; color: #155e75; }
.cal-tag--income          { background: #E0E7FF; color: #3730a3; }
.cal-tag--industry-sales  { background: #FFEDD5; color: #9a3412; }
.cal-tag--other           { background: #F3F4F6; color: #374151; }

.cal-source-note {
  font-size: 0.78rem;
  color: var(--gray-mid);
  opacity: 0.85;
  margin-top: 1.25rem;
  margin-bottom: 1rem;
}

.cal-empty {
  color: var(--gray-mid);
  font-size: 0.88rem;
  font-style: italic;
  padding: 0.5rem 0;
}

/* ── Section divider ────────────────────────────────────────── */
.cal-section-divider {
  border: none;
  border-top: 1px solid var(--gray-border);
  margin: 0.5rem 0 0.75rem;
}

/* ── View toggle (List / Calendar) ─────────────────────────── */
/* Sticky calendar controls bar (view toggle + filter) */
.cal-controls-sticky {
  position: sticky;
  top: var(--nav-height);
  z-index: 80;
  background: var(--gray-light);
  padding: 0.75rem 0 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-border);
}

.cal-view-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.cal-view-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-mid);
  margin-right: 0.15rem;
  white-space: nowrap;
}

.cal-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1.5px solid var(--gray-border);
  border-radius: 2rem;
  background: var(--white);
  color: var(--gray-mid);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1;
}

.cal-view-btn:hover {
  border-color: var(--blue-mid);
  color: var(--blue-mid);
}

.cal-view-btn.active {
  background: var(--blue-mid);
  border-color: var(--blue-mid);
  color: var(--white);
}

/* ── Calendar grid ──────────────────────────────────────────── */
#calendar-grid {
  margin-top: 1.25rem;
}

.cal-month-block {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-border);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem 1rem;
  margin-bottom: 1.5rem;
}

.cal-month-label {
  font-family: 'Roboto Slab', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.6rem;
}

.cal-grid-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.15rem;
}

.cal-grid-weekdays--weekdays {
  grid-template-columns: repeat(5, 1fr);
}

.cal-grid-weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-mid);
  padding: 0.2rem 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cal-grid-cells {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-grid-cells--weekdays {
  grid-template-columns: repeat(5, 1fr);
}

.cal-grid-cell {
  min-height: 60px;
  padding: 0.3rem 0.35rem 0.3rem;
  border-radius: 6px;
  background: var(--white);
  border: 1px solid var(--gray-border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: border-color 0.12s, background 0.12s;
  overflow: hidden;
}

.cal-grid-cell--empty {
  background: transparent;
  border-color: transparent;
}

.cal-grid-cell--past {
  background: var(--white);
}

.cal-grid-cell--past .cal-cell-day {
  color: #c0c4cc;
}

.cal-grid-cell--today {
  background: #EFF6FF;
  border-color: var(--blue-mid) !important;
}

.cal-grid-cell--has-release {
  cursor: pointer;
}

.cal-grid-cell--has-release:hover {
  border-color: var(--blue-mid);
  background: #F0F7FF;
}

.cal-grid-cell--has-release:focus-visible {
  outline: 2px solid var(--blue-mid);
  outline-offset: 1px;
}

.cal-grid-cell--selected {
  border-color: var(--ember) !important;
  background: #FFF5F0 !important;
}

/* Past cells with releases: show them but more muted */
.cal-grid-cell--past-release {
  cursor: pointer;
}

.cal-grid-cell--past-release:hover {
  border-color: #B0B8C1;
  background: #F2F4F6;
}

/* Cells whose dots are all filtered out */
.cal-grid-cell--no-match {
  cursor: default;
}

.cal-grid-cell--no-match:hover {
  border-color: transparent;
  background: var(--white);
}

.cal-cell-day {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue-dark);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.2rem;
}

.cal-today-marker {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue-mid);
  flex-shrink: 0;
}

.cal-cell-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-top: 2px;
}

/* Ensure hidden attribute overrides display:block on chip spans */
.cal-release-chip[hidden] { display: none !important; }

.cal-release-chip {
  display: block;
  padding: 2px 3px 2px 5px;
  border-left: 2px solid var(--chip-color, #CBD5E1);
  border-radius: 2px;
  background: color-mix(in srgb, var(--chip-color, #CBD5E1) 15%, white);
  overflow: hidden;
  color: var(--blue-dark);
  cursor: pointer;
  line-height: 1;
}

.cal-chip-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1.3;
}

.cal-chip-meta {
  display: block;
  font-size: 0.59rem;
  font-weight: 400;
  color: var(--gray-mid);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

/* ── Day panel modal ────────────────────────────────────────── */
.cal-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 47, 0.45);
  z-index: 200;
  cursor: pointer;
}

.cal-day-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  background: var(--white);
  border-left: 3px solid var(--ember);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem 1rem;
  width: min(90vw, 520px);
  max-height: 78vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}

.cal-day-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.cal-day-panel-date {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--blue-dark);
}

.cal-day-panel-close {
  background: none;
  border: none;
  color: var(--gray-mid);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.12s, background 0.12s;
}

.cal-day-panel-close:hover {
  color: var(--blue-dark);
  background: var(--gray-light);
}

/* ── Placeholder / Coming Soon ──────────────────────────────── */
.coming-soon-banner {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--gray-border);
  box-shadow: var(--shadow-sm);
}

.coming-soon-banner .icon { font-size: 3rem; margin-bottom: 1rem; }
.coming-soon-banner h2   { color: var(--blue-dark); font-size: 1.5rem; margin-bottom: 0.75rem; }
.coming-soon-banner p    { color: var(--gray-mid); max-width: 520px; margin: 0 auto 2rem; line-height: 1.7; }

.notify-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 420px;
  margin: 0 auto;
}

.notify-form input[type="email"] {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 1rem;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
}

.notify-form input[type="email"]:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(27,79,138,0.15);
}

/* ── Page Header (inner pages) ──────────────────────────────── */
.page-header {
  background: linear-gradient(140deg, var(--blue-dark) 0%, #142947 100%);
  color: var(--white);
  padding: 2.5rem 1.5rem;
}

.page-header h1 {
  color: var(--white);
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 0.4rem;
}

.page-header p { color: rgba(255,255,255,0.72); font-size: 0.95rem; }

/* ── Loading state ──────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 0.75rem;
  color: var(--gray-mid);
  font-size: 0.9rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-border);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Tooltips ───────────────────────────────────────────────── */
.tippy {
  position: relative;
  cursor: help;
  text-decoration: underline dotted var(--gray-mid);
  text-underline-offset: 3px;
  display: inline;
}

.tippy::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--blue-dark);
  color: var(--white);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-md);
  font-size: 0.76rem;
  font-weight: 400;
  font-family: var(--font-body);
  line-height: 1.5;
  width: 230px;
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
}

.tippy::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--blue-dark);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 9999;
}

.tippy:hover::after,
.tippy:hover::before { opacity: 1; }

/* Row-label variant: anchor to left edge */
.tippy-right::after {
  left: 0;
  transform: none;
}
.tippy-right::before {
  left: 0.75rem;
  transform: none;
}

/* Column-header variant: centered above */
.tippy-col::after {
  left: 50%;
  transform: translateX(-50%);
}
.tippy-col::before {
  left: 50%;
  transform: translateX(-50%);
}

/* ── Impact Calculator ──────────────────────────────────────── */
.calc-intro {
  font-size: 0.95rem;
  color: var(--text-body);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  text-align: justify;
}

.calc-card {
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.calc-card:hover {
  transform: none;
  box-shadow: var(--shadow-md);
  background: var(--white);
  border-color: var(--gray-border);
}

.calc-section-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.calc-sub-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue-mid);
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.calc-results-inner {
  margin-top: 0;
}

.calc-results-divider {
  border-top: 1px solid var(--gray-border);
  margin: 1.75rem -2rem;
}

.calc-card__title {
  font-size: 1.2rem;
  color: var(--blue-dark);
  margin-bottom: 0.5rem;
}

.calc-card__desc {
  font-size: 0.9rem;
  color: var(--gray-mid);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.calc-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.calc-field--action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.calc-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.calc-select,
.calc-input {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-dark);
  background: var(--white);
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.calc-select:focus,
.calc-input:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(27,79,138,0.15);
}

.calc-input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--gray-border);
  border-radius: var(--radius-md);
  background: var(--white);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.calc-input-group:focus-within {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(27,79,138,0.15);
}

.calc-input-prefix,
.calc-input-suffix {
  padding: 0 0.65rem;
  font-size: 0.9rem;
  color: var(--gray-mid);
  background: var(--gray-light);
  border: none;
  white-space: nowrap;
  line-height: 2.5rem;
}

.calc-input-prefix { border-right: 1px solid var(--gray-border); }
.calc-input-suffix { border-left:  1px solid var(--gray-border); }

.calc-unit-select {
  padding: 0 0.6rem;
  height: 100%;
  font-size: 0.88rem;
  color: var(--text-body);
  background: var(--gray-light);
  border: none;
  border-left: 1px solid var(--gray-border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  cursor: pointer;
  outline: none;
  font-family: var(--font-body);
  min-width: 90px;
}

.calc-input-group .calc-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
  min-width: 0;
}

.calc-input-group .calc-input:focus {
  border: none;
  box-shadow: none;
}

.calc-btn {
  white-space: nowrap;
}

.calc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.calc-error {
  font-size: 0.82rem;
  color: #C0392B;
  font-weight: 500;
  min-height: 1.2rem;
}

/* ── Results Panel ──────────────────────────────────────────── */
.calc-results__heading {
  font-size: 1.15rem;
  color: var(--blue-dark);
  margin-bottom: 0.5rem;
}

.calc-results__note {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 0.4rem;
}

.calc-results-meta {
  font-size: 0.88rem;
  color: var(--gray-mid);
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}
.calc-results-meta strong {
  color: var(--text-dark);
}

.calc-results__sub {
  font-size: 0.82rem;
  color: var(--gray-mid);
  margin-bottom: 1rem;
}

.calc-results__geo {
  font-size: 0.82rem;
  color: var(--gray-mid);
  font-style: italic;
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

.calc-mult-interp {
  font-size: 0.85rem;
  color: var(--text-body);
  background: var(--gray-light);
  border-left: 3px solid var(--blue-mid);
  padding: 0.55rem 0.85rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 0.75rem;
  line-height: 1.55;
}

.calc-detail-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 0.6rem;
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
}
.calc-detail-nav a {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  background: #2e6da4;
  border: 1px solid #25609a;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}
.calc-detail-nav a:hover {
  background: #1a3a5c;
}

.calc-table-wrap {
  overflow: visible;
  margin-bottom: 1.5rem;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}

.calc-table th,
.calc-table td {
  padding: 0.5rem 0.6rem;
  text-align: right;
  border-bottom: 1px solid var(--gray-border);
  overflow: visible;
}

.calc-table th:first-child,
.calc-table td:first-child {
  text-align: left;
  width: 23%;
}

.calc-table thead th {
  background: var(--blue-mid);
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: normal;
  line-height: 1.3;
  vertical-align: bottom;
  overflow: visible;
  position: relative;
}

/* Zebra striping — even rows get a light gray tint */
.calc-table tbody tr:nth-child(even) td {
  background: #f4f7fa;
}

.calc-table tbody tr:last-child td {
  border-bottom: none;
}

.calc-table tbody tr.total-row td {
  font-weight: 700;
  color: var(--blue-dark);
  background: #eaf0f7;
  border-top: 2px solid #b8cfe0;
}

.calc-table tbody tr:hover td {
  background: #dce8f3;
}

.total-col {
  font-weight: 700;
  color: var(--blue-dark);
}

.metric-label {
  color: var(--text-dark);
  font-weight: 500;
}

.calc-mult-heading {
  font-size: 1rem;
  color: var(--blue-dark);
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.calc-table--mult .mult-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gray-mid);
  margin-top: 0.15rem;
}

.calc-methodology {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-border);
  font-size: 0.8rem;
  color: var(--gray-mid);
  line-height: 1.6;
}

.calc-methodology a {
  color: var(--blue-mid);
}

.calc-methodology a:hover {
  color: var(--ember);
}

/* ── Detailed Results (expandable) ─────────────────────────── */
.calc-details {
  margin-top: 1.5rem;
  border: none;
  border-top: 1px solid var(--gray-border);
  border-radius: 0;
  overflow: visible;
  padding-top: 1rem;
}

.calc-details__summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.1rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue-mid);
  cursor: pointer;
  user-select: none;
  background: none;
  border-radius: 0;
  transition: color 0.15s;
}
.calc-details__summary::-webkit-details-marker { display: none; }
.calc-details__summary::before {
  content: '▶';
  font-size: 0.65rem;
  color: var(--blue-mid);
  transition: transform 0.2s;
  display: inline-block;
}
.calc-details[open] > .calc-details__summary::before {
  transform: rotate(90deg);
}
.calc-details__summary:hover { color: var(--blue-dark); background: none; }
.calc-details__summary:hover::before { color: var(--blue-dark); }

.calc-details__body {
  padding: 1.25rem 1.25rem 0.75rem;
  overflow: visible;
}

.calc-detail-heading {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--blue-dark);
  margin-top: 1.25rem;
  margin-bottom: 0.2rem;
  scroll-margin-top: calc(var(--nav-height) + 1rem);
}
.calc-detail-heading:first-child { margin-top: 0; }

/* Separator below each detail table section */
.calc-table-wrap:has(.calc-detail-table) {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #b8c8d8;
}

/* ── Sortable column headers ────────────────────────────────── */
.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable:hover { background: #2e5a8a; }

/* sort indicator rendered via ::after on the <th> itself */
.sortable::after {
  content: ' ⇅';
  font-size: 0.68em;
  color: rgba(255,255,255,0.5);
  margin-left: 0.2em;
}
.sort-asc::after  { content: ' ▲'; color: rgba(255,255,255,0.9); }
.sort-desc::after { content: ' ▼'; color: rgba(255,255,255,0.9); }

/* ── Responsive: calculator ─────────────────────────────────── */
@media (max-width: 640px) {
  .calc-form {
    grid-template-columns: 1fr;
  }

  .calc-btn {
    width: 100%;
    text-align: center;
  }

  .calc-field--action {
    align-items: stretch;
  }
}

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.82rem;
}

footer a { color: rgba(255,255,255,0.65); }
footer a:hover { color: var(--ember); }
.footer-disclaimer {
  font-size: 0.75rem;
  opacity: 0.55;
  margin-bottom: 0.4rem;
}

/* ── Utilities ──────────────────────────────────────────────── */
.text-ember { color: var(--ember); }
.text-muted { color: var(--gray-mid); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--blue-dark);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }

  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.75rem 2rem; border-radius: 0; width: 100%; }

  .hero { padding: 3.5rem 1rem 3rem; }
  .chart-header { flex-direction: column; }
  .calendar-day { min-height: 56px; }
  .sa-tooltip { right: auto; left: 0; }
}

@media (max-width: 860px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .notify-form { flex-direction: column; }
  .notify-form input[type="email"] { min-width: unset; width: 100%; }
  .horizon-bar { gap: 0.5rem; }
}

/* ── Quick Facts panel ──────────────────────────────────────── */
.chart-body-row {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.chart-col {
  flex: 1;
  min-width: 0;
}

.quick-facts {
  flex-shrink: 0;
  width: 220px;
  background: var(--gray-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.qf-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-mid);
  margin: 0 0 0.15rem;
}

/* Series sub-label (e.g. "Total", "Private", "Government") shown below QF title */
.qf-series-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin: 0 0 0.4rem;
}

.qf-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.3rem 0;
}

.qf-label {
  color: var(--gray-mid);
  font-size: 0.8rem;
  line-height: 1.3;
  flex: 1;
}

.qf-value {
  font-weight: 600;
  color: var(--blue-dark);
  font-size: 0.88rem;
  white-space: nowrap;
  text-align: right;
}

.qf-pos { color: #0a7c55; }
.qf-neg { color: #c0392b; }

.qf-divider {
  border: none;
  border-top: 1px solid var(--gray-border);
  margin: 0.35rem 0;
}

/* ── Wide QF variant (for dual-column CPI / PPI panels) ────── */
.quick-facts--wide {
  width: 300px;
}

/* ── Triple-column QF (Measures of Unemployment) ───────────── */
.quick-facts--triple {
  width: 340px;
}

/* Unemployment QF grid: row headers + 3 value columns */
.unemp-qf-grid {
  display: grid;
  grid-template-columns: auto repeat(3, 1fr);
  gap: 0.35rem 0.3rem;
  margin-top: 0.25rem;
}
.unemp-col-hdr {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--blue-mid);
  text-align: center;
  line-height: 1.3;
  padding-bottom: 0.2rem;
  border-bottom: 1.5px solid var(--blue-mid);
}
.unemp-row-hdr {
  font-size: 0.7rem;
  color: var(--gray-mid);
  white-space: nowrap;
  display: flex;
  align-items: center;
  padding-right: 0.3rem;
}
.unemp-val {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qf-dual-cols {
  display: flex;
  gap: 0.6rem;
  flex: 1;
}

.qf-dual-col {
  flex: 1;
  min-width: 0;
}

.qf-col-hdr {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--blue-mid);
  margin: 0 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1.5px solid var(--blue-mid);
  white-space: normal;
  line-height: 1.3;
}

.qf-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.3rem 0;
}

.qf-skeleton-line {
  height: 10px;
  background: var(--gray-light);
  border-radius: 4px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@media (max-width: 700px) {
  .chart-body-row { flex-direction: column; }
  .quick-facts,
  .quick-facts--wide,
  .quick-facts--triple { width: 100%; max-width: none; }
}

/* ── Supply Chain / Sankey page ─────────────────────────────── */
.section-sankey {
  padding-top: 2rem;
}

/* ── Sector panel — container card ──────────────────────────────────────── */
.sector-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

/* Prompt — always visible */
.sector-panel__prompt {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 0.55rem;
}

/* Selector row: box fills remaining space, button sits flush to the right */
.sector-selector-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
}

/* Selection box — the clickable "dropdown trigger" shown before first pick */
.sector-selector {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.9rem;
  border: 1.5px solid var(--gray-border);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-mid);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s;
}

.sector-selector:hover {
  border-color: var(--blue-mid);
  color: var(--text-dark);
}

.sector-selector[aria-expanded="true"] {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  color: var(--text-dark);
}

/* Once a sector is chosen, style the box text like a real value (not placeholder) */
.sector-selector--selected {
  color: var(--text-dark);
  font-weight: 500;
  border-color: var(--gray-border);
}

.sector-panel__change-btn {
  flex-shrink: 0;
  padding: 0.38rem 1.1rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--ember);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s;
}

.sector-panel__change-btn:hover {
  background: var(--ember-dark);
}

/* ── Sector picker — 3-column categorized link grid ────────────────────── */
.sector-picker {
  columns: 3;
  column-gap: 2rem;
  margin-top: 1rem;
  margin-bottom: 0;
}

/* Each category block stays intact — never split across columns */
.sector-group {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin-bottom: 1.1rem;
}

.sector-group__heading {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-mid);
  padding-bottom: 0.2rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--gray-border);
}

.sector-group__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sector-link {
  display: block;
  padding: 0.18rem 0.45rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-body);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}

.sector-link:hover {
  background: var(--blue-light);
  color: var(--blue-mid);
}

.sector-link--active {
  background: var(--blue-mid);
  color: var(--white) !important;
  font-weight: 500;
}

/* Responsive: 2 columns on tablet, 1 on mobile */
@media (max-width: 720px) {
  .sector-picker { columns: 2; }
}
@media (max-width: 480px) {
  .sector-picker { columns: 1; }
}

/* Card wrapper */
.sankey-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;   /* scroll the card rather than crush the chart */
}

/* Loading state */
.sankey-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 3rem 1rem;
  color: var(--gray-mid);
  font-size: 0.9rem;
  justify-content: center;
}

.sankey-loading__spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-border);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* Stage: flex column (axis titles row + chart row) — minimum width prevents
   Chart.js from crushing the canvas on narrow viewports */
.sankey-stage {
  display: flex;
  flex-direction: column;
  min-width: 500px;
}

/* Title row: "Input Suppliers" left, "Output Markets" right */
.sankey-axis-titles {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.sankey-axis-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #2D3748;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sankey-axis-subtitle {
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gray-mid);
}

/* Chart row: canvas + output-group label column side by side */
.sankey-chart-row {
  display: flex;
  align-items: flex-start;
}

/* Canvas wrapper — grows to fill the row, fixed height */
.sankey-canvas-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 600px;
}

.sankey-canvas-wrap canvas {
  height: 100% !important;
}

/* Industry-name label overlaid on the selected-industry node.
   Top/left are set dynamically by the afterDraw plugin. */
.sankey-focal-label {
  position: absolute;
  left: 50%;           /* overwritten by plugin once chart draws */
  top: 50%;            /* overwritten by plugin once chart draws */
  transform: translateX(-50%) translateY(0);
  max-width: 180px;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  background: transparent;
  border-radius: 4px;
  padding: 4px 7px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.45);
  pointer-events: none;
  z-index: 2;
}

/* Sector icon overlay — injected & positioned by afterDraw plugin */
.sankey-focal-icon {
  position: absolute;
  width: 80px;
  height: 80px;
  left: 50%;           /* overwritten by plugin once chart draws */
  top: 60%;            /* overwritten by plugin once chart draws */
  transform: translateX(-50%) translateY(-50%);
  pointer-events: none;
  z-index: 2;
  display: none;       /* shown by JS after chart renders */
}

.sankey-focal-icon img {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.75;
  /* Render any dark SVG icon as white against the gray focal node */
  filter: brightness(0) invert(1);
}

/* Narrow column of pivoted group labels to the right of the canvas */
.sankey-output-groups {
  position: relative;
  flex-shrink: 0;
  width: 1.35rem;
  height: 600px;       /* matches canvas-wrap */
  margin-left: 0.3rem;
}

/* Individual group label (Intermediate Demand / Final Demand).
   Top and height are set dynamically by the afterDraw plugin. */
.sankey-output-group {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.sankey-output-group--buyers { color: #16A34A; }  /* vibrant green — matches buyer nodes */
.sankey-output-group--fd     { color: #EA580C; }  /* vibrant orange — matches FD nodes */

/* Source note inside the sankey card */
.source-note {
  font-size: 0.78rem;
  color: var(--gray-mid);
  margin: 0;
  line-height: 1.5;
}

.source-note a {
  color: var(--gray-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.source-note a:hover { color: var(--blue-mid); }

.source-note--chart {
  padding: 0.65rem 0 0;
  border-top: 1px solid var(--gray-border);
  margin-top: 0.75rem;
}

/* ── FAQ list inside the explainer ──────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 0.25rem 0 0.5rem;
}

.faq-item {
  border-left: 3px solid var(--blue-light);
  padding-left: 0.9rem;
}

.faq-q {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 0.3rem;
}

.faq-a {
  font-size: 0.875rem;
  color: var(--text-body);
  line-height: 1.65;
  margin: 0;
}

.faq-a a {
  color: var(--blue-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.faq-a a:hover { color: var(--ember); }



/* ── State GDP Tile Map ──────────────────────────────────────────────────── */

/* ── State GDP two-column layout ──────────────────────────── */
.chart-section.state-gdp-section {
  position: relative;
  overflow-x: auto;   /* horizontal scroll rather than layout collapse */
}

/* ── GDP by Industry section ──────────────────────────────── */
.chart-section.state-industry-section {
  margin-top: 2rem;
  padding: 1.5rem 1.75rem;
  border-top: 1px solid var(--gray-border);
}

.state-industry-header {
  margin-bottom: 1.1rem;
}

.state-industry-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--blue-dark);
  margin-bottom: 0.3rem;
}

.state-industry-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.state-industry-control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.state-industry-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-mid);
  white-space: nowrap;
}

.state-industry-select {
  max-width: 240px;
  padding: 0.35rem 0.7rem;
  font-size: 0.88rem;
}

.state-industry-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

/* ── Industry data table ─────────────────────────────────── */
.industry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  table-layout: fixed;
}

.industry-table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-mid);
  padding: 0.3rem 0.4rem;
  border-bottom: 2px solid var(--gray-border);
  white-space: nowrap;
  user-select: none;
}

.industry-table thead th.itbl-sortable {
  cursor: pointer;
}
.industry-table thead th.itbl-sortable:hover {
  color: var(--blue-dark);
}

.industry-table thead th.itbl-col-val,
.industry-table thead th.itbl-col-bar {
  text-align: right;
}

.industry-table tbody tr {
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.industry-table tbody tr:hover {
  background-color: rgba(0,0,0,0.04);
}

.itbl-col-name {
  text-align: left;
  padding: 0.16rem 0.5rem 0.16rem 0;
  color: var(--text-dark);
  width: 28%;
}

.itbl-col-val {
  text-align: right;
  padding: 0.16rem 0.4rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 15%;
}

.itbl-col-bar {
  text-align: left;
  /* Symmetric padding so 50% of padding-box = 50% of content-box = zero line */
  padding: 0.12rem 0.6rem;
  width: 27%;
}

/* Zero-line only on data cells (td), not the header (th) */
td.itbl-col-bar {
  background-image: linear-gradient(
    to right,
    transparent calc(50% - 0.5px),
    rgba(0,0,0,0.15) calc(50% - 0.5px),
    rgba(0,0,0,0.15) calc(50% + 0.5px),
    transparent calc(50% + 0.5px)
  );
}

.itbl-row-total td {
  font-weight: 600;
  font-style: italic;
}
.itbl-row-subtotal td {
  font-weight: 600;
}

/* Extra breathing room between table and source note */
.state-industry-table-wrap + .chart-source {
  margin-top: 0.75rem;
}
.itbl-row-govt td {
  color: var(--text-mid);
}
.itbl-row-govt-first td {
  border-top: 1px dashed var(--gray-border);
}

/* Value color classes */
.itbl-pos        { color: #0E9C6E; }
.itbl-neg        { color: #F4511E; }
.itbl-pos-strong { color: #0A6644; font-weight: 600; }
.itbl-neg-strong { color: #9E2A0F; font-weight: 600; }
.itbl-muted      { color: #9AA5B1; }

/* Sort icon */
.isort-icon {
  font-size: 0.7rem;
  opacity: 0.35;
  margin-left: 2px;
}
.isort-icon--on {
  opacity: 1;
  color: var(--blue-mid);
}

.state-gdp-header {
  position: absolute;
  top: 1.75rem;
  left: 2rem;
  max-width: 580px;
  z-index: 2;
  pointer-events: none;
}

.state-gdp-header h2 {
  font-size: 1.1rem;
  color: var(--blue-dark);
  margin-bottom: 0.3rem;
}

.state-gdp-body {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  min-width: 820px;   /* prevent layout collapse on narrow viewports */
}

.state-tile-wrap {
  position: relative;
  overflow: visible;   /* let hover scale bleed out without clipping */
  padding: 2.5rem 0 0.5rem 25px;
  flex: 0 0 715px;     /* 11 × 60px tiles + 10 × 3px gaps + 25px left pad — fixed so ranking panel is consistent width across all tabs */
}

.state-tile-grid {
  display: grid;
  grid-template-columns: repeat(11, 60px);
  grid-template-rows: repeat(8, 58px);
  gap: 3px;
  width: fit-content;
  margin: 0;
}

.state-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: default;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  user-select: none;
}

.state-tile:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  z-index: 5;
  position: relative;
}

.tile-abbr {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.03em;
}

.tile-val {
  font-size: 0.75rem;
  line-height: 1.25;
  font-weight: 500;
}

.state-map-tooltip {
  position: fixed;   /* viewport-relative — never clipped by any ancestor */
  background: rgba(10, 22, 40, 0.92);
  color: #fff;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  font-size: 0.8rem;
  line-height: 1.5;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Legend */
.state-gdp-legend {
  margin: 2.25rem auto 0;
  width: fit-content;
  max-width: 100%;
}

.state-gdp-legend-title {
  font-size: 0.78rem;
  color: var(--text-body);
  margin: 0 0 0.5rem;
  font-weight: 500;
}

.state-gdp-legend-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

.state-gdp-swatch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.swatch-color {
  width: 28px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.swatch-label {
  font-size: 0.74rem;
  color: var(--text-body);
  white-space: nowrap;
}

/* ── State GDP ranking panel ──────────────────────────────── */
.state-gdp-ranking {
  flex: 1 1 auto;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  padding-top: 0.25rem;
}

.rank-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.3rem;
}

/* Two-column flowing list — items flow top→bottom in col 1, then col 2 */
.rank-list {
  column-count: 2;
  column-gap: 5px;
  column-fill: balance;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  margin-bottom: 2px;
  break-inside: avoid;
}

.rank-us-row {
  font-style: italic;
  outline: 1.5px solid rgba(0,0,0,0.18);
  outline-offset: -1px;
}

.rank-num {
  font-size: 0.6rem;
  width: 14px;
  text-align: right;
  flex-shrink: 0;
  opacity: 0.5;
}

.rank-abbr {
  font-size: 0.72rem;
  font-weight: 700;
  flex: 1;
}

.rank-val {
  font-size: 0.68rem;
  font-weight: 600;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Named ranked list (home page EMI — includes full state name) ─ */
.state-rank-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.4rem;
  border-radius: 3px;
  margin-bottom: 2px;
  font-size: 0.78rem;
}
.state-rank-us { font-style: italic; outline: 1.5px solid rgba(0,0,0,0.18); outline-offset: -1px; }
.state-rank-row .rank-num {
  font-size: 0.6rem;
  width: 16px;
  text-align: right;
  flex-shrink: 0;
  opacity: 0.55;
}
.state-rank-row .rank-abbr {
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  border-radius: 3px;
  padding: 1px 2px;
}
.state-rank-row .rank-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--blue-dark);
}
.state-rank-row .rank-val {
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
}
