:root {
  --itsbad-navy: #07111F;
  --itsbad-navy-2: #0A1630;
  --itsbad-white: #F4F7FF;
  --itsbad-muted: #B3BFD8;
  --itsbad-pink: #FF66C4;
  --itsbad-cyan: #5FD4FF;
  --itsbad-violet: #8A7DFF;
  --itsbad-indigo: #3A3B78;

  --ink: #07111F;
  --muted: #58667A;
  --brand: #3A3B78;
  --brand-dark: #171845;
  --line: #DDE3ED;
  --line-strong: #A8B3C5;
  --neutral: #F6F8FC;
  --info: #3A3B78;
  --focus: #5FD4FF;

  /* Public-health severity colors remain independent from brand colors. */
  --danger: #8F2D2A;
  --danger-bg: #FFF5F4;
  --warning: #7A4B00;
  --warning-bg: #FFF9E8;
  --historical: #665E78;

  --surface: #FFFFFF;
  --surface-soft: #F7F8FC;
  --surface-brand: #F4F3FB;
  --shadow-soft: 0 8px 28px rgba(7, 17, 31, .07);
  --shadow-lift: 0 14px 38px rgba(7, 17, 31, .11);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html {
  background: var(--surface);
  -webkit-text-size-adjust: 100%;
}
html, body, button, input, textarea, select {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body {
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.58;
}
h1, h2, h3 {
  color: var(--ink);
  text-wrap: balance;
}
h1 {
  font-size: clamp(2rem, 10vw, 3.2rem);
  line-height: 1.04;
  letter-spacing: -.035em;
}
h2 {
  font-size: clamp(1.45rem, 6vw, 2rem);
  letter-spacing: -.025em;
}
h3 { letter-spacing: -.018em; }
p { text-wrap: pretty; }
a { color: var(--itsbad-indigo); }
a:hover { color: #25265C; }

/* Mobile-first masthead: restrained parent-brand attribution. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 4rem;
  padding: .55rem 1rem;
  gap: .75rem;
  background: var(--itsbad-navy);
  border-bottom: 1px solid #202C44;
  box-shadow: 0 5px 22px rgba(7, 17, 31, .12);
}
.site-header .brand,
.site-header nav a,
.site-header .more-menu summary { color: var(--itsbad-white); }
.site-header .brand strong {
  font-size: 1.05rem;
  letter-spacing: -.02em;
}
.site-header .brand small {
  margin-top: .16rem;
  color: var(--itsbad-muted);
  font-size: .68rem;
  font-weight: 600;
}
.site-header nav a[aria-current="page"] {
  text-decoration-color: var(--itsbad-pink);
  text-decoration-thickness: 3px;
  text-underline-offset: .28em;
}
.site-header nav a:hover,
.site-header .more-menu summary:hover { color: var(--itsbad-cyan); }
.site-header .menu-button {
  display: block;
  min-width: 3.25rem;
  min-height: 44px;
  padding: .45rem .75rem;
  color: var(--itsbad-white);
  background: #121F36;
  border: 1px solid #3A4964;
  border-radius: var(--radius-sm);
}
.site-header nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: .5rem 1rem 1rem;
  background: var(--itsbad-navy-2);
  border-bottom: 1px solid #34405A;
  box-shadow: 0 16px 30px rgba(7,17,31,.22);
}
.site-header nav[data-open="true"] { display: block; }
.primary-nav { flex-direction: column; align-items: stretch; gap: 0; }
.site-header nav a { min-height: 48px; padding: .65rem 0; }
.more-item { position: static; }
.more-menu > summary { display: none; }
.secondary-nav {
  position: static;
  min-width: 0;
  padding: 0 !important;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* Global mobile-first content rhythm */
main { padding-inline: 1rem; }
.page {
  padding-top: 1.75rem;
  padding-bottom: 2.75rem;
}
.page > .content-section,
.content-section,
.disclosure,
.support-links,
.about {
  max-width: 72rem;
}
.page article > p,
.page article > ul,
.page article > ol,
.page article > dl,
.page article > h2,
.page article > h3 {
  max-width: 46rem;
}
.content-section { padding-top: 2.25rem; }
.content-section + .content-section { margin-top: 2.75rem; }

/* Primary task: intentionally simple on a phone */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 0 -1rem;
  padding: 2rem 1rem 1.6rem;
  border: 0;
  border-bottom: 1px solid #D7DCE8;
  border-radius: 0;
  background: #F5F6FA;
  box-shadow: inset 0 4px 0 var(--itsbad-pink);
}
.hero-copy { max-width: 36rem; }
.hero h1 { max-width: 11ch; margin-bottom: .7rem; }
.hero .lede {
  max-width: 31rem;
  margin-bottom: 1.25rem;
  color: #3D4A60;
  font-size: 1.05rem;
}
.hero-actions { width: 100%; max-width: 28rem; }
.scan-action {
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  box-shadow: 0 8px 20px rgba(58, 59, 120, .18);
}
.hero .manual-action { align-self: center; }
.hero .data-facts {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #D9DEEA;
  color: var(--muted);
  font-size: .85rem;
}
.barcode-signature { display: none; }

/* Brand actions; safety actions remain red/amber elsewhere */
.primary,
.button--primary,
.filters button[aria-pressed="true"] {
  background: var(--itsbad-indigo);
  border-color: var(--itsbad-indigo);
  color: #fff;
}
.primary:hover,
.button--primary:hover { background: #25265C; }
.manual-action,
.text-button,
.button--text,
.recall-card .secondary { color: var(--itsbad-indigo); }
.secondary,
.button--secondary {
  border-color: #AAB5C7;
  border-radius: var(--radius-sm);
}

/* Working states feel calm and precise */
.card,
.results {
  width: 100%;
  max-width: 42rem;
  margin: 1rem 0 2rem;
  padding: 1.1rem;
  border-color: #C9D1DF;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
input,
textarea {
  border-color: #AEB8C9;
  border-radius: var(--radius-sm);
  background: #fff;
}
input:focus,
textarea:focus { border-color: var(--itsbad-indigo); }

/* Messy data becomes a readable signal stack */
.recent-section { margin-top: 2.5rem; }
.section-heading {
  align-items: flex-start;
  flex-direction: column;
  gap: .35rem;
}
.recall-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .9rem;
  margin-top: 1rem;
}
.recall-card,
.recall-card:first-child {
  position: relative;
  min-width: 0;
  padding: 1rem 1rem 1rem 1.15rem;
  background: #fff;
  border: 1px solid #E0E5ED;
  border-left: 4px solid var(--danger) !important;
  border-radius: var(--radius-md);
  box-shadow: 0 5px 18px rgba(7,17,31,.055);
}
.recall-card::before {
  margin-bottom: .35rem;
  color: var(--danger);
  font-size: .7rem;
  letter-spacing: .09em;
}
.recall-card h3 {
  margin: 0 0 .55rem;
  font-size: 1.04rem;
  line-height: 1.3;
}
.recall-card .recall-meta {
  margin: 0 0 .7rem;
  color: #637087;
  font-size: .78rem;
  font-weight: 600;
}
.recall-card p:not(.recall-meta):not(.category) {
  display: block;
  margin: .55rem 0;
  overflow: visible;
  color: #263348;
  font-size: .92rem;
  line-height: 1.46;
}
.recall-card .category {
  display: inline-flex;
  flex-wrap: wrap;
  margin: .65rem 0 .8rem;
  color: #5C5678;
  font-size: .78rem;
  font-weight: 700;
}
.recall-card .secondary {
  min-height: 44px;
  align-items: center;
  padding: 0;
  font-size: .9rem;
}

/* Filters behave like a mobile control rail, not a wall of buttons */
.filters,
.page .filters {
  display: flex;
  flex-wrap: nowrap;
  gap: .5rem;
  margin: 1.1rem -1rem 1.4rem;
  padding: .1rem 1rem .45rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filters::-webkit-scrollbar,
.page .filters::-webkit-scrollbar { display: none; }
.filters button,
.page .filters button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: .55rem .85rem;
  border: 1px solid #CBD3E0;
  border-radius: 999px;
  background: #fff;
  color: #263348;
  font-size: .86rem;
  font-weight: 700;
  white-space: nowrap;
}
.filters button[aria-pressed="true"],
.page .filters button[aria-pressed="true"] {
  color: #fff;
  background: var(--itsbad-indigo);
  border-color: var(--itsbad-indigo);
  box-shadow: 0 5px 14px rgba(58,59,120,.16);
}

/* Data provenance is important but visually secondary */
.data-status {
  margin-top: 1.4rem;
  padding: .85rem 1rem;
  border: 1px solid #D8DFEA;
  border-radius: var(--radius-md);
  background: #F8F9FC;
  color: #445168;
  font-size: .86rem;
}
.data-status p { margin: .35rem 0; }
.disclosure > summary {
  min-height: 52px;
  font-size: 1rem;
}

/* Explain the process without making it feel like documentation */
.how-section {
  margin-top: 3rem;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  background: #F7F5FA;
  box-shadow: 0 0 0 100vmax #F7F5FA;
}
.steps {
  grid-template-columns: 1fr;
  gap: 1.35rem;
}
.steps li > span {
  width: 2.15rem;
  height: 2.15rem;
  border-color: var(--itsbad-pink);
  border-radius: 50%;
  color: var(--itsbad-navy);
}
.support-links a {
  min-height: 56px;
  color: var(--itsbad-indigo);
}

/* Detail/result hierarchy */
.result {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.result--critical { border-top-color: var(--danger); }
.button--critical { background: var(--danger); color: #fff; }
.result--warning,
.result--warning-critical { border-top-color: var(--warning); }
.result--historical { border-top-color: var(--historical); }
.result-heading { font-size: clamp(1.55rem, 7vw, 2.35rem); }
.result-summary,
.result-details { padding-inline: 1rem; }
.details {
  grid-template-columns: 1fr;
  gap: .15rem;
}
.details dt {
  margin-top: .8rem;
  color: #667187;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.details dd { margin-bottom: .2rem; }

/* Footer as a polished parent-brand anchor */
footer {
  margin-top: 3.5rem;
  padding: 2.5rem 1rem;
  background: var(--itsbad-navy);
  color: var(--itsbad-white);
  border-top: 4px solid var(--itsbad-pink);
}
footer a { color: var(--itsbad-cyan); }
footer a:hover { color: #fff; }
footer .footer-brand span,
footer #footer-updated,
footer .copyright { color: var(--itsbad-muted); }
footer strong { color: #fff; }
footer nav { gap: .5rem 1rem; }

@media (min-width: 640px) {
  .site-header { padding-inline: 1.5rem; }
  main { padding-inline: 1.5rem; }
  .page { padding-top: 2.5rem; }
  .hero {
    margin-inline: 0;
    padding: 2.5rem;
    border: 1px solid #D4DAE6;
    border-radius: var(--radius-lg);
  }
  .filters,
  .page .filters {
    margin-inline: 0;
    padding-inline: 0;
  }
  .recall-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .section-heading { flex-direction: row; align-items: baseline; justify-content: space-between; }
  .details { grid-template-columns: minmax(9rem, max-content) 1fr; gap: .55rem 1.25rem; }
  .details dt { margin-top: 0; }
}

@media (min-width: 800px) {
  .site-header {
    min-height: 4.5rem;
    padding-inline: max(1.5rem, calc((100% - var(--wide))/2));
  }
  .site-header .menu-button { display: none; }
  .site-header nav {
    display: block;
    position: static;
    margin-left: auto;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .primary-nav { flex-direction: row; align-items: center; gap: 1.4rem; }
  .site-header nav a { min-height: 44px; padding: .4rem 0; }
  .more-item { position: relative; }
  .more-menu > summary { display: flex; }
  .secondary-nav {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 13rem;
    padding: .45rem .9rem !important;
    background: var(--itsbad-navy-2);
    border: 1px solid #34405A;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lift);
  }
  .hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(15rem, .72fr);
    gap: clamp(2rem, 6vw, 5rem);
    align-items: center;
    margin-top: 1.5rem;
    padding: clamp(2.75rem, 5vw, 4.25rem);
  }
  .barcode-signature { display: flex; color: var(--itsbad-indigo); opacity: .9; }
}

@media (min-width: 1120px) {
  .recall-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.15rem; }
  .recall-card { padding: 1.15rem 1.15rem 1.1rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
