/* Site-wide responsive layout — desktop + mobile */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

/* Constrain emoji favicon-style inline SVGs in cards */
.card svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* ── Navigation (index + hubs) ── */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}

.site-nav-link {
  color: #486581;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  line-height: 1.4;
  padding: 0.2rem 0;
}

.site-nav-link:hover {
  color: #243b53;
}

.site-nav-sep {
  display: none;
  color: #d9e2ec;
  user-select: none;
}

@media (min-width: 768px) {
  .site-nav { gap: 0.25rem 0.5rem; }
  .site-nav-sep { display: inline; }
  .site-nav-link { font-size: 0.875rem; }
}

/* ── Index tabs ── */
.tab-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0.35rem;
  padding: 0.35rem;
}

@media (min-width: 520px) {
  .tab-list {
    flex-direction: row;
    width: auto;
  }
}

.tab-list button {
  text-align: center;
  white-space: normal;
  line-height: 1.35;
}

@media (max-width: 519px) {
  .tab-list button {
    width: 100%;
    padding: 0.65rem 0.75rem !important;
    font-size: 0.8125rem !important;
  }
}

/* ── Index vaccine cards ── */
.card {
  min-width: 0;
}

.age-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.68rem;
  line-height: 1.3;
  max-width: 100%;
}

/* ── Collapsible methodology (mobile) ── */
.methodology-details {
  border-radius: 0.5rem;
}

.methodology-details summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  padding: 0.25rem 0;
  color: #334e68;
}

.methodology-details summary::-webkit-details-marker { display: none; }

.methodology-details summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s;
}

.methodology-details[open] summary::before {
  transform: rotate(90deg);
}

@media (min-width: 768px) {
  .methodology-details summary { display: none; }
  .methodology-details { pointer-events: none; }
  .methodology-details .methodology-body { display: block; }
}

@media (max-width: 767px) {
  .methodology-details:not([open]) .methodology-body { display: none; }
}

/* ── Tables site-wide ── */
.overflow-x-auto,
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.overflow-x-auto table {
  min-width: 560px;
}

@media (max-width: 768px) {
  .section-card,
  #vaers-lot-signals-table .lot-product-block {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .section-card table,
  table.lot-pv-table,
  #vaers-lot-signals-table table {
    min-width: 520px;
  }
}

/* ── Surveillance chart grids ── */
@media (max-width: 640px) {
  .sv-multi-grid,
  .sv-dual-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .sv-panel {
    padding: 10px !important;
  }

  .sv-panel canvas,
  #ae-pie-container-cv canvas,
  #ae-pie-container-pmda canvas,
  #ae-pie-container-vaers canvas,
  #ae-pie-container-vigiaccess canvas,
  #ae-pie-container-lareb canvas,
  #ae-pie-container-eudra canvas,
  #ae-pie-container-daen canvas {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  .ae-pie-layout {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .ae-pie-legend {
    max-width: 100% !important;
  }
}

/* ── Vaccine page headers ── */
@media (max-width: 640px) {
  header .max-w-4xl,
  header .max-w-5xl {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  header h1 {
    font-size: 1.5rem !important;
    line-height: 1.25 !important;
  }

  header h1 span {
    display: block;
    font-size: 1rem !important;
    margin-top: 0.35rem;
  }

  .section-card {
    padding: 1rem !important;
  }

  .section-card h2 {
    font-size: 1.25rem !important;
  }

  main.max-w-4xl,
  main.max-w-5xl {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* ── Lot dashboard (vaers-lot-dashboard.html) ── */
@media (max-width: 640px) {
  .wrap { padding: 0 12px !important; }
  header { padding: 16px 0 !important; }
  h1 { font-size: 1.25rem !important; }
  .vax-section { padding: 12px !important; }
  .vax-title { flex-direction: column; align-items: flex-start !important; }
  .bar .wrap { flex-direction: column !important; align-items: flex-start !important; gap: 6px !important; }
  table { min-width: 460px; font-size: 10px !important; }
  .pv-overview { padding: 12px !important; }
}

/* ── Touch targets ── */
@media (pointer: coarse) {
  a.inline-flex,
  .tab-list button,
  select,
  .vt-btn {
    min-height: 44px;
  }

  .site-nav-link {
    padding: 0.35rem 0.15rem;
  }
}

/* ── Hero CTA buttons (index) ── */
@media (max-width: 400px) {
  .hero-cta-group {
    flex-direction: column !important;
  }

  .hero-cta-group a {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}