/* ==========================================================================
   US State Social Media Youth Restriction Tracker - Styles
   A Tech Policy Press project
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* TPP Brand */
  --red-accent: #FF0033;
  --blue-accent: #1d5d9e;
  --beige-bg: #efe9da;

  /* Text */
  --text-primary: #1a1a1a;
  --text-secondary: #595959;
  --text-light: #666666;

  /* UI */
  --border-color: #e5e5e5;
  --bg-light: #f9f9f9;
  --bg-white: #ffffff;

  /* Status — TPP logo palette (saturated). Text color follows lightness:
     dark fills → white text; light fills → near-black text. */
  --status-enacted: #1B4F8E;       /* navy */
  --status-blocked: #ED9B7E;       /* coral / peach — court-enjoined */
  --status-passed: #4F8068;        /* forest sage */
  --status-introduced: #82B0D6;    /* sky blue */
  --status-discussion: #ECDFC0;    /* warm cream */
  --status-none: #F0F0F0;          /* light gray */

  /* Badge backgrounds and text per contrast rule */
  --badge-enacted-bg: #1B4F8E;
  --badge-enacted-text: #FFFFFF;
  --badge-blocked-bg: #ED9B7E;
  --badge-blocked-text: #1A1A1A;
  --badge-passed-bg: #4F8068;
  --badge-passed-text: #FFFFFF;
  --badge-introduced-bg: #82B0D6;
  --badge-introduced-text: #1A1A1A;
  --badge-discussion-bg: #ECDFC0;
  --badge-discussion-text: #1A1A1A;
  --badge-none-bg: #F0F0F0;
  --badge-none-text: #5D6D7E;

  /* Layout */
  --header-height: auto;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Artifex CF', Georgia, 'Times New Roman', serif;
  background: var(--bg-white);
  line-height: 1.6;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--red-accent);
  text-decoration: underline;
}

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--text-primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 100;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
  color: #fff;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.tracker__header {
  background: var(--bg-white);
  border-bottom: 2px solid var(--text-primary);
  padding: 1.5rem 2rem;
}

.tracker__header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tracker__title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.tracker__subtitle {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.tracker__credit {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 400;
}

.tracker__credit a {
  color: var(--text-light);
  font-weight: 500;
}

.tracker__credit a:hover {
  color: var(--red-accent);
}

.tracker__header-right {
  text-align: right;
}

.header-logo {
  display: inline-block;
  line-height: 0;
}

.header-logo img {
  height: 48px;
  width: auto;
}

/* --------------------------------------------------------------------------
   Stats Bar
   -------------------------------------------------------------------------- */
.tracker__stats {
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
}

.tracker__stats-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.tracker__stat {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.tracker__stat-number {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tracker__stat-label {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Main Layout: Sidebar + Map
   -------------------------------------------------------------------------- */
.tracker__main {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tracker__map {
  width: 100%;
  aspect-ratio: 12 / 5;
  min-height: 280px;
  position: relative;
}

/* Override Mapbox default attribution style */
.tracker__map .mapboxgl-ctrl-attrib {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.7);
}

/* Map tooltip */
.map-tooltip .mapboxgl-popup-content {
  padding: 10px 14px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.map-tooltip .mapboxgl-popup-tip {
  border-top-color: #fff;
}

.tooltip-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tooltip-state {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tooltip-status {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tooltip-status.status-enacted { color: var(--status-enacted); }
.tooltip-status.status-blocked { color: var(--status-enacted); }
.tooltip-status.status-passed { color: var(--status-passed); }
.tooltip-status.status-introduced { color: var(--status-introduced); }
.tooltip-status.status-in_discussion { color: #6699bb; }
.tooltip-status.status-no_activity { color: #888; }

.tooltip-age {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Filter bar (status legend + ban-type chips + search/reset)
   -------------------------------------------------------------------------- */
.tracker__filters {
  background: var(--bg-white);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.filters__row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.filters__row--secondary {
  border-top: 1px solid var(--border-color);
  padding-top: 0.6rem;
}

.filters__label {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  flex-shrink: 0;
  width: 70px;
}

.filters__chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  flex: 1;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-white);
  cursor: pointer;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  color: var(--text-primary);
  user-select: none;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.filter-chip:hover {
  border-color: var(--text-secondary);
}

.filter-chip.is-inactive {
  opacity: 0.4;
  background: var(--bg-light);
}

.filter-chip__swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.filter-chip__swatch--enacted { background: var(--status-enacted); }
.filter-chip__swatch--blocked { background: var(--status-blocked); }
.filter-chip__swatch--passed { background: var(--status-passed); }
.filter-chip__swatch--introduced { background: var(--status-introduced); }
.filter-chip__swatch--in_discussion { background: var(--status-discussion); border: 1px solid #d8cfb8; }
.filter-chip__swatch--no_activity { background: var(--status-none); border: 1px solid #ddd; }

.filter-chip__count {
  font-size: 0.7rem;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

.filters__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.filters__search {
  width: 200px;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  background: var(--bg-white);
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filters__search:focus {
  outline: none;
  border-color: var(--blue-accent);
  box-shadow: 0 0 0 2px rgba(29, 93, 158, 0.1);
}

.filters__search::placeholder {
  color: #aaa;
}

.filters__reset {
  padding: 0.4rem 0.85rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.filters__reset:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.filters__count {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.72rem;
  color: var(--text-light);
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Status Badges
   -------------------------------------------------------------------------- */
.status-badge {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
  white-space: nowrap;
}

.status-badge--enacted {
  background: var(--badge-enacted-bg);
  color: var(--badge-enacted-text);
}

.status-badge--blocked {
  background: var(--badge-blocked-bg);
  color: var(--badge-blocked-text);
}

.status-badge--passed {
  background: var(--badge-passed-bg);
  color: var(--badge-passed-text);
}

.status-badge--introduced {
  background: var(--badge-introduced-bg);
  color: var(--badge-introduced-text);
}

.status-badge--in_discussion {
  background: var(--badge-discussion-bg);
  color: var(--badge-discussion-text);
}

.status-badge--no_activity {
  background: var(--badge-none-bg);
  color: var(--badge-none-text);
}

/* --------------------------------------------------------------------------
   State Table Section
   -------------------------------------------------------------------------- */
.tracker__table-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem 2rem;
}

.table__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0 0.75rem;
  border-bottom: 2px solid var(--text-primary);
  margin-bottom: 0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.table__title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Table grid */
.table__grid {
  width: 100%;
  border-collapse: collapse;
}

.table__header-row {
  background: var(--bg-light);
}

.table__header-cell {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.table__header-cell:hover {
  color: var(--text-primary);
}

.table__header-cell.is-sorted {
  color: var(--text-primary);
}

.table__sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.6rem;
  vertical-align: middle;
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.table__header-cell.is-sorted .table__sort-arrow {
  opacity: 1;
}

/* Table rows */
.table__row {
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s ease;
}

.table__row:hover {
  background: var(--bg-light);
}

.table__row.is-selected {
  background: #FFF8E1;
}

.table__row.is-highlight {
  animation: rowHighlight 1.5s ease-out;
}

@keyframes rowHighlight {
  0% { background: rgba(255, 0, 51, 0.1); }
  100% { background: transparent; }
}

.table__cell {
  padding: 0.75rem;
  font-size: 0.9rem;
  vertical-align: middle;
}

.table__cell--state {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  min-width: 140px;
}

.table__cell--state .table__expand-icon {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.6rem;
  color: var(--text-light);
  transition: transform 0.3s ease;
}

.table__row.is-expanded .table__cell--state .table__expand-icon {
  transform: rotate(180deg);
}

.table__cell--status {
  width: 150px;
}

.table__cell--age {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  width: 80px;
}

.table__cell--bill {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table__cell--ban-type {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  width: 160px;
}

.table__cell--date {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
  width: 100px;
}

/* --------------------------------------------------------------------------
   Expanded Row Detail
   -------------------------------------------------------------------------- */
.table__expanded-content {
  display: none;
  background: var(--bg-light);
}

.table__row.is-expanded + .table__expanded-content {
  display: table-row;
}

.expanded__inner {
  padding: 1.25rem 1.5rem 1.5rem;
}

.expanded__summary {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.expanded__section {
  margin-bottom: 1.25rem;
}

.expanded__section:last-child {
  margin-bottom: 0;
}

.expanded__heading {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.expanded__meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.expanded__meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.expanded__meta-label {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}

.expanded__meta-value {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.expanded__meta-value a {
  color: var(--blue-accent);
}

.expanded__meta-value a:hover {
  color: var(--red-accent);
}

.expanded__law {
  background: var(--bg-white);
  border-left: 3px solid var(--red-accent);
  padding: 0.75rem 1rem;
  margin-top: 0.25rem;
}

.expanded__law-name {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.expanded__law-name a {
  color: var(--text-primary);
}

.expanded__law-name a:hover {
  color: var(--blue-accent);
}

.expanded__updated {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

/* Recent News */
.expanded__articles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.expanded__article {
  padding: 0.6rem 0.75rem;
  background: var(--bg-light);
  border-left: 3px solid var(--blue-accent);
  border-radius: 0 3px 3px 0;
}

.expanded__article-title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.expanded__article-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.expanded__article-title a:hover {
  color: var(--red-accent);
  text-decoration: underline;
}

.expanded__article-meta {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* No results */
.table__no-results {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.tracker__footer {
  background: #111;
  padding: 2.5rem 2rem;
  margin-top: 2rem;
}

.tracker__footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2rem;
}

.tracker__footer .footer-logo {
  display: block;
  flex-shrink: 0;
}

.tracker__footer .footer-logo img {
  height: 80px;
  width: auto;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.tracker__footer .footer-logo:hover img {
  opacity: 1;
}

.tracker__methodology {
  text-align: left;
}

.tracker__methodology-heading {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.75rem;
}

.tracker__methodology p {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.7rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 0.75rem;
}

.tracker__methodology p:last-child {
  margin-bottom: 0;
}

.tracker__footer a {
  color: rgba(255, 255, 255, 0.7);
}

.tracker__footer a:hover {
  color: #fff;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Loading State
   -------------------------------------------------------------------------- */
.tracker__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.tracker__loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--blue-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .table__row,
  .table__expanded-content,
  .filter-chip,
  .table__header-cell {
    transition: none !important;
    animation: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* --------------------------------------------------------------------------
   Responsive: Mobile (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .tracker__header {
    padding: 1rem 1.25rem;
  }

  .tracker__header-inner {
    flex-direction: column;
    gap: 0.25rem;
  }

  .tracker__title {
    font-size: 1.25rem;
  }

  .header-logo img {
    height: 36px;
  }

  .tracker__stats {
    padding: 0.6rem 1.25rem;
  }

  .tracker__stats-inner {
    gap: 1.25rem;
    flex-wrap: wrap;
  }

  /* Filter bar stacks: status row, ban-type row, search/reset row, count */
  .tracker__filters {
    padding: 0.75rem 1rem;
  }

  .filters__label {
    width: auto;
    flex-basis: 100%;
  }

  .filters__row--secondary {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .filters__actions {
    margin-left: 0;
    width: 100%;
  }

  .filters__search {
    flex: 1;
    width: auto;
  }

  .tracker__table-section {
    padding: 0 1.25rem 1.5rem;
  }

  .table__header {
    flex-direction: column;
    align-items: stretch;
  }

  /* Make table scrollable horizontally */
  .table__grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table__cell--bill {
    max-width: 120px;
  }

  .table__cell--ban-type {
    display: none;
  }

  .tracker__footer {
    padding: 2rem 1.25rem;
  }

  .tracker__footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .tracker__footer .footer-logo img {
    height: 60px;
  }
}

/* --------------------------------------------------------------------------
   Responsive: Small Mobile (< 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .tracker__title {
    font-size: 1.1rem;
  }

  .tracker__stat-number {
    font-size: 1.1rem;
  }

  .tracker__stats-inner {
    gap: 1rem;
  }

  .filter-chip {
    font-size: 0.72rem;
    padding: 0.28rem 0.55rem;
  }
}

/* --------------------------------------------------------------------------
   Embed Mode
   -------------------------------------------------------------------------- */

/* Open full page link — hidden by default, shown in embed mode */
.embed-fullpage-link {
  display: none;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.embed-fullpage-link:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

.embed-fullpage-link svg {
  flex-shrink: 0;
}

body.is-embed {
  overflow: auto;
}

body.is-embed .tracker__header {
  padding: 0.75rem 1rem;
}

body.is-embed .tracker__header-inner {
  align-items: center;
}

body.is-embed .tracker__title {
  font-size: 1.1rem;
}

body.is-embed .tracker__subtitle {
  display: none;
}

body.is-embed .tracker__credit {
  display: none;
}

body.is-embed .header-logo {
  display: none;
}

body.is-embed .embed-fullpage-link {
  display: inline-flex;
}

body.is-embed .tracker__stats {
  padding: 0.5rem 1rem;
}

body.is-embed .tracker__stats-inner {
  gap: 1rem;
}

/* Embed: don't override aspect-ratio. The base 280px floor handles narrow
   widths (< ~672px); above that, aspect-ratio gives the natural fit and the
   Mapbox attribution sits flush against the data instead of floating below
   empty grey. */

body.is-embed .tracker__footer {
  padding: 1.5rem 1rem;
  margin-top: 1rem;
}

body.is-embed .tracker__filters {
  padding: 0.6rem 1rem;
}

body.is-embed .tracker__table-section {
  padding: 0 1rem 1.5rem;
}

/* Embed: card-based table layout */
body.is-embed .table__grid-wrapper {
  overflow-x: visible;
}

body.is-embed .table__grid {
  display: block;
}

body.is-embed .table__grid thead {
  display: none;
}

body.is-embed .table__grid tbody {
  display: block;
}

body.is-embed .table__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

body.is-embed .table__cell {
  display: block;
  padding: 0;
  border: none;
}

body.is-embed .table__cell--state {
  width: 100%;
  font-weight: 600;
  font-size: 0.95rem;
}

body.is-embed .table__cell--status {
  order: 1;
}

body.is-embed .table__cell--age {
  order: 2;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

body.is-embed .table__cell--age::before {
  content: 'Age: ';
  font-weight: 500;
}

body.is-embed .table__cell--bill {
  display: none;
}

body.is-embed .table__cell--ban-type {
  display: none;
}

body.is-embed .table__expanded-content {
  display: none;
}

body.is-embed .table__row.is-expanded + .table__expanded-content {
  display: block;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
}

body.is-embed .table__expanded-content td {
  display: block;
  padding: 0.5rem 0 0.75rem;
}
