/* ============================================================
   Dorna Health — Design System
   RTL-first · Persian · scientific / clean
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* color — neutral */
  --c-bg: #f6f7f9;
  --c-surface: #ffffff;
  --c-surface-2: #f1f3f5;
  --c-border: #e3e6ea;
  --c-border-strong: #cfd4da;
  --c-text: #1b2733;
  --c-text-soft: #5b6774;
  --c-text-faint: #8b97a3;

  /* color — brand */
  --c-primary: #0f766e;          /* teal 700 */
  --c-primary-soft: #d5f0ec;
  --c-primary-dark: #115e56;
  --c-accent: #2563eb;           /* blue 600 — links / science */
  --c-accent-soft: #dbe7fe;

  /* color — semantic */
  --c-success: #15803d;
  --c-success-soft: #dcfce7;
  --c-warning: #b45309;
  --c-warning-soft: #fef3c7;
  --c-danger: #b91c1c;
  --c-danger-soft: #fee2e2;
  --c-info: #0369a1;
  --c-info-soft: #e0f2fe;

  /* evidence grades */
  --grade-a: #15803d;
  --grade-b: #4d7c0f;
  --grade-c: #b45309;
  --grade-d: #b91c1c;
  --grade-e: #9a3412;
  --grade-f: #7f1d1d;

  /* spacing scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;

  /* shadow */
  --sh-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --sh-2: 0 4px 12px rgba(16, 24, 40, .08);
  --sh-3: 0 12px 32px rgba(16, 24, 40, .12);

  /* typography */
  --font-sans: "Vazirmatn", "Segoe UI", Tahoma, system-ui, -apple-system, "Iranian Sans", Arial, sans-serif;
  --fs-xs: .8rem; --fs-sm: .9rem; --fs-base: 1rem; --fs-lg: 1.15rem;
  --fs-xl: 1.4rem; --fs-2xl: 1.85rem; --fs-3xl: 2.4rem;
  --lh-tight: 1.35; --lh-body: 1.85;

  --container: 1140px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #0f1418;
    --c-surface: #1a2128;
    --c-surface-2: #222b33;
    --c-border: #2c353d;
    --c-border-strong: #3a444d;
    --c-text: #e7ecf0;
    --c-text-soft: #a9b4bf;
    --c-text-faint: #7c8894;
    --c-primary-soft: #123f3a;
    --c-accent-soft: #16305e;
    --sh-1: 0 1px 2px rgba(0,0,0,.3);
    --sh-2: 0 4px 12px rgba(0,0,0,.4);
    --sh-3: 0 12px 32px rgba(0,0,0,.5);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; display: block; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: 700; color: var(--c-text); }
h1 { font-size: var(--fs-3xl); letter-spacing: -.01em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
ul, ol { padding-inline-start: 1.4em; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 3px solid var(--c-accent-soft); outline-offset: 2px; border-radius: var(--r-sm); }

.skip-link:focus {
  inset-inline-start: var(--s-4) !important;
  top: var(--s-2);
  z-index: 100;
  background: var(--c-surface);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
}

/* ---------- Layout ---------- */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--s-4); }
.page { padding-block: var(--s-6) var(--s-8); }
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }
.grid { display: grid; gap: var(--s-4); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.split { display: grid; grid-template-columns: 1fr 320px; gap: var(--s-6); align-items: start; }
.split.wide-aside { grid-template-columns: 1fr 380px; }
@media (max-width: 960px) { .split, .split.wide-aside { grid-template-columns: 1fr; } }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 50;
}
.site-header .bar {
  display: flex; align-items: center; gap: var(--s-5);
  height: 64px;
}
.brand { display: flex; align-items: center; gap: var(--s-2); font-weight: 800; font-size: var(--fs-lg); color: var(--c-text); }
.brand:hover { text-decoration: none; }
.brand .logo { font-size: 1.5rem; }
.nav { display: flex; gap: var(--s-1); flex: 1; flex-wrap: wrap; }
.nav a {
  padding: var(--s-2) var(--s-3); border-radius: var(--r-sm);
  color: var(--c-text-soft); font-size: var(--fs-sm); font-weight: 600;
}
.nav a:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.nav a.active { color: var(--c-primary); background: var(--c-primary-soft); }
.header-cta { display: flex; gap: var(--s-2); align-items: center; margin-inline-start: auto; }
.nav-toggle {
  display: none; background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: var(--r-sm); width: 40px; height: 40px; font-size: 1.1rem; color: var(--c-text);
}
@media (max-width: 820px) {
  .site-header .bar { height: auto; flex-wrap: wrap; padding-block: var(--s-3); gap: var(--s-3); }
  .brand { flex: 1; white-space: nowrap; }
  .nav-toggle { display: block; }
  .nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; gap: var(--s-1); padding-top: var(--s-2); }
  .nav[data-open="true"] { display: flex; }
  .nav a { display: block; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--s-8); background: var(--c-surface);
  border-top: 1px solid var(--c-border); color: var(--c-text-soft);
  font-size: var(--fs-sm);
}
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--s-6); padding-block: var(--s-6); }
.site-footer h4 { font-size: var(--fs-sm); color: var(--c-text-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s-3); }
.site-footer .legal {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4);
  padding-block: var(--s-5); font-size: var(--fs-xs); color: var(--c-text-faint);
}
.site-footer .legal .brand { font-size: var(--fs-base); color: var(--c-text-soft); }
@media (max-width: 720px) { .site-footer .cols { grid-template-columns: 1fr; gap: var(--s-4); } }

/* ---------- Card ---------- */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: var(--s-5);
  box-shadow: var(--sh-1);
}
.card.flat { box-shadow: none; }
.card.pad-lg { padding: var(--s-6); }
.card-hover { transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.card-hover:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: var(--c-border-strong); }
.card-title { font-size: var(--fs-lg); font-weight: 700; }
.card-meta { color: var(--c-text-faint); font-size: var(--fs-sm); }

a.card, a.card-hover { color: inherit; }
a.card:hover { text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-5); border-radius: var(--r-md);
  font-weight: 700; font-size: var(--fs-sm); border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-ghost { background: transparent; border-color: var(--c-border-strong); color: var(--c-text); }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-sm { padding: var(--s-2) var(--s-3); font-size: var(--fs-xs); }

/* ---------- Badges & tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.6;
}
.badge-neutral { background: var(--c-surface-2); color: var(--c-text-soft); }
.badge-primary { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.badge-accent  { background: var(--c-accent-soft); color: var(--c-accent); }
.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-warning { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-danger  { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-info    { background: var(--c-info-soft); color: var(--c-info); }

.tag-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.grade-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  color: #fff; font-weight: 800; font-size: var(--fs-sm);
}
.grade-badge { background: var(--c-text-faint); }
.grade-badge[data-grade^="A"] { background: var(--grade-a); }
.grade-badge[data-grade^="B"] { background: var(--grade-b); }
.grade-badge[data-grade^="C"] { background: var(--grade-c); }
.grade-badge[data-grade^="D"] { background: var(--grade-d); }
.grade-badge[data-grade^="E"] { background: var(--grade-e); }
.grade-badge[data-grade^="F"] { background: var(--grade-f); }
.grade-badge.lg { width: 40px; height: 40px; font-size: var(--fs-lg); border-radius: 10px; }

/* ---------- Text helpers ---------- */
.muted { color: var(--c-text-soft); }
.faint { color: var(--c-text-faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.lead { font-size: var(--fs-lg); color: var(--c-text-soft); line-height: 1.7; }
.en { direction: ltr; unicode-bidi: isolate; font-family: "Segoe UI", system-ui, sans-serif; }
.prose { line-height: var(--lh-body); }
.prose p + p { margin-top: var(--s-3); }
.prose h3, .prose h4 { margin-top: var(--s-5); margin-bottom: var(--s-2); }
.divider { border: 0; border-top: 1px solid var(--c-border); margin-block: var(--s-5); }

/* ---------- Section heading ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.section-head .see-all { font-size: var(--fs-sm); font-weight: 700; }
.eyebrow { color: var(--c-primary); font-weight: 800; font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
  color: #fff; border-radius: var(--r-lg);
  padding: var(--s-8) var(--s-6);
}
.hero h1 { color: #fff; max-width: 22ch; }
.hero p { color: rgba(255,255,255,.88); font-size: var(--fs-lg); max-width: 52ch; margin-top: var(--s-3); }
.hero .btn-primary { background: #fff; color: var(--c-primary-dark); }
.hero .btn-primary:hover { background: rgba(255,255,255,.9); }
.hero .btn-ghost { border-color: rgba(255,255,255,.5); color: #fff; }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }

/* ---------- Landing (splash) ---------- */
.landing-hero { padding-block: var(--s-8); }
.landing-hero h1 { max-width: none; }
.landing-hero p { max-width: 60ch; }
.feature-card { gap: var(--s-2); }
.feature-card .feature-ic {
  font-size: 1.75rem; line-height: 1; width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); background: var(--c-primary-soft);
}
.feature-card .card-title { font-size: var(--fs-base); }

/* ---------- Stat tiles ---------- */
.stat { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--s-4); }
.stat .n { font-size: var(--fs-2xl); font-weight: 800; color: var(--c-primary); }
.stat .l { color: var(--c-text-soft); font-size: var(--fs-sm); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); }
.data-table { font-size: var(--fs-sm); }
.data-table th, .data-table td { padding: var(--s-3) var(--s-4); text-align: start; border-bottom: 1px solid var(--c-border); }
.data-table thead th { background: var(--c-surface-2); font-weight: 700; color: var(--c-text-soft); white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--c-surface-2); }

/* ---------- Definition list ---------- */
.spec-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-4); font-size: var(--fs-sm); }
.spec-list dt { color: var(--c-text-faint); font-weight: 600; }
.spec-list dd { color: var(--c-text); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--c-border); overflow-x: auto; }
.tabs button {
  padding: var(--s-3) var(--s-4); background: none; border: 0;
  border-bottom: 2px solid transparent; color: var(--c-text-soft);
  font-weight: 700; font-size: var(--fs-sm); white-space: nowrap;
}
.tabs button.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-panel { padding-top: var(--s-5); }
.tab-panel[hidden] { display: none; }

/* ---------- Accordion ---------- */
.accordion details { border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); }
.accordion details + details { margin-top: var(--s-2); }
.accordion summary { padding: var(--s-4); font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "＋"; color: var(--c-text-faint); }
.accordion details[open] summary::after { content: "－"; }
.accordion .body { padding: 0 var(--s-4) var(--s-4); color: var(--c-text-soft); }

/* ---------- Breadcrumbs ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-sm); color: var(--c-text-faint); margin-bottom: var(--s-4); }
.crumbs a { color: var(--c-text-soft); }
.crumbs span::before { content: "«"; margin-inline: var(--s-2); color: var(--c-border-strong); }
.crumbs span:first-child::before { content: none; }

/* ---------- Filters / search ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-bottom: var(--s-5); }
.search-box { display: flex; gap: var(--s-2); flex: 1; min-width: 220px; }
.input, .select {
  width: 100%; padding: var(--s-3) var(--s-4);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  background: var(--c-surface); color: var(--c-text); font-family: inherit; font-size: var(--fs-sm);
}
.input:focus, .select:focus { border-color: var(--c-primary); outline: none; }
.chip-filter { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip-filter a {
  padding: var(--s-2) var(--s-3); border-radius: var(--r-pill);
  border: 1px solid var(--c-border-strong); font-size: var(--fs-xs); font-weight: 700;
  color: var(--c-text-soft);
}
.chip-filter a:hover { background: var(--c-surface-2); text-decoration: none; }
.chip-filter a.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* ---------- Empty / loading / error states ---------- */
.state {
  text-align: center; padding: var(--s-8) var(--s-5);
  border: 1px dashed var(--c-border-strong); border-radius: var(--r-lg);
  color: var(--c-text-soft); background: var(--c-surface);
}
.state .icon { font-size: 2.5rem; margin-bottom: var(--s-3); }
.state h3 { color: var(--c-text); margin-bottom: var(--s-2); }

/* ---------- Notice / disclaimer ---------- */
.notice {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  font-size: var(--fs-sm); line-height: 1.7;
}
.notice-info { background: var(--c-info-soft); color: var(--c-info); }
.notice-warning { background: var(--c-warning-soft); color: var(--c-warning); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: var(--s-2); justify-content: center; margin-top: var(--s-6); }
.pagination a, .pagination span {
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  border: 1px solid var(--c-border-strong); font-size: var(--fs-sm); font-weight: 700; color: var(--c-text-soft);
}
.pagination .current { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pagination a:hover { background: var(--c-surface-2); text-decoration: none; }

/* ---------- Evidence row ---------- */
.evidence-item { display: flex; gap: var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--c-border); }
.evidence-item:last-child { border-bottom: 0; }
.evidence-item .grade { flex-shrink: 0; }
.evidence-item .meta { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }

/* ---------- Domain pill ---------- */
.domain-pill { font-size: var(--fs-xs); font-weight: 800; padding: 2px 10px; border-radius: var(--r-pill); }
.domain-supplement { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.domain-cosmetic { background: #fde7f3; color: #9d174d; }
.domain-medical_device { background: var(--c-info-soft); color: var(--c-info); }

/* ============================================================
   Knowledge-base sections (documentation/ spec)
   ============================================================ */

/* ---------- Knowledge page layout: sticky section nav ---------- */
.kb-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.kb-layout > * { min-width: 0; }
.kb-toc { position: sticky; top: var(--s-4); align-self: start; font-size: var(--fs-sm); max-height: calc(100vh - var(--s-6)); overflow-y: auto; }
.kb-toc a { display: block; padding: var(--s-2) var(--s-3); border-inline-start: 2px solid var(--c-border); color: var(--c-text-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.kb-toc a:hover { background: var(--c-surface-2); text-decoration: none; }
.kb-toc a.active { border-inline-start-color: var(--c-primary); color: var(--c-primary); font-weight: 700; background: var(--c-primary-soft); }
.kb-toc a.lvl-2 { padding-inline-start: var(--s-5); font-size: var(--fs-xs); }
.kb-section { scroll-margin-top: var(--s-5); margin-bottom: var(--s-6); }
.kb-section > h2 { font-size: var(--fs-xl); margin-bottom: var(--s-3); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); min-width: 0; }
.kb-section > h2 > .info-tip { flex-shrink: 0; }
@media (max-width: 900px) { .kb-layout { grid-template-columns: 1fr; } .kb-toc { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: var(--s-1); } .kb-toc a { border: 1px solid var(--c-border); border-radius: var(--r-pill); } }

/* ---------- Info tooltip ---------- */
.info-tip { position: relative; display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--c-surface-2); color: var(--c-text-faint); font-size: 11px; font-weight: 800; cursor: help; }
.info-tip::after { content: attr(data-tip); position: absolute; inset-inline-start: 50%; bottom: 140%; transform: translateX(50%);
  min-width: 200px; max-width: 280px; background: var(--c-text); color: var(--c-surface); padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 500; line-height: 1.7; text-align: start;
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 20; }
.info-tip:hover::after, .info-tip:focus::after { opacity: 1; }

/* ---------- Interactive citations ---------- */
sup.cite { font-size: .7em; font-weight: 700; color: var(--c-accent); cursor: pointer; padding: 0 1px; }
sup.cite:hover { text-decoration: underline; }
.ref-list { counter-reset: ref; font-size: var(--fs-sm); }
.ref-list li { padding: var(--s-2) 0; border-bottom: 1px solid var(--c-border); line-height: 1.8; }
.ref-list li:last-child { border-bottom: 0; }
.ref-list .backlink { color: var(--c-text-faint); font-weight: 800; margin-inline-end: var(--s-2); }
.ref-hl { animation: refflash 1.6s ease; }
@keyframes refflash { 0%, 40% { background: var(--c-warning-soft); } 100% { background: transparent; } }

/* ---------- Caution boxes (safety) ---------- */
.caution-box { border: 1px solid var(--c-danger-soft); border-inline-start: 4px solid var(--c-danger);
  background: var(--c-danger-soft); border-radius: var(--r-md); padding: var(--s-4); margin-top: var(--s-3); }
.caution-box.lvl-caution { border-color: var(--c-warning-soft); border-inline-start-color: var(--c-warning); background: var(--c-warning-soft); }
.caution-box h4 { color: var(--c-text); margin-bottom: var(--s-2); }
.intro-box { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--s-3) var(--s-4);
  font-size: var(--fs-sm); color: var(--c-text-soft); display: flex; gap: var(--s-3); align-items: flex-start; }
.intro-box[hidden] { display: none; }
.intro-box .x { background: none; border: 0; color: var(--c-text-faint); font-size: var(--fs-lg); cursor: pointer; line-height: 1; }

/* ---------- Chips (effect / interaction tags) ---------- */
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--r-sm);
  background: var(--c-surface-2); color: var(--c-text-soft); font-size: var(--fs-xs); font-weight: 600; }
.chip-list { display: flex; flex-wrap: wrap; gap: var(--s-1); }

/* ---------- Oval level badges (evidence / severity) ---------- */
.pill-badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; border: 1px solid currentColor; }
.pill-badge.solid { color: #fff; border-color: transparent; }

/* ---------- Effect arrows ---------- */
.effect-arrow { font-weight: 800; letter-spacing: -2px; }
.effect-up { color: var(--c-success); }
.effect-down { color: var(--c-danger); }
.effect-flat { color: var(--c-text-faint); }

/* ---------- Timeline (update history) ---------- */
.timeline { position: relative; padding-inline-start: var(--s-5); }
.timeline::before { content: ""; position: absolute; inset-inline-start: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--c-border); }
.timeline-item { position: relative; padding-bottom: var(--s-5); }
.timeline-item::before { content: ""; position: absolute; inset-inline-start: -22px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--c-surface); border: 2px solid var(--c-primary); }
.timeline-item:last-child { padding-bottom: 0; }
.gated-box { background: var(--c-primary-soft); border-inline-start: 3px solid var(--c-primary);
  border-radius: var(--r-sm); padding: var(--s-3); font-size: var(--fs-sm); color: var(--c-primary-dark); margin-top: var(--s-2); }

/* ---------- Drawer (studies list) ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; display: none; }
.drawer[open], .drawer.open { display: block; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(16,24,40,.5); }
.drawer-panel { position: absolute; inset-block: 0; inset-inline-end: 0; width: min(560px, 100%);
  background: var(--c-bg); box-shadow: var(--sh-3); overflow-y: auto; padding: var(--s-5); }
.drawer-panel h3 { margin-bottom: var(--s-4); }

/* ---------- Evidence matrix ---------- */
.matrix-group { border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); margin-bottom: var(--s-3); overflow: hidden; }
.matrix-group > summary { padding: var(--s-4); font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: var(--s-3); align-items: center; }
.matrix-group > summary::-webkit-details-marker { display: none; }
.matrix-group[open] > summary { border-bottom: 1px solid var(--c-border); }
.matrix-group .rows { padding: 0; }

/* ---------- Category cards ---------- */
.cat-card { position: relative; overflow: hidden; min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end; }
.cat-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .18; }
.cat-card > * { position: relative; }

/* ---------- Attached sub-question link ---------- */
.sub-q { display: flex; gap: var(--s-2); align-items: center; font-style: italic; color: var(--c-primary);
  padding: var(--s-2) 0; font-size: var(--fs-sm); }
.sub-q::before { content: "↳"; font-style: normal; }

/* ---------- Takeaway box (research breakdown) ---------- */
.takeaway { background: var(--c-primary-soft); border-inline-start: 4px solid var(--c-primary);
  border-radius: var(--r-sm); padding: var(--s-3) var(--s-4); font-style: italic; color: var(--c-primary-dark); margin: var(--s-3) 0; }

/* ---------- Stepped "how to use" (product pages) ---------- */
.usage-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.usage-steps > li { display: flex; gap: var(--s-3); align-items: flex-start; }
.usage-step-n { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--c-primary-soft); color: var(--c-primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: var(--fs-sm); }
.usage-note { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--c-border); }

/* ---------- Colour swatch (variant shade) ---------- */
.shade-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--c-border-strong); vertical-align: -2px; margin-inline-end: 4px; }

/* ---------- Figure block (research breakdown: chemical structure / diagram) ---------- */
.rb-figure { margin: var(--s-4) 0; text-align: center; }
.rb-figure img { max-width: 100%; height: auto; border: 1px solid var(--c-border); border-radius: var(--r-sm);
  background: #fff; padding: var(--s-3); }
.rb-figure figcaption { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--c-text-soft); text-align: start; }
.rb-figure figcaption .prose { font-size: var(--fs-sm); }

/* ---------- KB page: optional right rail (Research Snapshot) ---------- */
.kb-layout.with-aside { grid-template-columns: 210px minmax(0, 1fr) 250px; }
.kb-aside { position: sticky; top: var(--s-4); align-self: start; }
@media (max-width: 1100px) {
  .kb-layout.with-aside { grid-template-columns: 1fr; }
  .kb-aside { position: static; }
}

/* ---------- Research Snapshot card ---------- */
.snapshot { background: var(--c-primary-dark); color: #fff; border-radius: var(--r-md); padding: var(--s-4); }
.snapshot-h { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .75; }
.snapshot-stat { font-size: var(--fs-sm); font-weight: 700; margin-top: var(--s-2); line-height: 1.7; }
.snapshot-sub { font-size: var(--fs-xs); font-weight: 700; opacity: .8; margin: var(--s-3) 0 var(--s-2); }
.snapshot-grade { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); padding: 3px 0; }
.snapshot-grade .grade-badge { flex-shrink: 0; }

/* ---------- A–Z index (outcomes / conditions list) ---------- */
.az-nav { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-bottom: var(--s-5); position: sticky; top: 0;
  background: var(--c-bg); padding: var(--s-2) 0; z-index: 5; }
.az-nav a { display: inline-flex; min-width: 30px; justify-content: center; padding: 4px 8px; border: 1px solid var(--c-border);
  border-radius: var(--r-sm); font-weight: 700; font-size: var(--fs-sm); color: var(--c-primary); }
.az-nav a:hover { background: var(--c-primary-soft); text-decoration: none; }
.az-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-1) var(--s-5); }
@media (max-width: 640px) { .az-list { grid-template-columns: 1fr; } }
.az-item { position: relative; display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 0; border-bottom: 1px solid var(--c-border); }
.az-item > a { font-weight: 600; }
.az-tip { position: absolute; inset-inline-start: 0; top: 100%; z-index: 20; min-width: 240px; max-width: 320px;
  background: var(--c-text); color: var(--c-surface); font-size: var(--fs-xs); line-height: 1.8; padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm); box-shadow: var(--sh-2); opacity: 0; pointer-events: none; transition: opacity .12s; }
.az-item:hover .az-tip, .az-item:focus-within .az-tip { opacity: 1; }

/* ---------- Research-feed entry (full breakdown card) ---------- */
.feed-entry h4 { font-size: var(--fs-sm); color: var(--c-text-soft); margin-bottom: var(--s-1); }

/* ---------- Dorna Health Database — unified topic index ---------- */
.db-topics { border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: hidden; }
.db-topic { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--c-border); }
.db-topic:last-of-type { border-bottom: 0; }
.db-topic:hover { background: var(--c-surface-2); }
.db-topic > a { font-weight: 600; }
.db-topic .pill-badge { margin-inline-start: auto; flex-shrink: 0; }
.db-topic[hidden] { display: none; }

/* ---------- Nested accordion (guide: "what makes X a [tier] option") ---------- */
.sub-accordion { border-inline-start: 2px solid var(--c-primary-soft); padding-inline-start: var(--s-3); margin-top: var(--s-2); }
.sub-accordion > summary { cursor: pointer; font-weight: 700; color: var(--c-primary); font-size: var(--fs-sm); list-style: none; }
.sub-accordion > summary::-webkit-details-marker { display: none; }
.sub-accordion > summary::before { content: "▸ "; }
.sub-accordion[open] > summary::before { content: "▾ "; }
.sub-accordion > .body { padding-top: var(--s-2); }
.sub-accordion h4 { font-size: var(--fs-sm); color: var(--c-text-soft); margin-bottom: 2px; }

/* ---------- Editorial byline (Written by / Fact-checked by / …) ---------- */
.byline { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s-3); margin: 0; }
.byline dt { color: var(--c-text-faint); font-weight: 700; }
.byline dd { margin: 0; color: var(--c-text-soft); }

/* ---------- Intervention/condition hero with illustration ---------- */
.hero-card { position: relative; overflow: hidden; }
.hero-card .hero-illus { position: absolute; inset-inline-end: var(--s-4); top: var(--s-4); width: 96px; height: 96px;
  object-fit: contain; opacity: .5; pointer-events: none; }
@media (max-width: 640px) { .hero-card .hero-illus { display: none; } }

/* ---------- Cosmetic safety score (Phase 9) ---------- */
.safety-score { display: flex; gap: var(--s-4); align-items: center; flex-wrap: wrap; }
.safety-score-ring { --score: 0; position: relative; width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: conic-gradient(var(--c-primary) calc(var(--score) * 1%), var(--c-surface-2) 0); }
.safety-score-ring::after { content: ""; position: absolute; inset: 9px; background: var(--c-surface); border-radius: 50%; z-index: 0; }
.safety-score-ring .n { position: relative; z-index: 1; font-size: var(--fs-2xl); font-weight: 800; color: var(--c-primary-dark); line-height: 1; }
.safety-score-ring .d { position: relative; z-index: 1; font-size: var(--fs-xs); color: var(--c-text-soft); }
.safety-score-body { flex: 1; min-width: 220px; }
.safety-score-body .verdict { font-size: var(--fs-lg); font-weight: 800; }
.risk-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--c-surface-2); margin: var(--s-2) 0; }
.risk-bar .seg { display: block; min-width: 0; }
.risk-bar .seg.low { background: var(--c-success); }
.risk-bar .seg.moderate { background: var(--c-warning); }
.risk-bar .seg.high { background: var(--c-danger); }

/* ---------- EWG hazard pill (ingredient table) ---------- */
.ewg-pill { display: inline-block; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: var(--r-sm);
  font-weight: 700; font-size: var(--fs-xs); background: var(--c-surface-2); color: var(--c-text-soft); }
.ewg-pill.ewg-low { background: var(--c-success-soft); color: var(--c-success); }
.ewg-pill.ewg-moderate { background: var(--c-warning-soft); color: var(--c-warning); }
.ewg-pill.ewg-high { background: var(--c-danger-soft); color: var(--c-danger); }

/* ---------- Skin-type fit bars (Phase 9) ---------- */
.skin-fit-row { display: flex; align-items: center; gap: var(--s-3); }
.skin-fit-label { flex-shrink: 0; width: 130px; font-size: var(--fs-sm); }
.skin-fit-bar { flex: 1; display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--c-surface-2); }
.skin-fit-bar .g { background: var(--c-success); min-width: 0; }
.skin-fit-bar .b { background: var(--c-danger); min-width: 0; }
.skin-fit-count { flex-shrink: 0; font-size: var(--fs-xs); color: var(--c-text-soft); }
@media (max-width: 620px) { .skin-fit-label { width: 92px; } }
