/**
 * Knowledge Hub: threat library (countries, ransomware groups, malware, techniques,
 * vulnerabilities, incidents) and the shelf grid shared with the hub landing page.
 * Uses the --hp-* variables only. Breakpoints: 1100px (tablet), 720px (phone).
 */

/* ------------------------------------------------------------ facts card */

.hp-kb-libcard .hp-kb-idcard__mark {
    padding: 24px;
}

.hp-kb-libcard .hp-kb-idcard__code {
    max-width: calc(100% - 32px);
    text-align: right;
}

/* Status colours next to the existing "active" one */
.hp-kb-status.is-inactive {
    color: var(--hp-on-dark-soft);
}

.hp-kb-status.is-disrupted {
    color: var(--hp-amber);
}

.hp-kb-status.is-rebranded {
    color: #8fb0ff;
}

/* ------------------------------------------------------------ page layout */

/* Pages with a single block: definition on the left, a small card on the right,
   so nothing sits in an empty 220px column or leaves the right half blank. */
.hp-kb-body__grid--libsolo {
    grid-template-columns: minmax(0, 760px) minmax(0, 1fr);
    gap: 56px;
}

.hp-kb-libaside {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 380px;
    padding: 28px;
    border-radius: var(--hp-radius-md);
    background: var(--hp-white);
}

.hp-kb-libaside__title {
    font-family: var(--hp-font-display);
    font-size: var(--bd-card-dense-size);
    font-weight: var(--bd-heading-weight);
    color: var(--hp-ink);
    line-height: var(--bd-card-lh);
}

.hp-kb-libaside__list {
    margin: 0;
}

.hp-kb-libaside__list > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--hp-line);
}

.hp-kb-libaside__list dt {
    font-family: var(--bd-font-mono);
    font-size: var(--bd-eyebrow-size);
    letter-spacing: var(--bd-eyebrow-track);
    text-transform: uppercase;
    color: var(--hp-ink-soft);
    font-weight: var(--bd-eyebrow-weight);
}

.hp-kb-libaside__list dd {
    margin: 0;
    font-size: var(--bd-body-size);
    font-weight: 600;
    color: var(--hp-ink);
    text-align: right;
}

.hp-kb-libaside__text {
    font-size: var(--bd-small-size);
    line-height: 1.6;
    color: var(--hp-ink-muted);
}

.hp-kb-libaside__link {
    font-size: var(--bd-body-size);
    font-weight: 600;
    color: var(--hp-ink);
}

.hp-kb-libaside__link:hover {
    color: var(--hp-coral);
}

.hp-kb-libaside__link:focus-visible {
    outline: 2px solid var(--hp-coral);
    outline-offset: 3px;
}

/* A date column that fits "February 2016" */
.hp-kb-timeline--dates .hp-kb-timeline__item {
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 36px;
}

.hp-kb-timeline--dates .hp-kb-timeline__item::before {
    left: 161px;
}

.hp-kb-timeline--dates .hp-kb-timeline__item:not(:last-child)::after {
    left: 166px;
}

.hp-kb-timeline--dates .hp-kb-timeline__year {
    font-size: var(--bd-body-size);
}

.hp-kb-timeline--dates .hp-kb-timeline__body p {
    color: var(--hp-ink);
}

/* ---------------------------------------------------- linked entries */

.hp-kb-liblinks__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hp-kb-liblinks__item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    padding: 22px;
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-radius-md);
    background: var(--hp-white);
    color: var(--hp-ink);
    text-decoration: none;
    transition: border-color .2s ease, transform .2s ease;
}

.hp-kb-liblinks__item:hover {
    border-color: var(--hp-coral);
    transform: translateY(-2px);
}

.hp-kb-liblinks__item:focus-visible {
    outline: 2px solid var(--hp-coral);
    outline-offset: 3px;
}

.hp-kb-liblinks__kind {
    font-family: var(--bd-font-mono);
    font-size: var(--bd-eyebrow-size);
    letter-spacing: var(--bd-eyebrow-track);
    text-transform: uppercase;
    color: var(--hp-coral);
    font-weight: var(--bd-eyebrow-weight);
}

.hp-kb-liblinks__name {
    font-family: var(--hp-font-display);
    font-size: var(--bd-card-dense-size);
    font-weight: var(--bd-heading-weight);
    line-height: var(--bd-card-lh);
}

.hp-kb-liblinks__text {
    font-size: var(--bd-small-size);
    line-height: 1.6;
    color: var(--hp-ink-muted);
}

.hp-kb-liblinks__facts {
    margin-top: auto;
    padding-top: 4px;
    font-size: var(--bd-small-size);
    font-weight: 600;
    color: var(--hp-ink-soft);
}

.hp-kb-liblinks .hp-kb-note {
    margin-top: 16px;
}

.hp-kb-threats + .hp-kb-liblinks[id$="-more"] {
    margin-top: -40px;
}

.hp-kb-threats + .hp-kb-liblinks[id$="-more"] .hp-kb-block__title {
    font-size: var(--bd-h3-size);
    line-height: var(--bd-h3-lh);
    letter-spacing: var(--bd-h3-track);
    font-weight: var(--bd-heading-weight);
}

/* ------------------------------------------------ card groups without empty cells */

/* Defence / detection cards, tool cards and alias cards. A row of cells that wraps on its own:
   each card asks for a third (aliases, defences) or a half (tools) of the row, never less than a
   readable width, and grows to fill what is left. So 3 cards sit in one row of 3, 5 cards make
   3 + 2, 7 make 3 + 3 + 1, and the last row always stretches instead of leaving a gap.
   Four defence cards sit as 2 + 2 instead of 3 + 1. At phone width they stack or pair up. */
.hp-kb-defenses,
.hp-kb-tools,
.hp-kb-aliases {
    --kb-cell-gap: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--kb-cell-gap);
}

.hp-kb-tools {
    --kb-cell-gap: 16px;
}

.hp-kb-defenses > .hp-kb-defense {
    flex: 1 1 max(240px, calc((100% - 2 * var(--kb-cell-gap)) / 3));
    min-width: 0;
}

.hp-kb-defenses > .hp-kb-defense:first-child:nth-last-child(4),
.hp-kb-defenses > .hp-kb-defense:first-child:nth-last-child(4) ~ .hp-kb-defense {
    flex-basis: max(240px, calc((100% - var(--kb-cell-gap)) / 2));
}

.hp-kb-tools > .hp-kb-tool {
    flex: 1 1 max(280px, calc((100% - var(--kb-cell-gap)) / 2));
    min-width: 0;
}

.hp-kb-aliases > .hp-kb-alias {
    flex: 1 1 max(150px, calc((100% - 2 * var(--kb-cell-gap)) / 3));
    min-width: 0;
}

/* ------------------------------------------------------------ key figures */

.hp-kb-figures__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hp-kb-figures__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 22px;
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-radius-md);
    background: var(--hp-white);
}

.hp-kb-figures__value {
    font-family: var(--bd-font-mono);
    font-size: var(--bd-stat-size);
    font-weight: var(--bd-stat-weight);
    line-height: 1.1;
    color: var(--hp-ink);
    letter-spacing: var(--bd-stat-track);
}

.hp-kb-figures__label {
    font-size: var(--bd-body-size);
    color: var(--hp-ink-muted);
}

.hp-kb-figures__meta,
.hp-kb-figures__source {
    font-size: var(--bd-small-size);
    color: var(--hp-ink-soft);
}

/* ------------------------------------------------------------ directory */

.hp-kb-libsearch {
    width: 100%;
    max-width: 480px;
}

.hp-kb-libcardlink__aka {
    margin-top: -6px;
    font-size: var(--bd-small-size);
    color: var(--hp-on-dark-faint);
}

/* Rows wrap and the cards in the last row stretch, so no row ends with an
   empty cell at any card count. */
.hp-kb-library--directory .hp-kb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.hp-kb-library--directory .hp-kb-grid > * {
    flex: 1 1 340px;
    min-width: 0;
}

.hp-kb-library--directory .hp-kb-grid > [hidden] {
    display: none;
}

.hp-kb-library--directory .hp-kb-hero__grid {
    align-items: center;
}

/* ------------------------------------------------------------ shelf grid */

.hp-kb-shelves {
    padding-block: 8px 72px;
}

.hp-kb-shelves__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 1101px) {
    .hp-kb-shelves__grid > li:last-child:nth-child(4n+3) {
        grid-column: span 2;
    }
}

@media (min-width: 721px) and (max-width: 1100px) {
    .hp-kb-shelves__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hp-kb-shelves__grid > li:last-child:nth-child(odd) {
        grid-column: span 2;
    }
}

.hp-kb-shelf {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    padding: 22px;
    border: 1px solid var(--hp-line);
    border-radius: var(--hp-radius-md);
    background: var(--hp-white);
    color: var(--hp-ink);
    text-decoration: none;
    transition: border-color .2s ease, transform .2s ease;
}

.hp-kb-shelf:hover {
    border-color: var(--hp-coral);
    transform: translateY(-2px);
}

.hp-kb-shelf:focus-visible {
    outline: 2px solid var(--hp-coral);
    outline-offset: 3px;
}

.hp-kb-shelf.is-current {
    border-left: 4px solid var(--hp-coral);
}

.hp-kb-shelf__label {
    font-family: var(--hp-font-display);
    font-size: var(--bd-card-dense-size);
    font-weight: var(--bd-heading-weight);
    line-height: var(--bd-card-lh);
}

.hp-kb-shelf__text {
    font-size: var(--bd-small-size);
    line-height: 1.55;
    color: var(--hp-ink-muted);
}

.hp-kb-shelf__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 6px;
}

.hp-kb-shelf__count {
    font-family: var(--bd-font-mono);
    font-size: var(--bd-eyebrow-size);
    letter-spacing: var(--bd-eyebrow-track);
    text-transform: uppercase;
    color: var(--hp-ink-soft);
    font-weight: var(--bd-eyebrow-weight);
}

.hp-kb-shelf__arrow {
    color: var(--hp-coral);
}

/* ---------------------------------------------------------------- tablet */

@media (max-width: 1100px) {
    .hp-kb-body__grid--libsolo {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }

    .hp-kb-libaside {
        max-width: none;
    }

    .hp-kb-shelves {
        padding-block: 0 56px;
    }
}

/* ----------------------------------------------------------------- phone */

@media (max-width: 720px) {
    .hp-kb-library--directory .hp-kb-grid > * {
        flex-basis: 100%;
    }

    .hp-kb-timeline--dates .hp-kb-timeline__item {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    .hp-kb-timeline--dates .hp-kb-timeline__item::before {
        left: 0;
    }

    .hp-kb-timeline--dates .hp-kb-timeline__item:not(:last-child)::after {
        left: 5px;
    }

    .hp-kb-liblinks__list {
        grid-template-columns: minmax(0, 1fr);
    }

    .hp-kb-shelves__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .hp-kb-libaside {
        padding: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hp-kb-liblinks__item,
    .hp-kb-shelf {
        transition: none;
    }

    .hp-kb-liblinks__item:hover,
    .hp-kb-shelf:hover {
        transform: none;
    }
}

/* ------------------------------------------------------------ country flags */

/* Small crisp flag next to the eyebrow. */
.hp-kb-card__aka--flag {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hp-kb-flag {
    flex: none;
    display: block;
    width: 28px;
    height: 21px;
    border: 1px solid rgb(255 255 255 / .28);
    border-radius: 3px;
    object-fit: cover;
}

.hp-kb-flag--hero {
    position: relative;
    z-index: 1;
    width: 132px;
    height: 99px;
    border-radius: 4px;
    box-shadow: 0 12px 32px rgb(0 3 19 / .45);
}

/* Large flag behind the content, right side, faded into the navy. */
.hp-kb-card.has-flag,
.hp-kb-libcard.has-flag .hp-kb-idcard__mark {
    isolation: isolate;
    overflow: hidden;
}

.hp-kb-flagbg {
    position: absolute;
    z-index: -1;
    top: 0;
    right: 0;
    width: 72%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: .2;
    filter: saturate(.7);
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgb(0 0 0 / .55) 45%, #000 100%);
    mask-image: linear-gradient(to right, transparent 0%, rgb(0 0 0 / .55) 45%, #000 100%);
    transition: opacity .5s ease, filter .5s ease;
}

.hp-kb-card.has-flag:hover .hp-kb-flagbg,
.hp-kb-card.has-flag:focus-within .hp-kb-flagbg {
    opacity: .32;
    filter: saturate(.9);
}

.hp-kb-libcard .hp-kb-flagbg {
    width: 100%;
    opacity: .22;
    -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 100%);
    mask-image: radial-gradient(closest-side, #000 20%, transparent 100%);
}

@media (prefers-reduced-motion: reduce) {
    .hp-kb-flagbg { transition: none; }
}

/* ------------------------------------------------------------ card artwork */

/* Soft gradient and one abstract shape behind each directory card. Variant, angle and
   position come from a hash of the slug, so neighbouring cards differ. Calm: no motion. */
.hp-kb-libcardlink {
    isolation: isolate;
    overflow: hidden;
}

.hp-kb-art {
    position: absolute;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        linear-gradient(var(--ang, 135deg), rgb(255 82 71 / .11) 0%, transparent 48%),
        linear-gradient(calc(var(--ang, 135deg) + 180deg), rgb(36 52 128 / .45) 0%, transparent 60%);
    transition: opacity .5s ease;
}

.hp-kb-art::before,
.hp-kb-art::after {
    content: "";
    position: absolute;
    opacity: .85;
    transition: opacity .5s ease, transform .6s ease;
}

.hp-kb-libcardlink:hover .hp-kb-art::before,
.hp-kb-libcardlink:focus-within .hp-kb-art::before {
    opacity: 1;
    transform: translate(-6px, 4px);
}

/* 0: blurred orb and a thin ring */
.hp-kb-art--0::before {
    left: calc(var(--ax) - 90px);
    top: calc(var(--ay) - 90px);
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgb(255 82 71 / .22), transparent);
    filter: blur(8px);
}
.hp-kb-art--0::after {
    right: -50px;
    bottom: -60px;
    width: 190px;
    height: 190px;
    border: 1px solid rgb(255 255 255 / .1);
    border-radius: 50%;
}

/* 1: concentric rings */
.hp-kb-art--1::before {
    left: calc(var(--ax) - 120px);
    top: calc(var(--ay) - 120px);
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: repeating-radial-gradient(circle, transparent 0 17px, rgb(255 255 255 / .09) 17px 18px);
    -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
    mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
}

/* 2: arc, partly coral */
.hp-kb-art--2::before {
    left: calc(var(--ax) - 100px);
    top: calc(var(--ay) - 100px);
    width: 200px;
    height: 200px;
    border: 2px solid transparent;
    border-top-color: rgb(255 82 71 / .4);
    border-right-color: rgb(255 255 255 / .12);
    border-radius: 50%;
    transform: rotate(var(--ang));
}
.hp-kb-art--2::after {
    left: calc(var(--ax) - 60px);
    top: calc(var(--ay) - 60px);
    width: 120px;
    height: 120px;
    border: 1px solid rgb(255 255 255 / .08);
    border-radius: 50%;
}

/* 3: grid fragment */
.hp-kb-art--3::before {
    inset: 0;
    background:
        repeating-linear-gradient(0deg, rgb(255 255 255 / .07) 0 1px, transparent 1px 24px),
        repeating-linear-gradient(90deg, rgb(255 255 255 / .07) 0 1px, transparent 1px 24px);
    -webkit-mask-image: radial-gradient(160px 130px at var(--ax) var(--ay), #000, transparent);
    mask-image: radial-gradient(160px 130px at var(--ax) var(--ay), #000, transparent);
}

/* 4: angled plane */
.hp-kb-art--4::before {
    left: calc(var(--ax) - 80px);
    top: -30%;
    width: 160px;
    height: 160%;
    background: linear-gradient(90deg, rgb(255 255 255 / .06), rgb(255 82 71 / .1));
    transform: rotate(18deg) skewX(-12deg);
}

/* 5: two soft orbs */
.hp-kb-art--5::before {
    left: calc(var(--ax) - 110px);
    top: calc(var(--ay) - 70px);
    width: 220px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgb(96 124 255 / .22), transparent);
    filter: blur(10px);
}
.hp-kb-art--5::after {
    right: -40px;
    top: -40px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgb(255 82 71 / .2), transparent);
}

/* Country cards: the flag is the artwork, only the gradient stays */
.hp-kb-art--flag::before,
.hp-kb-art--flag::after { content: none; }

@media (prefers-reduced-motion: reduce) {
    .hp-kb-art,
    .hp-kb-art::before,
    .hp-kb-art::after { transition: none; }
    .hp-kb-libcardlink:hover .hp-kb-art::before,
    .hp-kb-libcardlink:focus-within .hp-kb-art::before { transform: none; }
}

/* ------------------------------------------------------- compact filters */

/* One row per filter: the chips scroll sideways inside their own frame, so 14 tactics
   never wrap into loose rows. Controls use 8px corners. */
.hp-kb-library--directory .hp-kb-filters__group {
    flex-wrap: nowrap;
    align-items: center;
    gap: 16px;
}

.hp-kb-library--directory .hp-kb-filters__label {
    flex: 0 0 auto;
    width: 76px;
}

.hp-kb-filters__rail {
    display: flex;
    flex: 1 1 auto;
    gap: 8px;
    min-width: 0;
    padding: 6px;
    overflow-x: auto;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
    background: var(--hp-white);
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.hp-kb-filters__rail:focus-visible {
    outline: 2px solid var(--hp-coral);
    outline-offset: 2px;
}

.hp-kb-library--directory .hp-kb-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-color: transparent;
    border-radius: 6px;
    background: transparent;
    white-space: nowrap;
    scroll-snap-align: start;
}

.hp-kb-library--directory .hp-kb-chip:hover {
    border-color: var(--hp-line-strong);
}

.hp-kb-library--directory .hp-kb-chip.is-active {
    border-color: var(--hp-navy-900);
    background: var(--hp-navy-900);
    color: var(--hp-white);
}

.hp-kb-chip__n {
    font-family: var(--hp-font-mono);
    font-size: 11px;
    font-weight: 600;
    opacity: .6;
}

/* ------------------------------------------------- grouped shelf (techniques) */

/* Groups pack into rows by their card count (flex-grow and basis follow --n), so a
   group of one card sits beside others instead of stretching across the page. */
.hp-kb-libgroups {
    display: flex;
    flex-wrap: wrap;
    gap: 40px 28px;
}

.hp-kb-libgroup {
    flex: var(--n, 1) 1 calc(var(--n, 1) * 340px);
    min-width: min(100%, 340px);
}

.hp-kb-libgroup:not(:has(.hp-kb-card:not([hidden]))) {
    display: none;
}

.hp-kb-libgroup__head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--hp-line-strong);
}

.hp-kb-libgroup__no,
.hp-kb-libgroup__n {
    font-family: var(--hp-font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--hp-coral);
}

.hp-kb-libgroup__n {
    margin-left: auto;
    color: var(--hp-ink-soft);
}

.hp-kb-libgroup__title {
    font-size: var(--bd-h4-size, 20px);
    line-height: 1.2;
    color: var(--hp-ink);
}

/* ------------------------------------------------------ technique card */

.hp-kb-libcardlink--tech {
    border-left: 3px solid var(--hp-coral);
}

.hp-kb-techid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hp-kb-techid__code {
    padding: 4px 10px;
    border: 1px solid rgb(255 255 255 / .22);
    border-radius: 6px;
    background: rgb(255 255 255 / .06);
    font-family: var(--hp-font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--hp-white);
}

.hp-kb-techid__stage {
    font-family: var(--hp-font-mono);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--hp-on-dark-faint);
}

.hp-kb-chainbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.hp-kb-chainbar__segs {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 3px;
}

.hp-kb-chainbar__segs i {
    height: 4px;
    border-radius: 2px;
    background: rgb(255 255 255 / .12);
}

.hp-kb-chainbar__segs i.is-past {
    background: rgb(255 255 255 / .3);
}

.hp-kb-chainbar__segs i.is-on {
    background: var(--hp-coral);
}

.hp-kb-chainbar__name {
    font-size: 12px;
    color: var(--hp-on-dark-muted);
}

/* Cards per row follow the group size, so rows stay balanced (4 cards: 2 and 2). */
@media (min-width: 721px) {
    .hp-kb-library--directory .hp-kb-libgroup .hp-kb-grid > * {
        flex: 1 1 calc((100% - (var(--cols, 3) - 1) * 20px) / var(--cols, 3));
        min-width: min(100%, 300px);
    }
}

@media (max-width: 720px) {
    .hp-kb-library--directory .hp-kb-filters__group {
        flex-wrap: wrap;
        gap: 6px;
    }

    .hp-kb-library--directory .hp-kb-filters__label {
        width: 100%;
    }

    .hp-kb-filters__rail {
        flex-basis: 100%;
    }

    .hp-kb-libgroups {
        gap: 32px;
    }

    .hp-kb-libgroup {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hp-kb-library--directory .hp-kb-chip {
        transition: none;
    }

    .hp-kb-filters__rail {
        scroll-behavior: auto;
    }
}

/* ------------------------------------------------------------ spec strip (vulnerabilities) */

.hp--white {
    background: var(--hp-white);
    color: var(--hp-ink);
}

.hp-kb-spec {
    padding-block: 28px;
    border-bottom: 1px solid var(--hp-line);
}

/* Cells share the row and grow, so the strip never ends with an empty cell. */
.hp-kb-spec__list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
}

.hp-kb-spec__cell {
    display: flex;
    flex: 1 1 170px;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
    background: var(--hp-paper);
}

.hp-kb-spec__cell:first-child {
    flex-grow: 1.4;
    border-color: var(--hp-navy-900);
    background: linear-gradient(135deg, #000313 0%, #11193f 100%);
}

.hp-kb-spec__cell dt {
    font-family: var(--bd-font-mono);
    font-size: 11px;
    letter-spacing: var(--bd-eyebrow-track);
    text-transform: uppercase;
    color: var(--hp-ink-soft);
}

.hp-kb-spec__cell dd {
    margin: 0;
    font-family: var(--hp-font-display);
    font-size: 19px;
    font-weight: 500;
    line-height: 1.25;
    color: var(--hp-ink);
    overflow-wrap: anywhere;
}

.hp-kb-spec__cell:first-child dt {
    color: var(--hp-on-dark-faint);
}

.hp-kb-spec__cell:first-child dd {
    font-family: var(--hp-font-mono);
    font-size: 20px;
    font-weight: 600;
    color: var(--hp-white);
}

.hp-kb-spec__cell.is-kev {
    border-color: rgb(255 82 71 / .45);
    background: #fff4f3;
}

.hp-kb-spec__cell.is-kev dd {
    color: #c2352b;
}

/* ------------------------------------------------------------ facts card as tiles */

.hp-kb-libcard--tiles .hp-kb-idcard__facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hp-kb-libcard--tiles .hp-kb-idcard__facts > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 16px 24px;
}

.hp-kb-libcard--tiles .hp-kb-idcard__facts > div.is-wide {
    grid-column: 1 / -1;
}

.hp-kb-libcard--tiles .hp-kb-idcard__facts > div:not(.is-wide):nth-child(odd):not(:last-child) {
    border-right: 1px solid rgb(255 255 255 / .08);
}

.hp-kb-libcard--tiles .hp-kb-idcard__facts dt {
    line-height: 1.4;
}

.hp-kb-libcard--tiles .hp-kb-idcard__facts dd {
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.hp-kb-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--hp-on-dark-soft);
}

.hp-kb-dot.is-active {
    background: var(--hp-green);
}

.hp-kb-dot.is-disrupted {
    background: var(--hp-amber);
}

.hp-kb-dot.is-rebranded {
    background: #8fb0ff;
}

/* ------------------------------------------------------------ visual timeline */

.hp-kb-timeline--dates {
    padding: 8px 0;
}

.hp-kb-timeline--dates .hp-kb-timeline__item {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 44px;
    padding-bottom: 20px;
}

.hp-kb-timeline--dates .hp-kb-timeline__item::before {
    top: 14px;
    left: 169px;
    width: 12px;
    height: 12px;
    border: 3px solid var(--hp-coral);
    box-shadow: 0 0 0 4px var(--hp-paper);
}

.hp-kb-timeline--dates .hp-kb-timeline__item:not(:last-child)::after {
    top: 30px;
    bottom: -12px;
    left: 174px;
    width: 2px;
    background: repeating-linear-gradient(180deg, var(--hp-line-strong) 0 6px, transparent 6px 10px);
}

.hp-kb-timeline--dates .hp-kb-timeline__year {
    align-self: start;
    justify-self: end;
    padding: 5px 12px;
    border: 1px solid var(--hp-navy-900);
    border-radius: 6px;
    background: var(--hp-navy-900);
    font-family: var(--hp-font-mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--hp-white);
}

.hp-kb-timeline--dates .hp-kb-timeline__body {
    padding: 12px 18px;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
    background: var(--hp-white);
}

.hp-kb-timeline--dates .hp-kb-timeline__body p {
    margin: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .hp-kb-spec__cell {
        flex-basis: calc(50% - 6px);
    }

    .hp-kb-spec__cell:first-child {
        flex-basis: 100%;
    }

    .hp-kb-timeline--dates .hp-kb-timeline__item {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding-left: 28px;
    }

    .hp-kb-timeline--dates .hp-kb-timeline__item::before {
        top: 6px;
        left: 0;
    }

    .hp-kb-timeline--dates .hp-kb-timeline__item:not(:last-child)::after {
        top: 24px;
        left: 5px;
    }

    .hp-kb-timeline--dates .hp-kb-timeline__year {
        justify-self: start;
    }

    .hp-kb-libcard--tiles .hp-kb-idcard__facts > div {
        padding-inline: 18px;
    }
}

/* Type culture: labels and numbers in JetBrains Mono (kb-classic points the mono token at the display face). */
.bd-kb-classic {
    --hp-font-mono: var(--bd-font-mono);
}

/* Defence cards: kb-classic sets block paragraphs to article size; keep the card body below its title. */
.bd-kb-classic .hp-kb-defense p {
    font-size: var(--bd-small-size);
    line-height: 1.55;
}

.bd-kb-classic .hp-kb-defense .kb-apt-tech {
    font-size: 12px;
}

/* Profile heroes: text column starts at the top, like the other profile pages, instead of floating mid-card. */
.hp-kb-library:not(.hp-kb-library--directory) .hp-kb-hero__grid {
    align-items: start;
}

/* Route cards: never leave one card alone in the last row. */
@media (min-width: 900px) {
    .hp-kb-library .hp-kb-threats__list:has(> :nth-child(3):last-child) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hp-kb-library .hp-kb-threats__list > .hp-kb-threats__item:last-child:nth-child(odd):not(:first-child):not(:nth-child(3)) {
        grid-column: 1 / -1;
    }
}

/* Filter rails scroll sideways: leave room at the end and fade the edge so a cut-off chip reads as "more". */
.hp-kb-filters__rail {
    padding-inline-end: 48px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent);
}

/* Route cards: body at card size, not article size, so three across stay readable. */
.bd-kb-classic .hp-kb-library .hp-kb-threats__item p {
    font-size: var(--bd-body-size);
    line-height: 1.6;
}
