/* ---------------------------------------------------------------------------
   CVE Feed — a reading view, not a control panel.

   Hairlines instead of boxes, one accent, numerals in mono, and a serif
   wordmark to keep the page from reading like a generated dashboard.
   --------------------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --paper: #0c0d10;
  --paper-raised: #121318;
  --ink: #e9e7e4;
  --ink-soft: #a4a29d;
  --ink-faint: #6e6d6a;
  --hair: #22242a;
  --hair-strong: #30323a;

  --accent: #d2694f;
  --accent-ink: #e8866c;

  /* A cool counterpoint to the warm accent: the AI-stack facet is a different
     dimension from severity, so it should not read as another severity. */
  --copy-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M10 1H3a1 1 0 0 0-1 1v9h2V3h6V1zm3 3H6a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1zm-1 9H7V6h5v7z'/%3E%3C/svg%3E");

  --stack: #5a9c98;
  --stack-ink: #76b8b2;

  --critical: #d4544a;
  --high: #d08a3e;
  --medium: #bfa23c;
  --low: #5f9b7e;
  --unscored: #6b6d75;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 1180px;
  --gutter: clamp(20px, 5vw, 56px);
}

html[data-theme="light"] {
  color-scheme: light;

  --paper: #fbfaf8;
  --paper-raised: #ffffff;
  --ink: #17181b;
  --ink-soft: #55565a;
  --ink-faint: #85868a;
  --hair: #e4e1db;
  --hair-strong: #d2cec6;

  --accent: #b4482d;
  --accent-ink: #a84026;

  --stack: #2f6d68;
  --stack-ink: #275f5a;

  --critical: #b8372e;
  --high: #9c5f12;
  --medium: #806a12;
  --low: #3d7a5e;
  --unscored: #76777c;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--hair-strong); }
a:hover { border-bottom-color: var(--accent); color: var(--accent-ink); }

::selection { background: var(--accent); color: #fff; }

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: var(--gutter); top: 14px; z-index: 50;
  background: var(--paper-raised); padding: 8px 14px; border: 1px solid var(--hair-strong);
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------- masthead */

.masthead {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 52px) var(--gutter) 0;
}

.masthead-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 5.2vw, 50px);
  line-height: 1;
  letter-spacing: -0.015em;
  margin: 0;
}
.wordmark em { font-style: italic; color: var(--accent-ink); }

.masthead-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.freshness { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

.pip {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--low);
  flex: none;
}
.pip[data-state="stale"] { background: var(--medium); }
.pip[data-state="error"] { background: var(--critical); }
.pip[data-state="loading"],
.pip[data-state="refreshing"] { background: var(--accent); animation: blink 1.2s ease-in-out infinite; }

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

button.quiet {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--hair-strong);
  padding: 1px 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
button.quiet:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }
button.quiet[disabled] { opacity: 0.45; cursor: default; }

.standfirst {
  font-family: var(--serif);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 14px 0 0;
}

.sourceline {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.src { display: inline-flex; align-items: center; gap: 6px; }
.src b { font-weight: 500; color: var(--ink-soft); letter-spacing: 0.04em; }
.src i { font-style: normal; font-family: var(--mono); font-size: 11px; }
.src::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--low); flex: none;
}
.src[data-ok="false"]::before { background: var(--critical); }
.src[data-ok="false"] b { color: var(--critical); }

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

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter) 72px;
}

/* ---------------------------------------------------------------- summary */

.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  margin: 34px 0 30px;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}

.figure {
  flex: 1 1 128px;
  padding: 16px 20px 15px 0;
  margin-right: 20px;
  border-right: 1px solid var(--hair);
  background: none;
  border-top: 0; border-bottom: 0; border-left: 0;
  font: inherit;
  text-align: left;
  color: inherit;
}
.summary > .figure:last-child { border-right: 0; margin-right: 0; }

button.figure { cursor: pointer; transition: color 0.15s; }
button.figure:hover .figure-value { color: var(--accent-ink); }
button.figure[aria-pressed="true"] .figure-value { color: var(--accent-ink); }
button.figure[aria-pressed="true"] .figure-label::after {
  content: " ×";
  color: var(--accent-ink);
}

.figure-value {
  display: block;
  font-family: var(--mono);
  font-size: clamp(22px, 3vw, 29px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s;
}
.figure-label {
  display: block;
  margin-top: 7px;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

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

.searchline {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--hair-strong);
  padding-bottom: 9px;
  transition: border-color 0.18s;
}
.searchline:focus-within { border-bottom-color: var(--accent); }

#q {
  flex: 1;
  font: inherit;
  font-size: clamp(17px, 2.4vw, 21px);
  font-family: var(--serif);
  background: none;
  border: 0;
  color: var(--ink);
  padding: 2px 0;
  min-width: 0;
}
#q::placeholder { color: var(--ink-faint); }
#q:focus { outline: none; }
#q::-webkit-search-cancel-button { display: none; }

.filterline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 12.5px;
}

.stackline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--hair);
  font-size: 12.5px;
}
.stack-label {
  flex: none;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stack-ink);
}
.stackline .toggle input { accent-color: var(--stack); }
.stackline .toggle input:checked + span { color: var(--stack-ink); }
.stackline .toggle b {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  opacity: 0.6;
  margin-left: 5px;
}
.stackline .chip[aria-pressed="true"] {
  color: var(--stack-ink);
  border-bottom-color: var(--stack);
}
.stack-counts {
  font-size: 12px;
  color: var(--ink-faint);
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.stack-counts .dot { opacity: 0.5; }
.stack-exploited {
  all: unset;
  cursor: pointer;
  color: var(--critical);
  border-bottom: 1px solid transparent;
}
.stack-exploited:hover { border-bottom-color: currentColor; }
.stack-exploited:focus-visible { outline: 2px solid var(--critical); outline-offset: 2px; }

.exploitline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 13px;
  font-size: 12.5px;
}
.exploit-label {
  flex: none;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--high);
}
.exploitline .chip[aria-pressed="true"] {
  color: var(--high);
  border-bottom-color: var(--high);
}
.exploit-note { font-size: 11.5px; color: var(--medium); }

.flag-exploit { color: var(--high); }

.exploit-evidence { display: flex; flex-wrap: wrap; gap: 0 14px; margin: 0; }
.exploit-links { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.exploit-links li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.exploit-links .exploit-src {
  flex: none;
  min-width: 86px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.exploit-links a { font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; }
.exploit-links a:hover { color: var(--accent-ink); }

.exploit-evidence span {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--high);
}

.crosslinks {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin: 14px 0 0;
  font-size: 12.5px;
}
.crosslinks a { color: var(--ink-faint); text-decoration: none; border-bottom: 1px solid var(--hair-strong); padding-bottom: 1px; }
.crosslinks a:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }
.flag-stack { color: var(--stack-ink); }

.facet { display: flex; gap: 14px; flex-wrap: wrap; }

.rule { width: 1px; height: 13px; background: var(--hair-strong); flex: none; }
.spacer { flex: 1 1 auto; }

/* Sort/window/reset travel together, so they wrap as a block rather than
   stranding a single control on its own line. */
.controls-right { display: flex; align-items: center; gap: 14px; flex: none; }

.chip {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-faint);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--ink); }
.chip b { font-weight: 400; font-family: var(--mono); font-size: 11px; opacity: 0.6; margin-left: 4px; }
.chip[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--tone, var(--accent));
}
.chip[data-empty="true"] { opacity: 0.4; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-faint);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.toggle:hover { color: var(--ink); }
.toggle input { accent-color: var(--accent); width: 13px; height: 13px; cursor: pointer; }
.toggle input:checked + span { color: var(--accent-ink); }

select {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--hair-strong);
  padding: 2px 18px 3px 2px;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 7px center, right 3px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
select:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- results */

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 38px 0 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hair-strong);
}
.results-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.results-head p { margin: 0; font-size: 11.5px; color: var(--ink-faint); letter-spacing: 0.03em; }

.feed { list-style: none; margin: 0; padding: 0; }

.entry { border-bottom: 1px solid var(--hair); }

.entry-head {
  position: relative;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 20px;
  align-items: baseline;
  width: 100%;
  padding: 17px 0;
  text-align: left;
  cursor: pointer;
}
.entry-head:hover .entry-title { color: var(--accent-ink); }

/* The toggle is a real button for keyboard and screen readers, stretched over
   the row so the whole thing stays clickable - without trapping the text in a
   button, where it could not be selected. */
.entry-toggle {
  all: unset;
  cursor: pointer;
  display: inline;
}
.entry-toggle::after {
  content: '';
  position: absolute;
  inset: 0;
}
.entry-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Above the stretched hit area, so its own controls and text selection win. */
.entry-meta { position: relative; z-index: 1; }

.mark { text-align: right; padding-top: 1px; }
.mark-score {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--tone);
  line-height: 1.1;
}
.mark-sev {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.entry-body { min-width: 0; }

.entry-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 450;
  line-height: 1.45;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
  transition: color 0.15s;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 14px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-faint);
}
.entry-meta .id {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
  user-select: text;
}
/* The glyph only appears once the row is worth acting on, so the meta line
   stays quiet at rest. */
.entry-meta .id .copy.icon { margin-left: 6px; margin-right: 0; opacity: 0; transition: opacity 0.12s; }
.entry:hover .entry-meta .id .copy.icon,
.entry-meta .id .copy.icon:focus-visible,
.entry-meta .id .copy.icon[data-copied] { opacity: 0.45; }
.entry-meta .id .copy.icon:hover { opacity: 1; }

/* ---------- copy controls ---------- */

.copy {
  all: unset;
  position: relative;
  cursor: pointer;
  color: inherit;
}
.copy:hover .copy-label { color: var(--accent-ink); }
.copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* A quiet mark that something was copied, where the eye already is. */
.copy::after {
  content: attr(data-note);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  padding: 2px 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.copy[data-copied] { --note: ''; }
.copy[data-copied]::after { opacity: 1; }
.copy[data-copied="yes"]::after { content: 'Copied'; }
.copy[data-copied="failed"]::after { content: 'Press ctrl+C'; background: var(--critical); }

.copy.quiet .copy-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--hair-strong);
  padding-bottom: 1px;
}
.copy.tiny .copy-label { font-size: 10px; border-bottom: 0; }

.copy.vector .copy-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

/* The per-reference control is a glyph, so the URL keeps the room. */
.copy.icon {
  width: 13px;
  height: 13px;
  flex: none;
  margin-right: 8px;
  vertical-align: baseline;
  border: 0;
  padding: 0;
  opacity: 0.45;
  background-color: currentColor;
  -webkit-mask: var(--copy-glyph) center / 11px 11px no-repeat;
  mask: var(--copy-glyph) center / 11px 11px no-repeat;
  display: inline-block;
}
.copy.icon:hover { opacity: 1; color: var(--accent-ink); }

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
}

.flag {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.flag-ransom { color: var(--critical); }
.flag-quiet { color: var(--ink-faint); }

.entry-sources {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  white-space: nowrap;
  text-align: right;
}

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

.detail {
  padding: 2px 0 26px 78px;
  display: grid;
  gap: 20px;
  max-width: 78ch;
}
.detail p { margin: 0; }

.lede {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.block h4 {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.kev {
  border-left: 2px solid var(--accent);
  padding: 2px 0 2px 16px;
}
.kev h4 { color: var(--accent-ink); }
.kev p + p { margin-top: 7px; }
.kev .terms { font-size: 13px; color: var(--ink-soft); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 16px 24px;
  margin: 0;
}
.facts dt {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.facts dd {
  margin: 4px 0 0;
  font-size: 13.5px;
  font-family: var(--mono);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.vector { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); overflow-wrap: anywhere; }

.outlinks { display: flex; flex-wrap: wrap; gap: 0 18px; font-size: 13px; }

.refs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.refs li { display: flex; align-items: baseline; }
.refs a { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); overflow-wrap: anywhere; }

/* --------------------------------------------------- notices / empty / etc */

.notice {
  margin: 18px 0 0;
  padding: 12px 0 12px 16px;
  border-left: 2px solid var(--medium);
  font-size: 13px;
  color: var(--ink-soft);
}
.notice[data-kind="error"] { border-left-color: var(--critical); }
.notice[data-kind="found"] { border-left-color: var(--low); }

.empty { padding: 52px 0 60px; max-width: 48ch; }
.empty-lead {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 8px;
}
.empty p { margin: 0; font-size: 14px; color: var(--ink-faint); line-height: 1.6; }

.skeletons { display: grid; gap: 1px; }
.skel {
  height: 72px;
  border-bottom: 1px solid var(--hair);
  position: relative;
  overflow: hidden;
}
.skel::after {
  content: "";
  position: absolute;
  inset: 17px 0 auto 78px;
  height: 11px;
  width: min(60%, 420px);
  background: var(--hair);
  animation: fade 1.5s ease-in-out infinite;
}
@keyframes fade { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.9; } }

.pager {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.pager-info { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.02em; }

/* -------------------------------------------------------------- colophon */

.colophon {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 24px var(--gutter) 64px;
  border-top: 1px solid var(--hair);
  font-size: 12.5px;
  color: var(--ink-soft);
  max-width: min(var(--measure), 100%);
}
.colophon p { margin: 0 0 6px; max-width: 72ch; }
.quiet-text { color: var(--ink-faint); font-size: 11.5px; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 760px) {
  .standfirst { font-size: 16px; max-width: none; }
  .masthead-row { align-items: center; }
  .masthead-tools { width: 100%; justify-content: space-between; gap: 12px; }
  .freshness { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

  .summary { border-bottom: 0; }
  .figure {
    flex: 1 1 calc(50% - 20px);
    border-right: 0;
    margin-right: 0;
    padding: 13px 0;
    border-bottom: 1px solid var(--hair);
  }

  .entry-head { grid-template-columns: 44px 1fr; gap: 14px; }
  .entry-sources { display: none; }
  .detail { padding-left: 58px; }
  .filterline, .stackline, .exploitline { gap: 12px; }
  .rule, .spacer { display: none; }
  .controls-right { width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
