/* ===================================================================
   Supplement Hub — Design System v3
   Based on UI UX Pro Max: Accessible & Ethical + Healthcare
   =================================================================== */

/* Google Fonts: Figtree (headings) + Noto Sans (body) */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;600;700;800;900&family=Noto+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
    /* Typography */
    --font-heading: 'Figtree', system-ui, -apple-system, sans-serif;
    --font-body: 'Noto Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;

    /* Colors — Pharmacy Green + Trust Blue */
    --pri: #15803D;
    --pri-hover: #166534;
    --pri-light: #F0FDF4;
    --pri-ring: rgba(21, 128, 61, 0.3);
    --accent: #0369A1;
    --accent-hover: #075985;
    --accent-light: #E0F2FE;

    /* Semantic Colors */
    --suc: #16a34a;
    --suc-light: #f0fdf4;
    --warn: #d97706;
    --warn-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;

    /* Surfaces */
    --bg: #ffffff;
    --surface: #f8fafc;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-focus: #15803D;

    /* Text */
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-on-pri: #ffffff;

    /* Spacing Scale */
    --xs: 0.25rem;
    --s: 0.5rem;
    --m: 1rem;
    --l: 1.5rem;
    --xl: 2rem;
    --xxl: 3rem;
    --xxxl: 4rem;

    /* Border Radius */
    --rad: 8px;
    --rad-lg: 12px;
    --rad-xl: 16px;
    --rad-full: 9999px;

    /* Shadows */
    --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --sh: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --sh-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --sh-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Layout */
    --mw: 1080px;
    --header-height: 64px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Focus Ring */
    --focus-ring: 0 0 0 3px var(--pri-ring);
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    max-width: var(--mw);
    margin: 0 auto;
    padding: var(--m) var(--l);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: var(--m);
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: var(--xl) 0 var(--m);
    padding-bottom: var(--s);
    border-bottom: 2px solid var(--border);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: var(--l) 0 var(--s);
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: var(--m) 0 var(--s);
}

p {
    margin-bottom: var(--m);
    color: var(--text);
    font-size: 1rem;
}

a {
    color: var(--pri);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--pri-hover);
    text-decoration: underline;
}

ul, ol {
    padding-left: 1.5rem;
    margin-bottom: var(--m);
}

li {
    margin-bottom: var(--xs);
}

strong {
    font-weight: 600;
}

small {
    font-size: 0.875rem;
    color: var(--text-muted);
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--surface);
    padding: 0.125em 0.375em;
    border-radius: var(--rad);
    border: 1px solid var(--border);
}

/* ── Header ────────────────────────────────────────────────────── */
.site-header {
    display: flex;
    align-items: center;
    gap: var(--m);
    padding: var(--m) 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--l);
    flex-wrap: wrap;
    position: relative;
    min-height: var(--header-height);
}

.site-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    letter-spacing: -0.025em;
}

.site-logo span {
    color: var(--pri);
}

.site-logo:hover {
    text-decoration: none;
    color: var(--text);
}

/* ── Search Form ───────────────────────────────────────────────── */
.search-form {
    flex: 1;
    min-width: 200px;
    max-width: 420px;
    position: relative;
}

.search-form input[type="search"] {
    width: 100%;
    padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    border: 2px solid var(--border);
    border-radius: var(--rad-full);
    font-size: 0.9375rem;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    min-height: 44px;
}

.search-form input[type="search"]:focus {
    border-color: var(--pri);
    box-shadow: var(--focus-ring);
}

.search-form input[type="search"]::placeholder {
    color: var(--text-muted);
}

.search-form button {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.125rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.search-form button:hover {
    color: var(--pri);
}

/* ── Navigation ────────────────────────────────────────────────── */
.site-nav .nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    border-radius: var(--rad);
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: var(--font-body);
    color: var(--text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
    min-height: 44px;
}

.nav-links a:hover {
    background: var(--pri-light);
    color: var(--pri);
    text-decoration: none;
}

.nav-links a[aria-current="page"],
.nav-links a.active {
    background: var(--pri-light);
    color: var(--pri);
    font-weight: 600;
}

/* ── Mobile Navigation ─────────────────────────────────────────── */
.mobile-menu-toggle {
    display: none;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    z-index: 20;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.mobile-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--rad-lg);
    box-shadow: var(--sh-lg);
    z-index: 10;
    padding: var(--s);
    max-height: 80vh;
    overflow-y: auto;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem var(--m);
    border-radius: var(--rad);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    min-height: 44px;
}

.mobile-nav a:hover {
    background: var(--pri-light);
    color: var(--pri);
    text-decoration: none;
}

.mobile-menu-toggle:checked ~ .mobile-nav {
    display: block;
}

.mobile-menu-toggle:checked ~ .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle:checked ~ .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle:checked ~ .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
    .site-nav {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .search-form {
        order: 3;
        min-width: 100%;
        max-width: 100%;
        margin-top: var(--s);
    }
}

/* ── Breadcrumbs ───────────────────────────────────────────────── */
.breadcrumbs {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--m);
    flex-wrap: wrap;
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.breadcrumbs a {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--pri);
}

.breadcrumbs span[aria-current="page"] {
    color: var(--text);
    font-weight: 500;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--rad-lg);
    padding: var(--l);
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
    box-shadow: var(--sh-md);
    border-color: var(--border);
}

a.card {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.card:hover {
    text-decoration: none;
    border-color: var(--pri);
}

a.card:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-color: var(--pri);
}

/* ── Tables ────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--m) 0;
    border-radius: var(--rad-lg);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    border: 1px solid var(--border);
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

th {
    background: var(--surface);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-family: var(--font-heading);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--surface-hover);
}

caption {
    font-weight: 600;
    margin-bottom: var(--s);
    text-align: left;
    font-family: var(--font-heading);
    color: var(--text);
}

/* ── Alerts ────────────────────────────────────────────────────── */
.alert {
    padding: var(--m) var(--l);
    border-radius: var(--rad);
    margin: var(--m) 0;
    border-left: 4px solid;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.alert-info {
    background: var(--pri-light);
    border-color: var(--pri);
}

.alert-warn {
    background: var(--warn-light);
    border-color: var(--warn);
}

.alert-danger {
    background: var(--danger-light);
    border-color: var(--danger);
}

.alert-success {
    background: var(--suc-light);
    border-color: var(--suc);
}

/* ── Badges ────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--rad-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    font-family: var(--font-heading);
    line-height: 1.4;
}

.badge-pri {
    background: var(--pri-light);
    color: var(--pri);
}

.badge-suc {
    background: var(--suc-light);
    color: var(--suc);
}

.badge-warn {
    background: var(--warn-light);
    color: var(--warn);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-accent {
    background: var(--accent-light);
    color: var(--accent);
}

/* ── Author Byline ─────────────────────────────────────────────── */
.author-byline {
    background: var(--pri-light);
    border-left: 4px solid var(--pri);
    padding: var(--m) var(--l);
    border-radius: 0 var(--rad) var(--rad) 0;
    font-size: 0.875rem;
    margin-bottom: var(--l);
    line-height: 1.6;
    color: var(--text-secondary);
}

.author-byline strong {
    color: var(--text);
}

/* ── Disclaimer Box ────────────────────────────────────────────── */
.disclaimer-box {
    background: var(--warn-light);
    border: 1px solid var(--warn);
    border-radius: var(--rad-lg);
    padding: var(--m) var(--l);
    margin: var(--xl) 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.disclaimer-box strong {
    color: var(--warn);
}

/* ── FAQ Accordion ─────────────────────────────────────────────── */
.faq details {
    border-bottom: 1px solid var(--border);
    padding: var(--s) 0;
}

.faq summary {
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--m) 0;
    gap: var(--m);
    font-family: var(--font-heading);
    min-height: 44px;
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--pri);
    transition: transform var(--transition-base);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.faq details[open] summary::after {
    content: '\2212';
    transform: rotate(180deg);
}

.faq details p {
    padding: 0 0 var(--m) 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
}

/* ── Grid Layout ───────────────────────────────────────────────── */
.grid {
    display: grid;
    gap: var(--m);
}

.grid-2 {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--rad);
    font-weight: 600;
    font-size: 0.9375rem;
    font-family: var(--font-heading);
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 2px solid transparent;
    min-height: 44px;
    line-height: 1.4;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn-pri {
    background: var(--pri);
    color: var(--text-on-pri);
    border-color: var(--pri);
}

.btn-pri:hover {
    background: var(--pri-hover);
    border-color: var(--pri-hover);
    color: var(--text-on-pri);
    text-decoration: none;
}

.btn-out {
    background: transparent;
    border: 2px solid var(--pri);
    color: var(--pri);
}

.btn-out:hover {
    background: var(--pri);
    color: var(--text-on-pri);
    text-decoration: none;
}

.btn-accent {
    background: var(--accent);
    color: var(--text-on-pri);
    border-color: var(--accent);
}

.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--text-on-pri);
    text-decoration: none;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    min-height: 36px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.0625rem;
    min-height: 52px;
}

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer {
    margin-top: var(--xxxl);
    padding-top: var(--xl);
    border-top: 2px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.site-footer a {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.site-footer a:hover {
    color: var(--pri);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--xl);
    margin-bottom: var(--xl);
}

.footer-grid h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: var(--m);
    color: var(--text);
    font-family: var(--font-heading);
}

.footer-grid ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-grid li {
    margin: 0.375rem 0;
}

.footer-grid a {
    font-size: 0.875rem;
    padding: 0.25rem 0;
    display: inline-block;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--l);
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
}

.footer-bottom p {
    margin-bottom: var(--s);
}

/* ── Accessibility ─────────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--text);
    color: var(--bg);
    padding: 0.75rem 1rem;
    z-index: 100;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 0 0 var(--rad) 0;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
    outline: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 3px solid var(--pri);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── Sections & Hero ───────────────────────────────────────────── */
.section {
    margin-bottom: var(--xl);
}

.section:last-child {
    margin-bottom: 0;
}

.hero {
    background: linear-gradient(135deg, var(--pri-light) 0%, var(--accent-light) 100%);
    padding: var(--xxl) var(--xl);
    border-radius: var(--rad-xl);
    margin-bottom: var(--xl);
}

/* ── Stat Cards ────────────────────────────────────────────────── */
.stat-card {
    text-align: center;
    padding: var(--l);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--pri);
    font-family: var(--font-heading);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--xs);
    font-weight: 500;
}

/* ── Supplement Card ───────────────────────────────────────────── */
.supp-card {
    display: flex;
    flex-direction: column;
    gap: var(--xs);
}

.supp-card .supp-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    font-family: var(--font-heading);
}

.supp-card .supp-category {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ── Comparison Cards ──────────────────────────────────────────── */
.compare-card {
    text-align: center;
    border: 2px solid var(--border);
    transition: border-color var(--transition-base);
}

.compare-card.featured {
    border-color: var(--pri);
    background: var(--pri-light);
}

.compare-card h3 {
    margin-top: 0;
}

/* ── Tool Cards ────────────────────────────────────────────────── */
.tool-card {
    display: flex;
    flex-direction: column;
    gap: var(--xs);
}

.tool-card .tool-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    font-family: var(--font-heading);
}

.tool-card .tool-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Study Card ────────────────────────────────────────────────── */
.study-card {
    display: flex;
    flex-direction: column;
    gap: var(--xs);
}

.study-card .study-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
    line-height: 1.4;
}

.study-card .study-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ── Key Takeaway ──────────────────────────────────────────────── */
.takeaway {
    border-left: 4px solid var(--pri);
    background: var(--pri-light);
    padding: var(--m) var(--l);
    border-radius: 0 var(--rad) var(--rad) 0;
    font-size: 0.9375rem;
    line-height: 1.7;
}

/* ── Search Results ────────────────────────────────────────────── */
.search-result {
    display: flex;
    align-items: center;
    gap: var(--m);
    padding: var(--m);
}

.search-result .result-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: var(--rad);
}

.search-result .result-info {
    flex: 1;
    min-width: 0;
}

.search-result .result-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
}

.search-result .result-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.search-result .result-badge {
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Autocomplete Dropdown ─────────────────────────────────────── */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--rad-lg);
    box-shadow: var(--sh-lg);
    z-index: 100;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    margin-top: var(--xs);
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--surface);
    text-decoration: none;
}

.autocomplete-item .ac-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.autocomplete-item .ac-name {
    font-weight: 600;
    color: var(--text);
}

.autocomplete-item .ac-name mark {
    background: var(--pri-light);
    color: var(--pri);
    padding: 0 2px;
    border-radius: 2px;
}

.autocomplete-item .ac-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Empty State ───────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--xxxl) var(--xl);
}

.empty-state .empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--s);
}

.empty-state .empty-desc {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ── Dark Mode Toggle ──────────────────────────────────────────── */
.theme-toggle {
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--rad);
    padding: 0.375rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--pri);
    color: var(--pri);
    background: var(--pri-light);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

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

/* ── Dark Mode ─────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --surface: #1e293b;
        --surface-hover: #334155;
        --border: #334155;
        --text: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --pri: #4ade80;
        --pri-hover: #22c55e;
        --pri-light: #052e16;
        --pri-ring: rgba(74, 222, 128, 0.3);
        --accent: #38bdf8;
        --accent-hover: #0ea5e9;
        --accent-light: #0c4a6e;
        --suc: #4ade80;
        --suc-light: #052e16;
        --warn: #fbbf24;
        --warn-light: #422006;
        --danger: #f87171;
        --danger-light: #450a0a;
        --text-on-pri: #0f172a;
    }

    body {
        background: var(--bg);
        color: var(--text);
    }

    th {
        background: var(--surface);
    }

    table {
        background: var(--surface);
    }

    .hero {
        background: linear-gradient(135deg, var(--pri-light) 0%, var(--accent-light) 100%);
    }
}

/* Dark mode via class (for manual toggle) */
[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --pri: #4ade80;
    --pri-hover: #22c55e;
    --pri-light: #052e16;
    --pri-ring: rgba(74, 222, 128, 0.3);
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-light: #0c4a6e;
    --suc: #4ade80;
    --suc-light: #052e16;
    --warn: #fbbf24;
    --warn-light: #422006;
    --danger: #f87171;
    --danger-light: #450a0a;
    --text-on-pri: #0f172a;
}

[data-theme="dark"] body {
    background: var(--bg);
    color: var(--text);
}

[data-theme="dark"] th {
    background: var(--surface);
}

[data-theme="dark"] table {
    background: var(--surface);
}

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, var(--pri-light) 0%, var(--accent-light) 100%);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    body {
        padding: var(--s) var(--m);
    }

    h1 {
        font-size: 1.625rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.8125rem;
    }

    th, td {
        padding: 0.5rem 0.625rem;
    }

    .hero {
        padding: var(--xl) var(--m);
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--l);
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Print ─────────────────────────────────────────────────────── */
@media print {
    .site-header,
    .site-footer,
    .search-form,
    .hamburger,
    .mobile-nav,
    .theme-toggle,
    .skip-link {
        display: none !important;
    }

    body {
        max-width: 100%;
        padding: 0;
        font-size: 12pt;
    }

    a {
        color: var(--text);
        text-decoration: underline;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
.citation-link{font-size:.75rem;font-weight:600;padding:0 .15rem;white-space:nowrap}
.citation-link:hover{text-decoration:none;background:var(--pri-l)}
.ai-content h3{font-size:1.05rem;font-weight:700;margin:1.2rem 0 .4rem 0;border:none;padding:0;color:var(--text)}
.ai-content h3:first-child{margin-top:0}
.ai-content p{margin-bottom:.8rem;line-height:1.7}
.ai-content p:last-child{margin-bottom:0}
