:root {
    /* editor surfaces */
    --bg: #16181e;
    --bg-panel: #1c1f27;
    --bg-hover: #22262f;
    --border: #2b2f3a;

    /* foreground */
    --text: #cdd3de;
    --text-dim: #868e9c;
    --text-faint: #5a616e;

    /* syntax tokens — one hue per topic */
    /* windows */
    --tok-blue: #61afef;
    /* ubuntu-linux */
    --tok-amber: #e0a44a;
    /* supply-chain */
    --tok-rose: #e06c75;
    /* atlassian */
    --tok-purple: #c678dd;
    /* accent / interactive / new */
    --tok-teal: #56b6c2;
    /* browsers */
    --tok-green: #98c379;
    /* fortinet */
    --tok-orange: #d19a66;

    /* diagnostics — editor error / warning colours (also used by the KEV badge) */
    --diag-error: #f14c4c;
    --diag-warn: #cca700;

    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 2.4rem 1.25rem 4rem;
}

/* ---- hero: a live command prompt ---------------------------------- */
header {
    margin-bottom: 1.75rem;
}

.prompt {
    font-family: var(--mono);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-dim);
    word-break: break-word;
}

.prompt .user {
    color: var(--tok-green);
}

.prompt .path {
    color: var(--tok-blue);
}

.prompt .cmd {
    color: var(--text);
}

.prompt .flag {
    color: var(--tok-amber);
}

.cursor {
    display: inline-block;
    width: 0.55ch;
    height: 1.05em;
    margin-left: 1px;
    background: var(--tok-teal);
    vertical-align: text-bottom;
    animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink {
    to {
        opacity: 0;
    }
}

.status {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-faint);
    margin-top: 0.9rem;
}

.status b {
    color: var(--text-dim);
    font-weight: 500;
}

.status .new {
    color: var(--tok-teal);
}

.status .err {
    color: var(--diag-error);
}

.status .warn {
    color: var(--diag-warn);
}

/* ---- filter chips ------------------------------------------------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.chip {
    font-family: var(--mono);
    font-size: 0.76rem;
    color: var(--chip, var(--text-dim));
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}

.chip::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--chip, var(--text-dim));
}

.chip:hover {
    background: var(--bg-hover);
}

.chip[aria-pressed="false"] {
    opacity: 0.4;
    text-decoration: line-through;
}

.chip:focus-visible {
    outline: 2px solid var(--tok-teal);
    outline-offset: 2px;
}

/* the "new only" toggle: off = normal, on = highlighted (no strike-through) */
.chip.toggle {
    margin-left: auto;
}

.chip.toggle[aria-pressed="false"] {
    opacity: 1;
    text-decoration: none;
}

.chip.toggle[aria-pressed="true"] {
    background: var(--bg-hover);
    border-color: var(--tok-teal);
}

/* ---- topic sections ----------------------------------------------- */
.topic {
    margin-top: 2rem;
}

.topic-head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 0.5rem;
    cursor: pointer;
    text-align: left;
    font-family: var(--mono);
    color: var(--topic);
}

.topic-head:focus-visible {
    outline: 2px solid var(--tok-teal);
    outline-offset: 3px;
}

.chevron {
    color: var(--text-faint);
    font-size: 0.7rem;
    transition: transform 0.15s;
    width: 0.8ch;
}

.topic.folded .chevron {
    transform: rotate(-90deg);
}

.topic-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.topic-count {
    margin-left: auto;
    color: var(--text-faint);
    font-size: 0.8rem;
}

.topic.folded .items {
    display: none;
}

/* ---- article rows ------------------------------------------------- */
.item {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 0.95rem 0.3rem;
    border-bottom: 1px solid var(--border);
}

.item:hover {
    background: var(--bg-hover);
}

.item:focus-visible {
    outline: 2px solid var(--tok-teal);
    outline-offset: -2px;
}

.item-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.item:hover .item-title {
    color: var(--tok-teal);
}

.item-time {
    flex-shrink: 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-faint);
    white-space: nowrap;
}

.item-time.is-new {
    color: var(--tok-teal);
}

.item-source {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--topic);
    margin-top: 0.3rem;
}

.item-summary {
    color: var(--text-dim);
    font-size: 0.88rem;
    margin-top: 0.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- diagnostics: gutter bar + squiggle + lint label -------------- */
.item.sev-exploited,
.item.sev-critical {
    padding-left: 0.9rem;
}

.item.sev-exploited {
    box-shadow: inset 3px 0 0 var(--diag-error);
}

.item.sev-critical {
    box-shadow: inset 3px 0 0 var(--diag-warn);
}

.item.sev-exploited .item-title,
.item.sev-critical .item-title {
    text-decoration-line: underline;
    text-decoration-style: wavy;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.item.sev-exploited .item-title {
    text-decoration-color: var(--diag-error);
}

.item.sev-critical .item-title {
    text-decoration-color: var(--diag-warn);
}

.diag {
    font-weight: 600;
    margin-right: 0.6rem;
}

.diag.error {
    color: var(--diag-error);
}

.diag.warn {
    color: var(--diag-warn);
}

/* CISA KEV badge: outlined tag, same red as the exploited diagnostic */
.kev {
    font-weight: 600;
    color: var(--diag-error);
    border: 1px solid var(--diag-error);
    border-radius: 3px;
    padding: 0 0.35rem;
    margin-right: 0.6rem;
    white-space: nowrap;
    cursor: help;
}

/* ---- states ------------------------------------------------------- */
.msg {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--text-dim);
    padding: 1.5rem 0.3rem;
}

.msg.error {
    color: var(--tok-rose);
}

footer {
    margin-top: 3rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-faint);
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    white-space: pre-wrap;
    line-height: 1.8;
}

@media (prefers-reduced-motion: reduce) {
    .cursor {
        animation: none;
    }

    * {
        transition: none !important;
    }
}