/* CVE Radar — "intelligence briefing" theme.
   Warm bone paper, ink type, a single severity heat ramp. See docs/DESIGN.md. */

:root {
  /* surfaces */
  --paper: #f4f1ea;
  --surface: #fbf9f4;
  --surface-2: #ece7db;
  --line: #d9d2c2;
  --ink: #1c1a17;
  --muted: #6b655b;

  /* severity heat ramp — the only color. Each shade is tuned so white badge
     text clears WCAG AA (4.5:1); see docs/DESIGN.md. */
  --sev-critical: #b3122a;
  --sev-high: #b84d1b;
  --sev-medium: #8d680d;
  --sev-low: #4c7a3f;
  --sev-none: #736e63;
  --accent: #2b4a6f;   /* support: links / focus */

  --radius: 6px;
  --shadow: 0 1px 0 rgba(28,26,23,.04), 0 6px 18px -12px rgba(28,26,23,.35);
  --step: 8px;
  --ease: cubic-bezier(.2,.7,.3,1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, #fbf8f1 0%, var(--paper) 55%),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(28,26,23,.025) 27px 28px);
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-underline-offset: 2px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 20;
}
.skip-link:focus { left: 12px; top: 12px; }

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

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

.masthead {
  border-bottom: 2px solid var(--ink);
  background: linear-gradient(180deg, var(--surface), transparent);
}
.masthead__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: flex; gap: 16px; align-items: center; }
.brand__mark { color: var(--ink); display: block; }
.brand__mark svg { display: block; }
.brand__sweep {
  fill: var(--sev-critical);
  transform-origin: 20px 20px;
  animation: sweep 6s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }

.brand__name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 3rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}
.brand__tag {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 46ch;
}
.masthead__aside { display: flex; align-items: center; gap: 12px; }
.masthead__about {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; color: var(--muted);
  border-bottom: 1px solid transparent;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.masthead__about:hover { color: var(--ink); border-bottom-color: var(--ink); }
.masthead__stamp {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 5px 9px;
  margin: 4px 0 0;
  white-space: nowrap;
}

/* severity spectrum bar */
.spectrum {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.spectrum__seg {
  flex: 1 1 120px;
  min-width: 110px;
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 10px 12px;
  color: #fff;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
  transition: transform .14s var(--ease), box-shadow .14s var(--ease),
    opacity .14s var(--ease), filter .14s var(--ease);
}
.spectrum__seg:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -18px rgba(28,26,23,.55); }
.spectrum__seg:active { transform: translateY(0); }
.spectrum__seg.is-active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink);
}
.spectrum__seg.is-dimmed { opacity: .5; filter: saturate(.7); }
.spectrum__seg.is-dimmed:hover { opacity: 1; filter: none; }
.spectrum__count { font-size: 1.5rem; font-weight: 600; font-family: "Fraunces", serif; line-height: 1; }
.spectrum__label { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; opacity: .92; }

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

.wrap { max-width: 1120px; margin: 0 auto; padding: 24px; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.control { display: flex; flex-direction: column; gap: 5px; }
.control--search { flex: 1 1 260px; }
.control label {
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.control input, .control select {
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 11px;
  min-height: 44px;
  transition: border-color .16s var(--ease), background .16s var(--ease);
  appearance: none;
}
.control select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b655b' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.control input:hover, .control select:hover { border-color: var(--muted); }
.control input:focus, .control select:focus { border-color: var(--accent); background: var(--surface); }

.control__reset {
  font: inherit;
  cursor: pointer;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 5px;
  padding: 0 18px;
  min-height: 44px;
  transition: transform .12s var(--ease), background .16s var(--ease);
}
.control__reset:hover { background: #2f2b26; }
.control__reset:active { transform: translateY(1px); }

.resultline { color: var(--muted); font-size: 0.9rem; margin: 18px 2px 12px; }

.noscript {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--sev-high);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.noscript__title { font-family: "Fraunces", serif; font-weight: 600; margin: 0 0 6px; }
.noscript p { margin: 0; color: var(--muted); }

/* ---- feed ---------------------------------------------------------------- */

.feed { display: flex; flex-direction: column; gap: 14px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-left: 5px solid var(--sev, var(--sev-none));
  padding: 16px 18px 16px 20px;
  box-shadow: var(--shadow);
  transition: transform .14s var(--ease), box-shadow .14s var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 0 rgba(28,26,23,.05), 0 16px 30px -18px rgba(28,26,23,.5); }

.card__top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card__id {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.badge {
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600;
  color: #fff; background: var(--sev, var(--sev-none));
  padding: 3px 9px; border-radius: 999px;
}
.card__score {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  color: var(--muted);
}
.card__score b { color: var(--ink); font-weight: 600; }

.meter {
  height: 5px;
  margin-top: 12px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.meter__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width .3s var(--ease);
}

.card__blurb {
  margin: 11px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.45;
}
.card__desc { margin: 8px 0 0; color: var(--muted); font-size: 0.94rem; }

.card__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.vector {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 7px;
  color: var(--muted);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.tag {
  font-size: 0.74rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--ink);
}
.chip--cwe {
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--ink);
}
.card__date { margin-left: auto; font-size: 0.78rem; color: var(--muted); }

.card__refs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.ref {
  font-size: 0.76rem;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.ref:hover { background: var(--surface-2); border-color: var(--accent); }
.ref--nvd {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
}
.ref--nvd:hover { background: #22405f; }

/* ---- empty / footer ------------------------------------------------------ */

.empty { text-align: center; padding: 64px 20px; color: var(--muted); }
.empty__glyph { font-size: 3rem; opacity: .5; }
.empty__title { font-family: "Fraunces", serif; font-size: 1.3rem; color: var(--ink); margin: 8px 0 4px; }
.empty__reset {
  font: inherit; cursor: pointer;
  margin-top: 18px; min-height: 44px; padding: 0 20px;
  color: var(--paper); background: var(--ink);
  border: 1px solid var(--ink); border-radius: 5px;
  transition: transform .12s var(--ease), background .16s var(--ease);
}
.empty__reset:hover { background: #2f2b26; }
.empty__reset:active { transform: translateY(1px); }

.foot {
  max-width: 1120px; margin: 40px auto 0; padding: 22px 24px 48px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem;
}
.foot a { color: var(--accent); }
.foot__meta { font-family: "IBM Plex Mono", monospace; font-size: 0.76rem; margin-top: 6px; }
.foot__promo { margin-top: 14px; font-size: 0.82rem; }
.foot__promo a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.foot__promo a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* Tablet — keep the column but tighten gutters. */
@media (max-width: 768px) {
  .masthead__inner { padding: 22px 18px 14px; }
  .spectrum { padding: 0 18px 14px; }
  .wrap { padding: 18px; }
}

/* Phone — masthead stacks, spectrum wraps 2-up, meta rows unhook their
   auto margins so nothing is pushed off-screen (no horizontal scroll). */
@media (max-width: 560px) {
  .masthead__inner { flex-direction: column; gap: 12px; }
  .masthead__stamp { align-self: flex-start; }
  .spectrum__seg { flex: 1 1 calc(50% - 3px); min-width: 0; }
  .brand__name { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .card__score { margin-left: 0; }
  .card__date { margin-left: 0; }
  .card__top { gap: 8px; }
}

/* ---- about / SEO block (below the dashboard) ----------------------------- */

.about {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, var(--surface));
}
.about__inner { max-width: 760px; margin: 0 auto; padding: 44px 24px 8px; }
.about__h {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.about p { margin: 0 0 14px; max-width: 68ch; }
.about .vector { white-space: normal; overflow-wrap: anywhere; }
.about__h3 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.2rem;
  margin: 28px 0 10px;
}
.about__list { margin: 0; padding-left: 1.15rem; color: var(--ink); }
.about__list li { margin: 0 0 7px; max-width: 66ch; }
.about__faq { margin: 0; }
.about__faq dt {
  font-weight: 600;
  margin-top: 16px;
}
.about__faq dd { margin: 5px 0 0; color: var(--muted); max-width: 66ch; }

/* ---- landing page (shares tokens with the app) --------------------------- */

.masthead__stamp--link {
  text-decoration: none;
  color: var(--ink);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.masthead__stamp--link:hover { background: var(--ink); color: var(--paper); }

.lp { padding-top: 8px; padding-bottom: 8px; }

.lp-hero { padding: 40px 0 8px; max-width: 40ch; }
.lp-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}
.lp-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.04; letter-spacing: -0.02em;
  margin: 0; max-width: 18ch;
}
.lp-sub { color: var(--muted); font-size: 1.05rem; max-width: 60ch; margin: 18px 0 0; }

.lp-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.lp-btn {
  font: inherit; font-weight: 500;
  text-decoration: none;
  display: inline-flex; align-items: center;
  min-height: 46px; padding: 0 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); background: var(--surface);
  transition: transform .12s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.lp-btn:hover { border-color: var(--muted); transform: translateY(-2px); }
.lp-btn:active { transform: translateY(0); }
.lp-btn--primary {
  color: var(--paper); background: var(--ink); border-color: var(--ink);
  box-shadow: var(--shadow);
}
.lp-btn--primary:hover { background: #2f2b26; border-color: #2f2b26; }

/* vector → sentence, the wow in miniature */
.lp-translate {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  margin: 40px 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.lp-translate__tag {
  display: block;
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 8px;
}
.lp-translate__from .vector { display: inline-block; white-space: normal; word-break: break-word; }
.lp-translate__to .card__blurb { margin: 0; }
.lp-translate__arrow { font-size: 1.6rem; color: var(--sev-critical); }

/* feature list — editorial rows with a severity spine, not gray emoji cards */
.lp-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 40px 0;
}
.lp-feature {
  position: relative;
  padding: 18px 18px 18px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--sev, var(--sev-none));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.lp-feature__h { font-family: "Fraunces", serif; font-weight: 600; font-size: 1.15rem; margin: 0 0 6px; }
.lp-feature__p { color: var(--muted); font-size: 0.94rem; margin: 0; max-width: 52ch; }

.lp-final { text-align: center; padding: 48px 0 24px; }
.lp-final__h {
  font-family: "Fraunces", serif; font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 22px; letter-spacing: -0.02em;
}

@media (max-width: 700px) {
  .lp-translate { grid-template-columns: 1fr; }
  .lp-translate__arrow { transform: rotate(90deg); justify-self: start; }
  .lp-features { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .brand__sweep { animation: none; }
  .card { transition: none; }
  .lp-btn:hover, .spectrum__seg:hover, .card:hover { transform: none; }
}
