/* ===========================================================================
   PeptideLine.io
   =========================================================================== */

:root {
    --navy: #0d1f3c;
    --navy-deep: #081528;
    --brand: #1b3a6b;
    --red: #e8403c;
    --ink: #121826;
    --body: #4d5668;
    --muted: #8a93a5;
    --line: #e6e9f0;
    --surface: #ffffff;
    --surface-2: #f6f8fc;
    --radius: 16px;
    --shadow: 0 10px 40px rgba(13, 31, 60, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.65;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .num {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

/* --------------------------------------------------------------- header -- */

#site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 21, 40, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.3s;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 0.85rem 2rem;
}

.logo img {
    height: 42px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.93rem;
    padding-bottom: 3px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.nav-links a:hover {
    color: #fff;
    border-bottom-color: var(--red);
}

/* ----------------------------------------------------------------- hero -- */

.hero {
    position: relative;
    background:
        radial-gradient(900px 600px at 15% 0%, #1b3a6b 0%, rgba(27, 58, 107, 0) 60%),
        radial-gradient(800px 500px at 85% 20%, #2a1e52 0%, rgba(42, 30, 82, 0) 65%),
        linear-gradient(170deg, #0d1f3c 0%, #081528 100%);
    color: #fff;
    text-align: center;
    padding: 5.5rem 2rem 6.5rem;
    overflow: hidden;
    isolation: isolate;
}

#molecules {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: 0.55;
}

.hero-glow {
    position: absolute;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 900px;
    background: radial-gradient(circle, rgba(232, 64, 60, 0.16) 0%, rgba(232, 64, 60, 0) 62%);
    z-index: -1;
    pointer-events: none;
}

.hero-fade {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 120px;
    background: linear-gradient(180deg, rgba(8, 21, 40, 0) 0%, #ffffff 100%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 920px;
    margin: 0 auto;
}

.hero-logo {
    display: block;
    /* max-width caps the clamp's 290px floor, which otherwise overflows
       viewports narrower than that and scrolls the page sideways. */
    width: clamp(290px, 66vw, 780px);
    max-width: 100%;
    height: auto;
    margin: 0 auto 2.5rem;
    filter: drop-shadow(0 8px 40px rgba(120, 170, 255, 0.35));
    animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tagline {
    font-size: clamp(1.6rem, 3.6vw, 2.9rem);
    font-weight: 700;
    margin-bottom: 1.3rem;
    animation: rise 0.9s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.grad {
    background: linear-gradient(100deg, #ff6b57 0%, #ffb86b 45%, #6fd3ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.sub {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    color: rgba(255, 255, 255, 0.72);
    max-width: 56ch;
    margin: 0 auto 2.4rem;
    animation: rise 0.9s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    animation: rise 0.9s 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.btn {
    display: inline-block;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.95rem 2rem;
    border-radius: 999px;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #e8403c 0%, #ff7a4d 100%);
    color: #fff;
    box-shadow: 0 10px 30px rgba(232, 64, 60, 0.35);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(232, 64, 60, 0.45);
}

.btn-ghost {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

.stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2.5rem 3.5rem;
    margin-top: 4rem;
    animation: rise 0.9s 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.num {
    font-size: 2.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #9fc2ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lbl {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.55);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(26px); }
    to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- sections -- */

.content-section {
    max-width: 1200px;
    margin: 5.5rem auto;
    padding: 0 2rem;
}

.section-head {
    margin-bottom: 2.5rem;
}

.eyebrow {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--red);
    margin-bottom: 0.7rem;
}

.content-section h2 {
    font-size: clamp(1.9rem, 3.4vw, 2.6rem);
    color: var(--ink);
}

.lede {
    color: var(--body);
    max-width: 68ch;
    margin-top: 0.9rem;
    font-size: 1.05rem;
}

.count {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
    vertical-align: middle;
    margin-left: 0.6rem;
    letter-spacing: 0;
}

/* --------------------------------------------------------- theme tiles -- */

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr));
    gap: 1rem;
}

.theme {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem 1.3rem 1.2rem;
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    font: inherit;
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.theme::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--c) 0%, transparent 70%);
    opacity: 0.08;
    transition: opacity 0.25s;
}

.theme:hover {
    transform: translateY(-5px);
    border-color: transparent;
    box-shadow: 0 14px 34px rgba(13, 31, 60, 0.14);
}

.theme:hover::before {
    opacity: 0.18;
}

.theme .dot {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--c);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.05rem;
    margin-bottom: 0.9rem;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 45%, transparent);
}

.theme h3 {
    position: relative;
    font-size: 1.02rem;
    margin-bottom: 0.15rem;
}

.theme span.n {
    position: relative;
    font-size: 0.85rem;
    color: var(--muted);
}

/* -------------------------------------------------------------- search -- */

.library-bar {
    margin: 4rem auto 2rem;
}

.searchwrap {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 1.3rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}

#search {
    width: 100%;
    padding: 1.1rem 1.4rem 1.1rem 3.3rem;
    font: inherit;
    font-size: 1.02rem;
    color: var(--ink);
    background: var(--surface-2);
    border: 2px solid transparent;
    border-radius: 999px;
    outline: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

#search::placeholder {
    color: var(--muted);
}

#search:focus {
    background: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 5px rgba(27, 58, 107, 0.1);
}

/* ------------------------------------------------------------- filters -- */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.chip {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--body);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    border-color: var(--c, var(--brand));
    color: var(--c, var(--brand));
    transform: translateY(-1px);
}

.chip.active {
    background: var(--c, var(--brand));
    border-color: var(--c, var(--brand));
    color: #fff;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--c, var(--brand)) 40%, transparent);
}

/* ----------------------------------------------------------- compounds -- */

.compound-list {
    display: grid;
    gap: 0.8rem;
}

.compound {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
}

.compound::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--c, var(--brand));
    opacity: 0.85;
}

.compound:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(13, 31, 60, 0.1);
    border-color: transparent;
}

.compound.open {
    box-shadow: 0 16px 44px rgba(13, 31, 60, 0.13);
    border-color: transparent;
}

.compound-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.6rem 1.15rem 1.9rem;
    background: none;
    border: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.compound-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.compound-head h3 {
    font-size: 1.16rem;
    color: var(--ink);
}

.tag {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--c, var(--brand));
    background: color-mix(in srgb, var(--c, var(--brand)) 12%, transparent);
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
}

.pill {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.26rem 0.66rem;
    border-radius: 999px;
    color: #fff;
}

.pill.approved { background: #10b981; }
.pill.trials   { background: #f59e0b; }
.pill.research { background: #94a3b8; }

.chev {
    flex: none;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.28s;
}

.compound.open .chev {
    transform: rotate(-135deg) translate(-2px, -2px);
    border-color: var(--c, var(--brand));
}

.compound-body {
    display: none;
    padding: 0 1.9rem 1.75rem;
    max-width: 78ch;
}

.compound.open .compound-body {
    display: block;
    animation: fade 0.35s ease both;
}

@keyframes fade {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.compound-body h4 {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 1.5rem 0 0.7rem;
}

.aka {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0.8rem;
}

.summary {
    color: var(--body);
    font-size: 1.02rem;
}

.reported {
    margin: 0;
    padding: 0;
    list-style: none;
}

.reported li {
    position: relative;
    padding-left: 1.6rem;
    margin-bottom: 0.5rem;
    color: var(--body);
}

.reported li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.62em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c, var(--brand));
}

.caveat,
.status {
    font-size: 0.95rem;
    margin-top: 1.2rem;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
}

.caveat {
    background: #fff8ec;
    border-left: 3px solid #f59e0b;
    color: #7a5a17;
}

.status {
    background: var(--surface-2);
    border-left: 3px solid var(--brand);
    color: #46506a;
}

.facts {
    margin-top: 1.6rem;
    border-top: 1px solid var(--line);
    padding-top: 1.1rem;
    font-size: 0.9rem;
}

.facts > div {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 1rem;
    padding: 0.4rem 0;
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    color: #46506a;
    word-break: break-word;
}

.facts dd.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.84rem;
}

.pubchem {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}

.pubchem:hover {
    color: var(--red);
}

.empty {
    color: var(--muted);
    padding: 2.5rem 0;
    text-align: center;
}

/* ---------------------------------------------------------- field guide -- */

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 1.2rem;
}

.guide-card {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 1.8rem 1.6rem;
    transition: transform 0.25s, box-shadow 0.25s;
}

.guide-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(13, 31, 60, 0.1);
}

.guide-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--c);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

.guide-card h3 {
    font-size: 1.08rem;
    margin-bottom: 0.5rem;
}

.guide-card p {
    color: var(--body);
    font-size: 0.95rem;
}

.disclaimer {
    margin-top: 2.5rem;
    padding: 1.4rem 1.6rem;
    background: #fff8ec;
    border: 1px solid #f6e3bd;
    border-radius: var(--radius);
    font-size: 0.92rem;
    color: #7a5a17;
}

/* --------------------------------------------------------------- footer -- */

footer {
    background: var(--navy-deep);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 3rem 2rem;
    margin-top: 5rem;
}

.footer-logo {
    height: 38px;
    width: auto;
    margin: 0 auto 1.1rem;
    display: block;
    opacity: 0.9;
}

/* --------------------------------------------------------------- reveal -- */

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.in {
    opacity: 1;
    transform: none;
}

/* ----------------------------------------------------------- responsive -- */

@media (max-width: 860px) {
    nav {
        flex-direction: column;
        gap: 0.7rem;
        padding: 0.8rem 1.1rem;
    }

    .logo img {
        height: 34px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem 1.1rem;
    }

    .nav-links a {
        font-size: 0.84rem;
    }

    .hero {
        padding: 3.5rem 1.25rem 5rem;
    }

    .content-section {
        margin: 4rem auto;
        padding: 0 1.25rem;
    }

    .stats {
        gap: 1.75rem 2.5rem;
        margin-top: 3rem;
    }

    .num {
        font-size: 2rem;
    }

    .facts > div {
        grid-template-columns: 1fr;
        gap: 0.1rem;
        padding: 0.55rem 0;
    }

    .compound-head {
        padding: 1rem 1.2rem 1rem 1.5rem;
    }

    .compound-body {
        padding: 0 1.5rem 1.4rem;
    }

    .btn {
        padding: 0.85rem 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}

.pill.supply { background: #64748b; }

/* why people take it */
.uses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.use {
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    color: var(--c, var(--brand));
    background: color-mix(in srgb, var(--c, var(--brand)) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--c, var(--brand)) 22%, transparent);
}

.fam {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--line);
    padding: 0.24rem 0.6rem;
    border-radius: 999px;
}

.mech {
    color: var(--body);
    font-size: 0.97rem;
}

/* evidence tiers */
.ev-grid {
    display: grid;
    gap: 1.1rem;
}

.ev {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.7rem;
    border-left: 5px solid var(--c);
    background: var(--surface);
}

.ev-a { --c: #10b981; }
.ev-b { --c: #3b82f6; }
.ev-c { --c: #f59e0b; }
.ev-d { --c: #94a3b8; }

.ev header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.ev-rank {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: var(--c);
    padding: 0.26rem 0.7rem;
    border-radius: 999px;
}

.ev h3 {
    font-size: 1.12rem;
}

.ev ul {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: var(--body);
}

.ev li {
    margin-bottom: 0.4rem;
}

.ev-note {
    font-size: 0.93rem;
    color: #46506a;
    background: var(--surface-2);
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
}

.ev-safety {
    margin-top: 1.6rem;
    padding: 1.3rem 1.5rem;
    background: #fff8ec;
    border: 1px solid #f6e3bd;
    border-radius: var(--radius);
    font-size: 0.95rem;
    color: #7a5a17;
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 1.2rem;
    margin-top: 1.6rem;
}

.class-card {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 1.6rem;
    border-top: 4px solid var(--brand);
}

.class-card:last-child {
    border-top-color: var(--red);
}

.class-card h3 {
    font-size: 1.08rem;
    margin-bottom: 0.6rem;
}

.class-card p {
    color: var(--body);
    font-size: 0.96rem;
}

/* ---- in practice: real-world use, deliberately NOT styled like evidence ---- */
.practice {
    margin-top: 1.5rem;
    padding: 1.2rem 1.4rem;
    border: 1px dashed #c9b8e8;
    border-radius: 14px;
    background: #faf8ff;
}

.practice-h {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0 0 0.8rem !important;
    color: #6d4fa8 !important;
}

.offlabel {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: #8b5cf6;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    cursor: help;
}

.practice-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.practice-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.45rem;
    color: #4a4160;
    font-size: 0.96rem;
}

.practice-list li::before {
    content: '';
    position: absolute;
    left: 0.25rem;
    top: 0.62em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1.5px solid #8b5cf6;
}

.gap {
    margin-top: 0.9rem;
    padding: 0.8rem 1rem;
    background: #f3eeff;
    border-radius: 10px;
    font-size: 0.93rem;
    color: #5b4a85;
}

.practice-note {
    margin-top: 0.8rem;
    font-size: 0.82rem;
    font-style: italic;
    color: #8b83a3;
}

.guide-card h3 .offlabel {
    vertical-align: middle;
    margin-left: 0.4rem;
}

.guide-sub {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--line);
    font-size: 0.88rem !important;
    color: var(--muted) !important;
}

/* study metadata beside each evidence tier */
.ev-meta {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    border-left: 2px solid var(--line);
    padding-left: 1rem;
}

.ev-meta > div {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 0.75rem;
    padding: 0.22rem 0;
}

.ev-meta dt {
    color: var(--muted);
}

.ev-meta dd {
    color: #46506a;
}

@media (max-width: 860px) {
    .ev-meta > div {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0.35rem 0;
    }
}

/* visually hidden, still announced */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* combined search/filter result line */
.result-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 640px;
    margin: 1rem auto 0;
    padding: 0.8rem 1.1rem;
    background: var(--surface-2);
    border-radius: 999px;
    font-size: 0.92rem;
    color: var(--body);
}

.rb-split {
    color: var(--muted);
}

.rb-none {
    color: #7a5a17;
}

.result-bar:has(.rb-none) {
    background: #fff8ec;
    border: 1px solid #f6e3bd;
}

.clear-search {
    flex: none;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.95rem;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-search:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* evidence strength on collapsed cards */
.evidence-tag {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.24rem 0.62rem;
    border-radius: 999px;
    border: 1px solid currentColor;
}

.evidence-tag.human { color: #0f766e; }
.evidence-tag.animal { color: #a16207; }
.evidence-tag.thin  { color: #9f1239; }

/* ---- keyboard focus -------------------------------------------------------
   Only #search had a focus style; everything else fell back to the browser
   default, which is inconsistent and nearly invisible on the dark header. */
:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 3px;
    border-radius: 6px;
}

.compound-head:focus-visible,
.theme:focus-visible {
    outline-offset: -3px;
}

#site-header a:focus-visible,
.hero a:focus-visible {
    outline-color: #ffb86b;
}

/* skip link */
.skip-link {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -120%);
    z-index: 200;
    background: #fff;
    color: var(--brand);
    font-weight: 600;
    padding: 0.7rem 1.3rem;
    border-radius: 0 0 10px 10px;
    text-decoration: none;
    transition: transform 0.2s;
}

.skip-link:focus {
    transform: translate(-50%, 0);
}

/* ---- individual compound pages (pre-rendered for search) ---------------- */
.entry {
    max-width: 820px;
    margin: 3rem auto 5rem;
    padding: 0 2rem;
}

.crumbs {
    font-size: 0.86rem;
    color: var(--muted);
    margin-bottom: 1.6rem;
}

.crumbs a {
    color: var(--brand);
    text-decoration: none;
}

.crumbs a:hover { text-decoration: underline; }

.crumbs span[aria-hidden] { margin: 0 0.35rem; }

.entry h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--ink);
    margin-bottom: 1rem;
    border-left: 5px solid var(--c, var(--brand));
    padding-left: 1rem;
}

.entry-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.entry h2 {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 2.2rem 0 0.9rem;
}

.entry .summary {
    font-size: 1.12rem;
    color: var(--body);
    margin-bottom: 0.5rem;
}

.entry .practice-h {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #6d4fa8;
}

.entry .facts { margin-top: 1rem; }

.prevnext {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 3rem 0 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.pn {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
    padding: 0.5rem 0;
}

.pn:hover { color: var(--red); }

.pn.next { margin-left: auto; text-align: right; }

.entry .disclaimer { margin-top: 2rem; }

/* link from a library card out to its full page */
.full-entry {
    display: inline-block;
    margin-top: 1.3rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
}

.full-entry:hover { color: var(--red); }

@media (max-width: 860px) {
    .entry { padding: 0 1.25rem; margin: 2rem auto 3rem; }
}

/* ---- chat widget ------------------------------------------------------- */
.chat-toggle {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 150;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #e8403c 0%, #ff7a4d 100%);
    border: 0;
    padding: 0.85rem 1.4rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(232, 64, 60, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(232, 64, 60, 0.45);
}

.chat-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 160;
    width: min(420px, calc(100vw - 2.5rem));
    max-height: min(620px, calc(100vh - 2.5rem));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 24px 70px rgba(13, 31, 60, 0.28);
    overflow: hidden;
}

.chat-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: var(--navy-deep);
    color: #fff;
}

.chat-sub {
    display: block;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.62);
    margin-top: 0.15rem;
}

.chat-close {
    font: inherit;
    font-size: 1.4rem;
    line-height: 1;
    background: none;
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.chat-close:hover { color: #fff; }

.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.msg {
    max-width: 92%;
    padding: 0.7rem 0.95rem;
    border-radius: 14px;
    font-size: 0.94rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.msg.bot {
    background: var(--surface-2);
    color: var(--body);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.msg.user {
    background: var(--brand);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.msg.pending { opacity: 0.6; font-style: italic; }

.msg.error {
    background: #fff8ec;
    color: #7a5a17;
    border: 1px solid #f6e3bd;
}

.msg a { color: var(--brand); }

.chat-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem 1.2rem 0.5rem;
    border-top: 1px solid var(--line);
}

.chat-form input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 0.94rem;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    outline: none;
}

.chat-form input:focus { border-color: var(--brand); }

.chat-form button {
    flex: none;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: var(--brand);
    border: 0;
    padding: 0.65rem 1.2rem;
    border-radius: 999px;
    cursor: pointer;
}

.chat-form button:disabled { opacity: 0.55; cursor: default; }

.chat-note {
    padding: 0 1.2rem 0.9rem;
    font-size: 0.78rem;
    color: var(--muted);
    min-height: 1.1rem;
}

@media (max-width: 860px) {
    .chat-toggle { right: 0.8rem; bottom: 0.8rem; padding: 0.75rem 1.1rem; font-size: 0.86rem; }
    .chat-panel { right: 0.6rem; left: 0.6rem; bottom: 0.6rem; width: auto; }
}

.msg p { margin: 0 0 0.55rem; }
.msg p:last-child { margin-bottom: 0; }
.msg-list { margin: 0 0 0.55rem; padding-left: 1.15rem; }
.msg-list li { margin-bottom: 0.25rem; }
.msg { white-space: normal; }

/* ---- chat on phones ----------------------------------------------------
   Two real iOS bugs: Safari zooms the page when an input under 16px gets
   focus, and 100vh counts the browser chrome so a panel sized with it runs
   off the bottom of the screen. dvh tracks the visible viewport instead and
   shrinks when the keyboard opens. */
.chat-panel {
    max-height: min(620px, calc(100dvh - 2.5rem));
}

@media (max-width: 860px) {
    .chat-panel {
        right: 0;
        left: 0;
        bottom: 0;
        top: auto;
        width: auto;
        height: 88dvh;
        max-height: 88dvh;
        border-radius: 18px 18px 0 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }

    /* 16px exactly — anything less and iOS zooms on focus. */
    .chat-form input {
        font-size: 16px;
        padding: 0.7rem 1rem;
    }

    .chat-form {
        padding: 0.8rem 1rem 0.5rem;
        /* clear the home indicator on gesture-nav phones */
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    }

    .chat-log {
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .msg {
        max-width: 100%;
        font-size: 0.97rem;
    }

    .chat-head {
        padding: 0.9rem 1rem;
        padding-top: max(0.9rem, env(safe-area-inset-top));
    }

    .chat-close {
        font-size: 1.8rem;
        padding: 0 0.3rem;
    }

    .chat-note {
        padding: 0 1rem 0.7rem;
    }

    .chat-toggle {
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
}
