:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e3e6ef;
  --text: #161a29;
  --muted: #646b80;
  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --sponsor: #22c55e;

  color-scheme: light dark;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --surface: #171b2e;
    --border: #2a3050;
    --text: #e8eaf5;
    --muted: #9aa1bd;
    --accent: #818cf8;
    --accent-strong: #a5b4fc;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: var(--accent);
}

.site-header,
main,
.site-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-header nav,
.site-footer nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
}

h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0.5rem 0 0.75rem;
}

h2 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}

h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.25rem;
}

p {
  margin: 0 0 0.75rem;
}

.lede {
  font-size: 1.1rem;
  color: var(--muted);
}

.crumbs {
  font-size: 0.85rem;
  color: var(--muted);
}

.button,
.cta {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.button:hover,
.cta:hover {
  background: var(--accent-strong);
}

.facts dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.facts dl div {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.facts dt {
  font-size: 0.75rem;
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 600;
}

.note {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--surface);
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--muted);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.aliases {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-clinical {
  background: #dcfce7;
  color: #166534;
}

.badge-limited {
  background: #fef3c7;
  color: #92400e;
}

.badge-anecdotal {
  background: #fee2e2;
  color: #991b1b;
}

@media (prefers-color-scheme: dark) {
  .badge-clinical {
    background: #14532d;
    color: #bbf7d0;
  }
  .badge-limited {
    background: #713f12;
    color: #fde68a;
  }
  .badge-anecdotal {
    background: #7f1d1d;
    color: #fecaca;
  }
}

.related {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.35rem 1rem;
  padding: 0;
  list-style: none;
}

.related span {
  color: var(--muted);
  font-size: 0.85rem;
}

.sponsor {
  margin: 2rem 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--sponsor);
  border-radius: 12px;
  background: var(--surface);
}

.sponsor h2 {
  margin-top: 0;
}

.sponsor.labs {
  border-left-color: #0ea5e9;
}

.sponsor-label {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.sponsor-vendors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.sponsor-vendor {
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sponsor-vendor h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.sponsor-vendor .cta {
  align-self: flex-start;
  margin-top: auto;
}

.sponsor ul {
  display: grid;
  gap: 0.3rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.sponsor ul li {
  position: relative;
  padding-left: 1.4rem;
}

.sponsor ul li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--sponsor);
  font-weight: 700;
}

.disclosure {
  margin: 0.85rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.site-footer {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.button.secondary:hover {
  background: var(--bg);
}

.button + .button {
  margin-left: 0.5rem;
}

code {
  font-size: 0.9em;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* Comparison pages */
.compare-table th[scope="row"] {
  white-space: nowrap;
}

.compare-table td,
.compare-table thead th {
  width: 38%;
}

.decay-chart {
  display: block;
  width: 100%;
  height: auto;
  margin: 0.5rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.decay-chart .grid {
  stroke: var(--border);
  stroke-width: 1;
}

.decay-chart .tick {
  fill: var(--muted);
  font-size: 11px;
}

.decay-chart .curve {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.decay-chart .marker {
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.series-a {
  stroke: var(--accent);
  background: var(--accent);
}

.series-b {
  stroke: #f59e0b;
  background: #f59e0b;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-legend .key {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 2px;
}

.chart-legend .key.series-b {
  margin-left: 0.75rem;
}

.compare-list {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Guides */
.guide ul {
  padding-left: 1.25rem;
}

.guide li {
  margin-bottom: 0.35rem;
}

.guide-list {
  display: grid;
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.guide-list li {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.guide-list a {
  font-weight: 600;
}

.guide-list p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.converter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.converter label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.converter input {
  width: 11rem;
  max-width: 100%;
  padding: 0.5rem 0.65rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.converter output {
  flex-basis: 100%;
  font-weight: 600;
  white-space: pre-line;
}

.converter select {
  padding: 0.5rem 0.65rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* Newsletter and contact forms */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.newsletter-block {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
}

.newsletter-block h2 {
  margin-top: 0;
}

.newsletter-form,
.contact-form {
  display: grid;
  gap: 0.4rem;
  max-width: 32rem;
}

.newsletter-form label,
.contact-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

.newsletter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.newsletter-row input {
  flex: 1 1 14rem;
}

.newsletter-form input,
.contact-form input,
.contact-form textarea {
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.newsletter-form button,
.contact-form button {
  justify-self: start;
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

.newsletter-form button:disabled,
.contact-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.form-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.85rem;
}

.footer-newsletter {
  padding: 0.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
}

.footer-newsletter p {
  font-size: 0.9rem;
  color: var(--text);
}

/* Glossary */
.glossary div {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 1rem;
}

.glossary div:target {
  background: var(--surface);
}

.glossary dt {
  font-weight: 700;
}

.glossary dd {
  margin: 0.15rem 0 0;
}
