/* ══ Stats Page — Scientific Reference Layout ════════════════════════════════ */
/* Fonts loaded via <link> in stats.html head block                            */

/* ── Custom Properties ──────────────────────────────────────────────── */
.stats-page {
    --nrd-font: 'DM Sans', 'Helvetica Neue', system-ui, sans-serif;
    --nrd-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --nrd-radius: 8px;
    --nrd-radius-lg: 10px;
    --nrd-shadow: none;
    --nrd-shadow-hover: none;
    --nrd-data-primary: #4f46e5;
    --nrd-data-secondary: #0ea5e9;
    --nrd-border: rgba(128,128,128,0.12);
    --nrd-rule: rgba(128,128,128,0.18);
    --nrd-surface: var(--bg-alt);
    --nrd-surface-raised: var(--bg-elevated, var(--bg-alt));
    --nrd-section-gap: 2.5rem;
    --nrd-table-stripe: rgba(128,128,128,0.025);
}
body.dark .stats-page {
    --nrd-data-primary: #818cf8;
    --nrd-data-secondary: #38bdf8;
    --nrd-border: rgba(255,255,255,0.08);
    --nrd-rule: rgba(255,255,255,0.12);
}
body.light .stats-page {
    --nrd-surface: #ffffff;
    --nrd-surface-raised: #ffffff;
    --nrd-border: rgba(0,0,0,0.08);
    --nrd-rule: rgba(0,0,0,0.14);
    --nrd-table-stripe: rgba(0,0,0,0.02);
}

/* ── Page Container ─────────────────────────────────────────────────── */
.stats-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem 4rem;
    font-family: var(--nrd-font);
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
}

/* ── Navigation ─────────────────────────────────────────────────────── */
.stats-page .rpt-nav { margin-bottom: 1.25rem; }
.stats-page .rpt-back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.stats-page .rpt-back-link:hover { color: var(--accent); text-decoration: none; }

/* ── Hero — Clean Title Block ───────────────────────────────────────── */
.nrd-hero {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--nrd-rule);
}
.nrd-hero-info { flex: 1; min-width: 0; }
.nrd-title {
    font-family: var(--nrd-font);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.nrd-title-sub {
    display: block;
    font-family: var(--nrd-mono);
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}
.nrd-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
}
.nrd-hero-aliases {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}
.nrd-hero-alias {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--nrd-border);
    border-radius: 3px;
    font-family: var(--nrd-mono);
}
.nrd-hero-structure {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: 120px;
}
.nrd-hero-structure img {
    max-width: 120px;
    max-height: 110px;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0.85;
}
body.dark .nrd-hero-structure img:not(.structure-webp) {
    filter: invert(0.88) hue-rotate(180deg);
}
.nrd-hero-structure .structure-webp { filter: none; }
body.dark .nrd-hero-structure .structure-webp { filter: invert(1); }

/* ── Chemical Identity Table (in hero) ──────────────────────────────── */
.nrd-hero-chem {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--nrd-border);
}
.nrd-hero-chem-head {
    margin-bottom: 0.4rem;
}
.nrd-hero-chem-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}
.sub-chem-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: var(--nrd-surface);
    border: 1px solid var(--nrd-border);
    border-radius: 4px;
    font-size: 0.78rem;
}
.sub-chem-key {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.sub-chem-val {
    font-weight: 500;
    color: var(--text);
    font-family: var(--nrd-mono);
    font-size: 0.78rem;
}
.sub-chem-iupac {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.78rem;
}
.sub-chem-iupac-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.sub-chem-iupac-value {
    color: var(--text-dim);
    word-break: break-word;
}
.sub-chem-mono {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
}
.sub-chem-mono-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}
.sub-chem-mono-value {
    font-family: var(--nrd-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    word-break: break-all;
    background: none;
    padding: 0;
}
.sub-chem-hazard {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}
.sub-chem-hazard-codes { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.sub-chem-hazard-code {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: #fff3e0;
    color: #e65100;
}
body.dark .sub-chem-hazard-code {
    background: rgba(230, 81, 0, 0.15);
    color: #ffab40;
}
.sub-chem-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.3rem;
}
.sub-chem-tag {
    font-size: 0.68rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: var(--nrd-surface);
    border: 1px solid var(--nrd-border);
    color: var(--text-muted);
}

/* ── Metadata Bar (Classification Strip) ────────────────────────────── */
.nrd-metadata-bar {
    display: flex;
    border: 1px solid var(--nrd-border);
    border-radius: var(--nrd-radius);
    overflow: hidden;
    margin-bottom: var(--nrd-section-gap);
}
.nrd-metadata-bar .nrd-metric {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.85rem;
    background: var(--nrd-surface);
    border-right: 1px solid var(--nrd-border);
    min-width: 0;
}
.nrd-metadata-bar .nrd-metric:last-child { border-right: none; }
/* Legacy grid fallback */
.nrd-card-grid-4 {
    display: flex;
    border: 1px solid var(--nrd-border);
    border-radius: var(--nrd-radius);
    overflow: hidden;
    margin-bottom: var(--nrd-section-gap);
}
.nrd-metric {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.85rem;
    background: var(--nrd-surface);
    border-right: 1px solid var(--nrd-border);
    min-width: 0;
}
.nrd-metric:last-child { border-right: none; }
.nrd-metric-value {
    font-family: var(--nrd-mono);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    overflow-wrap: break-word;
    word-break: break-word;
    text-align: center;
}
.nrd-metric-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
body.light .nrd-metric {
    background: #ffffff;
}

/* ── Zone / Grid Layout ─────────────────────────────────────────────── */
.nrd-zone { margin-bottom: var(--nrd-section-gap); }
.nrd-card-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}
.nrd-content-card {
    padding: 1.25rem;
    background: var(--nrd-surface);
    border-radius: var(--nrd-radius);
    border: 1px solid var(--nrd-border);
}
body.light .nrd-content-card {
    background: #ffffff;
    border-color: rgba(0,0,0,0.07);
}
.nrd-content-card > .nrd-section { margin-bottom: 0; }
.nrd-card-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Section Blocks ─────────────────────────────────────────────────── */
.nrd-section {
    margin-bottom: var(--nrd-section-gap);
    animation: nrdFadeUp 0.3s ease-out both;
}
.nrd-section-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.45rem;
    border-bottom: 2px solid var(--nrd-rule);
}
.nrd-section-head h2 {
    font-family: var(--nrd-font);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.01em;
}
.nrd-section-badge {
    font-family: var(--nrd-mono);
    font-size: 0.55rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0.7;
}
a.nrd-section-badge {
    text-decoration: none;
    transition: color 0.2s;
}
a.nrd-section-badge:hover {
    color: var(--accent);
    opacity: 1;
}

/* ── Source citation links (inline after section headings) ───────── */
.nrd-section-sources {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.5rem;
    vertical-align: baseline;
}
.nrd-source-link {
    font-family: var(--nrd-mono);
    font-size: 0.55rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    opacity: 0.65;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s, opacity 0.2s;
}
.nrd-source-link:hover {
    color: var(--accent);
    opacity: 1;
    text-decoration: underline;
}

/* ── References section ──────────────────────────────────────────── */
.nrd-references-section {
    border-top: 2px solid var(--nrd-rule);
    padding-top: var(--nrd-section-gap);
}
.nrd-ref-group {
    margin-bottom: 1.25rem;
}
.nrd-ref-group-title {
    font-family: var(--nrd-mono);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
}
.nrd-ref-list {
    list-style: none;
    margin: 0;
    padding: 0;
    columns: 2;
    column-gap: 2rem;
}
.nrd-ref-list li {
    font-size: 0.78rem;
    line-height: 1.7;
    break-inside: avoid;
    padding-left: 0.8rem;
    position: relative;
    color: var(--text-muted);
}
.nrd-ref-list li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: var(--text-muted);
    opacity: 0.4;
}
.nrd-ref-list a {
    color: var(--text);
    text-decoration: none;
    opacity: 0.8;
    transition: color 0.2s, opacity 0.2s;
}
.nrd-ref-list a:hover {
    color: var(--accent);
    opacity: 1;
    text-decoration: underline;
}
@media (max-width: 700px) {
    .nrd-ref-list { columns: 1; }
}
.nrd-source-sep {
    font-size: 0.45rem;
    color: var(--text-muted);
    opacity: 0.4;
    margin: 0 0.1rem;
}

/* ── Subtitle ───────────────────────────────────────────────────────── */
.nrd-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: -0.5rem 0 1rem 0;
    line-height: 1.5;
    font-weight: 400;
}

/* ── Metrics row (inside sections) ──────────────────────────────────── */
.nrd-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 0.75rem 0 1.25rem;
}

/* ── Chart Containers ───────────────────────────────────────────────── */
.nrd-chart-wrap {
    position: relative;
    max-height: 320px;
    margin: 0.5rem 0;
}
.nrd-chart-wrap-sm { max-height: 230px; }
.nrd-chart-wrap-lg { max-height: none; }
.nrd-chart-title {
    font-family: var(--nrd-font);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
    letter-spacing: 0.01em;
}
.nrd-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 0.75rem 0;
}
.nrd-chart-card {
    padding: 1rem;
    border-top: 1px solid var(--nrd-border);
    border-bottom: 1px solid var(--nrd-border);
    background: transparent;
}

/* ── Effect Profile ─────────────────────────────────────────────────── */
.nrd-ep-class {
    margin-bottom: 1.5rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--nrd-rule);
}
.nrd-ep-class:last-child { margin-bottom: 0; }
.nrd-ep-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.nrd-ep-name {
    font-family: var(--nrd-font);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}
.nrd-ep-intensity-label {
    font-family: var(--nrd-mono);
    font-size: 0.6rem;
    font-weight: 500;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    border: 1px solid var(--nrd-border);
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.nrd-ep-score-badge {
    font-family: var(--nrd-mono);
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
    margin-left: auto;
    letter-spacing: -0.02em;
}
.nrd-ep-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.85rem;
    line-height: 1.6;
    font-style: italic;
    padding-left: 0.75rem;
    border-left: 2px solid var(--nrd-border);
}
.nrd-ep-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}
.nrd-ep-radar-wrap {
    position: relative;
    max-height: 300px;
}

/* Dimension bars */
.nrd-ep-dims { }
.nrd-ep-dim {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0;
}
.nrd-ep-dim-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 125px;
    text-align: right;
    white-space: nowrap;
    font-weight: 400;
}
.nrd-ep-dim-weight {
    display: inline-block;
    font-family: var(--nrd-mono);
    font-size: 0.5rem;
    font-weight: 600;
    margin-left: 0.1rem;
    padding: 1px 3px;
    border-radius: 2px;
    vertical-align: middle;
    line-height: 1;
}
.nrd-w-core { color: var(--accent); background: rgba(255,0,139,0.08); }
.nrd-w-major { color: var(--text-muted); background: rgba(128,128,128,0.07); }
.nrd-w-minor { color: var(--text-muted); background: rgba(128,128,128,0.04); opacity: 0.5; }
.nrd-ep-dim-track {
    flex: 1;
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    overflow: visible;
    position: relative;
}
.nrd-ep-dim-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s linear;
}
.nrd-ep-dim-marker {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 10px;
    background: rgba(245,158,11,0.8);
    border-radius: 1px;
    transform: translateX(-1px);
}
.nrd-ep-dim-score {
    font-family: var(--nrd-mono);
    font-weight: 600;
    font-size: 0.72rem;
    min-width: 22px;
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.nrd-ep-dim-er {
    font-size: 0.55rem;
    font-weight: 500;
    color: rgba(245,158,11,0.75);
    margin-left: 1px;
}
.nrd-ep-dim-er::before { content: '/'; color: var(--nrd-border); }
.nrd-ep-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.65rem;
    color: var(--text-muted);
}
.nrd-ep-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.nrd-ep-legend-bar {
    display: inline-block;
    width: 16px;
    height: 3px;
    border-radius: 1px;
}
.nrd-ep-legend-dot {
    display: inline-block;
    width: 2px;
    height: 10px;
    background: rgba(245,158,11,0.8);
    border-radius: 1px;
}
.nrd-ep-legend-dot-bl {
    background: rgba(80,160,255,0.8);
}
.nrd-ep-dim-ev {
    font-family: var(--nrd-mono);
    font-size: 0.55rem;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(16,185,129,0.08);
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    border: 1px solid rgba(16,185,129,0.12);
}

/* User experience quotes */
.nrd-ep-quotes {
    margin-top: 0.85rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--nrd-border);
    grid-column: 1 / -1;
}
.nrd-ep-quotes-title {
    font-family: var(--nrd-mono);
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.35rem;
}
.nrd-ep-quote-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.25rem 0;
    font-size: 0.78rem;
    line-height: 1.5;
}
.nrd-ep-quote-row + .nrd-ep-quote-row {
    border-top: 1px solid rgba(128,128,128,0.04);
}
.nrd-ep-quote-tag {
    font-family: var(--nrd-mono);
    font-size: 0.52rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--nrd-border);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}
.nrd-ep-quote-text {
    font-style: italic;
    color: var(--text);
    font-weight: 400;
}
.nrd-ep-quote-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.nrd-ep-cite-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    transition: color 0.15s;
}
.nrd-ep-cite-link:hover { color: var(--accent); text-decoration: none; }

/* Source color tags */
.nrd-src-bluelight { color: #5b9bd5; }
.nrd-src-nervewing-blog { color: #b07cd8; }
.nrd-src-shulgin { color: #d4a843; }
.nrd-src-reddit { color: #ff4500; }
.nrd-src-psychonautwiki { color: #6b8e23; }
.nrd-src-effectindex { color: #e06c75; }

/* Report sources */
.nrd-ep-sources {
    margin-top: 1rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--nrd-border);
}
.nrd-ep-sources-label {
    font-family: var(--nrd-mono);
    font-size: 0.56rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
    display: block;
}
.nrd-ep-sources-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.nrd-ep-src-link {
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--nrd-border);
    transition: border-color 0.2s, color 0.2s;
}
.nrd-ep-src-link:hover {
    border-color: var(--accent);
    color: var(--text);
    text-decoration: none;
}
.nrd-ep-src-name { font-weight: 600; white-space: nowrap; }
.nrd-ep-src-name::after { content: ':'; }
.nrd-ep-src-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.nrd-ep-src-author { opacity: 0.55; font-size: 0.66rem; }

/* Category fill colors */
.nrd-fill-psychedelic { background: var(--category-psychedelic, #9b59b6); }
.nrd-fill-empathogen { background: var(--category-empathogen, #e91e63); }
.nrd-fill-dissociative { background: var(--category-dissociative, #0097a7); }
.nrd-fill-stimulant { background: var(--category-stimulant, #f9a825); }
.nrd-fill-benzodiazepine { background: var(--category-benzodiazepine, #1e88e5); }
.nrd-fill-opioid { background: var(--category-opioid, #e57373); }
.nrd-fill-cannabinoid { background: var(--category-cannabinoid, #66bb6a); }
.nrd-fill-deliriant { background: var(--category-deliriant, #8d6e63); }
.nrd-fill-nootropic { background: var(--category-nootropic, #26a69a); }
.nrd-fill-depressant { background: var(--category-depressant, #5c6bc0); }

/* ── Pharmacology ───────────────────────────────────────────────────── */
.stats-page .nrd-pharm-quick { padding-left: 0; }
.stats-page .nrd-pharm-cols { padding-left: 0; }

/* ── Pharmacology subsections ───────────────────────────────────────── */
.pharm-subsection {
    margin-bottom: 1.25rem;
}
.pharm-subsection:last-child { margin-bottom: 0; }
.pharm-sub-title {
    font-family: var(--nrd-font);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.5rem;
    letter-spacing: 0;
}

/* Mechanism of Action — grouped chips */
.pharm-moa-groups {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.pharm-moa-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.pharm-moa-group-label {
    font-family: var(--nrd-font);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 0.15rem;
}
.pharm-moa-group[data-action="agonist"] .pharm-moa-group-label    { color: #43a047; }
.pharm-moa-group[data-action="antagonist"] .pharm-moa-group-label { color: #e53935; }
.pharm-moa-group[data-action="inhibitor"] .pharm-moa-group-label  { color: #f57c00; }
.pharm-moa-group[data-action="modulator"] .pharm-moa-group-label  { color: #1e88e5; }
.pharm-moa-group:not([data-action]) .pharm-moa-group-label        { color: var(--text-muted); }
body.dark .pharm-moa-group[data-action="agonist"] .pharm-moa-group-label    { color: #66bb6a; }
body.dark .pharm-moa-group[data-action="antagonist"] .pharm-moa-group-label { color: #ef5350; }
body.dark .pharm-moa-group[data-action="inhibitor"] .pharm-moa-group-label  { color: #ffa726; }
body.dark .pharm-moa-group[data-action="modulator"] .pharm-moa-group-label  { color: #42a5f5; }
.pharm-moa-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.pharm-moa-item {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    background: transparent;
    border-radius: 4px;
    border: 1px solid var(--nrd-border);
    border-left: 3px solid var(--accent, #ff008b);
    font-family: var(--nrd-font);
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.35;
}
.pharm-moa-item[data-action="agonist"]    { border-left-color: #43a047; }
.pharm-moa-item[data-action="antagonist"] { border-left-color: #e53935; }
.pharm-moa-item[data-action="inhibitor"]  { border-left-color: #f57c00; }
.pharm-moa-item[data-action="modulator"]  { border-left-color: #1e88e5; }

/* Receptor Binding */
.pharm-rb-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
}
.pharm-rb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.65rem;
    border-radius: 4px;
    border-left: 3px solid var(--nrd-border);
    font-family: var(--nrd-font);
    font-size: 0.82rem;
}
.pharm-rb-row:nth-child(odd) { background: var(--nrd-table-stripe); }
.pharm-rb-row[data-action="agonist"]    { border-left-color: #43a047; }
.pharm-rb-row[data-action="antagonist"] { border-left-color: #e53935; }
.pharm-rb-row[data-action="inhibitor"]  { border-left-color: #f57c00; }
.pharm-rb-row[data-action="modulator"]  { border-left-color: #1e88e5; }
body.dark .pharm-rb-row[data-action="agonist"]    { border-left-color: #66bb6a; }
body.dark .pharm-rb-row[data-action="antagonist"] { border-left-color: #ef5350; }
body.dark .pharm-rb-row[data-action="inhibitor"]  { border-left-color: #ffa726; }
body.dark .pharm-rb-row[data-action="modulator"]  { border-left-color: #42a5f5; }
.pharm-rb-receptor {
    color: var(--text);
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}
.pharm-rb-affinity {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--nrd-mono);
    text-align: right;
    white-space: nowrap;
}

/* Metabolism */
.pharm-metabolism-text {
    font-family: var(--nrd-font);
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.65;
    margin: 0;
    padding: 0.65rem 0.85rem;
    border-left: 2px solid var(--nrd-rule);
    border-radius: 0;
}
/* Metabolites */
.pharm-metabolites-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.pharm-metabolite-item {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--nrd-border);
    border-radius: 4px;
    font-family: var(--nrd-font);
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* Single column inside card grid */
.nrd-content-card .pharm-rb-grid { grid-template-columns: 1fr; }
@media (max-width: 600px) {
    .pharm-rb-grid { grid-template-columns: 1fr; }
}

/* ── Interaction Tiers ──────────────────────────────────────────────── */
.nrd-si-tier {
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: var(--nrd-radius);
    border: 1px solid var(--nrd-border);
}
.nrd-si-tier-label {
    font-family: var(--nrd-font);
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0 0 0.45rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--nrd-border);
}
.nrd-si-tier-dangerous .nrd-si-tier-label { color: #ef4444; border-bottom-color: rgba(239,68,68,0.3); }
.nrd-si-tier-unsafe .nrd-si-tier-label    { color: #f59e0b; border-bottom-color: rgba(245,158,11,0.3); }
.nrd-si-tier-caution .nrd-si-tier-label   { color: #eab308; border-bottom-color: rgba(234,179,8,0.2); }
.nrd-si-tier-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.nrd-si-tier-list li {
    font-size: 0.78rem;
    color: var(--text);
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(128,128,128,0.04);
    line-height: 1.5;
}
.nrd-si-tier-list li:last-child { border-bottom: none; }

/* ── Harm Potential Cards ───────────────────────────────────────────── */
.nrd-si-harm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.nrd-si-harm-card {
    padding: 0.85rem 1rem;
    border: 1px solid var(--nrd-border);
    border-radius: var(--nrd-radius);
}
.nrd-si-harm-label {
    display: block;
    font-family: var(--nrd-mono);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.nrd-si-harm-value {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.5;
}
.nrd-si-harm-detail {
    font-size: 0.78rem;
    color: var(--text);
    margin: 0.2rem 0;
    line-height: 1.5;
}
.nrd-si-harm-detail strong {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
}

/* ── Chemical Identification ────────────────────────────────────────── */
.nrd-si-ident-grid {
    border: 1px solid var(--nrd-border);
    border-radius: var(--nrd-radius);
    overflow: hidden;
}
.nrd-si-ident-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(128,128,128,0.04);
}
.nrd-si-ident-row:last-child { border-bottom: none; }
.nrd-si-ident-row:nth-child(even) { background: var(--nrd-table-stripe); }
.nrd-si-ident-key {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 130px;
    flex-shrink: 0;
}
.nrd-si-ident-val {
    font-size: 0.8rem;
    color: var(--text);
    word-break: break-all;
}
.nrd-si-ident-mono {
    font-family: var(--nrd-mono);
    font-size: 0.75rem;
}
.nrd-si-ident-smiles {
    font-size: 0.68rem;
    opacity: 0.85;
}

/* ── Legal Status ───────────────────────────────────────────────────── */
.nrd-si-intl-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}
.nrd-si-intl-badge {
    font-family: var(--nrd-mono);
    font-size: 0.62rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.15);
    letter-spacing: 0.02em;
}
body.dark .nrd-si-intl-badge {
    background: rgba(239,68,68,0.12);
    color: #f87171;
    border-color: rgba(239,68,68,0.2);
}
.nrd-si-legality-table td:first-child { font-weight: 500; }
.nrd-si-status-badge {
    font-family: var(--nrd-mono);
    font-size: 0.68rem;
    font-weight: 500;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    border: 1px solid var(--nrd-border);
}
.nrd-si-legality-notes {
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 300px;
}

/* ── History & Culture ──────────────────────────────────────────────── */
.hc-intro {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 1rem;
    opacity: 0.92;
}
.hc-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.hc-section {
    padding: 0;
    margin-bottom: 0.9rem;
}
.hc-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--text);
}
.hc-date-range {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent, #ff008b);
    white-space: nowrap;
}
.hc-section-text {
    font-size: 0.85rem;
    line-height: 1.75;
    color: var(--text);
    margin: 0;
    opacity: 0.9;
}
.hc-read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--nrd-border);
    border-radius: 100px;
    background: transparent;
    color: var(--accent, #ff008b);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--nrd-font);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.hc-read-more:hover {
    background: rgba(255, 0, 139, 0.06);
    border-color: var(--accent, #ff008b);
}
body.dark .hc-read-more:hover {
    background: rgba(255, 0, 139, 0.12);
}
.hc-read-more-chevron {
    transition: transform 0.2s;
}
.hc-read-more-open .hc-read-more-chevron {
    transform: rotate(180deg);
}

/* Subjective Effect Notes */
.effects-narrative {
    font-size: 0.84rem;
    line-height: 1.65;
    color: var(--text);
    opacity: 0.88;
    font-style: italic;
    margin: 0 0 0.65rem;
    padding: 0.55rem 0.85rem;
    border-left: 2px solid var(--accent, #ff008b);
}
body.dark .effects-narrative {
    background: rgba(255,255,255,0.015);
}
.effects-narrative-sub {
    margin: 0.3rem 0 0.6rem;
    font-size: 0.8rem;
    border-left-width: 2px;
    opacity: 0.82;
}

/* ── Dose-Response Table ────────────────────────────────────────────── */
.nrd-drc-details { margin-top: 0.6rem; }
.nrd-drc-toggle {
    font-family: var(--nrd-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0;
    user-select: none;
    letter-spacing: 0.02em;
}
.nrd-drc-toggle:hover { color: var(--accent); }
.nrd-drc-table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
    border-radius: var(--nrd-radius);
    border: 1px solid var(--nrd-border);
}
.nrd-drc-table {
    width: 100%;
    font-size: 0.75rem;
    border-collapse: collapse;
}
.nrd-drc-table th,
.nrd-drc-table td {
    padding: 0.4rem 0.55rem;
    text-align: center;
}
.nrd-drc-table thead th {
    font-family: var(--nrd-mono);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--nrd-rule);
    position: sticky;
    top: 0;
}
.nrd-drc-table tbody tr { border-bottom: 1px solid rgba(128,128,128,0.04); }
.nrd-drc-table tbody tr:nth-child(even) { background: var(--nrd-table-stripe); }
.nrd-drc-table td:first-child,
.nrd-drc-table th:first-child { text-align: left; font-weight: 500; }
.nrd-drc-table td {
    font-family: var(--nrd-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.72rem;
}
.nrd-drc-n {
    font-size: 0.58rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ── Dose stats ─────────────────────────────────────────────────────── */
.nrd-dose-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 0.65rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.nrd-dose-stats strong {
    font-family: var(--nrd-mono);
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ── Combination links ──────────────────────────────────────────────── */
.nrd-combo-link { color: var(--accent); text-decoration: none; }
.nrd-combo-link:hover { text-decoration: underline; }

/* ── External link ──────────────────────────────────────────────────── */
.nrd-ext-link { text-align: center; margin: 1.5rem 0 0.5rem; }
.nrd-erowid-btn {
    font-family: var(--nrd-font);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    display: inline-block;
    transition: background 0.2s, color 0.2s;
    letter-spacing: 0.01em;
}
.nrd-erowid-btn:hover {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

/* ── Card overrides ─────────────────────────────────────────────────── */
.stats-page .report-link-card { border-radius: var(--nrd-radius); }

/* ── Back card ──────────────────────────────────────────────────────── */
.nrd-back-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    margin-top: 2.5rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--nrd-radius);
    border: 1px solid var(--nrd-border);
    transition: color 0.2s, border-color 0.2s;
}
.nrd-back-card:hover {
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

/* ── Citations ──────────────────────────────────────────────────────── */
.nrd-si-cite-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

/* ── Animations ─────────────────────────────────────────────────────── */
@keyframes nrdFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.nrd-hero {
    animation: nrdFadeUp 0.3s ease-out both;
}
@media (prefers-reduced-motion: reduce) {
    .nrd-section,
    .nrd-hero {
        animation: none;
    }
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .nrd-card-grid-2 { grid-template-columns: 1fr; }
    .nrd-card-grid-4,
    .nrd-metadata-bar {
        flex-wrap: wrap;
    }
    .nrd-card-grid-4 .nrd-metric,
    .nrd-metadata-bar .nrd-metric {
        flex: 1 1 40%;
        border-right: none;
        border-bottom: 1px solid var(--nrd-border);
    }
    .nrd-hero {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }
    .nrd-hero-structure {
        width: 100%;
        height: 100px;
        order: -1;
    }
    .nrd-title { font-size: 1.45rem; }
    .nrd-ep-body { grid-template-columns: 1fr; }
    .nrd-ep-dim-label { min-width: 95px; font-size: 0.7rem; }
    .nrd-ep-header { flex-wrap: wrap; }
    .nrd-ep-name { min-width: auto; }
    .nrd-charts-grid { grid-template-columns: 1fr; }
    .nrd-si-harm-grid { grid-template-columns: 1fr; }
    .nrd-si-ident-key { min-width: 100px; }
    .nrd-metrics { gap: 0.5rem; }
    .nrd-subtitle { margin-left: 0; }
}

/* ── BlueLight-specific styles ──────────────────────────────────────── */
.nrd-ep-dim-marker-bl {
    background: rgba(80,160,255,0.8);
}
.nrd-ep-dim-bl {
    font-size: 0.55rem;
    font-weight: 500;
    color: rgba(80,160,255,0.75);
    margin-left: 1px;
}
.nrd-ep-dim-bl::before { content: '/'; color: var(--nrd-border); }

.nrd-badge-bl {
    background: rgba(80,160,255,0.12) !important;
    color: rgba(80,160,255,0.9) !important;
    border: 1px solid rgba(80,160,255,0.2) !important;
}

.nrd-metric-positive { color: rgba(52,211,153,0.9); }
.nrd-metric-negative { color: rgba(248,113,113,0.9); }
.nrd-metric-neutral  { color: rgba(156,163,175,0.7); }

/* Sentiment Grid */
.nrd-sentiment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.25rem;
}
.nrd-sentiment-col {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--nrd-border);
    border-radius: 8px;
    padding: 1rem;
}
.nrd-sentiment-title {
    font-family: var(--nrd-sans);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.nrd-sent-count {
    font-family: var(--nrd-mono);
    font-size: 0.65rem;
    background: rgba(255,255,255,0.05);
    padding: 1px 6px;
    border-radius: 3px;
    color: var(--text-muted);
}
.nrd-sent-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.nrd-sent-dot-pos { background: rgba(52,211,153,0.7); }
.nrd-sent-dot-neg { background: rgba(248,113,113,0.7); }

.nrd-sentiment-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.nrd-sent-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
}
.nrd-sent-name {
    min-width: 120px;
    max-width: 160px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nrd-sent-bar-wrap {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
    overflow: hidden;
}
.nrd-sent-bar {
    display: block;
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}
.nrd-sent-bar-pos { background: rgba(52,211,153,0.6); }
.nrd-sent-bar-neg { background: rgba(248,113,113,0.6); }

.nrd-sent-pct {
    font-family: var(--nrd-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.nrd-sent-conf {
    font-family: var(--nrd-mono);
    font-size: 0.55rem;
    color: var(--text-muted);
    opacity: 0.6;
    min-width: 28px;
    text-align: right;
    cursor: help;
}

@media (max-width: 768px) {
    .nrd-sentiment-grid { grid-template-columns: 1fr; }
    .nrd-sent-name { min-width: 90px; max-width: 120px; }
}

@media (max-width: 480px) {
    .nrd-card-grid-4,
    .nrd-metadata-bar {
        flex-direction: column;
    }
    .nrd-card-grid-4 .nrd-metric,
    .nrd-metadata-bar .nrd-metric {
        flex: 1 1 100%;
        flex-direction: row;
        justify-content: space-between;
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--nrd-border);
        border-right: none;
    }
    .nrd-metric-label { text-transform: none; text-align: right; }
    .nrd-content-card { padding: 0.85rem; }
    .stats-page { padding: 0.5rem 0.75rem 2.5rem; }
    .nrd-hero { padding: 0.75rem 0; }
    .nrd-title { font-size: 1.25rem; }
    .nrd-ep-dim-label { min-width: 75px; font-size: 0.66rem; }
    .nrd-ep-dim-weight { display: none; }
    .nrd-ep-class { padding: 0.85rem 0; }
    .nrd-metrics { flex-direction: column; }
    .nrd-dose-stats { flex-direction: column; gap: 0.2rem; }
    .nrd-section-head { padding-left: 0; }
    .nrd-si-ident-row { flex-direction: column; gap: 0.15rem; }
    .nrd-si-ident-key { min-width: unset; }
    .nrd-si-legality-notes { max-width: none; }
}
