:root {
  color-scheme: dark;
  --ink: #071016;
  --ink-2: #0d1921;
  --paper: #f4f1e9;
  --paper-2: #e7e0d3;
  --text: #f7f3ea;
  --muted: #9fb0b9;
  --muted-dark: #50616a;
  --line: rgba(232, 238, 239, 0.14);
  --line-dark: rgba(9, 18, 24, 0.14);
  --cyan: #39c8d6;
  --amber: #f4b43f;
  --red: #e9554f;
  --green: #68c772;
  --blue: #75a7ff;
  --violet: #a58bff;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.2);
  --radius: 8px;
  --max: 1380px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 78% 0%, rgba(57, 200, 214, 0.2), transparent 28rem),
    radial-gradient(circle at 92% 20%, rgba(233, 85, 79, 0.14), transparent 24rem),
    linear-gradient(180deg, rgba(7, 16, 22, 0), rgba(3, 9, 13, 0.84) 78%),
    var(--ink);
  color: var(--text);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.12;
  background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: screen;
}

#chemical-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.92;
}

.reduced-motion #chemical-field {
  opacity: 0;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 2;
}

.site-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 22, 0.88);
  backdrop-filter: blur(18px);
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 50%;
  background:
    radial-gradient(circle at 65% 35%, var(--cyan) 0 3px, transparent 4px),
    radial-gradient(circle at 34% 68%, var(--amber) 0 2px, transparent 3px);
  box-shadow: 0 0 28px rgba(57, 200, 214, 0.35);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.6vw, 28px);
  font-size: 0.76rem;
  color: rgba(247, 243, 234, 0.78);
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--text);
}

.hero {
  position: relative;
  min-height: calc(100dvh - 61px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  align-items: end;
  gap: clamp(28px, 6vw, 72px);
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(60px, 9vh, 110px) clamp(18px, 4vw, 48px) clamp(44px, 7vh, 74px);
}

.hero::before {
  content: "";
  position: absolute;
  left: clamp(18px, 4vw, 48px);
  right: clamp(18px, 4vw, 48px);
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(57, 200, 214, 0), rgba(57, 200, 214, 0.6), rgba(233, 85, 79, 0));
}

.hero h1 {
  max-width: 900px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.35rem, 8vw, 7.45rem);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: 0;
  text-wrap: balance;
}

.hero-copy p {
  max-width: 690px;
  margin: 28px 0 0;
  color: rgba(247, 243, 234, 0.76);
  font-size: clamp(1rem, 1.6vw, 1.28rem);
  line-height: 1.58;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 1px;
  max-width: 780px;
  margin-top: 28px;
  border: 1px solid rgba(247, 243, 234, 0.13);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(247, 243, 234, 0.09);
  box-shadow: var(--shadow-soft);
}

.hero-stat {
  min-height: 92px;
  padding: 16px;
  background: rgba(7, 16, 22, 0.74);
}

.hero-stat strong {
  display: block;
  color: var(--paper);
  font-size: clamp(1.5rem, 2.6vw, 2.3rem);
  line-height: 1;
}

.hero-stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.28;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--paper);
  color: var(--ink);
}

.button.ghost,
.button.secondary {
  border-color: rgba(247, 243, 234, 0.26);
  background: rgba(247, 243, 234, 0.06);
  color: var(--text);
}

.hero-brief {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(247, 243, 234, 0.08), rgba(247, 243, 234, 0.02)),
    rgba(9, 21, 29, 0.78);
  box-shadow: var(--shadow);
}

.hero-brief .label,
.section-kicker {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero-brief p:not(.label) {
  margin: 0;
  color: rgba(247, 243, 234, 0.74);
  line-height: 1.55;
}

.hero-brief dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0 0;
}

.hero-brief dt {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.hero-brief dd {
  margin: 6px 0 0;
  font-size: 0.86rem;
  font-weight: 800;
}

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(62px, 8vw, 104px) clamp(18px, 4vw, 48px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 88px;
}

.section-heading {
  margin-bottom: 28px;
}

.section-heading.split {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.section h2 {
  max-width: 940px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 4.8vw, 5rem);
  font-weight: 500;
  line-height: 1;
  text-wrap: balance;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(7, 16, 22, 0.72);
}

.metric {
  min-height: 174px;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric strong {
  display: block;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 5vw, 5.2rem);
  font-weight: 500;
  line-height: 0.96;
}

.metric span {
  display: block;
  max-width: 210px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.summary-card,
.filters,
.chemical-list,
.detail-panel,
.chart-card,
.evidence-legend,
.watch-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(247, 243, 234, 0.045), rgba(247, 243, 234, 0.012)),
    rgba(8, 18, 25, 0.82);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.18);
}

.summary-card {
  padding: 22px;
}

.summary-card h3,
.detail-panel h3,
.watch-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.summary-card p,
.watch-card p,
.detail-panel p {
  margin: 0;
  color: rgba(247, 243, 234, 0.7);
  line-height: 1.55;
}

.explorer-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

.filters,
.detail-panel {
  position: sticky;
  top: 90px;
  padding: 18px;
}

.filters label,
.filters fieldset {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.filters span,
.filters legend {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filters fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.filters fieldset label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: rgba(247, 243, 234, 0.78);
  font-size: 0.83rem;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(247, 243, 234, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 0 11px;
  outline: none;
}

select option {
  background: var(--ink-2);
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(57, 200, 214, 0.12);
}

.chemical-list {
  overflow: hidden;
}

.list-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-weight: 500;
}

.rows {
  display: grid;
}

.chemical-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(120px, 0.75fr) minmax(120px, 0.85fr) minmax(150px, 0.95fr) 34px;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.chemical-row:hover,
.chemical-row.active {
  background: rgba(247, 243, 234, 0.075);
}

.chemical-row.active {
  box-shadow: inset 3px 0 0 var(--cyan);
}

.row-name strong {
  display: block;
}

.row-name span,
.chemical-row small {
  color: var(--muted);
}

.status-pill,
.evidence-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-align: center;
}

.status-allowed {
  background: rgba(104, 199, 114, 0.15);
  color: #9ef0a7;
}

.status-restricted {
  background: rgba(244, 180, 63, 0.16);
  color: #ffd47c;
}

.status-banned {
  background: rgba(233, 85, 79, 0.16);
  color: #ffaaa6;
}

.status-under_review {
  background: rgba(117, 167, 255, 0.16);
  color: #a9c7ff;
}

.detail-panel {
  min-height: 520px;
}

.detail-panel .detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.detail-panel h4 {
  margin: 0 0 8px;
  color: var(--paper);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.concern-grid {
  display: grid;
  gap: 10px;
}

.concern-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(247, 243, 234, 0.09);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.concern-item strong {
  color: var(--paper);
  font-size: 0.82rem;
}

.concern-item span {
  color: rgba(247, 243, 234, 0.7);
  font-size: 0.83rem;
  line-height: 1.42;
}

.detail-panel ul {
  margin: 0;
  padding-left: 19px;
  color: rgba(247, 243, 234, 0.72);
  line-height: 1.48;
}

.source-list a {
  display: block;
  margin-top: 7px;
  color: var(--cyan);
  font-size: 0.84rem;
  text-decoration: none;
}

.matrix-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 18, 25, 0.78);
}

.matrix {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.matrix th,
.matrix td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.matrix th {
  color: var(--paper);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.matrix td {
  color: rgba(247, 243, 234, 0.78);
  font-size: 0.82rem;
  line-height: 1.45;
}

.matrix td small {
  display: block;
  margin-top: 10px;
  color: rgba(247, 243, 234, 0.66);
}

.matrix .chem-name {
  min-width: 180px;
  color: var(--paper);
  font-weight: 900;
}

.timeline-controls {
  display: flex;
  gap: 10px;
  min-width: min(520px, 100%);
}

.timeline-rail {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 18px 0 8px;
}

.timeline-rail::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 28px;
  bottom: 22px;
  width: 1px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  padding: 16px 18px 16px 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(57, 200, 214, 0.045), transparent 38%),
    rgba(8, 18, 25, 0.78);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 24px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 5px rgba(57, 200, 214, 0.13);
}

.timeline-date {
  color: var(--amber);
  font-weight: 900;
}

.timeline-item h3 {
  margin: 0 0 5px;
  font-size: 1rem;
}

.timeline-item p {
  margin: 0;
  color: rgba(247, 243, 234, 0.7);
  line-height: 1.48;
}

.evidence-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
}

.chart-card,
.evidence-legend {
  padding: 22px;
}

.chart-card {
  min-height: 440px;
}

.chart-card canvas {
  width: 100%;
  max-height: 390px;
}

.legend-row,
.bar-row {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.legend-row strong {
  color: var(--paper);
}

.legend-row span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--paper);
  font-size: 0.82rem;
  font-weight: 800;
}

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--amber), var(--red));
}

.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.watch-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 22px;
}

.watch-card .watch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.watch-card p + p {
  margin-top: 2px;
}

.watch-card a {
  display: inline-flex;
  margin-top: 4px;
  color: var(--cyan);
  font-weight: 800;
  text-decoration: none;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 28px clamp(18px, 4vw, 48px) 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer p {
  max-width: 760px;
  margin: 0;
}

.site-footer a {
  color: var(--paper);
  text-decoration: none;
}

.data-error {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 16, 22, 0.92);
}

.data-error[hidden] {
  display: none;
}

.data-error div {
  max-width: 680px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
}

.data-error h2 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
}

.data-error code {
  display: inline-flex;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
}

@media (max-width: 1120px) {
  .hero,
  .explorer-layout,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .filters,
  .detail-panel {
    position: static;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(1),
  .metric:nth-child(2) {
    border-bottom: 1px solid var(--line);
  }

  .summary-grid,
  .watchlist-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero {
    min-height: auto;
    padding-top: 48px;
  }

  .hero h1 {
    font-size: clamp(3rem, 14.8vw, 4.35rem);
  }

  .hero-copy p {
    margin-top: 20px;
    line-height: 1.5;
  }

  .hero-actions {
    gap: 8px;
    margin-top: 22px;
  }

  .hero-actions .button {
    padding: 0 13px;
    font-size: 0.76rem;
  }

  .hero-brief dl,
  .metric-grid,
  .summary-grid,
  .watchlist-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-stat {
    min-height: 72px;
    padding: 14px;
  }

  .metric,
  .metric:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .section-heading.split {
    align-items: stretch;
    flex-direction: column;
  }

  .chemical-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .detail-panel {
    min-height: auto;
  }

  .timeline-controls,
  .list-toolbar {
    flex-direction: column;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
