/* CVE Data Quality Explorer — Opteryx brand system (light only; the brand has no dark variant) */

@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/space-grotesk-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/ibm-plex-sans-200.woff2') format('woff2');
  font-weight: 200; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/ibm-plex-sans-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/ibm-plex-sans-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* Brand palette */
  --opteryx-teal: #07797C;
  --opteryx-orange: #CA4C00; /* readability variant of brand orange #FE7701 */
  --opteryx-navy: #1F2E61;
  --opteryx-pale-teal: #F3FBFA;

  --page: #F6F8FB;
  --surface: #FFFFFF;
  --text-primary: #1F2E61;
  --text-secondary: #3D4A4E;
  --text-muted: #5F6B78;
  --gridline: #EEF3F5;
  --baseline: #D9E2E8;
  --border: rgba(61, 74, 78, 0.08);
  --accent-ring: rgba(7, 121, 124, 0.18);
  --accent-soft: rgba(7, 121, 124, 0.08);

  --series-1: #07797C; /* teal — primary series */
  --series-2: #1F2E61; /* navy */
  --series-3: #C89427; /* gold */
  --series-4: #188038; /* success green */
  --series-5: #CA4C00; /* orange — emphasis / "look here" (readability variant) */

  --status-good: #188038;
  --status-warning: #FFA503;
  --status-serious: #C89427;
  --status-critical: #D50000;

  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --r-card: 12px;
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.035);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--page);
  color: var(--text-secondary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--opteryx-orange);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--opteryx-teal);
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--opteryx-pale-teal);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---------- Header ---------- */
header {
  padding: 2.5rem 1.5rem 0.75rem;
  max-width: 1240px;
  margin: 0 auto;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.brand-lockup img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.brand-lockup span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.brand-lockup:hover span {
  color: var(--opteryx-teal);
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--opteryx-navy);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(31, 46, 97, 0.15);
  transition: filter 150ms ease;
}

.cta-button:hover {
  filter: brightness(1.12);
  color: #ffffff;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.15;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0.6rem 0 0;
  color: var(--text-muted);
  max-width: 72ch;
  line-height: 1.6;
  font-size: 0.95rem;
}

.subtitle a {
  color: var(--text-muted);
  text-decoration-color: var(--baseline);
}
.subtitle a:hover {
  color: var(--opteryx-teal);
}

/* ---------- Filter bar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1240px;
  margin: 0 auto;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.filter select,
.filter input[type="search"] {
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--baseline);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  min-width: 160px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* Custom chevron so there's breathing room to the right of the arrow. */
.filter select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%235F6B78' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.3rem;
}

.filter select:focus,
.filter input[type="search"]:focus {
  border-color: var(--opteryx-teal);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.severity-toggles {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.severity-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--baseline);
  background: var(--surface);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

/* Hide the native checkbox — the pill's own filled/outline state is the toggle,
   so a square checkbox inside a round pill doesn't fight the shape language. */
.severity-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.severity-toggle:hover {
  border-color: var(--opteryx-teal);
}

.severity-toggle[data-active="true"] {
  color: #ffffff;
  border-color: var(--opteryx-teal);
  background: var(--opteryx-teal);
}

.status-line {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.status-line .err {
  color: var(--status-critical);
}

/* ---------- Hero / stat tiles ---------- */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 1rem;
  padding: 0.25rem 1.5rem 1.5rem;
  max-width: 1240px;
  margin: 0 auto;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 1.1rem 1.3rem;
}

.stat-tile .label {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-tile .value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.85rem;
  margin-top: 0.25rem;
  color: var(--text-primary);
}

.stat-tile .sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ---------- Dashboard grid ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(420px, 1fr));
  gap: 1rem;
  padding: 0 1.5rem 2rem;
  max-width: 1240px;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  min-height: 300px;
  transition: opacity 150ms ease;
}

.card.is-loading .chart-area {
  opacity: 0.45;
}

.card-wide {
  grid-column: span 2;
}

.card-header {
  padding: 1.2rem 1.4rem 0.3rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.card-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.card-header .card-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-source {
  padding: 0 1.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: -0.1rem 0 0.5rem;
  line-height: 1.5;
}

.card-footnote {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Centered single-figure block (scored vs unscored panel) */
.stat-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  gap: 0.6rem;
}

.stat-figure .figure-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 2.4rem;
  color: var(--text-primary);
}

.stat-figure .figure-sub {
  color: var(--text-secondary);
  font-size: 0.85rem;
  max-width: 34ch;
}

.stat-figure .figure-bars {
  width: 100%;
  max-width: 420px;
}

.card-body {
  padding: 0 1.4rem 1.4rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  position: relative;
}

.chart-area {
  flex: 1;
  min-height: 180px;
  position: relative;
}

.chart-area svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  font-family: var(--font-mono);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.legend-line {
  width: 14px;
  height: 2px;
  display: inline-block;
  border-radius: 2px;
}

/* gridlines / axis */
.chart-grid line {
  stroke: var(--gridline);
  stroke-width: 1;
}

.chart-axis text {
  fill: var(--text-muted);
  font-size: 10.5px;
}

.chart-baseline {
  stroke: var(--baseline);
  stroke-width: 1;
}

.data-label {
  fill: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
}

/* tooltip */
.viz-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--text-primary);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  z-index: 50;
  opacity: 0;
  transition: opacity 100ms ease;
  max-width: 240px;
  color: #ffffff;
}

.viz-tooltip.visible {
  opacity: 1;
}

.viz-tooltip .tt-title {
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.3rem;
}

.viz-tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: space-between;
}

.viz-tooltip .tt-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255, 255, 255, 0.8);
}

.viz-tooltip .tt-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.viz-tooltip .tt-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #ffffff;
}

.mark-bar {
  transition: opacity 100ms ease;
}

.mark-bar:hover,
.mark-bar.hovered {
  opacity: 0.82;
}

.hit-area {
  fill: transparent;
  cursor: pointer;
}

/* footer */
footer {
  padding: 1.75rem 1.5rem;
  max-width: 1240px;
  margin: 0 auto 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

footer p {
  margin: 0 0 0.5rem;
  font-size: inherit;
  color: inherit;
  line-height: 1.6;
}

footer p:last-child {
  margin-bottom: 0;
}

.banner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.banner-inner {
  background: rgba(255, 165, 3, 0.08);
  border: 1px solid var(--status-warning);
  color: var(--text-secondary);
  border-radius: var(--r-card);
  padding: 0.7rem 1.1rem;
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .card-wide {
    grid-column: span 1;
  }
  .hero-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .status-line {
    margin-left: 0;
    text-align: left;
  }
}
