/* ============================================================
   REPORT — long-form research render
   --------------------------------------------------------------
   Promoted from the inline <style> block in
   apps/public/templates/examples/report.html so the production
   episode_report.html template can render the editorial design.
   Builds on brand.css tokens.

   EVERY rule in this file is namespaced under `body.report-mode`
   so loading it globally from base.html does not leak styles
   (or @page sizing) onto non-report pages. The grep audit
   below MUST stay green:

       ! grep -nE '^\.(report__|dgm-)' static/css/report.css

   Pages that opt into the editorial render set the body class
   via `{% block body_class %}report-mode{% endblock %}`.
   ============================================================ */


body.report-mode .report {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg) var(--space-3xl);
    font-family: var(--font-sans);
    color: var(--color-text-charcoal);
    counter-reset: figure-counter;
}

/* ── Title block ────────────────────────────────────── */

body.report-mode .report__masthead {
    border-bottom: 1px solid var(--color-border-medium);
    padding-bottom: var(--space-lg);
    margin-bottom: var(--space-2xl);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
}

body.report-mode .report__masthead-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-black);
}

body.report-mode .report__masthead-meta {
    font-family: var(--font-mono);
    font-size: 0.688rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-light-gray);
    font-variant-numeric: tabular-nums;
}

body.report-mode .report__eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-annotation);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

body.report-mode .report__eyebrow::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-annotation);
    opacity: 0.4;
    max-width: 80px;
}

body.report-mode .report__title {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 3.25rem;
    line-height: 1.05;
    letter-spacing: -0.022em;
    color: var(--color-text-black);
    text-wrap: balance;
    margin: 0 0 var(--space-md);
}

body.report-mode .report__title em {
    font-style: italic;
    color: var(--color-text-black);
}

body.report-mode .report__deck {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.25rem;
    line-height: 1.45;
    color: var(--color-text-charcoal);
    text-wrap: pretty;
    margin: 0 0 var(--space-xl);
    max-width: 600px;
}

/* ── Stat strip — replaces fine-print byline with visual metric row ─ */
body.report-mode .report__stat-strip {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-top: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
    padding: 20px 0;
    margin: 0 0 var(--space-lg);
}

body.report-mode .report__stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 24px;
}

body.report-mode .report__stat-cell:not(:last-child) {
    border-right: 1px solid var(--color-border-light);
}

body.report-mode .report__stat-number {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-black);
    line-height: 1;
}

body.report-mode .report__stat-number--accent {
    color: var(--color-annotation);
}

body.report-mode .report__stat-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-gray);
}

/* ── TOC nav — sticky sidebar at large viewports ───────── */
/* ── TOC — sidebar variant (design-system example, non-report-page) ── */

body.report-mode .report__toc {
    display: none;
}

@media (min-width: 960px) {
    body.report-mode .report {
        position: relative;
    }

    body.report-mode .report__toc {
        display: flex;
        flex-direction: column;
        gap: 4px;
        position: sticky;
        top: var(--space-lg);
        float: right;
        clear: right;
        margin-right: calc(-220px - var(--space-xl));
        margin-top: calc(-1 * var(--space-xl));
        width: 200px;
        padding: 20px 16px;
        background: var(--color-bg-white);
        border: 1px solid var(--color-border-light);
        border-radius: 2px;
    }
}

body.report-mode .report__toc-title {
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-gray);
    margin-bottom: 8px;
}

body.report-mode .report__toc-link {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--color-text-gray);
    text-decoration: none;
    line-height: 1.5;
    transition: color var(--duration-fast, 150ms) ease;
}

body.report-mode .report__toc-link:hover,
body.report-mode .report__toc-link.active {
    color: var(--color-annotation);
}

/* ── TOC — horizontal chip row for full-page report view ── */

body.report-mode article.report-page .report__toc {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    float: none;
    position: static;
    width: auto;
    margin: 0 0 0;
    padding: var(--space-md) 0;
    background: none;
    border: none;
    border-radius: 0;
}

body.report-mode article.report-page .report__toc-title {
    font-size: 0.5625rem;
    letter-spacing: 0.14em;
    margin-bottom: 0;
    align-self: center;
    padding-right: var(--space-sm);
    border-right: 1px solid var(--color-border-light);
    margin-right: 2px;
}

body.report-mode article.report-page .report__toc-link {
    font-size: 0.5625rem;
    letter-spacing: 0.08em;
    line-height: 1;
    padding: 5px 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 1px;
    white-space: nowrap;
    max-width: 13rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
    transition: border-color var(--duration-fast) var(--ease-brand),
                color var(--duration-fast) var(--ease-brand);
}

body.report-mode article.report-page .report__toc-link:hover,
body.report-mode article.report-page .report__toc-link.active {
    border-color: var(--color-annotation);
    color: var(--color-annotation);
}

/* ── Section structure ──────────────────────────────── */

body.report-mode .report__section {
    margin-top: var(--space-2xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border-light);
}

body.report-mode .report__section-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-annotation);
    display: block;
    margin-bottom: var(--space-sm);
    padding-top: var(--space-sm);
}

body.report-mode .report h2 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 2.25rem;
    line-height: 1.15;
    letter-spacing: -0.018em;
    color: var(--color-text-black);
    margin: 0 0 var(--space-xl);
    text-wrap: balance;
}

body.report-mode .report h3 {
    font-family: var(--font-serif);
    font-size: 1.375rem;
    font-weight: 500;
    letter-spacing: -0.012em;
    line-height: 1.25;
    color: var(--color-text-black);
    margin: var(--space-2xl) 0 var(--space-md);
    text-wrap: balance;
    font-feature-settings: "kern", "liga", "calt";
    font-optical-sizing: auto;
}

body.report-mode .report p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text-charcoal);
    margin: 0 0 var(--space-md);
    text-wrap: pretty;
}

body.report-mode .report p strong:first-child {
    color: var(--color-text-black);
    font-weight: 600;
}

body.report-mode .report em {
    font-style: italic;
    color: var(--color-annotation);
}

body.report-mode .report ul,
body.report-mode .report ol {
    margin: 0 0 var(--space-md);
    padding-left: var(--space-lg);
    line-height: 1.65;
}

body.report-mode .report li {
    margin-bottom: var(--space-sm);
}

body.report-mode .report li::marker {
    color: var(--color-annotation);
    font-family: var(--font-mono);
    font-size: 0.875em;
}

/* Inline citation — quiet mono link. Restraint at rest, clear at hover.
   The underline only appears on hover so dense citation paragraphs don't
   look striped. Color shifts to red on hover and on :target so the
   reader's eye can track jumps. */
body.report-mode .report cite,
body.report-mode .report a.cite,
body.report-mode .report .cite {
    font-family: var(--font-mono);
    font-size: 0.825em;
    font-style: normal;
    color: var(--color-text-gray);
    letter-spacing: 0.01em;
    text-decoration: none;
    border-bottom: 1px dotted transparent;
    transition: color var(--duration-fast) var(--ease-brand),
                border-color var(--duration-fast) var(--ease-brand);
}

body.report-mode .report a.cite:hover {
    color: var(--color-annotation);
    border-bottom-color: var(--color-annotation);
}

body.report-mode .report a.cite:focus-visible {
    outline: 2px solid var(--color-annotation);
    outline-offset: 2px;
    border-radius: 1px;
}

/* Backref — the ↩ marker on each reference linking to where it was cited.
   Multiple backrefs (a, b, c…) stack inline when one ref is cited many times. */
body.report-mode .cite-back-group {
    margin-left: var(--space-sm);
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
    white-space: nowrap;
}

body.report-mode .report a.cite-back {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-annotation);
    text-decoration: none;
    padding: 1px 5px;
    border: 1px solid var(--color-annotation-rose);
    background: transparent;
    line-height: 1.2;
    transition: background-color var(--duration-fast) var(--ease-brand),
                color var(--duration-fast) var(--ease-brand),
                border-color var(--duration-fast) var(--ease-brand);
}

body.report-mode .report a.cite-back:hover {
    background: var(--color-annotation);
    color: var(--color-bg-cream);
    border-color: var(--color-annotation);
}

/* :target highlight — when reader clicks a cite and lands on its reference,
   tint the matched <li> rose for a couple seconds so they don't lose context.
   Same treatment for clicking a backref and landing on the citing paragraph. */
body.report-mode .report__sources li:target {
    background: var(--color-annotation-rose);
    box-shadow: -8px 0 0 var(--color-annotation-rose),
                 8px 0 0 var(--color-annotation-rose);
    animation: report-target-fade 2.4s var(--ease-brand) forwards;
}

body.report-mode .report a.cite:target {
    background: var(--color-annotation-rose);
    color: var(--color-annotation-deep);
    border-bottom-color: var(--color-annotation-deep);
    padding: 1px 4px;
    margin: 0 -3px;
    animation: report-target-fade 2.4s var(--ease-brand) forwards;
}

@keyframes report-target-fade {
    0%, 60% { background-color: var(--color-annotation-rose); }
    100%    { background-color: transparent; }
}

/* Inline code — the editorial code chip from brand.css applies here too */

/* ── Tables ─────────────────────────────────────────── */

body.report-mode .report table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-lg) 0 var(--space-xl);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
}

body.report-mode .report thead th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.688rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-gray);
    padding: var(--space-sm) var(--space-md) var(--space-sm) 0;
    border-top: 1px solid var(--color-text-black);
    border-bottom: 1px solid var(--color-border-medium);
    background: transparent;
    vertical-align: bottom;
}

body.report-mode .report tbody td {
    padding: var(--space-md) var(--space-md) var(--space-md) 0;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: top;
    line-height: 1.5;
    color: var(--color-text-charcoal);
}

body.report-mode .report tbody td:first-child {
    color: var(--color-text-black);
    font-weight: 500;
}

body.report-mode .report tbody tr:last-child td {
    border-bottom: 1px solid var(--color-text-black);
}

/* ── Pull quote ─────────────────────────────────────── */

body.report-mode .report__pullquote {
    margin: var(--space-3xl) calc(-1 * var(--space-lg));
    padding: var(--space-xl) var(--space-lg);
    border-top: 1px solid var(--color-text-black);
    border-bottom: 1px solid var(--color-text-black);
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.5rem;
    line-height: 1.35;
    color: var(--color-text-black);
    text-wrap: balance;
    text-align: center;
    position: relative;
}

/* Inline emphasis INSIDE a pullquote — used to highlight the actual value
   the quote is built around (a number, a name, a verdict). Drops italic,
   bumps weight, paints in annotation red. Apply sparingly: one phrase per
   pullquote, never two. */
body.report-mode .report__pullquote em.report__pullquote-value,
body.report-mode em.report__pullquote-value {
    font-style: normal;
    font-weight: 600;
    color: var(--color-annotation);
}

/* Callouts — note + caveat asides */
body.report-mode .report__callout {
    margin: var(--space-xl) 0;
    padding: 20px 24px;
    border-top: 3px solid var(--color-annotation);
    border-radius: 4px;
    background: var(--color-bg-warm-gray);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body.report-mode .report__callout--caveat {
    border-top-color: var(--color-ochre);
}

body.report-mode .report__callout-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-annotation);
}

body.report-mode .report__callout--caveat .report__callout-label {
    color: var(--color-ochre);
}

body.report-mode .report__callout-body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text-charcoal);
}

/* ── Figure framework ───────────────────────────────── */

body.report-mode .report__figure {
    margin: var(--space-xl) 0;
    padding: var(--space-lg);
    background: var(--color-bg-white);
    border: 1px solid var(--color-border-medium);
    counter-increment: figure-counter;
    page-break-inside: avoid;
    break-inside: avoid;
}

body.report-mode .report__figure-label {
    font-family: var(--font-mono);
    font-size: 0.688rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-annotation);
    margin-bottom: var(--space-xs);
}

body.report-mode .report__figure-label::before {
    content: "Fig " counter(figure-counter, decimal-leading-zero) " · ";
    color: var(--color-text-gray);
}

body.report-mode .report__figure-title {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-black);
    margin: 0 0 var(--space-lg);
    letter-spacing: -0.005em;
}

body.report-mode .report__figure-caption {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--color-text-gray);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border-light);
}

body.report-mode .report__figure-caption strong {
    color: var(--color-text-charcoal);
    font-weight: 600;
}

/* ── Diagram primitives — boxes, connectors, branches ── */

body.report-mode .dgm-box {
    border: 1px solid var(--color-border-medium);
    background: var(--color-bg-cream);
    padding: var(--space-sm) var(--space-md);
}

body.report-mode .dgm-box--solid {
    background: var(--color-text-black);
    color: var(--color-bg-cream);
    border-color: var(--color-text-black);
}

body.report-mode .dgm-box--accent {
    background: var(--color-annotation-rose);
    border-color: var(--color-annotation);
}

body.report-mode .dgm-box-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-gray);
    margin-bottom: 2px;
}

body.report-mode .dgm-box--solid .dgm-box-label {
    color: rgba(250, 249, 246, 0.55);
}

body.report-mode .dgm-box--accent .dgm-box-label {
    color: var(--color-annotation-deep);
}

body.report-mode .dgm-box-text {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.35;
    color: inherit;
}

body.report-mode .dgm-arrow-v {
    width: 1px;
    height: 24px;
    background: var(--color-border-dark);
    margin: 0 auto;
    position: relative;
}

body.report-mode .dgm-arrow-v::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--color-border-dark);
}

body.report-mode .dgm-arrow-tag {
    display: table;
    background: var(--color-bg-cream);
    border: 1px solid var(--color-border-medium);
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-gray);
    margin: 6px auto 0;
    white-space: nowrap;
}

/* ── Decision tree ──────────────────────────────────── */

body.report-mode .dgm-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.report-mode .dgm-tree-row {
    display: grid;
    gap: var(--space-md);
    width: 100%;
}

body.report-mode .dgm-tree-row--3 {
    grid-template-columns: repeat(3, 1fr);
}

body.report-mode .dgm-tree-row--2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 60%;
    margin: 0 auto;
}

body.report-mode .dgm-tree-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    text-align: center;
}

body.report-mode .dgm-tree-branch .dgm-box {
    width: 100%;
    text-align: left;
}

body.report-mode .dgm-tree-branch .dgm-tree-fork-down {
    margin: 0 auto;
    flex-shrink: 0;
}

body.report-mode .dgm-tree-fork {
    width: 100%;
    height: 1px;
    background: var(--color-border-dark);
    position: relative;
    margin: var(--space-xs) 0;
}

body.report-mode .dgm-tree-fork-down {
    width: 1px;
    height: 16px;
    background: var(--color-border-dark);
    margin: 0 auto;
}

body.report-mode .dgm-tree-fork-wrap {
    width: 100%;
}

body.report-mode .dgm-tree-fork-wrap--2 {
    max-width: 60%;
    margin: 0 auto;
}

/* ── Evidence ladder (tier list) ────────────────────── */

body.report-mode .dgm-ladder {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--color-border-medium);
    border: 1px solid var(--color-border-medium);
}

body.report-mode .dgm-rung {
    display: grid;
    grid-template-columns: 80px 1fr 80px;
    background: var(--color-bg-white);
    padding: var(--space-md);
    align-items: center;
    gap: var(--space-md);
}

body.report-mode .dgm-rung-tier {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-annotation);
    line-height: 1.2;
}

body.report-mode .dgm-rung--tier-2 .dgm-rung-tier { color: var(--color-annotation-active); }
body.report-mode .dgm-rung--tier-3 .dgm-rung-tier { color: var(--color-ochre); }
body.report-mode .dgm-rung--tier-4 .dgm-rung-tier { color: var(--color-text-gray); }

body.report-mode .dgm-rung-tier small {
    display: block;
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--color-text-gray);
    letter-spacing: 0.06em;
    margin-top: 2px;
}

body.report-mode .dgm-rung-body {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text-charcoal);
}

body.report-mode .dgm-rung-body strong {
    color: var(--color-text-black);
    font-weight: 600;
}

body.report-mode .dgm-rung-strength {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-gray);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}

body.report-mode .dgm-rung-strength strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--color-text-black);
    font-family: var(--font-serif);
    letter-spacing: -0.02em;
    line-height: 1;
}

/* ── 2x2 Framework matrix ───────────────────────────── */

body.report-mode .dgm-matrix {
    display: grid;
    grid-template-columns: 80px 1fr 1fr;
    grid-template-rows: 80px 1fr 1fr;
    gap: 1px;
    background: var(--color-border-medium);
    border: 1px solid var(--color-border-medium);
}

body.report-mode .dgm-matrix-corner {
    background: var(--color-bg-warm-gray);
    grid-column: 1;
    grid-row: 1;
}

body.report-mode .dgm-matrix-axis-x {
    background: var(--color-bg-warm-gray);
    padding: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.688rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-gray);
}

body.report-mode .dgm-matrix-axis-y {
    background: var(--color-bg-warm-gray);
    padding: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.688rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-gray);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

body.report-mode .dgm-matrix-cell {
    background: var(--color-bg-white);
    padding: var(--space-md);
    min-height: 110px;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

body.report-mode .dgm-matrix-cell-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-annotation);
}

body.report-mode .dgm-matrix-cell-action {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--color-text-black);
    line-height: 1.3;
}

body.report-mode .dgm-matrix-cell-detail {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--color-text-gray);
    line-height: 1.4;
    margin-top: auto;
}

body.report-mode .dgm-matrix-cell--featured {
    background: var(--color-annotation-rose);
}

body.report-mode .dgm-matrix-cell--featured .dgm-matrix-cell-action {
    color: var(--color-annotation-deep);
}

/* ── Gantt phases ───────────────────────────────────── */

body.report-mode .dgm-gantt {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 1px var(--space-md);
    align-items: center;
}

body.report-mode .dgm-gantt-row-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--color-text-charcoal);
    padding: var(--space-xs) 0;
}

body.report-mode .dgm-gantt-row-label strong {
    display: block;
    color: var(--color-text-black);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.688rem;
    margin-bottom: 2px;
}

body.report-mode .dgm-gantt-row-track {
    height: 24px;
    background: repeating-linear-gradient(
        to right,
        var(--color-border-light),
        var(--color-border-light) 1px,
        transparent 1px,
        transparent calc(100% / 12)
    );
    position: relative;
    border-bottom: 1px dotted var(--color-border-light);
}

body.report-mode .dgm-gantt-bar {
    position: absolute;
    top: 4px;
    height: 16px;
    background: var(--color-text-black);
    color: var(--color-bg-cream);
    display: flex;
    align-items: center;
    padding: 0 var(--space-xs);
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: visible;
}

body.report-mode .dgm-gantt-bar--narrow span,
body.report-mode .dgm-gantt-bar--narrow-left span {
    position: absolute;
    color: var(--color-text-black);
    background: transparent;
    white-space: nowrap;
    top: 50%;
    transform: translateY(-50%);
}

body.report-mode .dgm-gantt-bar--narrow span {
    left: 100%;
    margin-left: 6px;
}

body.report-mode .dgm-gantt-bar--narrow-left span {
    right: 100%;
    margin-right: 6px;
}

body.report-mode .dgm-gantt-bar--accent {
    background: var(--color-annotation);
    color: var(--color-bg-cream);
}

body.report-mode .dgm-gantt-bar--outline {
    background: transparent;
    border: 1px solid var(--color-text-black);
    color: var(--color-text-black);
}

body.report-mode .dgm-gantt-axis {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    margin-top: var(--space-xs);
    border-top: 1px solid var(--color-border-medium);
    padding-top: var(--space-xs);
}

body.report-mode .dgm-gantt-axis span {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--color-text-gray);
    text-align: center;
    letter-spacing: 0.04em;
}

/* ── Bar chart ──────────────────────────────────────── */

body.report-mode .dgm-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

body.report-mode .dgm-chart-row {
    display: grid;
    grid-template-columns: 180px 1fr 70px;
    gap: var(--space-md);
    align-items: center;
}

body.report-mode .dgm-chart-label {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: var(--color-text-charcoal);
    line-height: 1.3;
    text-align: right;
}

body.report-mode .dgm-chart-label strong {
    display: block;
    color: var(--color-text-black);
    font-weight: 600;
}

body.report-mode .dgm-chart-track {
    height: 18px;
    background: var(--color-bg-warm-gray);
    position: relative;
    border-right: 1px solid var(--color-border-light);
}

body.report-mode .dgm-chart-track::after {
    content: "";
    position: absolute;
    right: 0;
    top: -3px;
    bottom: -3px;
    width: 1px;
    background: var(--color-text-black);
}

body.report-mode .dgm-chart-bar {
    height: 100%;
    background: var(--color-text-black);
}

body.report-mode .dgm-chart-bar--gap {
    background: repeating-linear-gradient(
        45deg,
        var(--color-annotation),
        var(--color-annotation) 4px,
        var(--color-annotation-rose) 4px,
        var(--color-annotation-rose) 8px
    );
}

body.report-mode .dgm-chart-bar--low {
    background: var(--color-border-medium);
}

body.report-mode .dgm-chart-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-black);
    font-variant-numeric: tabular-nums;
}

body.report-mode .dgm-chart-axis {
    margin-top: var(--space-sm);
    margin-left: 196px;
    margin-right: 86px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--color-text-gray);
    letter-spacing: 0.04em;
    border-top: 1px solid var(--color-border-medium);
    padding-top: 4px;
}

/* ── Sources / bibliography ─────────────────────────── */

body.report-mode .report__sources {
    margin-top: var(--space-3xl);
    padding-top: var(--space-xl);
    border-top: 2px solid var(--color-text-black);
}

body.report-mode .report__sources-tier {
    margin-bottom: var(--space-xl);
}

body.report-mode .report__sources-tier-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-annotation);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid currentColor;
    display: inline-block;
}

body.report-mode .report__sources-tier--2 .report__sources-tier-label {
    color: var(--color-ochre);
}

body.report-mode .report__sources-tier--3 .report__sources-tier-label {
    color: var(--color-text-gray);
}

body.report-mode .report__sources ol {
    list-style: none;
    padding: 0;
    counter-reset: src;
}

body.report-mode .report__sources li {
    counter-increment: src;
    padding: var(--space-sm) 0 var(--space-sm) 36px;
    border-bottom: 1px solid var(--color-border-light);
    position: relative;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--color-text-charcoal);
    scroll-margin-top: var(--space-2xl);
}

/* Citing paragraphs also get a scroll margin so backref jumps land
   with breathing room instead of pinning the cite to the top edge. */
body.report-mode .report a.cite {
    scroll-margin-top: var(--space-2xl);
}

body.report-mode .report__sources li::before {
    content: counter(src, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-light-gray);
    font-variant-numeric: tabular-nums;
}

body.report-mode .report__sources li strong {
    color: var(--color-text-black);
    font-weight: 600;
}

body.report-mode .report__sources li em {
    color: var(--color-text-gray);
    font-style: italic;
}

/* ── Footer colophon ────────────────────────────────── */

body.report-mode .report__colophon {
    margin-top: var(--space-3xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border-medium);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.688rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-light-gray);
    font-variant-numeric: tabular-nums;
}

/* ── Print rules (report-mode only) ─────────────────── */
/* @page rules live inside @media print so they don't activate for
   non-report pages. Selectors inside the print block are also
   namespaced so they never bleed into non-report templates that
   happen to share class names. */

@media print {
    body.report-mode {
        /* Hide app chrome — nav, footer, debug toolbar */
    }

    body.report-mode .nav-brand,
    body.report-mode footer,
    body.report-mode #djDebug,
    body.report-mode #djDebugToolbar,
    body.report-mode #main_header { display: none !important; }

    body.report-mode main { padding: 0 !important; }
    body.report-mode main > div { padding: 0 !important; max-width: none !important; }

    body.report-mode {
        background: white !important;
    }

    body.report-mode .report {
        max-width: none;
        padding: 0;
    }

    body.report-mode .report__pullquote { margin-left: 0; margin-right: 0; }

    body.report-mode .report__figure,
    body.report-mode .report table,
    body.report-mode .report__pullquote {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    body.report-mode .report h2 {
        page-break-before: always;
        break-before: page;
    }

    body.report-mode .report__masthead,
    body.report-mode .report__title + *,
    body.report-mode .report h2:first-of-type {
        page-break-before: avoid;
        break-before: avoid;
    }

    body.report-mode .report__figure,
    body.report-mode .report__figure *,
    body.report-mode .dgm-box,
    body.report-mode .dgm-box *,
    body.report-mode .dgm-rung,
    body.report-mode .dgm-rung *,
    body.report-mode .dgm-matrix-cell,
    body.report-mode .dgm-gantt-bar,
    body.report-mode .dgm-chart-bar,
    body.report-mode .dgm-chart-track {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body.report-mode .dgm-interactive {
        break-inside: avoid;
        page-break-inside: avoid;
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
}

/* @page rules are NOT permitted in this file (CSS spec disallows
 * nesting under a selector, so they would leak globally to any
 * print job). They live in static/css/report-print.css, which is
 * loaded only from the editorial render path via a <link
 * media="print"> tag. Pre-push hook `scripts/check_design_sync.sh`
 * enforces this separation. */

/* ── Episode detail — wider layout matching navbar ──────── */

@media (min-width: 768px) {
    body.report-mode article.episode-detail,
    body.report-mode article.report-page {
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    body.report-mode article.episode-detail .report__deck,
    body.report-mode article.report-page .report__deck {
        max-width: none;
    }
}

/* ── Episode detail — single meta line + cover + content ── */

body.report-mode .episode-meta-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--color-border-medium);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-xl);
    color: var(--color-text-black);
}

body.report-mode .episode-meta-line nav,
body.report-mode .episode-meta-line nav a,
body.report-mode .episode-meta-line nav span {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    color: var(--color-text-gray);
}

body.report-mode .episode-meta-line nav a:hover {
    color: var(--color-text-charcoal);
    text-decoration: none;
}

body.report-mode .episode-meta-line__right {
    color: var(--color-text-light-gray);
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

body.report-mode .episode-meta-line__right a {
    color: var(--color-annotation);
    text-decoration: none;
}

body.report-mode .episode-meta-line__right a:hover {
    text-decoration: underline;
}

body.report-mode .episode-title-block {
    display: flex;
    align-items: flex-start;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
}

body.report-mode .episode-title-block .report__title {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

body.report-mode .episode-cover-small {
    flex-shrink: 0;
    width: 7rem;
    height: 7rem;
    object-fit: cover;
    border: 1px solid var(--color-border-light);
}

body.report-mode .episode-player {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

body.report-mode .episode-player audio {
    width: 100%;
}

@media (min-width: 640px) {
    body.report-mode .episode-player {
        flex-direction: row;
        align-items: center;
    }

    body.report-mode .episode-player audio {
        flex: 1;
        min-width: 0;
    }
}

body.report-mode .episode-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

body.report-mode .episode-block {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border-light);
}

/* ── Episode chapters list ───────────────────────────── */

body.report-mode .episode-chapters {
    list-style: none;
    padding: 0;
    margin: 0;
}

body.report-mode .episode-chapter {
    display: grid;
    grid-template-columns: 3.25rem 1fr;
    gap: var(--space-md);
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
    align-items: baseline;
}

body.report-mode .episode-chapter:last-child {
    border-bottom: none;
}

body.report-mode .episode-chapter__time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-annotation);
    font-weight: 500;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

body.report-mode .episode-chapter__title {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--color-text-charcoal);
    line-height: 1.4;
}

/* ── Responsive (screen) ────────────────────────────── */

@media (max-width: 720px) {
    body.report-mode .report__title { font-size: 2.25rem; }
    body.report-mode .report__deck { font-size: 1.0625rem; }
    body.report-mode .report h2 { font-size: 1.625rem; }
    body.report-mode .report__masthead { flex-wrap: wrap; }
    body.report-mode .report__pullquote { margin-left: 0; margin-right: 0; font-size: 1.25rem; }
    body.report-mode .dgm-tree-row--3 { grid-template-columns: 1fr; }
    body.report-mode .dgm-tree-row--2 { grid-template-columns: 1fr; max-width: 100%; }
    body.report-mode .dgm-rung { grid-template-columns: 1fr; }
    body.report-mode .dgm-rung-strength { text-align: left; }
    body.report-mode .dgm-matrix { grid-template-columns: 60px 1fr 1fr; grid-template-rows: 60px auto auto; }
    body.report-mode .dgm-gantt { grid-template-columns: 1fr; }
    body.report-mode .dgm-gantt-row-track { margin-bottom: var(--space-sm); }
    body.report-mode .dgm-chart-row { grid-template-columns: 100px 1fr 50px; }
    body.report-mode .dgm-chart-axis { margin-left: 116px; margin-right: 66px; }
}
