/* brief-v1.css — Daily Market Briefing articles (body HTML from C:\Ndev\druckfin\briefgen, published with druc -pub).
   Every rule is scoped to classes only briefings use (.sec, .lead-label, .view-tag, .table-wrap, ...), so other
   articles are untouched. Same look as the local briefing reader (briefgen assets/brief.css), on base-v8 tokens.
   Loaded by article.html; section nav + collapsible sources: brief-v1.js.
   To update: edit here, bump the filename version, update the <link> in article.html. */

/* ===== Tokens (gain / loss colors per theme) ===== */
:root,
:root[data-theme="light"] {
    --up: #0a8f5a;
    --down: #d92d20;
}

:root[data-theme="dark"] {
    --up: #2bd38a;
    --down: #ff6b5f;
}

:root[data-theme="bloomberg"] {
    --up: #3ddc84;
    --down: #ff4d4d;
}

/* ===== Body text => black list items and cells in light mode, like paragraphs ===== */
.article-body:has(> .sec) li,
.article-body:has(> .sec) td {
    color: var(--text-article-p);
}

.article-body:has(> .sec) li::marker {
    color: var(--accent);
}

.article-body:has(> .sec) li {
    margin-bottom: 0.45rem;
}

/* "Covers: ..." line at the top */
.article-body:has(> .sec) > p:first-child {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.article-body:has(> .sec) > p:first-child em {
    font-style: normal;
}

/* ===== Section nav (built by brief-v1.js) ===== */
.brief-toc {
    position: sticky;
    top: var(--brief-top, 3.65rem);
    z-index: 20;
    display: flex;
    gap: 0.4rem;
    margin: 1.4rem -20px 0;
    padding: 0.65rem 20px;
    font-size: 1rem;
    line-height: 1.4;
    overflow-x: auto;
    scrollbar-width: none;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.brief-toc::-webkit-scrollbar {
    display: none;
}

.article-body .brief-toc a {
    flex: none;
    text-decoration: none;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-2);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    text-transform: var(--case);
    transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.article-body .brief-toc a:hover,
.article-body .brief-toc a.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

/* ===== Sections ===== */
.article-body .sec {
    margin-top: 2.2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    scroll-margin-top: 7.5rem;
}

.article-body .sec > h2,
.article-body .sec summary h2 {
    margin: 0 0 0.6rem;
    font-size: 1.65rem;
}

.article-body .sec h3 {
    margin-top: 2rem;
    font-size: 1.25rem;
    scroll-margin-top: 7.5rem;
}

/* Small-caps section heads */
.article-body .sec-takeaways > h2,
.article-body .sec-snapshot > h2,
.article-body .sec-watch > h2,
.article-body .sec-sources h2 {
    color: var(--accent);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Top 3 takeaways => highlighted numbered card */
.article-body .sec.sec-takeaways {
    margin-top: 1.5rem;
    padding: 1.3rem 1.5rem 0.6rem;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, var(--accent-soft), transparent 70%), var(--surface);
    box-shadow: var(--shadow-sm);
}

.article-body .sec-takeaways ul {
    list-style: none;
    padding: 0;
    counter-reset: tk;
}

.article-body .sec-takeaways li {
    position: relative;
    counter-increment: tk;
    margin: 0.9rem 0 1.1rem;
    padding-left: 2.6rem;
}

.article-body .sec-takeaways li::before {
    content: counter(tk);
    position: absolute;
    left: 0;
    top: 0.15rem;
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-ink);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 800;
}

/* "What happened:" labels */
.article-body .lead-label {
    margin: 1.3rem 0 0.25rem;
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.article-body .lead-label strong {
    color: inherit;
}

/* "Our view" tag (the colon is for readers without this stylesheet, e.g. feeds) */
.article-body .vt-colon {
    display: none;
}

.article-body .view-tag {
    display: inline-block;
    margin-right: 0.25rem;
    padding: 0.08rem 0.5rem;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--pro-2) 13%, transparent);
    color: var(--pro-2);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: 0.12em;
}

.article-body .note {
    color: var(--muted);
    font-size: 0.86rem;
    font-style: italic;
}

/* ===== Market snapshot table ===== */
.article-body .table-wrap {
    margin: 0.6rem 0 0.8rem;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.article-body .table-wrap table {
    display: table;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
}

.article-body .table-wrap th,
.article-body .table-wrap td {
    padding: 0.6rem 0.85rem;
    vertical-align: top;
}

.article-body .table-wrap tbody tr:last-child td {
    border-bottom: 0;
}

.article-body .table-wrap tbody tr:hover {
    background: var(--surface-2);
}

.article-body .table-wrap th {
    background: var(--bg-2);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
}

.article-body .table-wrap td:first-child {
    color: var(--heading);
    font-weight: 600;
    white-space: nowrap;
}

.article-body .table-wrap td:nth-child(2),
.article-body .table-wrap td.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.article-body .table-wrap td.up {
    color: var(--up);
    font-weight: 700;
}

.article-body .table-wrap td.down {
    color: var(--down);
    font-weight: 700;
}

.article-body .sec-snapshot td:last-child {
    color: var(--muted);
    font-size: 0.84rem;
}

/* ===== Watch today => calendar cards ===== */
.article-body .sec-watch ul {
    list-style: none;
    padding: 0;
}

.article-body .sec-watch li {
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    background: var(--surface);
}

/* ===== Sources => collapsed by brief-v1.js ===== */
.article-body .sec-sources ul {
    font-size: 0.86rem;
    line-height: 1.5;
}

.article-body .brief-collapse {
    margin-top: 0.4rem;
}

.article-body .brief-collapse summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}

.article-body .brief-collapse summary::-webkit-details-marker {
    display: none;
}

.article-body .brief-collapse summary::after {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    margin-top: -0.2rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.article-body .brief-collapse[open] summary::after {
    margin-top: 0.2rem;
    transform: rotate(-135deg);
}

/* ===== Bloomberg extras ===== */
:root[data-theme="bloomberg"] .article-body .sec-takeaways li::before {
    border-radius: var(--radius);
}

:root[data-theme="bloomberg"] .article-body .sec h3 {
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .article-body .sec > h2 {
        font-size: 1.4rem;
    }
    .article-body .sec h3 {
        font-size: 1.15rem;
    }
}

@media (max-width: 560px) {
    .brief-toc {
        margin-inline: -16px;
        padding-inline: 16px;
    }
    .article-body .sec.sec-takeaways {
        padding: 1.1rem 1.1rem 0.5rem;
    }
}
