:root {
    /* Brand colors */
    --brand: #2e7d4f;
    --brand-deep: #205937;
    --brand-rgb: 46, 125, 79;

    /* Surfaces — body-bg is a vertical gradient (top → bottom) so the
       page feels less like a flat color block. Solid fallback inlined
       below on body{} for older browsers / linting tools. */
    --body-bg: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
    --body-bg-solid: var(--brand);
    --surface: #f8f6ee;
    --surface-elevated: #fff;
    --surface-shadow: rgba(0, 0, 0, 0.08);
    --surface-shadow-strong: rgba(0, 0, 0, 0.18);
    --surface-shadow-hover: rgba(0, 0, 0, 0.25);

    /* Text */
    --text: #222;
    --text-muted: #666;
    --text-faint: #555;
    --text-on-brand: #f8f6ee;

    /* Strokes */
    --border: rgba(0, 0, 0, 0.15);
    --border-soft: rgba(0, 0, 0, 0.1);
    --divider: rgba(0, 0, 0, 0.1);

    /* Banner header */
    --banner-bg: var(--brand-deep);
    --banner-text: var(--text-on-brand);
    --banner-shadow: rgba(0, 0, 0, 0.25);

    /* Interactive states */
    --brand-tint-soft: rgba(var(--brand-rgb), 0.06);
    --brand-tint: rgba(var(--brand-rgb), 0.08);
    --brand-tint-strong: rgba(var(--brand-rgb), 0.15);
    --brand-line: rgba(var(--brand-rgb), 0.2);
    --brand-line-strong: rgba(var(--brand-rgb), 0.3);
    --nav-hover: rgba(255, 255, 255, 0.08);

    /* Status: warning */
    --warning-bg: #fff7e0;
    --warning-text: #8a5a00;
    --warning-stroke: #d4a017;

    /* Geometry */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-pill: 999px;
    --transition: 0.15s;

    /* Layout */
    --content-max: 1400px;
    --card-min-col: 220px;
}

/* Wider content cap on very large displays so the card grid doesn't
   leave 500px+ of empty viewport on each side. */
@media (min-width: 2000px) {
    :root {
        --content-max: 1600px;
    }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --brand: #5ab07c;
        --brand-deep: #7dca96;
        --brand-rgb: 90, 176, 124;

        --body-bg: linear-gradient(180deg, #0e1a13 0%, #070d0a 100%);
        --body-bg-solid: #0e1a13;
        --surface: #1c2a22;
        --surface-elevated: #263a30;
        --surface-shadow: rgba(0, 0, 0, 0.4);
        --surface-shadow-strong: rgba(0, 0, 0, 0.5);
        --surface-shadow-hover: rgba(0, 0, 0, 0.65);

        --text: #f0e9d6;
        --text-muted: #a8a09a;
        --text-faint: #c0b8b0;
        --text-on-brand: #0e1a13;

        --border: rgba(255, 255, 255, 0.15);
        --border-soft: rgba(255, 255, 255, 0.08);
        --divider: rgba(255, 255, 255, 0.1);

        --banner-bg: #122119;
        --banner-text: #f0e9d6;
        --banner-shadow: rgba(0, 0, 0, 0.5);

        --warning-bg: #3d3322;
        --warning-text: #f0c060;
        --warning-stroke: #d4a017;
    }
}

/* Explicit user choice via the preferences menu — wins over the media query. */
:root[data-theme="dark"] {
    --brand: #5ab07c;
    --brand-deep: #7dca96;
    --brand-rgb: 90, 176, 124;

    --body-bg: linear-gradient(180deg, #0e1a13 0%, #070d0a 100%);
    --body-bg-solid: #0e1a13;
    --surface: #1c2a22;
    --surface-elevated: #263a30;
    --surface-shadow: rgba(0, 0, 0, 0.4);
    --surface-shadow-strong: rgba(0, 0, 0, 0.5);
    --surface-shadow-hover: rgba(0, 0, 0, 0.65);

    --text: #f0e9d6;
    --text-muted: #a8a09a;
    --text-faint: #c0b8b0;
    --text-on-brand: #0e1a13;

    --border: rgba(255, 255, 255, 0.15);
    --border-soft: rgba(255, 255, 255, 0.08);
    --divider: rgba(255, 255, 255, 0.1);

    --banner-bg: #122119;
    --banner-text: #f0e9d6;
    --banner-shadow: rgba(0, 0, 0, 0.5);

    --warning-bg: #3d3322;
    --warning-text: #f0c060;
    --warning-stroke: #d4a017;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background-color: var(--body-bg-solid);
    background-image: var(--body-bg);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--brand-deep); }

/* Visually hide an element while keeping it announceable by screen readers. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

/* Make keyboard focus visible everywhere. */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ---------- Preferences menu (top-left of banner) ---------- */
.prefs-menu {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
}
.prefs-button {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: var(--banner-text);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}
.prefs-button:hover { background: rgba(255, 255, 255, 0.16); }
.prefs-button svg { width: 20px; height: 20px; display: block; }
.prefs-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    padding: 12px;
    background: var(--surface-elevated);
    color: var(--text);
    font-family: system-ui, sans-serif;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 20px var(--surface-shadow-strong);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.prefs-panel[hidden] { display: none; }
.prefs-row { display: flex; flex-direction: column; gap: 6px; }
.prefs-row-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.prefs-segment {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.prefs-segment button {
    flex: 1;
    padding: 6px 12px;
    border: none;
    background: var(--surface-elevated);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition);
}
.prefs-segment button + button { border-left: 1px solid var(--border); }
.prefs-segment button.active {
    background: var(--brand);
    color: var(--text-on-brand);
}
.prefs-segment button:hover:not(.active) { background: var(--brand-tint); }

/* ---------- Banner + site nav ---------- */
.banner {
    position: relative;
    background: var(--banner-bg);
    color: var(--banner-text);
    text-align: center;
    padding: 32px 16px 16px;
    font-family: "Dancing Script", "Segoe Script", cursive;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 1px;
    text-shadow: 2px 2px 6px var(--banner-shadow);
}
.banner.large { font-size: clamp(3rem, 12vw, 6rem); padding: 80px 16px 40px; }
.banner.small { font-size: clamp(1.75rem, 5vw, 2.5rem); padding: 20px 16px 12px; }
.banner a {
    color: inherit;
    text-decoration: none;
}

.site-nav {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 12px 16px 20px;
    background: var(--banner-bg);
    font-size: 1rem;
}
.site-nav a {
    color: var(--banner-text);
    text-decoration: none;
    opacity: 0.8;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: opacity var(--transition), background var(--transition);
}
.site-nav a:hover { opacity: 1; background: var(--nav-hover); }
.site-nav a.active { opacity: 1; font-weight: 600; }

/* ---------- Page surface ---------- */
.page {
    padding: 24px;
}
.surface {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: 0 2px 8px var(--surface-shadow);
    max-width: var(--content-max);
    margin: 0 auto;
}
.surface h1 { margin-top: 0; color: var(--brand-deep); }
.surface h2 { color: var(--brand-deep); }

/* ---------- Home: link cards ---------- */
.home-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--card-min-col), 1fr));
    gap: 20px;
    max-width: 720px;
    margin: 40px auto 0;
    padding: 0 24px;
}
.home-link {
    display: block;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    padding: 32px 24px;
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 16px var(--surface-shadow-strong);
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}
.home-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--surface-shadow-hover);
}
.home-link-title {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--brand-deep);
    margin-bottom: 6px;
}
.home-link-desc {
    display: block;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ---------- News tabs ---------- */
.tab-nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--brand-line);
    margin-bottom: 20px;
    overflow: auto hidden;       /* x: auto, y: hidden — shorthand avoids Firefox quirk */
    scrollbar-width: thin;
}
.tab-nav button {
    flex: 0 0 auto;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}
.tab-nav button:hover { color: var(--brand-deep); }
.tab-nav button.active {
    color: var(--brand-deep);
    border-bottom-color: var(--brand);
}

/* ---------- News: search filter ----------
   The form stacks its four design rows vertically at every viewport:
     1. source · article-type · keyword
     2. from · to · date-presets
     3. domain · incident · exploitation · has-cve
     4. abused-infra · platform · actor · confidence
   Rows 1 and 2 use grid so the third column (keyword / date-presets)
   takes whatever's left of the row. Rows 3 and 4 use flex-wrap so
   the four pills sit on one line and wrap gracefully on narrow
   viewports. */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}
.filter-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}
/* Rows 1 and 2 use grid so the third column (keyword / date-presets)
   takes whatever's left without forcing the auto-width siblings to
   wrap below. minmax(0, 1fr) lets the row shrink in the paired
   wide-screen layout where each row only gets half the block width. */
.filter-row--primary,
.filter-row--dates {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: end;
    gap: 12px;
}
.filter-row--primary .search-field-keyword,
.filter-row--primary .search-field-keyword input { min-width: 0; }
/* Keep empty pill slots in the grid (they collapse to 0 width since
   nothing inside) so the keyword/presets column stays in track 3
   rather than auto-placing into the slot's vacated track. */
.filter-pill-slot:empty { width: 0; padding: 0; }

@media (max-width: 640px) {
    .filter-row--primary,
    .filter-row--dates {
        grid-template-columns: 1fr;
    }
}

/* Each filter-block stacks its rows vertically at all widths so the
   form always reads as the four design rows (primary / dates /
   categories / attribution). An earlier media query paired rows
   side-by-side at wide viewports, which collapsed the four design
   rows into two visual rows — removed because the requested column
   order assumes one row per line. */

.search-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-faint);
}
.date-input {
    position: relative;
    display: block;
}
.date-input input[type="text"] {
    width: 100%;
    padding-right: 32px;
}
.date-picker-btn {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.date-picker-btn:hover { background: var(--brand-tint); color: var(--brand-deep); }
.date-picker-btn svg { width: 16px; height: 16px; display: block; }
.date-picker-hidden {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
}
.search-field input,
.search-field select {
    /* Match the filter-pill-btn aesthetic so all inputs/buttons in the
       form share one visual language: brand-tinted border, slightly
       smaller text, same height. */
    padding: 5px 12px;
    font-size: 0.85rem;
    line-height: 1.6;
    border: 1px solid var(--brand-line-strong);
    border-radius: var(--radius);
    background: var(--surface-elevated);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-field input::placeholder { color: var(--text-muted); }
.search-field input:focus,
.search-field select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-tint-strong);
}
/* ---------- News: multi-select filter pills (mounted into .filter-pill-slot divs) ---------- */
.filter-pill {
    position: relative;
}
.filter-pill-btn {
    padding: 5px 10px 5px 14px;
    border: 1px solid var(--brand-line-strong);
    background: var(--surface-elevated);
    color: var(--brand-deep);
    font-size: 0.85rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.filter-pill-btn::after {
    content: ' ▾';
    font-size: 0.75em;
    opacity: 0.6;
    margin-left: 4px;
}
.filter-pill-btn:hover { background: var(--brand-tint); }
.filter-pill-btn.active {
    background: var(--brand);
    color: var(--text-on-brand);
    border-color: var(--brand);
}
.filter-pill-btn[aria-expanded="true"] {
    border-color: var(--brand);
}

/* Single-state toggle button (e.g. "Has CVE") — matches the pill button
   aesthetic but has no popover / chevron, just an active flip. */
.filter-toggle {
    padding: 5px 12px;
    border: 1px solid var(--brand-line-strong);
    background: var(--surface-elevated);
    color: var(--brand-deep);
    font-size: 0.85rem;
    border-radius: var(--radius);
    cursor: pointer;
    align-self: flex-end;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.filter-toggle:hover { background: var(--brand-tint); }
.filter-toggle.active,
.filter-toggle[aria-pressed="true"] {
    background: var(--brand);
    color: var(--text-on-brand);
    border-color: var(--brand);
}

.filter-pill-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 0;
    background: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 20px var(--surface-shadow-strong);
}
.filter-pill-panel[hidden] { display: none; }
.filter-pill-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 0.9rem;
    cursor: pointer;
}
.filter-pill-option:hover { background: var(--brand-tint-soft); }
.filter-pill-option input { cursor: pointer; }

/* Date-preset chips (Today / Last 3 days / ...) sit alongside the date pickers. */
.date-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.date-presets button {
    padding: 6px 12px;
    border: 1px solid var(--brand-line-strong);
    background: var(--surface-elevated);
    color: var(--brand-deep);
    font-size: 0.85rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.date-presets button:hover { background: var(--brand-tint); }
.date-presets button.active {
    background: var(--brand);
    color: var(--text-on-brand);
    border-color: var(--brand);
}

/* Reset + Search-all action row below the categorical filters. */
.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}
.filter-actions button {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.filter-actions .search-reset {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-faint);
}
.filter-actions .search-reset:hover { background: var(--brand-tint); color: var(--brand-deep); }
.filter-actions .search-all {
    margin-left: auto;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text-faint);
}
.filter-actions .search-all:hover:not(:disabled) { background: var(--brand-tint); color: var(--brand-deep); }
.filter-actions .search-all:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

/* Status + CVE chips on article cards */
.status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}
.status-kev  { background: #b91c1c; }   /* CISA Known Exploited Vulnerabilities */
.status-itw  { background: #b91c1c; }   /* in the wild */
.status-poc  { background: #c2410c; }   /* proof of concept */
.status-none { background: #6b7280; }
.status-unknown { background: #9ca3af; }
.cve-badge {
    background: var(--brand-tint-strong);
    color: var(--brand-deep);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    flex-shrink: 0;
}
.cve-more {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    flex-shrink: 0;
}
.cve-overflow { display: none; }
.article-card[open] .cve-overflow { display: inline-flex; }
.article-card[open] .cve-more { display: none; }

/* ---------- v1.9 categorical chips ----------
   Each chip family carries a distinct hue so the eye can parse Row 4
   (what happened + how exploited + which CVEs + by whom) and Row 5
   (what defenders own + what attackers used + what tech got hit)
   without re-reading every chip.
   Light-mode palette below; dark-mode overrides further down. */

/* Incident taxonomy uses an OUTLINED treatment to distinguish it visually
   from the SOLID status-badge (exploitation severity) — they encode
   different axes, so they shouldn't share treatment even when they
   share hue. Outlined also separates incident-behavior (blue) from
   the filled-pastel platform-chip. */
.incident-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: transparent;
    border: 1.5px solid;
    flex-shrink: 0;
    white-space: nowrap;
}
.incident-severe   { color: #991b1b; border-color: #991b1b; }   /* rce, ransomware, data-breach, supply-chain */
.incident-serious  { color: #b45309; border-color: #b45309; }   /* backdoor, intrusion-campaign, priv-esc, auth-bypass */
.incident-moderate { color: #a16207; border-color: #a16207; }   /* infostealer, malware-other, dos, info-disclosure */
.incident-behavior { color: #1d4ed8; border-color: #1d4ed8; }   /* credential-abuse, phishing */
.incident-neutral  { color: #4b5563; border-color: #4b5563; }   /* other, unknown */
[data-theme="dark"] .incident-severe   { color: #fca5a5; border-color: #fca5a5; }
[data-theme="dark"] .incident-serious  { color: #fdba74; border-color: #fdba74; }
[data-theme="dark"] .incident-moderate { color: #fcd34d; border-color: #fcd34d; }
[data-theme="dark"] .incident-behavior { color: #93c5fd; border-color: #93c5fd; }
[data-theme="dark"] .incident-neutral  { color: #9ca3af; border-color: #9ca3af; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .incident-severe   { color: #fca5a5; border-color: #fca5a5; }
    :root:not([data-theme="light"]) .incident-serious  { color: #fdba74; border-color: #fdba74; }
    :root:not([data-theme="light"]) .incident-moderate { color: #fcd34d; border-color: #fcd34d; }
    :root:not([data-theme="light"]) .incident-behavior { color: #93c5fd; border-color: #93c5fd; }
    :root:not([data-theme="light"]) .incident-neutral  { color: #9ca3af; border-color: #9ca3af; }
}

.domain-chip,
.infra-chip,
.platform-chip {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
    white-space: nowrap;
}
.domain-chip   { background: #ccfbf1; color: #115e59; }   /* security_domains — teal */
.infra-chip    { background: #ede9fe; color: #5b21b6; }   /* abused_infrastructure — violet */
.platform-chip { background: #dbeafe; color: #1e3a8a; }   /* affected_platforms — blue */

[data-theme="dark"] .domain-chip   { background: #134e4a; color: #99f6e4; }
[data-theme="dark"] .infra-chip    { background: #3b0764; color: #ddd6fe; }
[data-theme="dark"] .platform-chip { background: #1e3a8a; color: #bfdbfe; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .domain-chip   { background: #134e4a; color: #99f6e4; }
    :root:not([data-theme="light"]) .infra-chip    { background: #3b0764; color: #ddd6fe; }
    :root:not([data-theme="light"]) .platform-chip { background: #1e3a8a; color: #bfdbfe; }
}

/* article_type badge — small, uppercase, lives in Row 1 next to the
   source badge. Renders only when article_type carries signal; the
   default "news-report" produces no chip (see articleTypeLabel). */
.article-type-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}
.article-type-vendor-advisory {
    background: transparent;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
/* research-report uses a darker, more saturated purple than infra-chip's
   pastel violet so the two don't read as a hue family. Border is a solid
   line (1.5px) rather than the pastel borders used elsewhere. */
.article-type-research-report {
    background: transparent;
    color: #3b0764;
    border: 1.5px solid #3b0764;
}
.article-type-sponsored,
.article-type-thought-leadership {
    background: transparent;
    color: var(--text-faint);
    border: 1px solid var(--border);
    font-style: italic;
}
[data-theme="dark"] .article-type-vendor-advisory  { color: #93c5fd; border-color: #1e40af; }
[data-theme="dark"] .article-type-research-report  { color: #c4b5fd; border-color: #c4b5fd; }
[data-theme="dark"] .article-type-sponsored,
[data-theme="dark"] .article-type-thought-leadership { border-color: var(--text-faint); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .article-type-vendor-advisory  { color: #93c5fd; border-color: #1e40af; }
    :root:not([data-theme="light"]) .article-type-research-report  { color: #c4b5fd; border-color: #c4b5fd; }
    :root:not([data-theme="light"]) .article-type-sponsored,
    :root:not([data-theme="light"]) .article-type-thought-leadership { border-color: var(--text-faint); }
}

.search-summary {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* ---------- News: view toggle ---------- */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.view-toggle button {
    padding: 6px 16px;
    border: none;
    background: var(--surface-elevated);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition);
}
.view-toggle button + button { border-left: 1px solid var(--border); }
.view-toggle button.active {
    background: var(--brand);
    color: var(--text-on-brand);
}
.view-toggle button:hover:not(.active) { background: var(--brand-tint); }

.news-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.35;
}
.news-meta-updates {
    color: var(--text-faint);
    font-size: 0.8rem;
}

.news-warning {
    color: var(--warning-text);
    font-size: 0.9rem;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--warning-bg);
    border-left: 3px solid var(--warning-stroke);
    border-radius: var(--radius-sm);
}
.news-warning details summary { cursor: pointer; }
.news-warning ul { margin: 8px 0 0 0; padding-left: 20px; }
.news-warning code { font-size: 0.85em; }

/* ---------- Article cards ---------- */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.article-list[data-view="card"] {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(max(var(--card-min-col), calc((100% - 24px) / 3)), 1fr)
    );
    gap: 12px;
}

.article-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--surface-elevated);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.article-card > summary {
    list-style: none;
    cursor: pointer;
    flex: 1 1 auto;
}
.article-card > summary::-webkit-details-marker { display: none; }
.article-card[open] > summary { background: var(--brand-tint); }
/* Article card content — eight rows in the summary (see news.js card builder).
   Rows clip to one line and the severity summary clamps to 3 lines until
   the card is expanded. The header itself fills the card height so the
   severity summary can bottom-align across a row of cards. */
.article-card-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    user-select: none;
    transition: background var(--transition);
    height: 100%;
}
.article-card-header:hover { background: var(--brand-tint-soft); }
.article-card-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.article-card-r2 {
    flex-wrap: wrap;
    gap: 8px;
}
.article-card-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-card[open] .article-card-title {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}
.article-card-tags {
    flex-wrap: nowrap;
    overflow: hidden;
    max-width: 100%;
    gap: 8px;
    position: relative;
}
.article-card[open] .article-card-tags {
    flex-wrap: wrap;
    overflow: visible;
}
/* Right-edge fade signals that the chip row is clipped. Only renders in
   collapsed state; when the card opens, the ::after rule no longer
   matches and the gradient disappears. */
.article-card:not([open]) .article-card-tags::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 32px;
    background: linear-gradient(to right, rgba(0, 0, 0, 0), var(--surface-elevated));
    pointer-events: none;
}
.article-card-summary {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: auto;   /* push to bottom so cards in a row align */
}
.article-card[open] .article-card-summary {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}

/* Row 6 — actor attribution as italic text, ellipsis collapsed,
   wraps freely when open. Not a flex row: a single text container
   so text-overflow:ellipsis works without per-child styling. */
.article-card-actor {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.article-card[open] .article-card-actor {
    white-space: normal;
    overflow: visible;
}
.source-badge {
    background: var(--brand);
    color: var(--text-on-brand);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.2px;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}
a.source-badge { cursor: pointer; }
a.source-badge:hover { filter: brightness(1.1); }
.pdf-chip {
    background: var(--brand-tint-strong);
    color: var(--brand-deep);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.2px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.pdf-chip:hover {
    background: var(--brand);
    color: var(--text-on-brand);
}
.news-type-badge {
    background: var(--brand-tint-strong);
    color: var(--brand-deep);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.article-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.empty-state-action {
    padding: 5px 12px;
    border: 1px solid var(--brand-line-strong);
    background: var(--surface-elevated);
    color: var(--brand-deep);
    font-size: 0.85rem;
    font-style: normal;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}
.empty-state-action:hover { background: var(--brand-tint); }

/* ---------- Page nav (numbered pagination below the article grid) ---------- */
.page-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}
.page-nav[hidden] { display: none; }
.page-nav-btn {
    min-width: 36px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.page-nav-btn:hover:not(:disabled):not(.active) {
    background: var(--brand-tint);
    border-color: var(--brand-line-strong);
}
.page-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.page-nav-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--text-on-brand);
}
.page-nav-gap {
    align-self: center;
    color: var(--text-muted);
    padding: 0 4px;
}

/* ---------- Tools placeholder ---------- */
.placeholder-block {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.placeholder-block h2 { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .page { padding: 12px; }
    .surface { padding: 20px; }
    .home-links { padding: 0 12px; gap: 12px; }
    .home-link { padding: 24px 16px; }
    .toolbar { flex-direction: column; align-items: stretch; }
}

/* =============================================================
   Style variants — flip in the prefs menu (Style: Default /
   Editorial / Script). Brand colors stay the same in all
   variants so dark mode keeps working; only typography, geometry,
   and texture change.
   ============================================================= */

/* KEV outranks IN-THE-WILD in severity — give it a deeper red so the
   visual hierarchy matches the semantic hierarchy. Applied universally,
   not per-variant. */
.status-kev { background: #7f1d1d; }

/* ---------- Editorial: serious publication identity ---------- */
[data-variant="editorial"] {
    --radius-sm: 2px;
    --radius: 3px;
    --radius-lg: 4px;
    --radius-xl: 6px;
}
[data-variant="editorial"] body {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 400;
}
[data-variant="editorial"] .banner {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    letter-spacing: -1px;
    text-shadow: none;
}
[data-variant="editorial"] .banner.large {
    font-size: clamp(3rem, 10vw, 5rem);
    padding: 64px 16px 32px;
}
[data-variant="editorial"] .banner.small {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
}
[data-variant="editorial"] .site-nav {
    font-family: 'IBM Plex Serif', Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.78rem;
}
[data-variant="editorial"] .site-nav a { padding: 4px 12px; }
[data-variant="editorial"] .article-card {
    border-color: var(--border);
    box-shadow: none;
}
[data-variant="editorial"] .article-card-title {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.2px;
}
[data-variant="editorial"] .article-card-summary {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-style: italic;
    font-size: 0.92rem;
    color: var(--text-faint);
    line-height: 1.5;
}
[data-variant="editorial"] .status-badge {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    padding: 3px 8px;
}
/* Editorial mutes the new v1.9 categorical chips so they read as
   annotations in the margin rather than competing with the title.
   Lowercase + tracked-out + thinner borders. */
[data-variant="editorial"] .incident-badge {
    text-transform: none;
    letter-spacing: 0;
    font-style: italic;
    font-weight: 600;
}
[data-variant="editorial"] .domain-chip,
[data-variant="editorial"] .infra-chip,
[data-variant="editorial"] .platform-chip {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}
[data-variant="editorial"] .article-type-badge {
    font-family: 'IBM Plex Serif', Georgia, serif;
    text-transform: uppercase;
    font-weight: 700;
    font-style: normal;
    letter-spacing: 1.2px;
}
[data-variant="editorial"] .article-card-actor { color: var(--text); }
[data-variant="editorial"] .source-badge,
[data-variant="editorial"] a.source-badge {
    background: transparent;
    color: var(--brand-deep);
    border: 1px solid var(--brand-line-strong);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
}
[data-variant="editorial"] .pdf-chip {
    background: transparent;
    color: var(--brand-deep);
    border: 1px solid var(--brand-line-strong);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
}
[data-variant="editorial"] .home-link {
    border: 1px solid var(--border);
    box-shadow: none;
}
[data-variant="editorial"] .home-link-title {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-style: italic;
    font-size: 1.7rem;
}
[data-variant="editorial"] .home-link-desc {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-style: italic;
}

/* ---------- Script: amplify the cursive identity ---------- */
[data-variant="handwritten"] {
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
}
[data-variant="handwritten"]:not([data-theme="dark"]) {
    --surface: #faf6e8;
    --surface-elevated: #fffdf5;
}
[data-variant="handwritten"] body {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: "SOFT" 50, "WONK" 0, "opsz" 14;
    background-image:
        radial-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px);
    background-size: 28px 28px, 13px 13px;
    background-position: 0 0, 6px 7px;
}
[data-variant="handwritten"][data-theme="dark"] body {
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}
@media (prefers-color-scheme: dark) {
    [data-variant="handwritten"]:not([data-theme="light"]) body {
        background-image:
            radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
            radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    }
}
[data-variant="handwritten"] .banner {
    text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.18), 5px 8px 16px var(--banner-shadow);
}
[data-variant="handwritten"] .banner.large {
    font-size: clamp(3.5rem, 14vw, 7rem);
}
[data-variant="handwritten"] .banner.large::after {
    content: '';
    display: block;
    width: 140px;
    height: 5px;
    margin: 12px auto 0;
    background: var(--banner-text);
    border-radius: 999px;
    transform: rotate(-1.5deg);
    opacity: 0.55;
}
[data-variant="handwritten"] .article-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
[data-variant="handwritten"] .article-card:hover {
    transform: rotate(-0.3deg);
}
[data-variant="handwritten"] .article-card-title {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: "SOFT" 80, "WONK" 1, "opsz" 24;
    font-size: 1.12rem;
    font-weight: 600;
}
[data-variant="handwritten"] .article-card-summary {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: "SOFT" 50, "WONK" 0, "opsz" 14;
    font-weight: 400;
}
[data-variant="handwritten"] .home-link {
    transition: transform var(--transition), box-shadow var(--transition);
}
[data-variant="handwritten"] .home-link:hover {
    transform: translateY(-3px) rotate(-0.6deg);
}
[data-variant="handwritten"] .home-link-title {
    font-family: 'Dancing Script', cursive;
    font-weight: 700;
    font-size: 2.2rem;
    color: var(--brand-deep);
}
[data-variant="handwritten"] .home-link-desc {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: "SOFT" 50, "opsz" 14;
}
