/* ==========================================================================
   Global Social Media Age 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 - choropleth and badges */
  --status-implemented: #1B4F72;
  --status-passed: #2874A6;
  --status-consideration: #5DADE2;
  --status-proposed: #AED6F1;
  --status-discussion: #D5DBDB;
  --status-none: #F4F6F6;

  /* Badge backgrounds and text for contrast */
  --badge-implemented-bg: #1B4F72;
  --badge-implemented-text: #FFFFFF;
  --badge-passed-bg: #2874A6;
  --badge-passed-text: #FFFFFF;
  --badge-consideration-bg: #D6EAF8;
  --badge-consideration-text: #1B4F72;
  --badge-proposed-bg: #EBF5FB;
  --badge-proposed-text: #2874A6;
  --badge-discussion-bg: #F2F3F4;
  --badge-discussion-text: #5D6D7E;

  /* Layout */
  --sidebar-width: 260px;
  --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;
  min-height: 520px;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.tracker__sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  border-right: 1px solid var(--border-color);
  padding: 1.25rem 1.25rem 1.25rem 2rem;
  background: var(--bg-white);
}

.sidebar__section {
  margin-bottom: 1.5rem;
}

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

.sidebar__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.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar__controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sidebar__control-btn {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.65rem;
  color: var(--blue-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}

.sidebar__control-btn:hover {
  color: var(--red-accent);
  text-decoration: underline;
}

.sidebar__filter-list {
  list-style: none;
}

.sidebar__filter-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.15s ease;
}

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

.sidebar__checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid #999;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
  background: var(--bg-white);
}

.sidebar__filter-item.is-active .sidebar__checkbox {
  background: var(--blue-accent);
  border-color: var(--blue-accent);
}

.sidebar__checkbox-check {
  display: none;
  width: 10px;
  height: 10px;
  color: #fff;
}

.sidebar__filter-item.is-active .sidebar__checkbox-check {
  display: block;
}

.sidebar__label {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  color: var(--text-primary);
  flex: 1;
  user-select: none;
  font-weight: 400;
}

.sidebar__count {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.65rem;
  color: var(--text-light);
  background: var(--bg-light);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* Status color swatches in filter list */
.sidebar__swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sidebar__swatch--implemented { background: var(--status-implemented); }
.sidebar__swatch--passed { background: var(--status-passed); }
.sidebar__swatch--in_consideration { background: var(--status-consideration); }
.sidebar__swatch--proposed { background: var(--status-proposed); border: 1px solid #85C1E9; }
.sidebar__swatch--under_discussion { background: var(--status-discussion); border: 1px solid #BDC3C7; }

/* Search box */
.sidebar__search {
  margin-top: 0.25rem;
}

.sidebar__search-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  transition: border-color 0.2s;
  background: var(--bg-white);
  color: var(--text-primary);
}

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

.sidebar__search-input::placeholder {
  color: #aaa;
}

/* Reset button */
.sidebar__reset {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.75rem;
  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;
  transition: all 0.15s ease;
  font-weight: 500;
}

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

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

/* Mobile filter toggle button */
.tracker__filter-toggle {
  display: none;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: var(--bg-white);
  border: none;
  border-bottom: 1px solid var(--border-color);
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  font-weight: 500;
}

.tracker__filter-toggle svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-right: 6px;
}

.tracker__filter-toggle .filter-count {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-left: 4px;
}

/* --------------------------------------------------------------------------
   Map Panel
   -------------------------------------------------------------------------- */
.tracker__map-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.tracker__map {
  flex: 1;
  min-height: 480px;
  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-country {
  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-implemented { color: var(--status-implemented); }
.tooltip-status.status-passed { color: var(--status-passed); }
.tooltip-status.status-in_consideration { color: var(--status-consideration); }
.tooltip-status.status-proposed { color: #6699bb; }
.tooltip-status.status-under_discussion { color: #888; }

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

/* --------------------------------------------------------------------------
   Legend
   -------------------------------------------------------------------------- */
.tracker__legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--bg-white);
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

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

.legend__item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend__swatch--implemented { background: var(--status-implemented); }
.legend__swatch--passed { background: var(--status-passed); }
.legend__swatch--in_consideration { background: var(--status-consideration); }
.legend__swatch--proposed { background: var(--status-proposed); border: 1px solid #85C1E9; }
.legend__swatch--under_discussion { background: var(--status-discussion); border: 1px solid #BDC3C7; }
.legend__swatch--none { background: var(--status-none); border: 1px solid #ddd; }

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

/* --------------------------------------------------------------------------
   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--implemented {
  background: var(--badge-implemented-bg);
  color: var(--badge-implemented-text);
}

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

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

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

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

/* --------------------------------------------------------------------------
   Country 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__search {
  position: relative;
}

.table__search-input {
  padding: 0.45rem 0.75rem 0.45rem 2rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  width: 220px;
  transition: border-color 0.2s;
}

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

.table__search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #aaa;
}

/* 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--country {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  min-width: 160px;
}

.table__cell--country .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--country .table__expand-icon {
  transform: rotate(180deg);
}

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

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

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

.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__bullets {
  list-style: none;
  padding: 0;
}

.expanded__bullet {
  padding: 0.4rem 0;
  padding-left: 1rem;
  position: relative;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.expanded__bullet::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-light);
}

.expanded__bullet-source {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.expanded__bullet-source a {
  color: var(--blue-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__law-dates {
  font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.expanded__articles {
  list-style: none;
  padding: 0;
}

.expanded__article {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-color);
}

.expanded__article:last-child {
  border-bottom: none;
}

.expanded__article-title {
  font-size: 0.9rem;
  color: var(--text-primary);
}

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

.expanded__article-title a:hover {
  color: var(--blue-accent);
}

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

.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);
}

/* 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,
  .tracker__sidebar,
  .table__expanded-content,
  .sidebar__checkbox,
  .sidebar__filter-item,
  .table__header-cell {
    transition: none !important;
    animation: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* --------------------------------------------------------------------------
   Responsive: Tablet (768-1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .tracker__sidebar {
    width: 210px;
    min-width: 210px;
    padding: 1rem;
  }

  .tracker__map {
    min-height: 420px;
  }
}

/* --------------------------------------------------------------------------
   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;
  }

  /* Show filter toggle */
  .tracker__filter-toggle {
    display: flex;
    align-items: center;
  }

  /* Mobile layout: stack vertically */
  .tracker__main {
    flex-direction: column;
    min-height: auto;
  }

  /* Sidebar becomes collapsible drawer */
  .tracker__sidebar {
    width: 100%;
    min-width: 100%;
    max-height: 0;
    overflow: hidden;
    padding: 0 1.25rem;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    transition: max-height 0.3s ease, padding 0.3s ease;
  }

  .tracker__sidebar.is-open {
    max-height: 600px;
    padding: 1rem 1.25rem;
    overflow-y: auto;
  }

  .tracker__map {
    min-height: 300px;
  }

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

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

  .table__search-input {
    width: 100%;
  }

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

  .table__cell--law {
    max-width: 180px;
  }

  .tracker__footer {
    padding: 2rem 1.25rem;
  }

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

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

  .tracker__legend {
    padding: 0.5rem 1rem;
    gap: 0.6rem;
  }

  .legend__label {
    font-size: 0.6rem;
  }
}

/* --------------------------------------------------------------------------
   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;
  }

  .legend__item {
    gap: 0.2rem;
  }

  .legend__swatch {
    width: 10px;
    height: 10px;
  }

  .legend__label {
    font-size: 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;
}

body.is-embed .tracker__map {
  min-height: 380px;
}

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

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

body.is-embed .tracker__filter-toggle {
  display: flex;
}

body.is-embed .tracker__sidebar.is-open {
  display: block;
  position: absolute;
  z-index: 10;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: var(--sidebar-width);
}

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__row:hover {
  background: var(--bg-hover);
}

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

body.is-embed .table__cell--country {
  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--law {
  display: none;
}

body.is-embed .table__cell--date {
  order: 3;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-left: auto;
}

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;
}
