/* styles.css - Civic Data Atlas Portal */

/* ============================================================================
   CSS VARIABLES - Consistent color palette
   Breakpoints: sm=576px, md=768px, lg=1024px
   ============================================================================ */

:root {
  --primary-color: #2c3e50;
  --primary-light: #34495e;
  --accent-color: #5b8db8;
  --accent-hover: #4a7aa3;
  --accent-subtle: #f0f5fa;
  --success-color: #27ae60;
  --bg-light: #f8f9fa;
  --bg-card: #ffffff;
  --border-color: #dbe2e8;
  --border-color-strong: #c7d1db;
  --text-primary: #2c3e50;
  --text-secondary: #6c757d;
  --text-muted: #95a5a6;
  --text-muted-dark: #7f8c8d;
  --shadow-sm: 0 1px 2px rgba(44, 62, 80, 0.08);
  --shadow-md: 0 8px 20px rgba(44, 62, 80, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --max-width: 900px;
  /* Semantic comparison tokens — visually distinct, no positive/negative connotation */
  --color-higher: #0891b2;
  --color-lower:  #d97706;
  --color-ward-map: #C00000;
}

/* Focus ring — accessible, branded */
:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 3px;
}

/* ============================================================================
   GLOBAL LAYOUT - Prevent horizontal scroll
   ============================================================================ */

html, body {
  max-width: 100vw;
  scroll-padding-top: 100px;
}

body {
  color: var(--text-primary);
  line-height: 1.5;
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.nav-fixed {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#quarto-content {
  flex: 1 0 auto;
}

/* Sticky TOC sidebar */
#quarto-margin-sidebar #TOC {
  position: sticky !important;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding-bottom: 2rem;
}

#TOC .nav-link {
  color: var(--text-secondary) !important;
  font-weight: 400 !important;
  border: none !important;
  background: none !important;
}

#TOC .nav-link.active {
  color: var(--accent-color) !important;
  font-weight: 600 !important;
}

#TOC .nav-link:hover {
  color: var(--accent-color) !important;
  text-decoration: underline !important;
}

#toc-title {
  display: none !important;
}


/* Import Lato font (used by Flatly theme) */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');

/* ============================================================================
   SITE HEADER / NAVBAR
   Applied to both home/about pages (Quarto Bootstrap navbar) and ward pages
   (injected ward-navbar.html with identical markup).
   ============================================================================ */

/* Normalize Bootstrap navbar CSS variables — the home page and ward pages
   compile different Bootstrap/Flatly versions with different defaults.
   Setting these explicitly ensures pixel-identical rendering on both.
   Overriding dark theme to white navbar. */
.navbar[data-bs-theme="dark"] {
  --bs-navbar-color:             var(--text-secondary);
  --bs-navbar-hover-color:       var(--text-primary);
  --bs-navbar-active-color:      var(--text-primary);
  --bs-navbar-brand-color:       var(--text-primary);
  --bs-navbar-brand-hover-color: var(--text-primary);
  --bs-navbar-toggler-border-color: var(--border-color);
  --bs-navbar-toggler-border-radius: 0.25rem;
  background-color: #f1f5f9 !important;
}

/* Neutralize Quarto header rules that only exist in the homepage Bootstrap:
   #quarto-header{margin-right:16px} and #quarto-header>nav{padding-left:1em;...} */
#quarto-header {
  margin-right: 0 !important;
}

#quarto-header > nav {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Strip Quarto's default navbar shadow/border */
.navbar {
  box-shadow: none !important;
  border-bottom: 3px solid var(--accent-color) !important;
  padding-top: 1.25rem !important;
  padding-bottom: 1.25rem !important;
}

/* Remove container padding so content aligns with page */
.navbar-container.container-fluid {
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

/* Move brand to left — Bootstrap centers it with mx-auto by default.
   Also normalize padding and order: homepage Bootstrap sets padding and
   order:2 on this element; ward Bootstrap has no such rules. */
.navbar-brand-container {
  margin-left: 0 !important;
  margin-right: auto !important;
  flex: 0 0 auto !important;
  padding: 0 !important;
  order: 0 !important;
}

/* Brand/title to match .site-title */
.navbar-brand {
  padding: 0 !important;
  margin: 0 !important;
}

.navbar-title {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  letter-spacing: 0.01em !important;
  font-family: inherit !important;
}

.navbar-brand-lockup {
  display: inline-flex;
  align-items: flex-end;
  gap: 10px;
  white-space: nowrap;
  line-height: 1;
}

.navbar-brand-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex: 0 0 auto;
  transform: translateY(2px);
}

.navbar-brand-text {
  display: block;
}

/* Nav links */
.navbar-nav .nav-link {
  color: var(--text-secondary) !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  padding: 0.3rem 0.7rem !important;
  border-radius: var(--radius-sm) !important;
  transition: all 0.15s ease !important;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
  color: var(--text-primary) !important;
  background: #e2e8f0 !important;
  text-decoration: none !important;
}

.navbar-nav .nav-link.active {
  color: var(--text-primary) !important;
  background: transparent !important;
}

/* Keep right-side nav cluster anchored to the right on all page types */
.navbar .navbar-collapse {
  flex-grow: 1;
}

.navbar .navbar-nav.ms-auto {
  margin-left: auto !important;
}

/* Force identical desktop navbar geometry across homepage and ward pages,
   even when different Quarto/Bootstrap bundles are present. */
@media (min-width: 768px) {
  #quarto-header .navbar-container.container-fluid {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  #quarto-header .navbar-collapse {
    display: flex !important;
    flex-basis: auto;
  }

  #quarto-header .navbar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
  }

  #quarto-header .navbar-nav .nav-link {
    padding: 0.3rem 0.55rem !important;
  }
}

/* Dropdown toggle arrow */
.navbar-nav .dropdown-toggle::after {
  opacity: 0.7;
  vertical-align: 0.15em;
}

/* Wards dropdown menu — 5-column grid */
.navbar .dropdown-menu {
  background-color: #ffffff !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.35rem 0.5rem !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
  min-width: 13rem !important;
  columns: 1 !important;
  column-gap: 0 !important;
}

.navbar .dropdown-item {
  color: var(--text-secondary) !important;
  font-size: 0.875rem !important;
  padding: 0.3rem 1rem !important;
  font-weight: 500 !important;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
  color: var(--text-primary) !important;
  background-color: var(--bg-light) !important;
}

.navbar .dropdown-item.active,
.navbar .dropdown-item:active {
  color: var(--text-primary) !important;
  background-color: #e2e8f0 !important;
}

.navbar .dropdown-divider {
  border-color: var(--border-color) !important;
  margin: 0.2rem 0 !important;
}

.navbar .navbar-context-district-menu {
  min-width: min(22rem, 92vw) !important;
  max-width: calc(100vw - 2rem) !important;
  max-height: min(70vh, 34rem) !important;
  overflow-y: auto !important;
  columns: 3 !important;
}

@media (min-width: 992px) {
  .navbar .navbar-context-district-menu {
    columns: 5 !important;
  }
}

/* Hide search box — not needed */
#quarto-search {
  display: none !important;
}

/* Mobile hamburger toggler */
.navbar-toggler {
  border-color: var(--border-color) !important;
  padding: 0.25rem 0.5rem !important;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2844%2c62%2c80%2c0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* ============================================================================
   SITE FOOTER
   ============================================================================ */

.site-footer {
  margin-top: 3rem;
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  border-top: 1px solid var(--border-color);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 0 1rem;
  box-sizing: border-box;
}

.site-footer-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.25rem 0 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  box-sizing: border-box;
}

.site-footer-brand {
  flex: 1 1 auto;
  min-width: 0;
}

.site-footer-title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.site-footer-copy {
  margin: 0;
  max-width: 40rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  padding-left: 0;
  text-indent: 0;
  overflow-wrap: anywhere;
}

.site-footer-nav {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  justify-content: flex-end;
}

.site-footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.site-footer-nav a:hover,
.site-footer-nav a:focus-visible {
  color: var(--accent-color);
  text-decoration: underline;
}

@media (max-width: 960px) {
  .site-footer-inner {
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 0 1.1rem;
  }

  .site-footer-nav {
    display: none;
  }
}

@media (max-width: 768px) {
  .site-footer-inner {
    padding: 0.95rem 0 1rem;
  }
}

/* Let Quarto handle page layout for proper TOC sidebar positioning */
/* Note: Removed centering constraints that conflicted with grid layout */

main.content {
  max-width: var(--max-width);
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1, h2, h3, h4 {
  color: var(--primary-color);
  font-weight: 600;
  word-wrap: break-word;
  overflow-wrap: break-word;
  scroll-margin-top: 120px;
}

h1, .title {
  font-size: 1.75rem !important;
  margin-bottom: 0.25rem;
  line-height: 1.25;
  text-wrap: balance;
}

/* Major Category Sections (h1) — shelf treatment */
h1:not(.unlisted):not(.title) {
  border-left: 3px solid var(--primary-color);
  border-top: none;
  padding: 0.8rem 1rem;
  margin-top: 4rem !important;
  margin-bottom: 1.5rem !important;
  margin-left: -1rem;
  font-size: 1.8rem !important;
  letter-spacing: 0.15px;
  background: #fbfcfd;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--primary-light);
}

h3 {
  font-size: 1.1rem;
  margin-top: 1.25rem;
  color: var(--primary-light);
}

/* ============================================================================
   STAT CARDS - Key metrics display
   ============================================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1rem 0 1.5rem 0;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 576px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  min-width: 0; /* Prevent overflow */
}

.stat-card:hover {
  background: var(--accent-subtle);
  border-color: var(--border-color-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
  min-height: 4.6em;
  line-height: 1.3;
}

.stat-single-view,
.stat-comp-view {
  margin-top: auto;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.stat-value.currency {
  color: var(--success-color);
}

.stat-value-main,
.stat-col-main {
  display: block;
  white-space: nowrap;
  max-width: 100%;
}

/* ── Stat card comparison view (Option 3A — side-by-side) ─────────────────── */

.stat-comp-view .stat-compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
  gap: 0.35rem;
  margin-top: 0.15rem;
  align-items: end;
}

.stat-comp-view .stat-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.stat-comp-view .stat-col-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.25px;
  margin-bottom: 0.1rem;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.15;
  min-height: 0;
}

.stat-comp-view .stat-col.ward .stat-col-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.1;
  white-space: nowrap;
  padding-right: 0;
  min-width: 0;
}

.stat-comp-view .stat-col.ward .stat-col-value.currency {
  color: var(--success-color);
}

.stat-comp-view .stat-col.city .stat-col-value {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.1;
  white-space: nowrap;
  padding-left: 0;
  min-width: 0;
}

.stat-comp-view .stat-divider {
  width: 1px;
  background: var(--border-color);
  align-self: stretch;
  flex-shrink: 0;
  margin: 0.15rem 0;
}

@media (max-width: 960px) {
  .stat-comp-view .stat-col-label {
    font-size: 0.56rem;
    letter-spacing: 0.15px;
  }
}

@media (max-width: 420px) {
  .stat-comp-view .stat-col-label {
    font-size: 0.54rem;
    letter-spacing: 0.1px;
  }
}

.stat-comp-view .stat-compare-row.is-tight {
  gap: 0.24rem;
}

.stat-comp-view .stat-compare-row.is-tight .stat-col.ward .stat-col-value,
.stat-comp-view .stat-compare-row.is-tight .stat-col.city .stat-col-value {
  font-size: 0.86rem;
  line-height: 1.05;
}

.stat-comp-view .stat-compare-row.is-tight-strong {
  gap: 0.18rem;
}

.stat-comp-view .stat-compare-row.is-tight-strong .stat-col.ward .stat-col-value,
.stat-comp-view .stat-compare-row.is-tight-strong .stat-col.city .stat-col-value {
  font-size: 0.76rem;
  line-height: 1.02;
}

.stat-comp-view .stat-compare-row.is-ward-split .stat-col {
  justify-content: flex-end;
}

.stat-comp-view .stat-compare-row.is-ward-split .stat-col-label {
  font-size: 0.48rem;
  letter-spacing: 0;
  line-height: 1.05;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}

/* Prevent numeric values from wrapping, but allow text labels to wrap */
.profile-card .gt_table td.gt_row.gt_right,
.profile-card .gt_table td.gt_row.gt_center,
.profile-card .gt_table th.gt_col_heading.gt_right,
.profile-card .gt_table th.gt_col_heading.gt_center {
  white-space: nowrap;
}

/* ============================================================================
   WARD GRID - Homepage ward selection
   ============================================================================ */

.ward-grid {
  margin: 1rem 0 2rem 0;
  width: 100%;
  box-sizing: border-box;
}

.ward-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

@media (min-width: 768px) {
  .ward-row {
    grid-template-columns: repeat(10, 1fr);
  }
}

.ward-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.ward-card:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.ward-card:hover .ward-number,
.ward-card:hover .ward-pop {
  color: white;
}

.ward-number {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--primary-color);
}

.ward-pop {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ============================================================================
   WARD NAVIGATION - Change Ward dropdown on ward pages
   ============================================================================ */

.ward-nav {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.ward-change-btn {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  color: var(--primary-color) !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  padding: 0.55rem 1rem !important;
  box-shadow: var(--shadow-sm) !important;
}

.ward-change-btn:hover,
.ward-change-btn:focus {
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12) !important;
}

.ward-change-menu {
  min-width: min(92vw, 34rem) !important;
  max-height: min(70vh, 28rem);
  overflow-y: auto;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.2rem;
  padding: 0.35rem !important;
}

.ward-change-dropdown .ward-change-menu.show {
  display: grid !important;
}

.ward-change-menu .dropdown-item {
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  text-align: center;
  padding: 0.4rem 0.5rem !important;
}

.ward-change-menu .dropdown-item.current-ward,
.ward-change-menu .dropdown-item.active {
  background: var(--accent-color) !important;
  color: white !important;
  font-weight: 700;
}

.ward-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.ward-title-row .ward-page-title {
  margin: 0;
}

.ward-title-row .ward-nav {
  margin: 0;
}

/* ============================================================================
   TABLES
   ============================================================================ */

/* GT table styling */
.gt_table {
  margin: 1rem 0 !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  box-shadow: var(--shadow-sm) !important;
  width: 100% !important;
  max-width: 100% !important;
  font-size: 0.9rem !important;
}

.gt_table thead th {
  background: var(--accent-subtle) !important;
  color: var(--text-primary) !important;
  font-weight: 700 !important;
  text-transform: none !important;
  font-size: 0.8rem !important;
  letter-spacing: 0.15px !important;
  padding: 0.35rem 0.75rem !important;
  border-bottom: 2px solid var(--border-color-strong) !important;
}

.gt_table tbody td {
  padding: 0.5rem 0.75rem !important;
}

.gt_table tbody tr:hover {
  background: var(--accent-subtle) !important;
}


/* Standard markdown tables */
table {
  width: 100%;
  max-width: 100%;
  margin: 1rem 0;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
}

th {
  font-weight: 700;
  background: var(--accent-subtle);
  color: var(--text-primary);
  text-transform: none;
  font-size: 0.8rem;
  letter-spacing: 0.15px;
  border-bottom: 2px solid var(--border-color-strong);
}

td {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--bg-light);
}

/* ============================================================================
   CALLOUTS - Remove default styling
   ============================================================================ */

.callout {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}

.callout-note {
  border: none !important;
  background: transparent !important;
}

.callout-header {
  display: none !important;
}

.callout-body {
  padding: 0 !important;
}

/* ============================================================================
   ABOUT SECTION
   ============================================================================ */

.about-section {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 2rem;
}

.about-section h2 {
  border-bottom: none;
  margin-top: 0;
  font-size: 1.2rem;
}

.about-section h3 {
  margin-top: 1.25rem;
  font-size: 1rem;
}

.about-section p {
  font-size: 0.9rem;
}

.data-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

@media (min-width: 500px) {
  .data-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

.data-list li {
  padding: 0.35rem 0;
  padding-left: 1rem;
  position: relative;
}

.data-list li::before {
  content: "•";
  color: var(--accent-color);
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 576px) {
  h1, .title {
    font-size: 1.5rem !important;
  }

  h2 {
    font-size: 1.2rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .ward-change-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .about-section {
    padding: 1rem;
  }
}

@media (min-width: 577px) and (max-width: 820px) {
  .ward-change-menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ============================================================================
   PAGE FOOTER
   ============================================================================ */

footer:not(.site-footer), .page-footer {
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
}

/* ============================================================================
   WARD SELECTOR DROPDOWN
   ============================================================================ */

.ward-selector-container {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

.ward-selector {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.ward-selector label {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.95rem;
  margin: 0;
}

.ward-selector select {
  padding: 0.55rem 2.25rem 0.55rem 1rem;
  font-size: 0.95rem;
  font-family: "Lato", sans-serif;
  font-weight: 600;
  color: var(--primary-color);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 180px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232c3e50' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: auto;
}

.ward-selector select:hover {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.ward-selector select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

@media (max-width: 576px) {
  .ward-selector {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 1rem;
  }

  .ward-selector label {
    text-align: center;
  }

  .ward-selector select {
    width: 100%;
    min-width: 0;
  }
}

/* ============================================================================
   WARD MAP STYLING (Leaflet)
   ============================================================================ */

.leaflet-container {
  height: 600px;
  width: 100%;
  max-width: var(--max-width);
  margin: 2rem auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* Map tooltip styling */
.leaflet-tooltip {
  font-family: "Lato", sans-serif;
  font-size: 14px;
  font-weight: 600;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* Map popup styling */
.leaflet-popup-content {
  font-family: "Lato", sans-serif;
}

.leaflet-popup-content a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

.leaflet-popup-content a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Responsive: shorter on mobile */
@media (max-width: 768px) {
  .leaflet-container {
    height: 400px;
  }
}

/* ============================================================================
   PAGE LAYOUT ADJUSTMENTS
   ============================================================================ */

.page-columns .page-full {
  grid-column: page !important;
}

/* ============================================================================
   ALDERPERSON CARD
   ============================================================================ */

.alder-card {
  padding: 1.5rem;
  margin: 1rem 0 2rem 0;
  font-family: "Lato", sans-serif;
}

.alder-main-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 2rem;
  align-items: start;
}

.alder-content-col,
.alder-map-col {
  min-width: 0;
}

.alder-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  margin-top: 0;
}

.alder-image {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border-color);
}

.alder-card .alder-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0 0 0.2rem 0;
  border: none;
}

.alder-title {
  font-size: 1.1rem;
  color: var(--text-muted-dark);
  font-weight: 600;
}

.alder-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1rem 0;
}

.alder-divider-dashed {
  border: none;
  border-top: 1px dashed var(--border-color);
  margin: 1.25rem 0;
}

.alder-buttons-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
  max-width: 30rem;
}

.alder-card .alder-link-btn {
  padding: 0.4rem 1rem;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  background-color: var(--bg-card);
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  min-height: 2.25rem;
  text-align: center;
}

.alder-buttons-row-single-link .alder-link-btn:first-child {
  grid-column: 1 / -1;
}

.alder-card .alder-link-btn:hover {
  background-color: var(--accent-color);
  color: white;
}

.alder-card .alder-link-btn .alder-ext-icon {
  font-size: 0.75em;
  margin-left: 0.3em;
  vertical-align: middle;
  opacity: 0.75;
}

.alder-map-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0;
}

.alder-map-container {
  width: 100%;
  max-width: 320px;
  height: 220px;
  padding: 10px;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-sizing: border-box;
}

.alder-map-container > .html-widget {
  height: 100% !important;
}

.alder-map-container .leaflet-container {
  height: 100% !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: calc(var(--radius-sm) - 2px) !important;
  box-shadow: none !important;
}

.map-caption {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  width: 100%;
}

.alder-more-info-content {
  width: 100%;
}

.alder-card .alder-more-info-btn {
  grid-column: 1 / -1;
  padding: 0.4rem 1rem;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  background-color: var(--accent-subtle);
  transition: all 0.2s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  min-height: 2.25rem;
}

.alder-card .alder-more-info-btn:hover {
  background-color: var(--accent-color);
  color: white;
}

.alder-revealed-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.contact-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-light);
  text-transform: none;
  letter-spacing: 0.15px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.contact-label i {
  color: var(--accent-color);
  font-size: 0.9rem;
}

.contact-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.contact-multi-item {
  margin-bottom: 0.45rem;
}

.contact-multi-item:last-child {
  margin-bottom: 0;
}

.contact-value a {
  color: var(--accent-color);
  text-decoration: none;
}

.alder-committees {
  margin-top: 1rem;
  padding: 1.25rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-light);
}

.alder-committees > strong {
  font-size: 0.85rem;
  color: var(--text-muted-dark);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: block;
}

.committee-list li strong {
  color: var(--primary-color);
  font-weight: bold;
  text-transform: none;
  font-size: inherit;
  display: inline;
}

.committee-list {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  font-size: 0.85rem;
  color: var(--text-secondary);
  list-style-type: disc;
}

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

@media (max-width: 768px) {
  .alder-main-row {
    grid-template-columns: 1fr;
  }

  .alder-map-container {
    max-width: none;
  }
}

@media (max-width: 1100px) {
  .alder-main-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .alder-buttons-row {
    width: 100%;
    max-width: none;
  }

  .alder-map-container {
    max-width: none;
  }
}

@media (min-width: 992px) and (max-width: 1100px) {
  .alder-card {
    width: 100%;
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
  }

  .alder-map-container {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 576px) {
  .alder-revealed-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   INTERACTIVE TABLE SYSTEM (from table-display-exploration)
   ============================================================================ */

/* Global controls - sticky toggle bar */
.global-controls-sticky {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  padding: 0.75rem 0;
  border-bottom: 2px solid var(--border-color);
  z-index: 990;
  margin-bottom: 2rem;
  backdrop-filter: blur(5px);
}

.mobile-section-nav {
  display: none;
}

.global-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.segmented-control {
  display: flex;
  background: #f0f2f5;
  padding: 4px;
  border-radius: 10px;
  gap: 2px;
}

.control-btn {
  border: none;
  background: none;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted-dark);
  transition: all 0.2s ease;
}

.control-btn:hover { color: var(--primary-color); }

.control-btn.active {
  background: white;
  color: var(--primary-color);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* MOE toggle button */
.moe-toggle-btn {
  position: relative;
  margin-left: 1rem;
  padding-right: 1.4rem; /* room for the ? badge */
  border: 1.5px solid #bbb !important;
  background: white !important;
  color: var(--text-muted-dark);
}

.moe-toggle-btn:hover {
  border-color: var(--primary-color) !important;
  color: var(--primary-color);
}

.moe-toggle-btn.active {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.moe-toggle-btn.active:hover { color: white; }

/* MOE help icon & tooltip */
.moe-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #999;
  color: white;
  font-size: 0.5rem;
  font-weight: 700;
  cursor: pointer;
  position: absolute;
  top: 3px;
  right: 4px;
  line-height: 1;
}

.moe-help-icon:hover { background: #555; }

.moe-toggle-btn.active .moe-help-icon {
  background: rgba(255,255,255,0.5);
  color: var(--primary-color);
}

.moe-toggle-btn.active .moe-help-icon:hover {
  background: rgba(255,255,255,0.75);
}

.moe-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  left: auto;
  transform: none;
  background: #333;
  color: white;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  width: 260px;
  text-align: left;
  z-index: 9999;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.moe-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 6px;
  left: auto;
  transform: none;
  border: 6px solid transparent;
  border-top-color: #333;
}

.moe-help-icon:hover .moe-tooltip,
.moe-help-icon:focus .moe-tooltip {
  display: block;
}

@media (max-width: 600px) {
  .global-controls-row {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0.75rem;
  }
  .global-controls-row > div {
    justify-content: center;
  }
  .segmented-control .control-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
  .moe-toggle-btn {
    margin-left: 0;
  }
  .moe-tooltip {
    width: 220px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }
  .moe-tooltip::after {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Profile card - wraps each table section */
.profile-card {
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Shared card shell used across homepage and ward pages */
.stat-card,
.profile-card,
.alder-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* Hide TOC title */

/* Master hidden class */
.val-hidden { display: none !important; }

/* Dual-value cell spans */
.mode-pct, .mode-count {
  font-variant-numeric: tabular-nums;
  text-align: right;
  display: inline-block;
  width: 100%;
}

/* Tab navigation */
.profile-card .nav-tabs {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-left: 0;
  list-style: none;
  display: flex;
}

.profile-card .nav-item { list-style: none; }

.profile-card .nav-link {
  cursor: pointer;
  color: var(--text-secondary);
  border: none;
  text-decoration: none;
  padding: 0.5rem 1rem;
  display: inline-block;
  transition: color 0.15s ease;
}

.profile-card .nav-link:hover {
  color: var(--primary-color);
}

.profile-card .nav-link.active {
  color: var(--primary-color);
  font-weight: bold;
  border-bottom: 2px solid var(--primary-color);
}

/* Comparison difference indicators — color + icon */
.diff-higher {
  color: var(--color-higher);
  font-weight: bold;
}

.diff-lower {
  color: var(--color-lower);
  font-weight: bold;
}

/* Rank display — neutral, no color */
.rank-display { }

/* Parenthetical denominator note inside a table row label */
.label-note {
  font-size: 0.82em;
  color: #888;
  font-weight: normal;
}

/* Table note (shown in table pane) */
.table-note {
  font-size: 0.72rem;
  color: #333;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.gt_sourcenote {
  font-size: 0.72rem !important;
}

/* MOE inline display (approach C) */
.moe-inline {
  color: #888;
  font-size: 0.85em;
  font-style: normal;
}

/* MOE sub-line display (approach D): second line below estimate */
.moe-sub {
  display: block;
  color: #aaa;
  font-size: 0.78em;
  font-weight: normal;
  line-height: 1.3;
}

/* MOE right display (approach E): same style but inline after estimate */
.moe-right {
  color: #aaa;
  font-size: 0.68em;
  font-weight: normal;
  margin-left: 0.35em;
}
/* MOE spans hidden by default; toggle button sets body.moe-visible to show */
.moe-right, .moe-sub { display: none; }
body.moe-visible .moe-right { display: inline; }
body.moe-visible .moe-sub { display: block; }
/* In count mode: give MOE a fixed inline-block width so all count estimates
   digit-align at the same column regardless of MOE length */
body.moe-visible .mode-count .moe-right {
  display: inline-block;
  min-width: 6.5ch;
  text-align: left;
}

/* Quick-facts cards need MOE on a second line so values stay inside the card. */
body.moe-visible .stat-single-view .stat-value,
body.moe-visible .stat-comp-view .stat-col-value {
  white-space: normal;
}

body.moe-visible .stat-single-view .stat-value .moe-right,
body.moe-visible .stat-comp-view .stat-col-value .moe-right {
  display: block;
  margin-left: 0;
  margin-top: 0.15rem;
  line-height: 1.05;
}

body.moe-visible .stat-single-view .stat-value .moe-right {
  font-size: 0.62em;
}

body.moe-visible .stat-comp-view .stat-col-value {
  font-size: 0.88rem;
  line-height: 1.1;
}

body.moe-visible .stat-comp-view .stat-col-value .moe-right {
  font-size: 0.5em;
  margin-top: 0.1rem;
}


/* Chart.js canvas container — height set dynamically by JS based on row count */
.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  min-height: 160px;
}

/* Chart annotation: stat card displayed above chart for summary stats on a different scale */
.chart-meta-note {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 7px 12px;
  margin-bottom: 12px;
  background: #f0f7ff;
  border-radius: 6px;
  border: 1px solid #d0e8f8;
}
.chart-meta-note .cmn-label {
  font-size: 11px;
  color: #7a9ab5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chart-meta-note .cmn-value {
  font-size: 18px;
  font-weight: 700;
  color: #3f8bc9;
  line-height: 1.3;
}

.chart-meta-note .cmn-city-nowrap {
  white-space: nowrap;
}

.chart-meta-note .cmn-ward-nowrap {
  white-space: nowrap;
}

.comp-city-nowrap {
  white-space: nowrap;
}

.comp-ward-nowrap {
  white-space: nowrap;
}


/* Chart download button */
.viz-download-container {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.btn-download {
  font-size: 0.8rem;
  color: var(--success-color);
  font-weight: bold;
  text-decoration: none;
}

.btn-download:hover { text-decoration: underline; }

/* Table alignment within profile cards */
.profile-card td { text-align: right !important; }
.profile-card td:first-child { text-align: left !important; }
.profile-card .gt_table { margin: 0 !important; }

/* Section headings inside profile cards */
.profile-card h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  border-bottom: none;
}

/* ============================================================================
   MOBILE TOC - Hide sidebar on mobile / tablet
   ============================================================================ */

@media (max-width: 900px) {
  #quarto-margin-sidebar {
    display: none !important;
  }

  .mobile-section-nav {
    display: block;
    position: sticky;
    top: 58px;
    z-index: 985;
    margin: 0 0 1rem 0;
    padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(4px);
  }

  .mobile-section-nav label {
    display: block;
    margin: 0 0 0.35rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
  }

  .mobile-section-nav select {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    background: white;
    font-size: 0.9rem;
  }
}

/* ============================================================================
   GT TABLE NOTES - Source/universe notes extracted outside the overflow-x:auto
   table container so they wrap at viewport width on mobile.
   JS in ward-template.qmd moves .gt_sourcenote content into .gt-notes-mobile
   and hides the original <tfoot> rows.
   ============================================================================ */

.gt-notes-mobile {
  display: block;
  width: 100%;
  font-size: 0.72rem;
  color: #333;
  padding: 4px 5px 2px;
}

.geo-mismatch-summary {
  margin: 0.8rem 0 1.35rem;
  display: flex;
  justify-content: center;
}

.geo-mismatch-summary-main {
  margin: 0.45rem 0 0;
  justify-content: center;
}

.geo-mismatch-line {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.geo-mismatch-summary-main .geo-mismatch-line {
  font-size: 0.78rem;
}

.geo-mismatch-label {
  color: var(--text-secondary);
}

.geo-mismatch-label a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* ============================================================================
   ABOUT + METHODOLOGY LONGFORM PAGE POLISH
   ============================================================================ */

.geo-mismatch-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
}

.geo-mismatch-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 1px solid #5b8def;
  background: #eef4ff;
  color: #2457c5;
  box-shadow: 0 1px 3px rgba(36, 87, 197, 0.18);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
  padding: 0;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.geo-mismatch-help-link:hover,
.geo-mismatch-help-link[aria-expanded="true"],
.geo-mismatch-help-link:focus {
  background: #2457c5;
  border-color: #1e49a6;
  color: white;
  box-shadow: 0 3px 8px rgba(36, 87, 197, 0.3);
  transform: translateY(-1px);
}

.geo-mismatch-help-link:focus-visible {
  outline: 2px solid rgba(36, 87, 197, 0.3);
  outline-offset: 2px;
}

.geo-mismatch-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #333;
  color: white;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  width: 280px;
  text-align: left;
  z-index: 9999;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.geo-mismatch-tooltip[hidden] {
  display: none;
}

.geo-mismatch-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 6px;
  border: 6px solid transparent;
  border-top-color: #333;
}

.accuracy-map-key {
  margin: 0.75rem 0 1.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.accuracy-map-key-title {
  font-weight: 700;
  margin-bottom: 0.55rem;
  color: var(--text-primary);
}

.accuracy-map-key-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.accuracy-map-key-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.accuracy-map-key-swatch {
  width: 24px;
  height: 15px;
  border: 1.5px dashed #999999;
  flex: 0 0 auto;
  box-sizing: border-box;
}

.accuracy-map-key-swatch-inside {
  background: rgba(67, 147, 195, 0.3);
}

.accuracy-map-key-swatch-outside {
  background: repeating-linear-gradient(
    45deg,
    rgba(244, 162, 97, 0.85),
    rgba(244, 162, 97, 0.85) 2px,
    rgba(67, 147, 195, 0.3) 2px,
    rgba(67, 147, 195, 0.3) 7px
  );
}

.accuracy-map-key-line {
  width: 24px;
  height: 0;
  flex: 0 0 auto;
}

.accuracy-map-key-line-district {
  border-bottom: 6px solid #222222;
}

.accuracy-map-key-line-census {
  border-bottom: 1.35px solid #999999;
}

@media (max-width: 640px) {
  .accuracy-map-key-grid {
    grid-template-columns: 1fr;
  }
}

.gt-notes-mobile p {
  margin: 2px 0;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ============================================================================
   GT TABLE MOBILE - Wrap category labels (first column) on narrow screens
   so the table is narrower and requires less horizontal scrolling.
   The header and row label cells get a max-width and text wrapping.
   ============================================================================ */

@media (max-width: 576px) {
  .viz-download-container {
    display: none;
  }
}

@media (max-width: 576px) {
  .profile-card .tab-pane-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .profile-card .gt_table {
    width: max-content !important;
    min-width: 100% !important;
  }

  .profile-card .gt_table td.gt_row.gt_left:first-child,
  .profile-card .gt_table th.gt_col_heading.gt_left:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    white-space: normal !important;
    max-width: 180px;
    min-width: 130px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .profile-card .gt_table td.gt_row.gt_left:first-child {
    background: var(--bg-card) !important;
  }

  .profile-card .gt_table th.gt_col_heading.gt_left:first-child {
    background: var(--primary-light) !important;
  }

  .profile-card table th:first-child,
  .profile-card table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    white-space: normal;
    min-width: 130px;
    max-width: 180px;
    background: var(--bg-card);
  }

  .profile-card table th:first-child {
    z-index: 2;
    background: var(--primary-color);
  }

}
