/* ============================================================
   Anna Developer Reference — namespaced under .dr-
   Reuses the .dh- design tokens (--anna-warm, --bg-deep, etc.).
   Layout pattern: hero band + 3-column shell (sidebar / content / TOC)
   ============================================================ */

.dh-body--ref {
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(255, 158, 108, 0.06), transparent 60%),
        radial-gradient(800px 500px at -10% 10%, rgba(116, 138, 255, 0.05), transparent 60%),
        var(--bg-deep);
}

/* ── Hero ─────────────────────────────────────────────────────── */
.dr-hero {
    position: relative;
    padding: clamp(72px, 10vh, 120px) clamp(20px, 4vw, 60px) clamp(40px, 6vh, 64px);
    border-bottom: 1px solid var(--border-subtle);
    overflow: hidden;
    isolation: isolate;
}
.dr-hero__inner {
    max-width: 1220px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 2;
}
.dr-hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.dr-hero__grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(var(--border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 55% 70% at 80% 20%, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 55% 70% at 80% 20%, #000 30%, transparent 75%);
    opacity: 0.45;
}
.dr-hero__orb {
    position: absolute;
    width: 520px; height: 520px;
    top: -180px; right: -120px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--anna-warm), transparent 65%);
    filter: blur(80px);
    opacity: 0.32;
}
:root[data-theme="light"] .dr-hero__orb { opacity: 0.18; }

.dr-hero__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(36px, 5vw, 60px);
    line-height: 1.05;
    letter-spacing: -0.022em;
    font-weight: 600;
    margin: 24px 0 16px;
    color: var(--text-primary);
}
.dr-hero__sub {
    max-width: 720px;
    font-size: clamp(15px, 1.4vw, 17px);
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 28px;
}

/* ── Inline search ────────────────────────────────────────────── */
.dr-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 520px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-warm);
    border-radius: 12px;
    box-shadow: 0 8px 24px -12px rgba(0,0,0,0.4);
    transition: border-color .2s, box-shadow .2s;
}
.dr-search:focus-within {
    border-color: var(--anna-warm);
    box-shadow: 0 0 0 3px rgba(255, 158, 108, 0.12), 0 8px 24px -12px rgba(0,0,0,0.4);
}
.dr-search svg { color: var(--text-secondary); flex: none; }
.dr-search input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    min-width: 0;
}
.dr-search input::placeholder { color: var(--text-secondary); }
.dr-search__kbd {
    flex: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
}

.dr-hero__meta {
    margin-top: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}
.dr-hero__meta strong { color: var(--text-primary); font-weight: 600; }
.dr-hero__meta code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}
.dr-dot {
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.5;
}

/* ── Three-column shell ──────────────────────────────────────── */
/* Reserve the vertical scrollbar gutter so route changes that vary page
   height don't horizontally shift the centered shell. */
html { scrollbar-gutter: stable; }

.dr-shell {
    max-width: 1520px;
    margin: 0 auto;
    padding: 32px clamp(20px, 3vw, 48px) 96px;
    display: grid;
    /* Columns are always present (sidebar | content | TOC) so navigating
       between modes never reflows the grid. The TOC column hides its
       contents via .is-empty but keeps its 220px slot reserved. */
    grid-template-columns: 260px minmax(0, 1fr) 220px;
    gap: 40px;
    align-items: flex-start;
}
@media (max-width: 1180px) {
    .dr-shell { grid-template-columns: 240px minmax(0, 1fr); gap: 32px; }
    .dr-toc { display: none; }
}
@media (max-width: 760px) {
    .dr-shell { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 20px; }
    .dr-sidebar { position: static; max-height: none; padding: 16px; }
}

/* Sidebar ─────────────────────────────────────────────────────── */
.dr-sidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding: 16px 12px;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--bg-card), rgba(18, 20, 28, 0.6));
    border: 1px solid var(--border-subtle);
    scrollbar-width: thin;
}
:root[data-theme="light"] .dr-sidebar {
    background:
        linear-gradient(180deg, #ffffff, #fbf6f1);
    border-color: rgba(224, 122, 58, 0.18);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 12px 28px -20px rgba(48, 30, 18, 0.18);
}
.dr-sidebar::-webkit-scrollbar { width: 6px; }
.dr-sidebar::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }
:root[data-theme="light"] .dr-sidebar::-webkit-scrollbar-thumb { background: rgba(224, 122, 58, 0.25); }

.dr-sidebar__group { margin-bottom: 14px; }

/* Group header (clickable, collapses the link list) */
.dr-sidebar__group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    margin: 0 0 4px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-primary);
    transition: color .15s, background .15s;
}
.dr-sidebar__group-header:hover {
    color: var(--anna-warm);
    background: var(--bg-card-hover);
}
:root[data-theme="light"] .dr-sidebar__group-header { color: #4a3220; }
:root[data-theme="light"] .dr-sidebar__group-header:hover { background: rgba(224, 122, 58, 0.08); color: #c75a1f; }
.dr-sidebar__chevron {
    flex: none;
    width: 12px;
    height: 12px;
    transition: transform .18s ease;
    transform: rotate(-90deg); /* collapsed: chevron points right */
    opacity: 0.7;
}
.dr-sidebar__group:not(.dr-sidebar__group--collapsed) .dr-sidebar__chevron {
    transform: rotate(0deg); /* expanded: chevron points down */
}
.dr-sidebar__group-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}
.dr-sidebar__group--collapsed .dr-sidebar__group-items { display: none; }

/* Legacy class kept for safety; the new markup uses .dr-sidebar__group-header */
.dr-sidebar__group-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 0 12px;
    margin-bottom: 8px;
}
.dr-sidebar__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 12px 5px 20px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.45;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color .15s, background .15s, transform .15s;
}
.dr-sidebar__link:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}
.dr-sidebar__link.active {
    color: var(--anna-warm);
    background: rgba(255, 158, 108, 0.10);
    box-shadow: inset 2px 0 0 var(--anna-warm);
}
:root[data-theme="light"] .dr-sidebar__link:hover {
    background: rgba(224, 122, 58, 0.08);
    color: #2a1a10;
}
:root[data-theme="light"] .dr-sidebar__link.active {
    background: linear-gradient(90deg, rgba(224, 122, 58, 0.14), rgba(224, 122, 58, 0.04));
    color: #c75a1f;
    box-shadow: inset 2px 0 0 #e07a3a;
}
:root[data-theme="light"] .dr-sidebar__group-title { color: #8a6a55; }
.dr-sidebar__count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: var(--text-secondary);
    opacity: 0.55;
}
.dr-sidebar__link.active .dr-sidebar__count { color: var(--anna-warm); opacity: 1; }

/* ── Content ─────────────────────────────────────────────────── */
.dr-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 56px;
}

.dr-section { scroll-margin-top: 88px; }
.dr-section__head {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.dr-section__kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--anna-warm);
    margin-bottom: 10px;
}
.dr-section__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(24px, 2.5vw, 30px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 0 0 8px;
    line-height: 1.2;
}
.dr-section__sub {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    max-width: 760px;
}

/* Cards grid ─────────────────────────────────────────────────── */
.dr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.dr-card {
    position: relative;
    padding: 18px 18px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    transition: transform .2s cubic-bezier(.4,0,.2,1), border-color .2s, box-shadow .2s, background .2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dr-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-warm);
    background: var(--bg-card-hover);
    box-shadow: 0 12px 28px -16px rgba(0,0,0,0.45);
}
.dr-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.dr-card__name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}
.dr-card__desc {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0;
}
.dr-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

/* Tags / pills ───────────────────────────────────────────────── */
.dr-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.3px;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    text-transform: lowercase;
}
.dr-tag--warm { color: var(--anna-warm); border-color: var(--border-warm); background: rgba(255, 158, 108, 0.06); }
.dr-tag--stub { color: #c9a14b; border-color: rgba(201,161,75,0.32); background: rgba(201,161,75,0.06); }
.dr-tag--noauth { color: #6db988; border-color: rgba(109,185,136,0.28); background: rgba(109,185,136,0.06); }
.dr-tag--req { color: #e88c8c; border-color: rgba(232,140,140,0.32); background: rgba(232,140,140,0.06); }

/* Method group header inside a section */
.dr-subhead {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 8px 0 12px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-subtle);
}
.dr-subhead:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
/* Inline markdown inside a group-label subhead — blend into the heading
   (no code chip / box), just a subtly distinct monospace weight. */
.dr-subhead code {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.92em;
    text-transform: none;
    letter-spacing: 0;
    background: none;
    padding: 0;
    color: var(--text-primary);
}
.dr-subhead strong { color: var(--text-primary); font-weight: 700; }

/* Inline code / signature blocks */
.dr-card code,
.dr-section__sub code,
.dr-content__sub code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
    color: var(--anna-warm);
    border: 1px solid var(--border-subtle);
}
:root[data-theme="light"] .dr-card code,
:root[data-theme="light"] .dr-section__sub code,
:root[data-theme="light"] .dr-content__sub code {
    background: rgba(224, 122, 58, 0.07);
}
.dr-content__sub strong { color: var(--text-primary); font-weight: 600; }

/* Anchor "#" inside section headings */
.dr-anchor {
    margin-left: 10px;
    color: var(--text-secondary);
    opacity: 0;
    text-decoration: none;
    font-size: 0.85em;
    transition: opacity .15s, color .15s;
}
.dr-section__head:hover .dr-anchor { opacity: 1; }
.dr-anchor:hover { color: var(--anna-warm); }

/* ── TOC ─────────────────────────────────────────────────────── */
.dr-toc {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    padding: 16px 0 16px 16px;
    border-left: 1px solid var(--border-subtle);
    scrollbar-width: thin;
}
.dr-toc__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.dr-toc ul { list-style: none; padding: 0; margin: 0; }
.dr-toc li { margin-bottom: 6px; }
.dr-toc a {
    display: block;
    padding: 4px 10px;
    border-left: 2px solid transparent;
    font-size: 12.5px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color .15s, border-color .15s;
    line-height: 1.4;
}
.dr-toc a:hover { color: var(--text-primary); }
.dr-toc a.active {
    color: var(--anna-warm);
    border-left-color: var(--anna-warm);
}
/* Inline markdown inside a TOC link — keep it lightweight (no chip), inherit
   the link colour so active/hover states still apply uniformly. */
.dr-toc a code {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9em;
    background: none;
    padding: 0;
    color: inherit;
}
.dr-toc a strong { font-weight: 600; color: inherit; }

/* ── Empty state ────────────────────────────────────────────── */
.dr-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}
.dr-empty__icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
}
.dr-empty h3 {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    margin: 0 0 8px;
}
.dr-empty code { font-family: 'JetBrains Mono', monospace; color: var(--anna-warm); }

/* ── Section visibility under search filter ────────────────── */
.dr-section[hidden] { display: none; }
.dr-card[hidden] { display: none; }

/* ── Landing: modules grid (langchain-style) ─────────────────── */
.dr-section--landing .dr-section__head { margin-bottom: 28px; }
.dr-modgroup { margin: 0 0 44px; }
.dr-modgroup__title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}
.dr-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.dr-module {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 18px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--bg-card);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s, transform .15s, background .15s, box-shadow .15s;
    position: relative;
}
.dr-module:hover {
    border-color: var(--border-warm);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
:root[data-theme="light"] .dr-module:hover {
    box-shadow: 0 8px 24px rgba(224, 122, 58, 0.12);
}
.dr-module__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.dr-module__name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}
.dr-module__count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    flex: none;
}
:root[data-theme="light"] .dr-module__count { background: rgba(224, 122, 58, 0.07); }
.dr-module__desc {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-secondary);
    flex: 1;
}
.dr-module__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: var(--anna-warm);
    margin-top: 4px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .15s, transform .15s;
}
.dr-module:hover .dr-module__cta { opacity: 1; transform: translateX(0); }
.dr-modgroup[hidden] { display: none; }
.dr-module[hidden] { display: none; }

/* ── Section detail: breadcrumb hero variant ─────────────────── */
.dr-hero--section { padding: 48px 0 36px; }
.dr-hero--section .dr-hero__title--section {
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.15;
    margin: 14px 0 12px;
}
.dr-hero--section .dr-hero__sub { font-size: 15px; max-width: 760px; }
.dr-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.dr-crumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color .15s;
}
.dr-crumbs a:hover { color: var(--anna-warm); }
.dr-crumbs__sep { color: var(--border-subtle); }
.dr-crumbs__group {
    color: var(--anna-warm);
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ── Section detail: render even without a section__head ─────── */
.dr-section--detail > .dr-subhead:first-child { margin-top: 0; }
.dr-section--missing { padding: 60px 0; }

/* ── Sidebar brand + inline search (langchain-style top) ────── */
.dr-sidebar__brand {
    display: block;
    padding: 4px 12px 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
}
.dr-sidebar__brand-eyebrow {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--anna-warm);
    margin-bottom: 4px;
}
.dr-sidebar__brand-title {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}
.dr-sidebar__brand:hover .dr-sidebar__brand-title { color: var(--anna-warm); }
.dr-sidebar__search { padding: 0 4px 14px; }
.dr-sidebar__search .dr-search {
    width: 100%;
    max-width: none;
    padding: 6px 10px;
    border-radius: 8px;
}
.dr-sidebar__search .dr-search input { font-size: 13px; }
.dr-sidebar__search .dr-search__kbd { font-size: 10px; padding: 1px 5px; }

/* ── Content header used in place of the removed hero ───────── */
.dr-content__head {
    padding-bottom: 18px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-subtle);
}
.dr-content__title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.15;
    margin: 10px 0 10px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}
.dr-content__sub {
    margin: 0;
    max-width: 820px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}
.dr-content__kicker {
    display: inline-block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--anna-warm);
}

/* Breadcrumb at the top of detail content */
.dr-crumbs {
    margin-bottom: 10px;
    padding-bottom: 0;
}

/* TOC: keep grid slot reserved when empty so layout never reflows. */
.dr-toc.is-empty { visibility: hidden; pointer-events: none; }
.dr-toc.is-empty * { visibility: hidden; }

/* ── Clickable cards (sections with detail data) ─────────────────────── */
a.dr-card.dr-card--link {
    text-decoration: none;
    cursor: pointer;
}
a.dr-card.dr-card--link:hover {
    border-color: var(--accent-warm, var(--border-warm));
    box-shadow: 0 16px 36px -18px rgba(238, 145, 67, 0.35);
}
a.dr-card.dr-card--link:hover .dr-card__cue { transform: translateX(3px); opacity: 1; }
.dr-card__cue {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 999px;
    color: var(--text-secondary);
    opacity: 0.55;
    transition: transform .15s ease, opacity .15s ease;
}
.dr-detail-note {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--text-tertiary, var(--text-secondary));
    font-style: italic;
}

/* ── Item-detail page (LangChain-style) ──────────────────────────────── */
.dr-detail {
    display: flex;
    flex-direction: column;
    gap: 28px;
    margin-top: 14px;
}
.dr-detail__block { display: block; }
.dr-detail__h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}
.dr-detail__none {
    margin: 0;
    color: var(--text-tertiary, var(--text-secondary));
    font-style: italic;
}

/* Signature & example: monospace blocks */
.dr-signature, .dr-example {
    margin: 0;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre;
}
.dr-signature code, .dr-example code {
    background: transparent;
    padding: 0;
    font: inherit;
    color: inherit;
}

/* Wire / metadata strip (under the title) */
.dr-wire {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px 20px;
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
}
.dr-wire__row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0; /* allow children to shrink inside grid track */
}
.dr-wire__k {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-tertiary, var(--text-secondary));
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-subtle);
}
.dr-wire__v {
    min-width: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}
.dr-wire__v code {
    display: inline;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
    padding: 1px 5px;
    border-radius: 4px;
    /* allow long backtick-quoted identifiers / URLs to wrap inside the grid cell */
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Type badge (inline code chip) */
.dr-type {
    display: inline-block;
    padding: 1px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    background: rgba(255,255,255,0.03);
    color: var(--accent-warm, var(--text-primary));
}

/* Parameters & errors tables */
.dr-params-table__wrap,
.dr-errors-table__wrap {
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
}
.dr-params-table,
.dr-errors-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.dr-params-table thead th,
.dr-errors-table thead th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-tertiary, var(--text-secondary));
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-subtle);
}
.dr-params-table tbody td,
.dr-errors-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
    color: var(--text-secondary);
}
.dr-params-table tbody tr:last-child td,
.dr-errors-table tbody tr:last-child td { border-bottom: none; }
.dr-params-table__name code { font-weight: 600; color: var(--text-primary); }
.dr-params-table__desc { line-height: 1.55; }
.dr-params-table__summary { font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.dr-params-table__notes {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}
.dr-params-table__notes li { margin: 2px 0; }
.dr-params-table__notes li + li { margin-top: 4px; }

/* Returns block — soft panel with left accent stripe + lead paragraph. */
.dr-returns {
    position: relative;
    padding: 18px 20px;
    background: rgba(255, 158, 108, 0.04);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--anna-warm);
    border-radius: 10px;
}
/* Type signature now lives in the flow above the body so long generic
   signatures wrap naturally instead of overflowing the top-right corner. */
.dr-returns__type {
    display: block;
    margin: 0 0 12px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-x: auto;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}
.dr-returns__type .dr-type {
    display: inline;
    padding: 0;
    border: none;
    background: transparent;
    font-size: inherit;
    color: inherit;
}
.dr-returns__body p {
    margin: 0 0 10px;
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 14px;
}
.dr-returns__body p:last-child { margin-bottom: 0; }
.dr-returns__body p:first-child {
    color: var(--text-primary);
    font-size: 15px;
}
.dr-returns__body--has-type p:first-child { padding-right: 0; }
.dr-returns__body strong { color: var(--text-primary); font-weight: 600; }
:root[data-theme="light"] .dr-returns {
    background: rgba(255, 158, 108, 0.05);
}
:root[data-theme="light"] .dr-returns__type {
    background: rgba(0,0,0,0.03);
}

/* Known limitations block. */
.dr-limitations {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.dr-limitations li { margin: 6px 0; }
.dr-limitations li strong { color: var(--text-primary); }

.dr-params-table__req { white-space: nowrap; width: 1%; }
.dr-params-table__req .dr-pill { margin-left: 0; }
.dr-pill {
    display: inline-block;
    margin-left: 8px;
    padding: 0 7px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid transparent;
}
.dr-pill--req {
    background: rgba(238,145,67,0.12);
    color: var(--accent-warm, #ee9143);
    border-color: rgba(238,145,67,0.35);
}
.dr-pill--opt {
    background: rgba(255,255,255,0.04);
    color: var(--text-tertiary, var(--text-secondary));
    border-color: var(--border-subtle);
}
.dr-muted { color: var(--text-tertiary, var(--text-secondary)); }

/* Sources of truth — file/symbol/line citations */
.dr-sources {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dr-source {
    display: grid;
    grid-template-columns: minmax(140px, 0.8fr) minmax(0, 2fr) minmax(0, 1.4fr);
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 12.5px;
}
.dr-source__label {
    font-weight: 600;
    color: var(--text-primary);
}
.dr-source__path {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    overflow-x: auto;
}
.dr-source__path code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}
.dr-source__repo {
    display: inline-block;
    padding: 1px 7px;
    font-size: 10.5px;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-tertiary, var(--text-secondary));
    background: rgba(255,255,255,0.02);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.dr-source__lines {
    color: var(--text-tertiary, var(--text-secondary));
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
}
.dr-source__symbol code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--accent-warm, var(--text-primary));
}
@media (max-width: 760px) {
    .dr-source { grid-template-columns: 1fr; gap: 4px; }
}
