/* Design aligned with https://notebook.link/ — dark theme, Work Sans, blue + yellow accents */

:root {
  color-scheme: dark;

  --primary: #1876d2;
  --primary-hover: #1a85eb;
  --primary-foreground: #e8e9eb;

  --secondary: #f6f07e;
  --secondary-hover: #f9f5a8;
  --secondary-foreground: #1d283a;

  --bg-body: #0f1729;
  --bg-page: #1e222c;
  --surface-card: #374762;
  --surface-card-hover: #3f5270;
  --surface-elevated: #232f40;

  --text: #ebeef0;
  --text-muted: #a8b0bd;
  --muted: var(--text-muted);
  --text-subtle: #7d8798;

  --border: #4a5d7a;
  --border-subtle: #303848;
  --border-focus: #f6f07e;

  --danger: #e5484d;
  --danger-bg: rgba(229, 72, 77, 0.14);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.14);
  --ok: #30a46c;
  --ok-bg: rgba(48, 164, 108, 0.14);
  --unknown: #9b8afb;
  --unknown-bg: rgba(155, 138, 251, 0.14);

  --sev-critical: #f97066;
  --sev-critical-bg: rgba(249, 112, 102, 0.16);
  --sev-high: #fdb022;
  --sev-high-bg: rgba(253, 176, 34, 0.16);
  --sev-medium: #fec84b;
  --sev-medium-bg: rgba(254, 200, 75, 0.14);
  --sev-low: #6ce9a6;
  --sev-low-bg: rgba(108, 233, 166, 0.12);
  --sev-unknown: #94a3b8;
  --sev-unknown-bg: rgba(148, 163, 184, 0.12);

  --radius: 12px;
  --radius-sm: 4px;
  --radius-pill: 999px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);

  --font-sans: "Work Sans", ui-sans-serif, system-ui, sans-serif;
  --font-heading: "Inter", var(--font-sans);
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;

  --nav-height: 4rem;
  --content-max: 72rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  background: var(--bg-body);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* —— Site chrome (notebook.link-style nav + shell) —— */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-height);
  background: var(--secondary);
  border-bottom: 1px solid rgba(29, 40, 58, 0.08);
}

.site-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
}

@media (min-width: 768px) {
  .site-nav-inner {
    padding: 0 2.5rem;
  }
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--secondary-foreground);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-logo:hover {
  color: var(--secondary-foreground);
  text-decoration: none;
  opacity: 0.92;
}

.site-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  background: var(--secondary-foreground);
  color: var(--secondary);
  font-size: 0.72rem;
  font-weight: 700;
}

.site-nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

.site-nav-links a {
  color: var(--secondary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav-links a:hover {
  color: var(--secondary-foreground);
  text-decoration: underline;
}

.site-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  background: var(--bg-page);
  min-height: calc(100vh - var(--nav-height));
}

.site-main {
  flex: 1;
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.25rem 3rem;
}

@media (min-width: 768px) {
  .site-main {
    padding: 2.5rem 2.5rem 4rem;
  }
}

/* —— Hero —— */

.hero {
  margin-bottom: 2rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero-lead {
  margin: 0;
  max-width: 42rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* Legacy header (docs pages) */
header:not(.hero) {
  margin-bottom: 1.5rem;
}

header:not(.hero) h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

header:not(.hero) p {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
}

/* —— Cards & panels —— */

.dropzone {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-card);
  padding: 2.75rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--surface-card-hover);
  box-shadow: var(--shadow);
}

.dropzone strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.dropzone span {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.url-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1.25rem;
}

.url-row label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.url-row input[type="url"],
.url-row input[type="text"],
.toolbar input[type="search"],
.toolbar select,
.controls input[type="text"] {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.url-row input:focus,
.toolbar input:focus,
.toolbar select:focus,
.controls input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(246, 240, 126, 0.25);
}

.url-hint {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  line-height: 1.45;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
  margin-top: 1.25rem;
}

.controls-secondary {
  margin-top: 0.875rem;
  flex-direction: column;
  align-items: flex-start;
}

/* —— Buttons —— */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button:hover:not(:disabled),
.button:hover {
  background: var(--surface-card-hover);
}

button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

button.primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

button.secondary-accent {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--secondary-foreground);
}

button.secondary-accent:hover:not(:disabled) {
  background: var(--secondary-hover);
  border-color: var(--secondary-hover);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#updated-lockfile-download {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
}

#updated-lockfile-download:hover {
  background: var(--secondary-hover);
  color: var(--secondary-foreground);
  text-decoration: none;
}

/* —— Status & progress —— */

.status {
  margin-top: 1.25rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: none;
}

.status.visible {
  display: block;
}

.status.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(229, 72, 77, 0.35);
}

.status.loading {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.scan-progress {
  margin: 1.25rem 0 0.5rem;
  padding: 1rem 1.125rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.scan-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.scan-progress-track {
  height: 6px;
  background: var(--surface-elevated);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.scan-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

/* —— Report —— */

.report {
  margin-top: 2rem;
  display: none;
}

.report.visible {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
}

.stat-card .value {
  font-family: var(--font-heading);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.toolbar input[type="search"] {
  flex: 1;
  min-width: 11rem;
}

.toolbar select {
  min-width: 9rem;
}

.info-notice,
.warnings {
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
}

.info-notice {
  border-left: 3px solid var(--primary);
}

.warnings {
  border-left: 3px solid var(--warn);
}

.info-notice ul,
.warnings ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.package-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.package-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.package-card:hover {
  border-color: var(--border);
}

.package-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.875rem 1rem;
  cursor: pointer;
  user-select: none;
}

.package-header:hover {
  background: var(--surface-card-hover);
}

.package-title {
  font-weight: 600;
  font-size: 0.9375rem;
  flex: 1;
  min-width: 10rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge.muted {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
}

.package-body {
  display: none;
  border-top: 1px solid var(--border-subtle);
  padding: 0 1rem 1rem;
  background: rgba(15, 23, 41, 0.35);
}

.package-card.expanded .package-body {
  display: block;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.8125rem;
}

.detail-grid dt {
  color: var(--text-subtle);
  font-weight: 500;
}

.detail-grid dd {
  margin: 0.15rem 0 0;
}

.coverage-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8125rem;
}

.coverage-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.coverage-list li:last-child {
  border-bottom: none;
}

.cve-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.cve-table th,
.cve-table td {
  text-align: left;
  padding: 0.5rem 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.cve-table th {
  color: var(--text-subtle);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cve-table tbody tr {
  border-left: 3px solid transparent;
}

.cve-table tbody tr.sev-row-critical {
  border-left-color: var(--sev-critical);
  background: var(--sev-critical-bg);
}

.cve-table tbody tr.sev-row-high {
  border-left-color: var(--sev-high);
  background: var(--sev-high-bg);
}

.cve-table tbody tr.sev-row-medium {
  border-left-color: var(--sev-medium);
  background: var(--sev-medium-bg);
}

.cve-table tbody tr.sev-row-low {
  border-left-color: var(--sev-low);
  background: var(--sev-low-bg);
}

.cve-table tbody tr.sev-row-unknown {
  border-left-color: var(--sev-unknown);
}

.sev-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sev-badge.critical {
  background: var(--sev-critical-bg);
  color: var(--sev-critical);
}

.sev-badge.high {
  background: var(--sev-high-bg);
  color: var(--sev-high);
}

.sev-badge.medium {
  background: var(--sev-medium-bg);
  color: var(--sev-medium);
}

.sev-badge.low {
  background: var(--sev-low-bg);
  color: var(--sev-low);
}

.sev-badge.unknown {
  background: var(--sev-unknown-bg);
  color: var(--sev-unknown);
}

/* —— Collapsible info panels —— */

.info-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  margin-bottom: 0.875rem;
  font-size: 0.875rem;
}

.info-panel summary {
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  list-style: none;
}

.info-panel a {
  color: var(--primary);
}

.update-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.section-label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-label-spaced {
  margin-top: 1rem;
}

.package-version-muted {
  font-weight: 400;
  color: var(--text-muted);
}

  display: none;
}

.info-panel summary::before {
  content: "▸ ";
  color: var(--secondary);
  font-size: 0.85em;
}

.info-panel[open] summary::before {
  content: "▾ ";
}

.panel-subhead {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin: 1.5rem 0 0.5rem;
}

.format-list {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

code,
.cve-id {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.info-panel code {
  background: var(--surface-elevated);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.severity-guide table,
.info-panel .api-endpoints-table {
  width: 100%;
  margin-top: 0.75rem;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.severity-guide th,
.severity-guide td,
.info-panel .api-endpoints-table th,
.info-panel .api-endpoints-table td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.severity-guide p {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.severity-guide p:first-of-type {
  color: var(--text);
}

.severity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.info-panel pre.api-snippet {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  margin: 0.35rem 0 0.5rem;
}

.ref-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ref-links a {
  font-size: 0.75rem;
  text-decoration: none;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.ref-links a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.empty-cves {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

.empty-cves.uncertain {
  color: var(--warn);
}

/* —— Footer —— */

.site-footer {
  margin-top: auto;
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-body);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer p {
  margin: 0 0 0.5rem;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

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

.site-footer .footer-nvd {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--secondary);
}

/* —— Documentation pages —— */

.doc-page {
  flex: 1;
  max-width: 52rem;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.25rem 3rem;
}

@media (min-width: 768px) {
  .doc-page {
    padding: 2.5rem 2.5rem 4rem;
  }
}

.doc-page h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 0;
}

.doc-page h2 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 2rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.doc-page h3 {
  font-size: 1rem;
  margin-top: 1.25rem;
}

.doc-page p,
.doc-page li {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.doc-page p strong,
.doc-page li strong {
  color: var(--text);
}

.doc-page a.back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.doc-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1rem 0;
}

.doc-page th,
.doc-page td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.doc-page pre {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  margin-right: 0.35rem;
  vertical-align: middle;
}

.method.get {
  background: var(--ok-bg);
  color: var(--ok);
}

.method.post {
  background: rgba(24, 118, 210, 0.18);
  color: var(--primary);
}

.doc-page .endpoint-path {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.doc-page .note {
  background: var(--warn-bg);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin: 1rem 0;
  color: var(--text-muted);
}

.doc-page .note strong {
  color: var(--text);
}
