/* cves.css — CVE database (/cves) and CVE detail (/cves/:id) layout.
   Component looks live in components.css; only page layout here (.cv-). */

/* ---------- database: controls, total, list ---------- */
.cv-controls { display: grid; gap: var(--space-3); }
.cv-results { display: grid; gap: var(--space-3); min-width: 0; }
.cv-total { margin: 0; font: 400 13px/20px var(--font-sans); color: var(--ink-muted); }
.cv-total strong { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }

.cv-table .id a { color: var(--ink); text-decoration: none; }
.cv-table .id a:hover { color: var(--grape); text-decoration: underline; text-underline-offset: 3px; }
.cv-table .ttl { min-width: 240px; }
.cv-table td.cv-when { white-space: nowrap; }
.cv-row--rejected td { opacity: .72; }
.cv-notitle { color: var(--ink-muted); font-style: italic; }

/* word badge on wide tables, letter badge when the table gets tight */
.cv-sev-letter { display: none; }
@media (max-width: 900px) {
  .cv-sev-word { display: none; }
  .cv-sev-letter { display: inline; }
}

/* card feed replaces the table under 640px */
.cv-cards { display: none; gap: var(--space-4); }
@media (max-width: 640px) {
  .cv-list .cv-tablewrap { display: none; }
  .cv-cards { display: grid; }
}

/* whole card is the link: stretch the title link over it */
.cv-card { position: relative; }
.cv-card__link { color: inherit; text-decoration: none; }
.cv-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.cv-card__link:focus-visible { outline: none; }
.cv-card:has(.cv-card__link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.cv-card .mc-card__title { overflow-wrap: anywhere; }

.cv-pager { display: flex; align-items: center; justify-content: center; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-3); }
.cv-pager__range { font: 500 13px/20px var(--font-mono); color: var(--ink-muted); }

/* ---------- detail ---------- */
.cv-back { margin: 0 0 calc(-1 * var(--space-3)); font: 400 13px/20px var(--font-sans); }
.cv-back a { display: inline-flex; align-items: center; gap: var(--space-1); }

.cv-head { display: grid; gap: var(--space-2); }
.cv-head__top { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.cv-detail__id { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; overflow-wrap: anywhere; margin: 0; }
.cv-head__title { margin: 0; color: var(--ink); max-width: 70ch; }
.cv-head__meta { margin: 0; color: var(--ink-muted); }
.cv-assigner { color: var(--ink); }

.cv-callout { display: flex; gap: var(--space-3); align-items: flex-start; background: var(--danger-wash);
  border-radius: var(--radius-lg); padding: var(--space-4); }
.cv-callout > i { color: var(--danger-text); margin-top: 2px; }
.cv-callout p { margin: 0; }
.cv-callout__title { font-weight: 600; color: var(--danger-text); }
.cv-callout__body { color: var(--ink); }

.cv-body { display: grid; gap: var(--space-6); }
.cv-section { display: grid; gap: var(--space-3); min-width: 0; }
.cv-section__title { margin: 0; color: var(--ink-muted); }
.cv-desc { margin: 0; max-width: 72ch; color: var(--ink); white-space: pre-line; overflow-wrap: anywhere; }
.cv-none { margin: 0; color: var(--ink-muted); }

.cv-metrics .cv-vector code { font: 500 13px/20px var(--font-mono); color: var(--ink); word-break: break-all; }
.cv-metrics td.id { white-space: nowrap; }

.cv-cwes, .cv-affected, .cv-versions, .cv-refs { list-style: none; margin: 0; padding: 0; }
.cv-cwes { display: grid; gap: var(--space-2); }
.cv-cwes li { display: flex; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; color: var(--ink); }
.cv-cwe-id { font: 500 13px/20px var(--font-mono); white-space: nowrap; }

.cv-affected { display: grid; gap: var(--space-3); }
.cv-product { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); display: grid; gap: var(--space-2); }
.cv-product__head { display: flex; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; }
.cv-product__name { font: 500 15px/22px var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.cv-product__src { font: 400 13px/20px var(--font-sans); color: var(--ink-muted); }
.cv-product__default { margin-left: auto; font: 400 13px/20px var(--font-sans); color: var(--ink-muted); }
.cv-versions { display: grid; gap: var(--space-1); }
.cv-versions li { display: flex; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; }
.cv-versions code { font: 500 13px/20px var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.cv-vs { font: 600 13px/20px var(--font-sans); }
.cv-vs--affected { color: var(--danger-text); }
.cv-vs--unaffected { color: var(--patched); }
.cv-vs--unknown { color: var(--ink-muted); font-weight: 400; }

.cv-refs { display: grid; gap: var(--space-2); }
.cv-refs li { display: grid; gap: 2px; min-width: 0; }
.cv-refs a { display: inline-flex; gap: var(--space-1); align-items: baseline; overflow-wrap: anywhere; word-break: break-word; }
.cv-refs a > i { flex: none; }
.cv-refs__host { font: 400 13px/20px var(--font-sans); color: var(--ink-muted); }

@media (max-width: 560px) {
  .cv-product__default { margin-left: 0; flex-basis: 100%; }
  .cv-body { gap: var(--space-6); }
}

/* ---------- impact graph (ui/impact.rs; ImpactGraph in the design system) ---------- */
.g-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4) var(--space-4); gap: var(--space-3); }
.g-headline { margin: 0; font: 700 20px/28px var(--font-display); color: var(--ink); max-width: 70ch; }
.g-headline--none { display: flex; gap: var(--space-2); align-items: baseline; flex-wrap: wrap;
  font: 600 15px/22px var(--font-sans); }
.g-headline--none > i { color: var(--patched); }
.g-caveat { margin: 0; font: 400 13px/20px var(--font-sans); color: var(--ink-muted); max-width: 72ch; }
.g-headline--none .g-caveat { font-weight: 400; }

/* the graph scrolls inside its box, never the page */
.g-wrap { overflow-x: auto; max-width: 100%; min-width: 0; -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-1); }
.g-svg { display: block; height: auto; overflow: visible; }

.g-edge { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.g-edge.affected { stroke: var(--sev-critical); stroke-width: 2.5; }
.g-edge.deployed { stroke: var(--grape); stroke-width: 2; stroke-dasharray: 6 5; }
.g-edge.fixed { stroke: var(--border-strong); stroke-width: 1.5; }
.g-edge.unknown { stroke: var(--warn-text); stroke-width: 1.5; }

.g-node { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1.5; rx: var(--radius-md); }
.g-node.cve { fill: var(--danger-wash); stroke: var(--sev-critical); stroke-width: 2.5; }
.g-node.affected { stroke: var(--sev-critical); stroke-width: 2.5; }
.g-node.deployed { stroke: var(--grape); stroke-width: 2; stroke-dasharray: 6 5; }
.g-node.unknown { stroke: var(--warn-text); stroke-width: 2; }
.g-node.fixed { stroke: var(--border); fill: var(--bg); }
.g-t1 { font: 500 12px var(--font-mono); fill: var(--ink); }
.g-t2 { font: 400 11px var(--font-sans); fill: var(--ink-muted); }
.g-col { font: 600 10px var(--font-sans); letter-spacing: .08em; fill: var(--ink-muted); }
.g-none { font-style: italic; }

/* nodes with a route are links: pointer, hover lift, focus ring */
.g-ring { fill: none; stroke: transparent; stroke-width: 2; }
.g-link { cursor: pointer; outline: none; text-decoration: none; }
.g-link text { text-decoration: none; }
.g-link:hover .g-node { fill: var(--surface-raised); }
.g-link:hover .g-t1 { fill: var(--grape); }
.g-link:focus-visible .g-ring { stroke: var(--focus); }

.mc-legend { display: flex; gap: var(--space-2) var(--space-4); flex-wrap: wrap; font: 400 13px/20px var(--font-sans);
  color: var(--ink-muted); list-style: none; margin: 0; padding: 0; }
.mc-legend li { display: inline-flex; align-items: center; gap: var(--space-2); }
.mc-legend i { width: 24px; height: 0; border-top: 2.5px solid var(--sev-critical); }
.mc-legend .deployed { border-top: 2px dashed var(--grape); }
.mc-legend .fixed { border-top: 1.5px solid var(--border-strong); }
.mc-legend .unknown { border-top: 2px solid var(--warn-text); }

@media (max-width: 560px) {
  .g-panel { padding: var(--space-3); }
  .g-headline { font-size: 17px; line-height: 24px; }
}
