/* Documentation pages. Shares the tokens, card surfaces and code styling defined in app.css. */

.docs-body { padding-top: 2.5rem; }

.docs-layout {
    display: grid;
    grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: start;
}

/* Sidebar */
.docs-sidebar {
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 7.5rem);
    overflow-y: auto;
    padding: .25rem .25rem 1rem 0;
    scrollbar-color: #3a3a42 transparent;
    scrollbar-width: thin;
}

.docs-nav-group + .docs-nav-group { margin-top: 1.4rem; }

.docs-nav-group-title {
    margin: 0 0 .4rem;
    padding: 0 .6rem;
    font-size: .86rem;
    font-weight: 600;
    color: var(--text-strong);
}

.docs-nav-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .05rem; }

.docs-nav-group a {
    display: block;
    padding: .3rem .6rem;
    border-radius: 7px;
    color: var(--muted);
    text-decoration: none;
    font-size: .9rem;
    transition: color .2s ease, background .2s ease;
}

.docs-nav-group a:hover { color: var(--text-strong); background: var(--surface-2); }

.docs-nav-group a.active {
    color: var(--text-strong);
    background: var(--surface-3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
    font-weight: 550;
}

.docs-mobile-nav { display: none; }

/* Content */
.docs-content { min-width: 0; }

.docs-breadcrumb { display: flex; gap: .5rem; font-size: .82rem; color: var(--muted); margin-bottom: .5rem; }
.docs-breadcrumb a { color: var(--muted); text-decoration: none; }
.docs-breadcrumb a:hover { text-decoration: underline; }

.docs-page-header h1 { font-size: clamp(2rem, 4vw, 2.9rem); margin: 0 0 .6rem; }

.docs-lead {
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 2rem;
    font-size: 1.05rem;
}

.docs-section { margin-bottom: 2.5rem; }

.docs-content h2 {
    font-size: clamp(1.35rem, 2.6vw, 1.7rem);
    margin: 2.25rem 0 .75rem;
    scroll-margin-top: 5.5rem;
}

.docs-content h3 { margin: 1.6rem 0 .6rem; font-size: 1.12rem; scroll-margin-top: 5.5rem; }

.docs-content h4 { margin: 1.25rem 0 .4rem; font-size: 1rem; color: var(--text-strong); }

.docs-content p { color: var(--text); line-height: 1.7; }

.docs-content p a, .docs-content li a, .docs-content td a { color: var(--accent); }

.docs-content strong { color: var(--text-strong); }

.docs-list { color: var(--text); line-height: 1.7; padding-left: 1.25rem; }
.docs-list li + li { margin-top: .25rem; }
.docs-list code, .docs-content p code { color: #e2e2e8; }

.docs-content .code-block { margin: .75rem 0 1rem; }

.docs-table-wrap {
    overflow-x: auto;
    margin: 1rem 0 1.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.docs-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.docs-table th, .docs-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.docs-table tr:last-child td { border-bottom: none; }
.docs-table th { color: var(--text); font-weight: 600; background: var(--surface-2); }
.docs-table td { color: var(--text); }
.docs-table code { color: #e2e2e8; white-space: nowrap; }

.docs-csharp { margin-top: 0.5rem; }

/* Callouts: a labelled aside, so meaning never depends on the border colour alone. */
.docs-callout {
    margin: 1.25rem 0;
    padding: .9rem 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: inset 0 1px 0 var(--edge-light);
}

.docs-callout-title {
    display: block;
    margin-bottom: .3rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-strong);
}

.docs-callout p { margin: .3rem 0 0; }
.docs-callout--warning { background: rgba(240, 180, 94, .07); border-color: rgba(240, 180, 94, .25); }
.docs-callout--warning .docs-callout-title { color: var(--warn); }
.docs-callout--status { }
.docs-callout--status .docs-callout-title { color: var(--accent); }

/* Landing-page cards */
.docs-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: .85rem;
    margin: 1rem 0 2rem;
}

.docs-group-card {
    padding: 1rem 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--panel-shadow);
}

.docs-group-card h3 { margin: 0 0 .5rem; font-size: 1rem; }
.docs-group-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.docs-group-card a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.docs-group-card a:hover { color: var(--text); }

/* Previous / next */
.docs-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.docs-pager-link {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    text-decoration: none;
    transition: border-color .2s ease;
}

.docs-pager-link:hover { border-color: var(--line-strong); background: var(--surface-2); }
.docs-pager-link--next { text-align: right; grid-column: 2; }
.docs-pager-dir { font-size: .82rem; color: var(--muted); }
.docs-pager-title { color: var(--text); font-weight: 600; }

@media (max-width: 940px) {
    .docs-layout { grid-template-columns: 1fr; gap: 1rem; }
    .docs-sidebar { display: none; }

    .docs-mobile-nav {
        display: block;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--surface);
    }

    .docs-mobile-nav summary {
        cursor: pointer;
        padding: .75rem 1rem;
        font-weight: 600;
        color: var(--text);
    }

    .docs-mobile-nav nav { padding: 0 1rem 1rem; }
    .docs-pager { grid-template-columns: 1fr; }
    .docs-pager-link--next { grid-column: 1; }
}

/* Figures in documentation pages (DocsFigure.razor, DocsIllustration.razor) */
.docs-figure { margin: 1.25rem 0 1.75rem; padding: 1.25rem 1.25rem .9rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.docs-figure-canvas { overflow-x: auto; scrollbar-width: thin; }
.docs-figure-canvas > .il, .docs-figure .sad-svg { min-width: 640px; }
.docs-figure--fluid .il { min-width: 0; }
.docs-figure figcaption { color: var(--muted); font-size: .85rem; line-height: 1.5; margin-top: .6rem; }

/* Before/after comparison chart (Performance page). Each row scales both bars to the "before" time,
   so workloads measured in microseconds and in seconds read on the same axis: relative time. */
.perf-chart { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.perf-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: 0 0 1.1rem; color: var(--muted); font-size: .8rem; }
.perf-legend span { display: inline-flex; align-items: center; gap: .45rem; }
.perf-legend span::before { content: ""; width: .8rem; height: .55rem; border-radius: 2px; background: var(--perf-swatch); }
.perf-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .35rem; }
.perf-row-label { color: var(--text-strong); font-size: .88rem; }
.perf-row-delta { color: var(--ok); font-family: var(--font-mono); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.perf-bar { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; align-items: center; gap: .6rem; }
.perf-bar + .perf-bar { margin-top: 3px; }
.perf-bar-track { height: .6rem; }
.perf-bar-fill { display: block; height: 100%; border-radius: 0 3px 3px 0; min-width: 2px; }
.perf-bar--before .perf-bar-fill { background: var(--faint); }
.perf-bar--after .perf-bar-fill { background: var(--accent); }
.perf-bar-value { color: var(--muted); font-family: var(--font-mono); font-size: .75rem; text-align: right; white-space: nowrap; }
.perf-bar--after .perf-bar-value { color: var(--text-strong); }

/* Drawing primitives used only by the documentation diagrams; the rest live in home.css */
.il-flow--warn { stroke: var(--warn); }
.il-flow--dashed { stroke-dasharray: 5 4; }
.il-axis { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.il-boundary { fill: rgba(255, 255, 255, 0.015); stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 6 4; }
.il-boundary--accent { fill: rgba(92, 212, 232, 0.03); stroke: var(--accent-line); }
.il-node--muted { stroke: var(--line); fill: rgba(255, 255, 255, 0.02); }
.il-node--dashed { stroke-dasharray: 5 4; }
.il-node-sub--ok { fill: var(--ok); }
.il-node-sub--strong { fill: var(--text-strong); font-weight: 600; font-size: 11.5px; }
.il-label--strong { fill: var(--text-strong); font-weight: 600; font-size: 11px; }
.il-label--warn { fill: var(--warn); }
.il-match-line--soft { stroke: rgba(92, 212, 232, 0.35); stroke-width: 1; }
.il-graph-edge { fill: none; stroke: rgba(141, 141, 151, 0.35); stroke-width: 1; }
.il-bracket { fill: none; stroke: var(--line-strong); stroke-width: 1; }

/* Small glyph layouts */
.docs-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; margin: 1rem 0 1.5rem; }
.docs-tile { display: grid; gap: .3rem; padding: 1rem 1.1rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.docs-tile strong { color: var(--text-strong); }
.docs-tile span:last-child { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.docs-tile-icon { font-size: 1.15rem; color: var(--text-strong); margin-bottom: .35rem; }
.docs-tile--warn .docs-tile-icon { color: var(--warn); }
.docs-caps { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: .75rem 0 1.25rem; }
.docs-caps li { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .75rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .88rem; }
.docs-caps .bi { color: var(--accent); }

/* Management UI screenshots */
.docs-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin: 1rem 0 1.75rem; }
.docs-shot { display: flex; flex-direction: column; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.docs-shot a { display: block; border-bottom: 1px solid var(--line); }
.docs-shot a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.docs-shot img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }
.docs-shot-placeholder { aspect-ratio: 16 / 10; display: grid; place-items: center; color: var(--accent); font-size: 2rem; background: rgba(255, 255, 255, 0.025); border-bottom: 1px solid var(--line); }
.docs-shot-body { padding: .85rem 1rem 1rem; }
.docs-content .docs-shot-body h3 { margin: 0 0 .3rem; font-size: 1rem; }
.docs-content .docs-shot-body p { margin: 0; font-size: .88rem; line-height: 1.5; }
.il-hex-label { dominant-baseline: central; }
