/* container-images / Vulnerability Report */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1d1f23;
  --muted: #5f6368;
  --border: #dde1e6;
  --link: #1a5fb4;
  --focus: #1a5fb4;
  --error-bg: #b3261e;
  --error-text: #ffffff;
  --warn-bg: #fff4e5;
  --warn-text: #7a4100;
  --kev: #b3261e;
  --selected: #e8f0fe;

  /* fixed severity palette - always shown together with a label */
  --sev-critical: #b71c1c;
  --sev-critical-text: #ffffff;
  --sev-high: #f57c00;
  --sev-high-text: #1a1a1a;
  --sev-medium: #fbc02d;
  --sev-medium-text: #1a1a1a;
  --sev-low: #6b6b6b;
  --sev-low-text: #ffffff;
  --sev-negligible: #a8a8a8;
  --sev-negligible-text: #1a1a1a;
  --sev-unknown: #d4d4d4;
  --sev-unknown-text: #1a1a1a;

  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --border: #2c313c;
    --link: #8ab4f8;
    --focus: #8ab4f8;
    --warn-bg: #3a2a12;
    --warn-text: #ffcc80;
    --kev: #ff8a80;
    --selected: #1c2a40;
    --sev-low: #8a8a8a;
    --sev-low-text: #111111;
    --sev-negligible: #5f5f5f;
    --sev-negligible-text: #ffffff;
    --sev-unknown: #3d3d3d;
    --sev-unknown-text: #ffffff;
  }
}

* { box-sizing: border-box; }

html { scroll-padding-top: 9rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

code, .mono { font-family: var(--mono); font-size: 0.9em; }
h1 { font-size: 1.6rem; margin: 0.2rem 0 0.6rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.strong { font-weight: 600; }

.error-bar {
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  color: var(--error-text);
  font-weight: 600;
}

/* ----- header ----- */

.page-header, main, .filters-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.page-header { padding-top: 1rem; padding-bottom: 0.75rem; }
.page-header p { margin: 0.35rem 0; max-width: 72rem; }
.lead { font-size: 1.02rem; }
.notice, .sources { color: var(--muted); }
.back { margin: 0 0 0.5rem; }
.back a { text-decoration: none; }
.kicker { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; font-weight: 600; }

.pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.pill {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.pill strong { color: var(--text); font-weight: 600; }
.pill.warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.pill.error { background: var(--error-bg); color: var(--error-text); border-color: transparent; }

/* ----- sticky filter row ----- */

.filters {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.group { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.7rem; }
.group legend { float: left; margin-right: 0.5rem; padding: 0; font-weight: 600; font-size: 0.85rem; }
.group label { white-space: nowrap; font-size: 0.9rem; cursor: pointer; }
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 2px; vertical-align: -1px; }
.totals { margin: 0 0 0 auto; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }

.search { position: relative; flex: 1 1 320px; max-width: 460px; }
.search input {
  width: 100%;
  padding: 0.45rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.suggestions {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 0.25rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgb(0 0 0 / 18%);
  max-height: 60vh;
  overflow-y: auto;
}
.suggestions li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0.7rem; cursor: pointer; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--selected); }
.suggestions .value { font-family: var(--mono); font-size: 0.9em; overflow-wrap: anywhere; }
.suggestions .hint { color: var(--muted); font-size: 0.85em; white-space: nowrap; }
.suggestions .empty { color: var(--muted); cursor: default; }

/* ----- overview ----- */

main { padding-top: 1rem; padding-bottom: 3rem; outline: none; }
.loading { color: var(--muted); }

.explain { margin: 0; }

.toolbar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.sort { color: var(--muted); font-size: 0.9rem; }
.sort button, .copy {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.15rem 0.6rem;
  margin-left: 0.25rem;
  cursor: pointer;
}
.sort button.active { background: var(--selected); border-color: var(--link); font-weight: 600; }

.blocks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  cursor: pointer;
}
.block:hover { border-color: var(--muted); }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem; }
.block-head h3 a { color: var(--text); text-decoration: none; }
.block-head h3 a:hover { text-decoration: underline; }
.links { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.88rem; }
.block-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-left: auto; font-size: 0.85rem; }
.digest { font-family: var(--mono); color: var(--muted); font-size: 0.82rem; }
.score-badge { font-weight: 600; }

.sevbar {
  display: flex;
  height: 8px;
  margin: 0.7rem 0 0.5rem;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.seg { display: block; height: 100%; }

/* position: relative keeps the absolutely positioned .sr-only hints inside the scroll box */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.num { text-align: right; white-space: nowrap; }
td.kev, span.kev, .value.kev { color: var(--kev); font-weight: 700; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.selected td { background: var(--selected); }
.variants td:first-child { min-width: 14rem; }
.variants th, .variants td { padding-top: 0.55rem; padding-bottom: 0.55rem; }
.variant-link { font-weight: 600; color: var(--text); text-decoration: none; }
.variant-link:hover { text-decoration: underline; }
.tag-badge {
  display: inline-block;
  margin-left: 0.35rem;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.85em;
  font-weight: 400;
  white-space: nowrap;
}
.tag-badge.tag-latest { color: var(--link); }
.tag-badge.tag-edge { color: var(--warn-text); }
.tag-badge.tag-platform { margin-left: 0; color: var(--muted); }
td > .tag-badge:first-child { margin-left: 0; }
.tag { font-family: var(--mono); font-size: 0.9em; white-space: nowrap; }
.variants .pill { margin-left: 0.5rem; }
.variants td.platform { white-space: nowrap; }
/* rows of one variant (tags x platforms) form a group */
.variants tbody tr.group-start:not(:first-child) td { border-top: 2px solid var(--border); }
.diff {
  display: block;
  margin-top: 0.15rem;
  color: var(--warn-text);
  font-size: 0.82rem;
}

.chip {
  display: inline-block;
  min-width: 2.1rem;
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  white-space: nowrap;
}
.chip.zero { background: transparent !important; color: var(--muted) !important; font-weight: 400; }

.sev-critical { background: var(--sev-critical); color: var(--sev-critical-text); }
.sev-high { background: var(--sev-high); color: var(--sev-high-text); }
.sev-medium { background: var(--sev-medium); color: var(--sev-medium-text); }
.sev-low { background: var(--sev-low); color: var(--sev-low-text); }
.sev-negligible { background: var(--sev-negligible); color: var(--sev-negligible-text); }
.sev-unknown { background: var(--sev-unknown); color: var(--sev-unknown-text); }

/* ----- detail pages ----- */

h1 .variant { color: var(--muted); font-weight: 400; font-size: 0.8em; }
.stats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0.5rem 0; }
.stat {
  display: flex;
  flex-direction: column;
  min-width: 7rem;
  padding: 0.5rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat .label { color: var(--muted); font-size: 0.78rem; }
.stat .value { font-size: 1.3rem; font-weight: 700; }
.stat .value.small { font-size: 0.95rem; font-weight: 400; }
.stat.chips { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.meta-line { color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.digests { max-width: 900px; }

.sbom p { margin: 0.4rem 0; }
.code { position: relative; }
.code pre {
  margin: 0;
  padding: 0.7rem 5rem 0.7rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre;
}
.copy { position: absolute; top: 0.45rem; right: 0.45rem; }

/* findings tables sit in a box like the image blocks of the overview */
.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 1rem;
}
.box tbody tr:last-child td { border-bottom: 0; }

/* top source packages on the image detail page */
.lever {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(6rem, 1fr) 6rem 7.5rem;
  gap: 0.25rem 1rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.lever:last-child { border-bottom: 0; }
.lever-name { overflow-wrap: anywhere; }
.lever-pkgs { display: block; color: var(--muted); }
.lever .sevbar { margin: 0; }
@media (max-width: 640px) {
  .lever { grid-template-columns: 1fr auto auto; }
  .lever .sevbar { grid-column: 1 / -1; grid-row: 2; }
}
/* long package names and versions break anywhere, so all columns fit without scrolling sideways */
.findings td { overflow-wrap: anywhere; }
.findings td:first-child, .findings td:last-child { white-space: nowrap; overflow-wrap: normal; }
.th-sort {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
th[aria-sort="ascending"] .th-sort::after { content: " ▲"; }
th[aria-sort="descending"] .th-sort::after { content: " ▼"; }

.note {
  padding: 0.45rem 0.7rem;
  background: var(--warn-bg);
  color: var(--warn-text);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .totals { margin-left: 0; }
  .block-meta { margin-left: 0; }
  html { scroll-padding-top: 16rem; }
}
