/* Security Matrix */
.security-matrix {
    background: linear-gradient(145deg, color-mix(in srgb, var(--accent-soft) 13%, var(--surface)) 0%, color-mix(in srgb, var(--accent-soft) 35%, var(--surface)) 52%, color-mix(in srgb, var(--accent-soft) 30%, var(--surface)) 100%);
    padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2rem);
    position: relative;
    min-height: 500px;
    border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
    border-radius: 16px;
    box-shadow: 0 14px 32px color-mix(in srgb, var(--accent) 12%, transparent);
}

.matrix-wrapper {
    overflow-x: auto;
    margin: clamp(1.5rem, 5vw, 3rem) 0;
}

.matrix {
    width: 100%;
    border-collapse: collapse;
    /* One background-color. A `var(--surface)` declaration used to sit at the
       top of this block, five lines above the `var(--accent)` that overrode it
       — same rule, same property, so it never painted anything. The block's
       indentation was uneven, which is what let two of them sit here unnoticed. */
    background-color: var(--accent);
    color: var(--text-on-accent);
    border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 12%, transparent);
}

.matrix > thead > tr > th {
    padding: clamp(0.75rem, 2vw, 1.5rem);
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--accent);
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
}

.matrix > tbody > tr > td {
    padding: clamp(0.75rem, 2vw, 1.5rem);
    text-align: center;
    border: 1px solid var(--border);
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
}

.matrix > tbody > tr:last-child > td {
    border-bottom: 2px solid var(--border);
}

.matrix > tbody > tr:nth-child(even) {
    background-color: var(--surface-2);
}

/* Every body row is painted an opaque --surface / --surface-2 at every
   breakpoint (responsive.css), never the .matrix --accent fill, so the threat
   name needs --text on ALL rows. It used to be set on even rows only, which
   left odd rows (Phishing, Knowledge-capital) with the inherited dark
   --text-on-accent on a dark surface in dark themes. */
.matrix > tbody > tr > .threat-name,
.matrix > tbody > tr:nth-child(even) .threat-name {
    color: var(--text);
}

/* GDPR Row Gold Highlight */

.threat-name {
    text-align: left;
    font-weight: 600;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.matrix-icon {
    width: clamp(24px, 5vw, 32px);
    height: clamp(24px, 5vw, 32px);
    margin: 0 auto;
    display: block;
}

.matrix-icon.secure {
    color: var(--success-text);
}

.matrix-icon.warning {
    color: var(--warning-text);
}

.matrix-icon.vulnerable {
    color: var(--danger-text);
}

/* ==================== KNOWLEDGE-CAPITAL ROW + DROPDOWN ==================== */
/* The last hero row owns the indexed-threat index: clicking it opens the
   dropdown row beneath, which holds the whole Others-vs-PA group matrix. */
/* The row that owns the index reads as the featured one, matching its info
   button, its pill, its modal and its demo panel. Gold in the fill, the edge
   and the glow; no text sits on it. Mixed INTO --surface rather than layered
   over it, because responsive.css paints an opaque row background at every
   breakpoint -- the attribute selector is what wins that tie despite
   responsive.css loading later. The edge and the glow are in responsive.css
   beside it, because the row changes box type at 1024px. */
.matrix > tbody > tr[data-matrix-dropdown] {
    background-color: color-mix(in srgb, var(--featured-soft) 30%, var(--surface));
}


/* Glow intensity lives on the tbody, not on the featured row: the dropdown row
   is its SIBLING and has to read the same three states, and a sibling cannot
   inherit from a row. Three tiers, quietest first -- collapsed, open, and
   hovered/held on either control -- and source order is what makes the last
   one win when a reader hovers an already-open row. */
.matrix > tbody {
    --kc-edge: color-mix(in srgb, var(--featured) 50%, transparent);
    --kc-edge-soft: color-mix(in srgb, var(--featured) 18%, transparent);
    --kc-glow: color-mix(in srgb, var(--featured) 20%, transparent);
}

.matrix > tbody:has(.matrix-dropdown-toggle[aria-expanded="true"]) {
    --kc-edge: color-mix(in srgb, var(--featured) 72%, transparent);
    --kc-edge-soft: color-mix(in srgb, var(--featured) 28%, transparent);
    --kc-glow: color-mix(in srgb, var(--featured) 34%, transparent);
}

.matrix > tbody:has(.matrix-dropdown-toggle:hover),
.matrix > tbody:has(.matrix-dropdown-toggle:focus-visible),
.matrix > tbody:has(.matrix-dropdown-toggle-icon:hover),
.matrix > tbody:has(.matrix-dropdown-toggle-icon:focus-visible) {
    --kc-edge: color-mix(in srgb, var(--featured) 100%, transparent);
    --kc-edge-soft: color-mix(in srgb, var(--featured) 42%, transparent);
    --kc-glow: color-mix(in srgb, var(--featured) 52%, transparent);
}

.matrix-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    /* Padding and the matching pull-back are constant, so the hover fill has
       somewhere to land without the label moving when it appears. */
    padding: 0.35rem 0.6rem;
    margin-left: -0.6rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

/* The row is the only expandable one in the table, so hovering its title has
   to advertise that: a gold pill, the same ring the info button uses, and a
   caret that leans toward the direction it will travel.
   The verdict checkmark opens the same thing, so hovering EITHER lights BOTH --
   that pairing is the only thing on screen that says they are one control. */
.matrix-dropdown-toggle:hover {
    background: color-mix(in srgb, var(--featured-soft) 45%, transparent);
    box-shadow: 0 0 0 1px var(--featured);
    color: var(--text-strong);
}

/* The pairing is its OWN rule, never a second branch on the one above: an
   unsupported `:has()` invalidates the whole selector list, so combining them
   would take the plain hover down with it on any browser that cannot do the
   pairing. Every :has() rule in this file is split for that reason. */
.matrix > tbody > tr[data-matrix-dropdown]:has(.matrix-dropdown-toggle-icon:hover) .matrix-dropdown-toggle {
    background: color-mix(in srgb, var(--featured-soft) 45%, transparent);
    box-shadow: 0 0 0 1px var(--featured);
    color: var(--text-strong);
}

.matrix-dropdown-toggle:focus-visible {
    /* --accent-text, not --accent-2: see the note in threat-catalog.css. */
    outline: 2px solid var(--accent-text);
    outline-offset: 3px;
    /* The toggle is a 999px pill (see the base rule above); this used to be
       a plain inline button before that, and the leftover 0.25rem radius
       made its focus outline snap to near-square corners on tab-focus. */
    border-radius: 999px;
}

.matrix-dropdown-caret {
    display: inline-block;
    color: var(--featured-text);
    transition: transform 0.15s ease;
}

.matrix-dropdown-toggle:hover .matrix-dropdown-caret {
    transform: translateX(3px);
}

.matrix > tbody > tr[data-matrix-dropdown]:has(.matrix-dropdown-toggle-icon:hover) .matrix-dropdown-caret {
    transform: translateX(3px);
}

.matrix-dropdown-toggle[aria-expanded="true"] .matrix-dropdown-caret {
    transform: rotate(90deg);
}

.matrix-dropdown-toggle[aria-expanded="true"]:hover .matrix-dropdown-caret {
    transform: rotate(90deg) translateX(3px);
}

.matrix > tbody > tr[data-matrix-dropdown]:has(.matrix-dropdown-toggle-icon:hover) .matrix-dropdown-toggle[aria-expanded="true"] .matrix-dropdown-caret {
    transform: rotate(90deg) translateX(3px);
}

/* The verdict glyph as the row's second toggle. Same gold pill and ring as the
   title so the two read as one control, but round and centred: the cell is
   centre-aligned and the glyph is square, so a pill shape would look pinned to
   nothing. */
.matrix-dropdown-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

/* The other half of the pairing: the title lights the checkmark too. */
.matrix-dropdown-toggle-icon:hover {
    background: color-mix(in srgb, var(--featured-soft) 45%, transparent);
    box-shadow: 0 0 0 1px var(--featured);
}

.matrix > tbody > tr[data-matrix-dropdown]:has(.matrix-dropdown-toggle:hover) .matrix-dropdown-toggle-icon {
    background: color-mix(in srgb, var(--featured-soft) 45%, transparent);
    box-shadow: 0 0 0 1px var(--featured);
}

.matrix-dropdown-toggle-icon:focus-visible {
    /* --accent-text, not --accent-2: see the note in threat-catalog.css. */
    outline: 2px solid var(--accent-text);
    outline-offset: 3px;
}

/* The glyph is `display: block; margin: 0 auto` for a bare cell; inside the
   button it is the only child of a flex box, so the auto margins would fight
   the padding. */
.matrix-dropdown-toggle-icon > .matrix-icon {
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .matrix-dropdown-caret {
        transition: none;
    }
}

/* The modal's two entrance animations are cancelled AFTER they are declared —
 * see the reduced-motion block below `#threat-modal .modal-content`. They used
 * to sit in this block, which is earlier in the file than
 * `#threat-modal.active { animation: modalFadeIn }` and
 * `#threat-modal .modal-content { animation: modalSlideDown }`. Same
 * specificity, so source order decided, and the later rules won: Reduce Motion
 * never reached the modal at all. A media query adds no specificity — only
 * position can settle a tie. */

/* The merged Token+Cookie+Passkey cell. Left-aligned prose, not a glyph. */
.threat-kc-range {
    text-align: left;
    color: var(--text-muted);
    font-style: italic;
}

/* The dropdown row is a container, not a threat row: no zebra, no hover
   scale, no pointer, no cell borders. */
.matrix > tbody > tr.matrix-dropdown-row {
    background-color: transparent;
    cursor: default;
}

.matrix > tbody > tr.matrix-dropdown-row > td {
    /* The featured row's own wash, continued: the opened index is the body of
       that row, so the gold runs behind it rather than stopping at the table's
       last border. Mixed INTO --surface for the same reason the row is --
       .matrix paints itself --accent, and the nested table's caption renders
       outside that table's own background, so muted caption text would
       otherwise sit on the dark header colour. */
    background-color: color-mix(in srgb, var(--featured-soft) 30%, var(--surface));
    padding: 0.5rem 0.75rem;
    border: 0;
    text-align: left;
}

.matrix > tbody > tr.matrix-dropdown-row > td::before {
    content: none;
}

.matrix-dropdown-cell .matrix-wrapper {
    margin: 0;
}

/* The indexed-threat matrix: one self-contained block per category, flowing
   into responsive columns.

   It was a single `.matrix-compare` table until 2026-08-25, one row per
   category. Two things were wrong with that once each category grew its own
   sub-matrix: every row was as wide as the widest, so a 300px pill sat in a
   700px cell; and the row's own Others/PA cells stated an aggregate that
   contradicted the per-threat verdicts printed directly beneath them. Both are
   gone, and with them every `.matrix-compare` rule that used to live here.

   `columns` rather than grid or flex: a short category has to be able to sit
   UNDER another short one beside a tall one, and only column flow packs that
   way without fixed row heights. */
.threat-matrix-grid {
    columns: 26rem;
    column-gap: 1rem;
}

/* The unindexed-threats line, under the whole index rather than over it: it is
   the one claim on this surface that the table below it cannot show, so it
   reads as a footnote and not as a heading. `column-span: all` puts it across
   the foot of both columns instead of at the bottom of whichever one it
   happened to flow into. */
.threat-matrix-footnote {
    color: var(--text-muted);
    font-size: 0.85rem;
    column-span: all;
    text-wrap: pretty;
    width: 100%;
    text-align: center;
    padding: 2.3rem;
    font-weight: bolder;
}

/* `break-inside: avoid` is the whole mechanism. Without it a category's rows
   split across a column boundary and its header row is orphaned from the
   threats it names. */
/* Each block is a card ON the featured wash, so it wears the featured row's
   chrome rather than the page's: an opaque surface fill to keep the sub-matrix
   readable, a gold edge, and a soft lift off the wash.

   NO LIT BOTTOM EDGE, and that is the point of this note. The corner-lit halo
   belongs to the knowledge-capital ROW and to the area as a whole, where it
   underlines one surface once (responsive.css draws it from the same
   --kc-edge / --kc-glow tiers). Repeated per category it stopped reading as a
   light source and started reading as chrome each block had grown: five of
   them stacked down a column, every one with its own glowing foot, and the
   effect the row spends on being singular was being handed out five times
   over. The row keeps it. The cards inside the row are plain.

   The cost, stated because it was a real property and it is now gone: the
   blocks no longer brighten with the row on hover, since --kc-glow was the
   only tier value they consumed. Their border reads --featured directly and
   does not follow the tiers. */
.threat-block {
    break-inside: avoid;
    margin: 0 0 1rem;
    padding: 0.85rem;
    background-color: var(--surface);
    border: 1px solid color-mix(in srgb, var(--featured) 38%, transparent);
    border-radius: 12px;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--featured) 14%, transparent);
}

.threat-group-label {
    display: block;
    margin: 0 0 0.55rem;
    color: var(--text);
    font-weight: 600;
    font-size: clamp(0.85rem, 1.6vw, 1rem);
}

.threat-group-count {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Each category's own Threat / Others / Passkey Accounts™ matrix. It used to be
   nested inside `.matrix-compare` and inherited that table's cell rules; it is
   a top-level table in its own block now, so it carries its own chrome. */
.threat-submatrix {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    table-layout: auto;
}

.threat-submatrix thead th {
    padding: 0.3rem 0.5rem;
    /* Featured, not accent: every surface inside the opened index belongs to
       the knowledge-capital row. */
    background-color: color-mix(in srgb, var(--featured-soft) 45%, transparent);
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-align: center;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.threat-submatrix thead th:first-child {
    text-align: left;
}

.threat-submatrix tbody th {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    color: var(--text);
    text-align: left;
    vertical-align: middle;
    font-weight: 500;
}

.threat-submatrix td {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
}

.threat-submatrix tbody tr.is-alt {
    background-color: var(--surface-2);
}

/* The two glyph columns take as little as they can and the name column takes
   the rest, so the pill wraps inside the block instead of widening it. */
.threat-submatrix .threat-verdict-cell {
    width: 1%;
    min-width: 48px;
}

/* The chips used to sit in a table cell as wide as the widest category row, so
   `white-space: nowrap` on .threat-pill cost nothing. They sit in a column of a
   fixed-width grid now, and nowrap makes the table wider than the block holding
   it -- the Passkey Accounts™ column rendered OUTSIDE its own border. The
   640px escape hatch that used to unset it is the rule at every width here. */
.threat-submatrix .threat-pill {
    margin: 0.12rem 0;
    max-width: 100%;
    white-space: normal;
}

.threat-submatrix .threat-pill-title small {
    white-space: normal;
}

/* Without this the cell refuses to shrink past its content's intrinsic width,
   which is the other half of the same overflow. */
.threat-submatrix .threat-submatrix-name {
    min-width: 0;
}

/* Smaller than the hero's 24-32px: 45 of these render at once. */
.threat-submatrix .matrix-icon {
    width: clamp(14px, 2.2vw, 18px);
    height: clamp(14px, 2.2vw, 18px);
}

/* The demo panel's own name. Visually hidden, because the panel is introduced
   by the essay around it and a visible heading would repeat what the reader can
   already see -- but a region with `aria-labelledby` needs something to point
   at, and this id had nothing behind it at all. */
.embedded-threat-demo-title,
/* Screen-reader text for the glyph-only verdict cells; same vocabulary as the
   legend. */
.threat-verdict-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.embedded-threat-demo-title { 
    display: none;
}

@media (max-width: 640px) {
    .threat-block {
        padding: 0.6rem;
    }

    .threat-submatrix thead th,
    .threat-submatrix tbody th,
    .threat-submatrix td {
        padding: 0.28rem 0.4rem;
    }

    .threat-submatrix .threat-verdict-cell {
        min-width: 36px;
    }

    /* Uppercase and letter-spacing cost width, and at one column per screen
       every pixel they take comes out of the threat name beside them --
       "Same-Origin Script Data Exfiltration" was wrapping to four lines to pay
       for "PASSKEY ACCOUNTS™". Same words, narrower setting. */
    .threat-submatrix thead th {
        text-transform: none;
        letter-spacing: 0;
        font-size: 0.64rem;
    }
}

.info-btn {
    background: none;
    border: none;
    /* Circular, so the hover fill reads as a disc behind the glyph rather than
       a rectangle. */
    border-radius: 999px;
    padding: clamp(0.375rem, 1vw, 0.5rem);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: clamp(0.5rem, 1vw, 1rem);
    min-width: 40px;
    min-height: 40px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.info-btn:hover {
    background: color-mix(in srgb, var(--accent-soft) 65%, transparent);
    box-shadow: 0 0 0 1px var(--accent);
}

.info-icon {
    width: 18px;
    height: 18px;
    color: var(--accent-text);
    transition: transform 0.2s ease;
}

.info-btn:focus-visible {
    /* --accent-text, not --accent-2: see the note in threat-catalog.css. */
    outline: 2px solid var(--accent-text);
    outline-offset: 2px;
    border-radius: 999px;
}

/* Knowledge-capital's info button wears the same gold as its modal, its pill
   and its demo panel, so the row that owns the index reads as the featured one.
   Gold stays in the ring and the glyph; no text sits on it. */
/* Fill and glyph only, no ring: the gold disc is enough to mark the row, and a
   ring read as a second border against the cell edge. */
.info-btn.is-featured {
    background: color-mix(in srgb, var(--featured-soft) 55%, transparent);
}

.info-btn.is-featured .info-icon {
    color: var(--featured-text);
}

.info-btn.is-featured:hover {
    background: color-mix(in srgb, var(--featured) 30%, var(--surface));
    box-shadow: 0 0 0 1px var(--featured),
                0 0 12px var(--featured-glow);
}

.info-btn:hover .info-icon {
    transform: scale(1.1);
}

.matrix-legend {
    display: flex;
    justify-content: center;
    gap: clamp(1rem, 3vw, 3rem);
    margin: clamp(1.5rem, 5vw, 3rem) 0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1vw, 1rem);
    font-weight: 500;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
}

.legend-icon {
    width: 24px;
    height: 24px;
}

.legend-item.color-secure {
    color: var(--success-text);
}

.legend-item.color-warning {
    color: var(--warning-text);
}

.legend-item.color-vulnerable {
    color: var(--danger-text);
}

/* Threat Modal Overlay */
#threat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* the visible viewport: 100vh ran under a phone's toolbar */
    z-index: 1000;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    overflow-y: auto;
    padding: 3rem 1rem;
}

#threat-modal.active {
    display: block;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#threat-modal .modal-content {
    /* Declared once, consumed by both children: the header's own padding and the
       scrollport's. The card itself carries none, so the header can span it edge
       to edge without negative margins. responsive.css overrides this variable
       rather than any padding, so the two can never drift apart. */
    --threat-modal-pad: 2.5rem;
    --threat-modal-radius: 12px;
    background: var(--surface);
    max-width: 900px;
    margin: 0 auto;
    border-radius: var(--threat-modal-radius);
    border: 3px solid var(--accent);
    box-shadow: 0 20px 60px color-mix(in srgb, var(--accent) 25%, transparent);
    animation: modalSlideDown 0.4s ease;
    position: relative;
    max-height: calc(100vh - 6rem);
    max-height: calc(100dvh - 6rem);
    /* The card itself no longer scrolls. It is a flex column whose second child
       (#modal-body) owns the scrollport, which is what keeps the header truly
       fixed: a sticky header inside the scrollport still travels with the
       content until it reaches the top, which read as "follows scroll". Out of
       the scrollport entirely, it cannot move at all. */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* The modal's entrance. Purely decorative — the dialog is equally usable
 * appearing at once, and this is the largest movement on the page.
 * The demo's skip spinner is deliberately NOT covered: it reports progress
 * rather than decorating, and a frozen spinner misstates that.
 *
 * MUST stay below both `#threat-modal.active` (modalFadeIn) and
 * `#threat-modal .modal-content` (modalSlideDown): the selectors tie on
 * specificity and a media query breaks no ties, so only source order does. */
@media (prefers-reduced-motion: reduce) {
    #threat-modal.active,
    #threat-modal .modal-content {
        animation: none;
    }
}

/* The scrollport. Padding lives here rather than on .modal-content so the
   scrollbar tracks beside the content instead of outside the padding. */
#threat-modal .modal-content > #modal-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* That `hidden` CUT words wider than the column at large text (Android text
       scaling: 302 clipped runs at 200%, 4 at 150%). Breaks only such a word;
       at default text none exists (0 on all 48 modals at 320 and 375). */
    overflow-wrap: break-word;
    /* The header already supplies the space above the first paragraph, so the
       scrollport's own top padding is small: together they read as one gap. */
    padding: var(--spacing-sm) var(--threat-modal-pad) var(--threat-modal-pad);
}

/* On the SCROLLPORT, not on .modal-content. The content box became a
   non-scrolling flex column when the header moved out of it (`overflow: hidden`,
   see the rule above), so these four styled an element with no scrollbar and the
   modal wore the browser default. `scrollbar-color` carries the same two colours
   to Firefox, which implements none of the -webkit- pseudo-elements. */
#threat-modal .modal-content > #modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--surface-3);
}

#threat-modal .modal-content > #modal-body::-webkit-scrollbar {
    width: 10px;
}

#threat-modal .modal-content > #modal-body::-webkit-scrollbar-track {
    background: var(--surface-3);
    border-radius: 5px;
}

#threat-modal .modal-content > #modal-body::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 5px;
}

#threat-modal .modal-content > #modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-2);
}

/* The essays' own headings are bare tags (lib/threat-catalog-data.js); the
   generated cards' section headings and the simulation's titles are classed and
   styled below, so these match only the essays. */
#modal-body h3:not([class]) {
    font-size: 1.5rem;
    /* The content's own <h3> is a full sentence and wraps at this size; the
       default 1.6 body leading left it looking like two separate lines. */
    line-height: 1.3;
    letter-spacing: -0.015em;
    margin-bottom: var(--spacing-md);
    color: var(--accent-text);
    max-width: 42ch;
    /* Evens out the line lengths on the two- and three-line titles rather than
       leaving one word stranded. Ignored where unsupported. */
    text-wrap: balance;
}

/* Fixed above the scrollport, not pinned inside it. These modals run long
   enough that both the nav arrows and the close button used to scroll out of
   reach; a sticky header solved that but still slid until it hit the top.
   As a flex sibling of the scrolling #modal-body it never moves at all.

   It is a direct child of the (now unpadded) card, so it carries the full
   horizontal padding itself rather than bleeding out with negative margins. */
.threat-modal-header {
    flex: 0 0 auto;
    /* Fills the card edge to edge. Without this the grid shrink-wraps its own
       columns and the bar reads as a floating panel with the card showing
       through beside it. */
    width: 100%;
    box-sizing: border-box;
    z-index: 2;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: calc(var(--threat-modal-pad, 2.5rem) * 0.62) var(--threat-modal-pad, 2.5rem);
    background: var(--surface);
    /* Matches .modal-content so the bled background does not square off the
       card's rounded top corners. Inner radius, hence the 3px border subtracted. */
    border-radius: calc(var(--threat-modal-radius, 12px) - 3px) calc(var(--threat-modal-radius, 12px) - 3px) 0 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Only once something has scrolled under it does the bar need to separate
   itself from the content. Driven by a sentinel in main.js. */
#threat-modal.is-scrolled .threat-modal-header {
    border-bottom-color: var(--border);
    box-shadow: 0 6px 16px -12px color-mix(in srgb, var(--text-strong) 55%, transparent);
}

/* A joined pair rather than two loose circles: they are one control with two
   directions, and reading them as a unit makes that obvious. */
.threat-modal-nav-group {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

/* Matrix threats hide the group (main.js). `hidden` alone loses to the
   inline-flex above, so the grid column has to be collapsed explicitly. */
.threat-modal-nav-group[hidden] {
    display: none;
}

/* Scoped to the DIALOG, not to the scrollport. The header is a SIBLING of
   #modal-body -- openThreatModal inserts it with
   `modalContent.insertBefore(header, modalBody)` so it can be sticky without
   travelling with the content -- so the old `#modal-body ...` scope stopped
   matching on that change and the title silently fell back to the UA <h3>
   size (18.72px against the 18.4px meant here) in the body ink. Two sibling
   rules had the same scope and the same problem: responsive.css and
   threat-catalog.css. */
#threat-modal .threat-modal-title {
    /* An <h2> inside <section id="matrix">: beats sections.css's
       `section h2 { display: none }`. */
    display: block;
    margin: 0;
    text-align: left;
    line-height: 1.25;
    /* `flex-start` is not a valid grid alignment keyword; `start` is. */
    justify-self: start;
    font-size: 1.15rem;
    color: var(--text-strong);
    letter-spacing: -0.01em;
}

/* Below ~446px the title's longest word, the 77px prev/next pill and the
   close button do not always fit one row, and the PILL gave way: its
   overflow: hidden (for the rounded ends) lets the grid squeeze it to nothing,
   so Next was cut or gone on 28 of 48 threats at 320 and 11 at 375, and at 320
   the close button left the card. Here the title takes its own row under the
   controls. A rem query, so large text (which needs the room most) gets it
   sooner. Costs ~20px of header on a phone. */
@media (max-width: 28rem) {
    .threat-modal-header {
        grid-template-areas:
            "nav . close"
            "title title title";
        row-gap: 0.35rem;
    }

    .threat-modal-nav-group {
        grid-area: nav;
    }

    #threat-modal .threat-modal-title {
        grid-area: title;
    }

    .threat-modal-header > .modal-close {
        grid-area: close;
    }

    /* No pill (a threat the ring cannot move from): title and close share
       the row, as before. */
    .threat-modal-header:has(> .threat-modal-nav-group[hidden]) {
        grid-template-areas: "nav title close";
        row-gap: 0;
    }
}

/* Large text on a phone. These three buttons are rem-sized, so at 200% each
   was 77px and the row needed 279px of a 209px header at 375: the pill's
   column squeezed it and the Next arrow was cut off on every threat (a 320
   phone at 150% lost a few px the same way). Past 44px a target gains
   nothing, so they stop growing there. An em query, so it follows the
   reader's text size: at default text it matches only below 224px. */
@media (max-width: 14em) {
    /* Scoped to the dialog: the base rules for both come later in this file. */
    #threat-modal .threat-modal-nav-btn {
        width: min(2.4rem, 44px);
        height: min(2.2rem, 44px);
    }

    #threat-modal .threat-modal-close-btn {
        width: min(2.4rem, 44px);
        height: min(2.4rem, 44px);
    }
}

.threat-modal-nav-btn {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--accent-text);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* The seam between the two halves of the pair. */
.threat-modal-nav-btn + .threat-modal-nav-btn {
    border-left: 1px solid var(--border);
}

.threat-modal-nav-btn:hover {
    background: var(--accent);
    color: var(--text-on-accent);
}

.threat-modal-nav-btn:focus-visible {
    /* --accent-text, not --accent-2: see the note in threat-catalog.css. */
    outline: 2px solid var(--accent-text);
    outline-offset: -2px;
}

.threat-modal-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Reads as "close" before hover, rather than relying on the hover colour to
   explain itself. */
/* Pinned to the LAST track. The header is `grid-template-columns: auto 1fr auto`
   with children (navGroup, heading, close) — but main.js hides the nav group for
   any threat the ring cannot move from, and a display:none child takes no grid
   slot. Auto-placement then put the heading in column 1 and the close button in
   the 1fr middle, so it sat beside the title instead of at the far edge. With
   the close pinned, the empty 1fr still absorbs the slack and the title keeps
   its `justify-self: start`. */
.threat-modal-close-btn {
    grid-column: 3;
    appearance: none;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    width: 2.4rem;
    height: 2.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.threat-modal-close-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    /* --text-on-danger, because the fill is --danger: --text-on-accent is
       repaired against --accent and measured 2.77:1 here on vampire (and under
       4.5:1 on nine more themes). Same pairing rule landing-extras.css states
       for its own danger fills. */
    color: var(--text-on-danger);
    transform: translateY(-1px);
}

.threat-modal-close-btn:focus-visible {
    /* --accent-text, not --accent-2: see the note in threat-catalog.css. */
    outline: 2px solid var(--accent-text);
    outline-offset: 2px;
}

#modal-body p {
    color: var(--text);
    margin-bottom: var(--spacing-md);
    line-height: 1.75;
    /* The card is 900px wide; unconstrained prose at that measure is hard to
       track line to line. Caps the line length without narrowing the card. */
    max-width: 68ch;
}

/* The level the threat content actually structures itself with — and, until
   now, the only heading level in #modal-body with no rule at all, so every
   section title rendered as browser-default bold and the modal read as one
   undifferentiated block. The leading bar is what makes a section scannable. */
#modal-body h4:not([class]),
#modal-body .threat-section-heading {
    position: relative;
    margin: var(--spacing-lg) 0 var(--spacing-sm);
    padding-left: 0.85rem;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--accent-text);
    letter-spacing: -0.01em;
}

#modal-body h4:not([class])::before,
#modal-body .threat-section-heading::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    bottom: 0.15em;
    width: 3px;
    border-radius: 999px;
    background: var(--accent);
}

/* First heading after the sticky bar should not add to its padding. */
#modal-body > div > h3:first-child,
#modal-body > div > h4:first-child {
    margin-top: 0;
}

#modal-body ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: var(--spacing-md);
    max-width: 68ch;
}

#modal-body li {
    position: relative;
    padding-left: var(--spacing-lg);
    /* Dense multi-line list items were running together at var(--spacing-sm). */
    margin-bottom: 0.85rem;
    line-height: 1.7;
    color: var(--text);
}

#modal-body li:before {
    content: "•";
    /* Drawn, not read: the list item is already announced as one. The line
       above stays for browsers without the alt-text syntax. */
    content: "•" / "";
    position: absolute;
    left: 0;
    color: var(--accent-text);
    font-weight: bold;
    font-size: 1.5rem;
    /* Optically centred on the first line rather than sitting proud of it. */
    line-height: 1.15;
}

#modal-body strong {
    color: var(--accent-text);
}

#modal-body em {
    color: var(--text-faint);
}

/* A callout, which is plainly what the markup intends — the sole rule for this
   class lived in auth-and-code.css and set only paragraph justification, so it
   rendered as an invisible container. Used exclusively by the threat content
   (lib/threat-catalog-data.js), so it belongs here with the rest of the modal. */
#modal-body .why-this-works {
    margin: var(--spacing-md) 0;
    padding: var(--spacing-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 10px;
}

/* Justified and indented paragraphs are deliberate voice for these blocks; the
   spacing between them is not, and is restored here rather than by an
   !important override of #modal-body p. */
#modal-body .why-this-works p {
    text-align: justify;
    text-indent: 1.5rem;
    margin-bottom: var(--spacing-sm);
    max-width: none;
}

#modal-body .why-this-works > :last-child {
    margin-bottom: 0;
}

#modal-body .why-this-works ul {
    max-width: none;
    margin-bottom: var(--spacing-sm);
}

#modal-body .threat-attention-note {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 0.65rem;
    row-gap: 0.35rem;
    margin: var(--spacing-md) 0;
    padding: 0.8rem 0.9rem;
    border: 1px solid color-mix(in srgb, var(--warning) 62%, var(--border));
    border-left: 4px solid var(--warning);
    border-radius: 8px;
    background: color-mix(in srgb, var(--warning-soft) 62%, var(--surface));
    color: var(--text);
}

#modal-body .threat-attention-note-label {
    align-self: start;
    padding: 0.14rem 0.42rem;
    border: 1px solid color-mix(in srgb, var(--danger) 68%, var(--border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--danger-soft) 80%, var(--surface));
    color: var(--text-strong);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

#modal-body .threat-attention-note-text {
    min-width: 0;
    line-height: 1.55;
}

#modal-body .threat-attention-note-references {
    grid-column: 2;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

/* The segment a deep link asked for, marked so the reader lands on the right
   paragraph rather than merely near it. Featured gold, in the border and the
   tint only, never behind the text. */
#modal-body .is-focus-highlight {
    border-left: 3px solid var(--featured);
    border-radius: 0.35rem;
    background: color-mix(in srgb, var(--featured-soft) 40%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--featured) 40%, transparent);
    padding: 0.6rem 0.8rem;
    margin: 0.35rem 0;
}

/* ==================== FEATURED THREAT (KNOWLEDGE-CAPITAL) ==================== */
/*
 * Knowledge-capital is the one unindexed case in a catalog of indexed ones. It
 * renders no pill at all -- the renderer excludes it, because it is the hero
 * row that owns this table rather than one of the threats inside it. It wears
 * gold on its row info button and as a demo panel
 * (.embedded-threat-demo.is-knowledge-capital); the modal was the only surface
 * that did not carry it. main.js toggles .is-featured-threat on #threat-modal.
 *
 * Same discipline as the row rules in threat-catalog.css: gold lives in
 * borders, glows and marks — never behind body text. --featured is a light
 * amber in both modes, so a solid fill would need dark text on light themes and
 * light text on dark ones. Text stays on --text-strong / --text throughout, so
 * no theme in the registry can turn this illegible.
 */

#threat-modal.is-featured-threat .modal-content {
    border-color: var(--featured);
    box-shadow: 0 0 0 4px var(--featured-glow),
                0 20px 60px color-mix(in srgb, var(--featured) 22%, transparent);
}

/* A hairline of gold along the top of the card, under the sticky bar. */
#threat-modal.is-featured-threat .threat-modal-header {
    background: linear-gradient(
        to bottom,
        color-mix(in srgb, var(--featured-soft) 55%, var(--surface)),
        var(--surface) 85%
    );
}

#threat-modal.is-featured-threat.is-scrolled .threat-modal-header {
    border-bottom-color: var(--featured);
}

.threat-modal-featured-badge {
    color: var(--featured-text);
    margin-right: 0.4rem;
    /* Optically aligned with the cap height of the title beside it. */
    font-size: 0.9em;
    line-height: 1;
}

#threat-modal.is-featured-threat .threat-modal-nav-group {
    border-color: color-mix(in srgb, var(--featured) 55%, var(--border));
}

#threat-modal.is-featured-threat .threat-modal-nav-btn {
    color: var(--text-strong);
}

#threat-modal.is-featured-threat .threat-modal-nav-btn:hover {
    background: color-mix(in srgb, var(--featured) 35%, var(--surface));
    color: var(--text-strong);
}

/* The content's own h3 — the long subtitle under the header bar. */
#threat-modal.is-featured-threat #modal-body h3:not([class]) {
    color: var(--text-strong);
}

#threat-modal.is-featured-threat #modal-body h4:not([class]),
#threat-modal.is-featured-threat #modal-body .threat-section-heading {
    color: var(--text-strong);
}

#threat-modal.is-featured-threat #modal-body h4:not([class])::before,
#threat-modal.is-featured-threat #modal-body .threat-section-heading::before {
    background: var(--featured);
    /* Wider than the accent bar: the gold is lighter, so it needs more of it to
       read at the same weight. */
    width: 4px;
}

#threat-modal.is-featured-threat #modal-body li:before {
    color: var(--featured-text);
}

/* --featured against --surface does not clear a text contrast floor on every
   theme, which is why emphasis here stays on --accent rather than going gold. */
#threat-modal.is-featured-threat #modal-body strong {
    color: var(--accent-text);
}

#threat-modal.is-featured-threat #modal-body .why-this-works {
    background: color-mix(in srgb, var(--featured-soft) 30%, var(--surface-2));
    border-color: color-mix(in srgb, var(--featured) 40%, var(--border));
    border-left-color: var(--featured);
}

.embedded-threat-demo {
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
    border-radius: 0.75rem;
    background: color-mix(in srgb, var(--accent-soft) 30%, var(--surface));
}

.embedded-threat-demo.is-running {
    cursor: progress;
}

.embedded-threat-demo .embedded-threat-demo-title {
    margin: 0 0 0.35rem;
    color: var(--accent-text);
}

.embedded-threat-demo-controls {
    display: flex;
    /* Both buttons fit on one row at default text; at large text Skip drops below. */
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.embedded-threat-demo-controls button {
    border: 0;
    border-radius: 0.4rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-on-accent);
    background: var(--accent);
    cursor: pointer;
    font-weight: 700;
}

.embedded-threat-demo-start {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.embedded-threat-demo-start-spinner {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--text-on-accent) 35%, transparent);
    border-top-color: var(--text-on-accent);
    display: inline-block;
    animation: embedded-threat-demo-spin 0.8s linear infinite;
}

.embedded-threat-demo-start:not(.is-running) .embedded-threat-demo-start-spinner {
    display: none;
}

.embedded-threat-demo-skip-spinner {
    display: none;
}

.embedded-threat-demo-skip.is-skipping .embedded-threat-demo-skip-spinner {
    display: inline-block;
}

.embedded-threat-demo-controls button:disabled {
    opacity: 0.65;
    cursor: progress;
}

/* Subordinate to Start, which wears the accent. Uses the designed surface/text
   pair rather than a fixed slate so it stays legible on every theme. */
.embedded-threat-demo-skip {
    background: var(--surface-3) !important;
    color: var(--text-strong) !important;
    border: 1px solid var(--border-strong) !important;
}

.embedded-threat-demo-skip.is-skipping {
    opacity: 0.82;
}

.embedded-threat-demo-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.embedded-threat-demo-column {
    min-width: 0;
}

/* An <h4> since the modal title became an <h2>; it was an <h5>, and keeps that size. */
.embedded-threat-demo-column-title {
    margin: 0 0 0.35rem;
    font-size: 0.83em;
    color: var(--text-muted);
}

.embedded-threat-demo-log {
    height: 12rem;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.4rem;
    background: var(--surface);
    font-size: 0.8rem;
    line-height: 1.45;
}

.embedded-threat-demo-entry {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    padding-left: 0.55rem;
    color: var(--text-muted);
}

.embedded-threat-demo-entry[data-group-key] {
    cursor: pointer;
}

.embedded-threat-demo.is-running .embedded-threat-demo-entry {
    cursor: progress;
}

.embedded-threat-demo-entry:last-child {
    border-bottom: 0;
}

.embedded-threat-demo-entry strong {
    color: var(--accent-text);
}

.embedded-threat-demo-message {
    color: inherit;
}

.embedded-threat-demo-entry.is-grouped {
    background: transparent;
    margin: 0;
}

.embedded-threat-demo-group {
    margin: 0.2rem 0;
    padding: 0.08rem 0.25rem;
    background: var(--group-fill, color-mix(in srgb, var(--accent) 6%, transparent));
    border: 1px solid var(--group-border, color-mix(in srgb, var(--accent) 18%, transparent));
    border-radius: 0.5rem;
}

.embedded-threat-demo-group .embedded-threat-demo-entry:last-child {
    border-bottom: 0;
}

.embedded-threat-demo-entry.is-group-start {
    border-top: 0;
}

.embedded-threat-demo-entry.is-selected {
    background: color-mix(in srgb, var(--warning-soft) 72%, var(--surface));
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--warning) 48%, transparent),
        0 0 0 1px color-mix(in srgb, var(--warning) 28%, transparent);
    transform: translateX(2px);
}

.embedded-threat-demo-group.is-selected {
    background: color-mix(in srgb, var(--warning-soft) 46%, var(--group-fill, var(--surface)));
    border-color: color-mix(in srgb, var(--warning) 62%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 25%, transparent);
}

.embedded-threat-demo-entry.log-hacker {
    border-left-color: var(--warning);
    /* The -text token, not raw --warning: the raw token is a fill colour and
       carries no text contrast (this rule used to hand-roll its own repair
       with a color-mix toward the body text — the derived token is the
       systematic version of the same idea, audited per theme). */
    color: var(--warning-text);
}

.embedded-threat-demo-entry.log-system {
    border-left-color: var(--accent);
    color: var(--text-muted);
}

/* matrix-data.json uses type:"warning" on 235 steps — the [Site]/[Browser]
   caution beats. This rule was simply missing, so those rows rendered with the
   base colours and a TRANSPARENT stripe. Shares the warning ink with
   .log-hacker: the actor labels and the stripe differentiate the rows, and a
   sixth hue family would say less than it costs. */
.embedded-threat-demo-entry.log-warning {
    border-left-color: var(--warning);
    color: var(--warning-text);
}

.embedded-threat-demo-entry.log-success {
    border-left-color: var(--success);
    color: var(--success-text);
}

.embedded-threat-demo-entry.log-error {
    border-left-color: var(--danger);
    color: var(--danger-text);
}

.embedded-threat-demo-entry.log-hacker strong,
.embedded-threat-demo-entry.log-system strong,
.embedded-threat-demo-entry.log-success strong,
.embedded-threat-demo-entry.log-error strong,
.embedded-threat-demo-entry.log-warning strong {
    color: currentColor;
}

/* Knowledge-capital timeline: clickable threat rows */
.embedded-threat-demo-entry .kc-threat-link {
    color: inherit;
    font-weight: 600;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}

.embedded-threat-demo-entry .kc-threat-link::after {
    content: ' \2197';
    font-size: 0.8em;
    opacity: 0.5;
}

.embedded-threat-demo-entry .kc-threat-link:hover,
.embedded-threat-demo-entry .kc-threat-link:focus-visible {
    color: var(--accent-text);
    text-decoration-style: solid;
}

.embedded-threat-demo-entry .kc-threat-link:focus-visible {
    /* --accent-text, not --accent-2: see the note in threat-catalog.css. */
    outline: 2px solid var(--accent-text);
    outline-offset: 1px;
    border-radius: 2px;
}

/* Priority badges reuse the catalog classes, shrunk to log scale.
   These rows are .log-error — red text on a warm group tint — and the tier fills
   are themselves yellow through red, so a pill can sit on a row nearly its own
   colour. The fix is separation, not a different fill: an outer 1px ring in the
   log's own text colour gives every tier a hard edge against any row behind it,
   while the fill keeps carrying the spectrum. Works in both modes because --text
   is dark on light themes and light on dark ones. */
.embedded-threat-demo-entry .threat-priority {
    font-size: 0.62rem;
    padding: 0.05rem 0.3rem;
    margin-left: 0.3rem;
    vertical-align: 1px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 32%, transparent),
                0 0 0 1px color-mix(in srgb, var(--text) 45%, transparent);
}

/* ~150 timeline rows need more than the default log height */
.embedded-threat-demo.is-knowledge-capital .embedded-threat-demo-log {
    height: 20rem;
}

/* The knowledge-capital simulation is the featured demo, so it wears the gold
   treatment instead of the shared accent border. Static glow — no keyframes,
   so nothing here needs a prefers-reduced-motion escape hatch. */
.embedded-threat-demo.is-knowledge-capital {
    border: 2px solid var(--featured);
    background: linear-gradient(160deg,
        color-mix(in srgb, var(--featured-soft) 42%, var(--surface)) 0%,
        var(--surface) 62%);
    box-shadow: 0 0 34px var(--featured-glow),
                inset 0 0 0 1px color-mix(in srgb, var(--featured) 22%, transparent);
}

.embedded-threat-demo.is-knowledge-capital .embedded-threat-demo-title {
    color: var(--featured-text);
}

/* Final unindexed-threats line */
.embedded-threat-demo-entry.is-twinkle {
    animation: embedded-threat-demo-twinkle 2.2s ease-in-out 3;
}

@keyframes embedded-threat-demo-twinkle {
    0%,
    100% {
        text-shadow: none;
    }

    50% {
        text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 55%, transparent);
    }
}

@media (prefers-reduced-motion: reduce) {
    .embedded-threat-demo-entry.is-twinkle {
        animation: none;
    }
}

@keyframes embedded-threat-demo-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .embedded-threat-demo-columns {
        grid-template-columns: 1fr;
    }
}


/* Glyph wrapper. `.matrix-icon` is `display: block; margin: 0 auto` (see the
   base rule above), which is what centres it in every matrix cell; inside this
   wrapper the block behaviour is neutralised so the glyph can share a line.

   It used to hold a second child, the reVerify asterisk beside a CATEGORY
   verdict glyph. There are no category verdicts any more, so the mark is back
   to living only on the chip, where it is inline inside an inline-flex pill and
   cannot wrap onto its own line the way the block glyph made it. */
.threat-submatrix .threat-verdict-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
}

.threat-submatrix .threat-verdict-mark .matrix-icon {
    margin: 0;
}

/* The modal half of the same mark. Structurally the attention note, in accent
   rather than warning, because this one is an answer and not a debt. */
#modal-body .threat-reverify-note {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 0.65rem;
    row-gap: 0.35rem;
    margin: var(--spacing-md) 0;
    padding: 0.8rem 0.9rem;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
    color: var(--text);
}

#modal-body .threat-reverify-note-label {
    align-self: start;
    padding: 0.14rem 0.42rem;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-soft) 80%, var(--surface));
    color: var(--text-strong);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

#modal-body .threat-reverify-note-text {
    min-width: 0;
    line-height: 1.55;
}

/* On a phone the nowrap label took the row: "* host triggers a reVerify" is
   ~190px, which left the text column ~21px, and its words spilled 69px past the
   modal (4 threats, both engines). Label above, text below. The attention note
   is the same grid and gets the same stack. */
@media (max-width: 480px) {
    #modal-body .threat-reverify-note,
    #modal-body .threat-attention-note {
        grid-template-columns: minmax(0, 1fr);
    }

    #modal-body .threat-reverify-note-label,
    #modal-body .threat-attention-note-label {
        justify-self: start;
    }

    /* Pinned to column 2 for the two-column layout; with one column that would
       open an implicit second one -- the overflow this block removes. */
    #modal-body .threat-attention-note-references {
        grid-column: 1;
    }
}

/* Large text on a phone (an em query scales with the reader's text size, so it
   matches only below 256px at default): the nowrap pill alone outgrew the
   stacked column and was cut by the body's overflow-x. */
@media (max-width: 16em) {
    #modal-body .threat-reverify-note-label,
    #modal-body .threat-attention-note-label {
        white-space: normal;
    }
}

/* Inline code in the threat prose breaks anywhere: "trusted.com.evil.example"
   is one 225px token and pushed the modal 19px sideways at 320. Blocks (pre)
   keep their own scroll. */
#modal-body :not(pre) > code {
    overflow-wrap: anywhere;
}

/* The "DB leak" link sits inside a sentence ("from a DB leak to what AI knows
   zero about.."). With only its accent colour to mark it, it measured 1.17:1
   against the words around it, and WCAG 1.4.1 wants a link in a text block to
   be told apart by more than colour. An underline, on this one cell only: the
   threat names and the verdict glyphs are not links in prose. */
.matrix td.threat-kc-range a {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/* An open threat prints as a document. On screen the modal is position:fixed
   with its own scrollport, and print repeats a fixed box on every page: the
   same first screenful came out on all four pages of the phishing essay and the
   rest never printed. In print it flows at full length, everything off its
   path up to <body> is hidden, and the on-screen controls and the interactive
   demo (two empty logs on paper) go. */
@media print {
    /* Two rules, not one list: a browser without :has() drops a whole selector
       list, and the controls below must go either way. */
    body:has(#threat-modal.active) > :not(.landing-scale-wrapper),
    body:has(#threat-modal.active) .landing-scale-wrapper > :not(main),
    body:has(#threat-modal.active) main > :not(#matrix),
    body:has(#threat-modal.active) #matrix > :not(#threat-modal) {
        display: none !important;
    }

    #threat-modal.active .threat-modal-nav-group,
    #threat-modal.active .modal-close,
    #threat-modal.active .embedded-threat-demo {
        display: none !important;
    }

    #threat-modal.active {
        position: static;
        height: auto;
        overflow: visible;
        padding: 0;
        background: none;
        animation: none;
    }

    #threat-modal.active .modal-content {
        max-height: none;
        overflow: visible;
        box-shadow: none;
        animation: none;
    }

    #threat-modal.active .modal-content > #modal-body {
        overflow: visible;
    }

    /* The matrix section's own frame around it spilled a page of border. */
    body:has(#threat-modal.active) .landing-scale-wrapper,
    body:has(#threat-modal.active) main,
    body:has(#threat-modal.active) #matrix {
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: none !important;
    }
}
