/* ==========================================================================
   TechRS — vulns.css
   Vulnerability dashboard: freshness/stale/note banners, advisories,
   filters, results table (stacked cards on mobile), detail page, KEV strip,
   metrics, references, attribution. Badges live in core.css (shared with
   the home widget). RTL-first; CVE/vector/refs are LTR islands via markup.
   ========================================================================== */

/* ─────────────────────────────────────────────
   Freshness + banners
   ───────────────────────────────────────────── */
.vulns-freshness {
  margin-block-start: var(--space-1);
  color: var(--text-muted);
  font-size: var(--step--1);
}

.stale-banner {
  margin-block: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid rgba(240, 169, 60, 0.45);
  border-inline-start-width: 4px;
  background: rgba(240, 169, 60, 0.14);
  color: var(--warn-text); /* #f2c078 dark / #7a5200 light — AA both */
  font-weight: 700;
}

.note-banner {
  margin-block: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid rgba(25, 196, 220, 0.30);
  border-inline-start: 4px solid var(--brand-cyan);
  background: rgba(25, 196, 220, 0.08);
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────
   Advisories
   ───────────────────────────────────────────── */
.advisories {
  margin-block: var(--space-8);
}
.advisories > h2 {
  margin-block-end: var(--space-4);
}

.advisory-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding-block: var(--space-3);
  border-block-end: 1px solid var(--border-glass);
}
.advisory-list li:last-child {
  border-block-end: 0;
}
.advisory-list a {
  font-weight: 700;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}
.advisory-list a:hover {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.advisory-list time {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-size: var(--step--1);
  white-space: nowrap;
}

/* ─────────────────────────────────────────────
   Filters — glass panel, 44px touch targets
   ───────────────────────────────────────────── */
.vuln-filters {
  margin-block: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4) var(--space-5);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-inline-size: 10rem;
  flex: 1 1 10rem;
}
fieldset.filter-group {
  border: 0;
  padding: 0;
  margin: 0;
  flex: 2 1 100%;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}
.filter-group legend {
  font-weight: 700;
  font-size: var(--step--1);
  color: var(--text-secondary);
  padding: 0;
  margin-block-end: var(--space-1);
}
.filter-group > label {
  font-size: var(--step--1);
  color: var(--text-secondary);
}
.filter-group select,
.filter-group input {
  min-block-size: 2.75rem; /* 44px touch target */
}
.filter-group select {
  inline-size: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: 2.75rem; /* 44px touch target */
  font-weight: 400;
  font-size: var(--step-0);
  cursor: pointer;
}
.filter-check input[type="checkbox"] {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  accent-color: var(--accent-text);
  cursor: pointer;
}
.filter-check:hover {
  color: var(--accent-text);
}

.filter-kev {
  font-weight: 700;
  color: var(--kev-text);
}

.filter-sort {
  flex-grow: 0;
  min-inline-size: 11rem;
}

.filter-row > button {
  min-block-size: 2.75rem; /* the submit .btn — 44px touch target */
}

.vulns-count {
  margin-block: var(--space-2) var(--space-4);
  color: var(--text-muted);
  font-size: var(--step--1);
}

/* ─────────────────────────────────────────────
   Results table — dense but readable
   ───────────────────────────────────────────── */
.vuln-table-wrap {
  margin-block-start: var(--space-2);
}

.vuln-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.5;
}

.vuln-table th {
  text-align: start;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-block-end: 1px solid var(--border-strong);
}

.vuln-table td {
  padding: var(--space-3) var(--space-4);
  border-block-end: 1px solid var(--border-subtle);
  vertical-align: top;
}

/* zebra + hover lift */
.vuln-table tbody tr:nth-child(even) {
  background: var(--surface-glass);
}
.vuln-table tbody tr {
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}
.vuln-table tbody tr:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
}

/* actively exploited rows: green accent on the inline-start edge */
.vuln-table .row-kev > td:first-child {
  border-inline-start: 3px solid var(--brand-green);
}

.cve-link {
  font-family: var(--font-mono); /* Latin CVE ids only — never Hebrew */
  font-size: 0.95em;
  color: var(--accent-text);
  white-space: nowrap;
}
.cve-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.cell-products {
  max-inline-size: 26rem;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
}

.muted {
  color: var(--text-muted);
  font-size: 0.9em;
}

.epss {
  font-family: var(--font-mono);
  font-size: 0.95em;
  color: var(--accent-text);
  unicode-bidi: isolate;
  white-space: nowrap;
}

/* Wide-but-not-huge screens: let the table scroll instead of squishing */
@media (min-width: 768px) {
  .vuln-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm), var(--ring-inset-light);
  }
}

/* Mobile (<768px): table converts to stacked glass cards */
@media (max-width: 767.98px) {
  .vuln-table,
  .vuln-table tbody,
  .vuln-table tr,
  .vuln-table td {
    display: block;
    inline-size: 100%;
  }
  .vuln-table thead {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .vuln-table tr {
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-block-end: var(--space-4);
  }
  .vuln-table tbody tr:nth-child(even) {
    background: var(--surface-glass); /* zebra collapses into the card look */
  }
  .vuln-table td {
    border: 0;
    padding: var(--space-1) 0;
  }
  .vuln-table td::before {
    content: attr(data-label);
    display: block;
    font-size: var(--step--1);
    font-weight: 700;
    color: var(--text-muted);
    margin-block-end: 2px;
  }
  .vuln-table .row-kev {
    border-inline-start: 3px solid var(--brand-green);
  }
  .vuln-table .row-kev > td:first-child {
    border-inline-start: 0; /* the card edge carries the accent instead */
  }
}

/* ─────────────────────────────────────────────
   Detail page
   ───────────────────────────────────────────── */
.vuln-detail {
  max-inline-size: 56rem;
  margin-block: var(--space-8) var(--space-12);
}

.vuln-head > p:first-child a {
  color: var(--accent-text);
  font-size: var(--step--1);
  font-weight: 700;
}
.vuln-head > p:first-child a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.vuln-title {
  font-size: var(--step-3);
  font-weight: 800;
  line-height: var(--leading-tight);
  margin-block: var(--space-2);
}

.vuln-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-block-start: var(--space-2);
}

/* KEV strip — danger-tinted glass, green "exploited" accent edge */
.kev-strip {
  margin-block: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: rgba(240, 71, 103, 0.10);
  border: 1px solid rgba(240, 71, 103, 0.28);
  border-inline-start: 4px solid var(--brand-green);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
}
:root[data-theme="light"] .kev-strip {
  background: rgba(240, 71, 103, 0.07);
}
.kev-strip h2 {
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--danger-text);
  margin-block-end: var(--space-4);
}

.kev-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-4);
}
.kev-facts dt {
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--text-muted);
  margin-block-end: 2px;
}
.kev-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.vuln-section {
  margin-block: var(--space-8);
}
.vuln-section h2 {
  font-size: var(--step-1);
  font-weight: 600;
  border-inline-start: 3px solid var(--brand-cyan);
  padding-inline-start: var(--space-3);
  margin-block-end: var(--space-4);
}

.vuln-description {
  /* dir="ltr" lang="en" set in markup; start-alignment follows it */
  max-inline-size: 75ch;
  line-height: 1.7;
  color: var(--text-secondary);
  overflow-wrap: break-word;
}

.metric-list > div {
  padding-block: var(--space-3);
  border-block-end: 1px solid var(--border-glass);
}
.metric-list > div:last-child {
  border-block-end: 0;
}
.metric-list dt {
  font-weight: 700;
  margin-block-end: 2px;
}
.metric-list dd {
  margin: 0;
  color: var(--text-secondary);
}
.metric-list .muted {
  display: inline-block;
  margin-inline-start: var(--space-2);
}

.vector {
  display: inline-block;
  max-inline-size: 100%;
  margin-block-start: var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.85em;
  direction: ltr; /* CVSS vector — LTR island */
  unicode-bidi: isolate;
  background: var(--chip-neutral-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.5em;
  overflow-wrap: anywhere;
}

/* References — the <ul> is dir="ltr" in markup; logical props follow it */
.ref-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-2);
  border-block-end: 1px solid var(--border-glass);
}
.ref-list li:last-child {
  border-block-end: 0;
}
.ref-list a {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.ref-list a:hover {
  color: var(--accent-text-strong);
}

/* ─────────────────────────────────────────────
   Attribution
   ───────────────────────────────────────────── */
.vulns-attribution {
  margin-block-start: var(--space-12);
  padding-block-start: var(--space-5);
  border-block-start: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: var(--step--1);
}
.vulns-attribution p + p {
  margin-block-start: var(--space-2);
}
.vulns-attribution a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* ─────────────────────────────────────────────
   Print — table black-on-white with borders
   ───────────────────────────────────────────── */
@media print {
  .site-header,
  .site-footer,
  .a11y-widget,
  .skip-link,
  .vuln-filters,
  .pagination {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .vuln-table-wrap {
    overflow: visible;
    border: 0;
    box-shadow: none;
    background: #fff;
  }
  .vuln-table th,
  .vuln-table td {
    color: #000 !important;
    background: #fff !important;
    border: 0.5pt solid #000;
  }
  .vuln-table tbody tr {
    background: #fff !important;
    box-shadow: none;
  }

  .badge,
  .chip {
    background: #fff !important;
    color: #000 !important;
    border: 0.5pt solid #000;
    box-shadow: none;
  }

  .cve-link,
  .epss,
  .ref-list a,
  .vulns-attribution a {
    color: #000 !important;
  }

  .kev-strip,
  .stale-banner,
  .note-banner {
    background: #fff !important;
    color: #000 !important;
    border: 1pt solid #000;
  }
  .kev-strip h2 {
    color: #000 !important;
  }
}
