/* ==========================================================================
   Crypto-View — QComply design system applied.

   Every colour and every spacing step comes from tokens.css; no hex value is
   retyped here. The rules that are easy to break and hard to notice:

   * two typefaces, Barlow Condensed for display and Barlow for text, with
     IBM Plex Mono reserved for algorithm names, paths and code
   * 2px corners, 4px on buttons, round only on status pills
   * no gradient, no glow, no shadow on a card — a hairline instead
   * navy is punctuation: the header, the footer and one stat strip
   * every section heading carries an eyebrow
   ========================================================================== */

@import url('../tokens/tokens.css');

/* -------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--qc-paper-100);
  color: var(--qc-ink-800);
  font: 400 16px/1.62 'Barlow', system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 {
  font-family: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.08;
  margin: 0;
}

h1 { font-size: 60px; }
h2 { font-size: 36px; }
h3 { font-size: 24px; }
h4 { font-size: 19px; }

p { margin: 0 0 16px; max-width: 68ch; }
a { color: var(--qc-blue-600); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--qc-blue-700); }
code, kbd, .mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.88em;
}
hr { border: 0; border-top: 1px solid var(--qc-paper-300); margin: 48px 0; }

/* ---------------------------------------------------------- primitives */

.eyebrow {
  font: 600 11px/1.2 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--qc-fg-subtle, #646D79);
  margin: 0 0 12px;
  display: block;
}

.standfirst {
  font-size: 18px;
  color: var(--qc-fg-muted, #5A6472);
  max-width: 68ch;
  margin-top: 16px;
}

.shell { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--qc-paper-300); }
.rule { border-top: 1px solid var(--qc-paper-300); padding-top: 24px; }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.card {
  background: var(--qc-paper-000);
  border: 1px solid var(--qc-paper-300);
  border-radius: 2px;
  padding: 24px;
  box-shadow: none;
}

.callout {
  border-left: 3px solid var(--qc-blue-500);
  background: var(--qc-blue-100);
  padding: 20px 24px;
  margin: 24px 0;
}
.callout p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border: 0;
  border-radius: 4px;
  font: 600 14px/1 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.button-primary { background: var(--qc-blue-600); color: #fff; }
.button-primary:hover { background: var(--qc-blue-700); color: #fff; }
.button-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.button-secondary {
  background: transparent;
  color: var(--qc-ink-800);
  border: 1px solid var(--qc-paper-400);
}
.button-secondary:hover { border-color: var(--qc-ink-600); color: var(--qc-ink-800); }
.button-onnavy { background: var(--qc-ink-200); color: var(--qc-ink-800); }
.button:focus-visible { outline: 2px solid var(--qc-blue-500); outline-offset: 2px; }

/* --------------------------------------------------------- status pill */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font: 600 11px/1 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.pill-vulnerable, .pill-critical { background: #FAEAE9; color: #A83A32; }
.pill-broken, .pill-high        { background: #FAEAE9; color: #A83A32; }
.pill-reduced, .pill-medium     { background: #FBF1E2; color: #96620F; }
.pill-unknown, .pill-low        { background: var(--qc-paper-200); color: #646D79; }
.pill-safe                      { background: #E6F2EE; color: #1F7A5C; }
.pill-info                      { background: var(--qc-blue-100); color: var(--qc-blue-600); }

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

.masthead {
  height: 72px;
  background: var(--qc-ink-800);
  color: var(--qc-paper-100);
  display: flex;
  align-items: center;
}
.masthead .shell { display: flex; align-items: center; gap: 32px; width: 100%; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--qc-paper-100);
  text-decoration: none;
}
.brand svg { width: 26px; height: 26px; color: var(--qc-ink-200); flex: none; }
.brand-name {
  font: 600 22px/1 'Barlow Condensed', sans-serif;
  letter-spacing: 0.005em;
}
.brand-name em { font-style: normal; color: var(--qc-ink-200); }
.masthead nav { margin-left: auto; display: flex; align-items: center; gap: 28px; }
.masthead nav a {
  color: rgba(242, 242, 243, 0.78);
  font-size: 14px;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.masthead nav a:hover { color: var(--qc-paper-100); }
.masthead nav a[aria-current="page"] {
  color: var(--qc-paper-100);
  border-bottom-color: var(--qc-ink-200);
}

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

.colophon {
  background: var(--qc-ink-800);
  color: var(--qc-paper-100);
  padding: 48px 0 40px;
  margin-top: 64px;
}
.colophon .shell { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; }
.colophon a { color: var(--qc-ink-200); }
.colophon-thesis {
  font: 600 20px/1.2 'Barlow Condensed', sans-serif;
  color: var(--qc-paper-100);
  text-align: right;
  max-width: 30ch;
  justify-self: end;
}
.colophon-meta {
  margin-top: 24px;
  font-size: 12px;
  color: var(--qc-ink-400);
  grid-column: 1 / -1;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
}
.colophon-meta img { height: 20px; width: auto; }
.colophon-links { display: flex; gap: 20px; flex-wrap: wrap; }

/* ---------------------------------------------------------- stat strip */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--qc-ink-800);
  border-top: 2px solid rgba(255, 255, 255, 0.28);
  color: var(--qc-paper-100);
}
.stats > div { padding: 20px 24px; border-left: 1px solid rgba(255, 255, 255, 0.18); }
.stats > div:first-child { border-left: 0; }
.stats .figure {
  font: 400 40px/1 'Barlow Condensed', sans-serif;
  color: var(--qc-ink-200);
  display: block;
}
.stats .label {
  font-size: 12px;
  line-height: 1.4;
  color: rgba(242, 242, 243, 0.72);
  margin-top: 8px;
  display: block;
}

/* --------------------------------------------------------------- table */

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
  font: 600 11px/1.2 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--qc-fg-subtle, #646D79);
  text-align: left;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--qc-paper-400);
  white-space: nowrap;
}
table.data tbody td {
  padding: 14px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--qc-paper-300);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .identifier { font-weight: 700; }
table.data .qualifier {
  display: block;
  font-size: 12px;
  color: var(--qc-fg-subtle, #646D79);
  font-weight: 400;
}
table.data .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

/* ------------------------------------------------------------- tooltip */

.term {
  border-bottom: 1px dotted var(--qc-paper-500);
  cursor: help;
}
.term:focus-visible { outline: 2px solid var(--qc-blue-500); outline-offset: 2px; }
#tooltip {
  position: absolute;
  z-index: 40;
  max-width: 300px;
  background: var(--qc-ink-800);
  color: var(--qc-paper-100);
  border-radius: 2px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  pointer-events: none;
}
#tooltip[hidden] { display: none; }
#tooltip strong {
  display: block;
  font: 600 11px/1.2 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--qc-ink-200);
  margin-bottom: 6px;
}

/* ---------------------------------------------------------- scan form */

.scan-form { margin-top: 32px; max-width: 720px; }
.scan-form label {
  font: 600 11px/1.2 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--qc-fg-subtle, #646D79);
  display: block;
  margin-bottom: 8px;
}
.field-row { display: flex; gap: 12px; }
.scan-form input[type="url"], .scan-form input[type="text"], .search input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--qc-paper-400);
  border-radius: 2px;
  background: var(--qc-paper-000);
  font: 400 15px/1 'IBM Plex Mono', monospace;
  color: var(--qc-ink-800);
  min-width: 0;
}
.scan-form input:focus, .search input:focus {
  outline: 2px solid var(--qc-blue-500);
  outline-offset: -1px;
  border-color: var(--qc-blue-500);
}
.form-note { font-size: 13px; color: var(--qc-fg-subtle, #646D79); margin-top: 12px; }
.form-error {
  color: #A83A32;
  background: #FAEAE9;
  border-left: 3px solid #A83A32;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 14px;
}
.form-error[hidden] { display: none; }

.progress { margin-top: 24px; }
.progress[hidden] { display: none; }
.progress-track { height: 4px; background: var(--qc-paper-300); overflow: hidden; }
.progress-bar {
  height: 100%;
  width: 20%;
  background: var(--qc-blue-500);
  transition: width 600ms ease;
}
.progress-label {
  font: 600 11px/1.2 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--qc-fg-subtle, #646D79);
  margin-bottom: 8px;
  display: block;
}

/* ------------------------------------------------------------- posture */

.posture-bar {
  display: flex;
  height: 10px;
  overflow: hidden;
  border: 1px solid var(--qc-paper-300);
  margin: 16px 0 12px;
}
.posture-bar span { display: block; height: 100%; }
.posture-vulnerable, .posture-broken { background: #A83A32; }
.posture-reduced { background: #96620F; }
.posture-unknown { background: var(--qc-paper-400); }
.posture-safe { background: #1F7A5C; }
.posture-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--qc-fg-muted, #5A6472);
}
.posture-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: baseline;
}

.score {
  font: 400 60px/1 'Barlow Condensed', sans-serif;
  color: var(--qc-ink-800);
  display: block;
}
.score-out-of { font-size: 20px; color: var(--qc-fg-subtle, #646D79); }

/* ------------------------------------------------------------ findings */

.finding {
  border-top: 1px solid var(--qc-paper-300);
  padding: 20px 0;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 24px;
}
.finding-meta { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.finding-algorithm {
  font: 600 17px/1.2 'IBM Plex Mono', monospace;
  word-break: break-word;
}
.finding-location {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--qc-fg-subtle, #646D79);
  word-break: break-all;
}
.finding-snippet {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  background: var(--qc-paper-200);
  border-left: 2px solid var(--qc-paper-400);
  padding: 8px 12px;
  margin: 10px 0;
  overflow-x: auto;
  white-space: pre;
}
.finding p { margin: 0 0 8px; }
.finding .plain { color: var(--qc-fg-muted, #5A6472); }
.finding .remediation { border-left: 3px solid var(--qc-blue-500); padding-left: 12px; }
.finding-rule {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--qc-fg-subtle, #646D79);
}
.severity-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 48px 0 0;
}

/* ------------------------------------------------------------- history */

.search { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.search select {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--qc-paper-400);
  border-radius: 2px;
  background: var(--qc-paper-000);
  font: 400 14px/1 'Barlow', sans-serif;
  color: var(--qc-ink-800);
}
.pagination { display: flex; gap: 8px; margin-top: 32px; align-items: center; }
.pagination span { font-size: 14px; color: var(--qc-fg-subtle, #646D79); }

.empty {
  border: 1px dashed var(--qc-paper-400);
  padding: 40px 24px;
  text-align: center;
  color: var(--qc-fg-muted, #5A6472);
}

/* ------------------------------------------------------------ contents */

.contents { position: sticky; top: 24px; }
.contents ol { list-style: none; margin: 0; padding: 0; }
.contents li { border-top: 1px solid var(--qc-paper-300); }
.contents a { display: block; padding: 10px 0; font-size: 14px; text-decoration: none; }

.terms-list dt {
  font: 600 15px/1.3 'IBM Plex Mono', monospace;
  margin-top: 20px;
}
.terms-list dd {
  margin: 6px 0 0;
  color: var(--qc-fg-muted, #5A6472);
  max-width: 68ch;
}

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

@media (max-width: 900px) {
  h1 { font-size: 40px; }
  h2 { font-size: 28px; }
  .grid-2, .grid-3, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(3) { border-left: 0; }
  .colophon .shell { grid-template-columns: minmax(0, 1fr); }
  .colophon-thesis { text-align: left; justify-self: start; }
  .finding { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .finding-meta { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .masthead { height: auto; padding: 12px 0; }
  .masthead .shell { flex-wrap: wrap; gap: 12px 20px; }
  .masthead nav { margin-left: 0; gap: 18px; flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .stats > div { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.18); }
  .stats > div:first-child { border-top: 0; }
  .field-row { flex-direction: column; }
}

@media print {
  .masthead nav, .scan-form, .pagination { display: none; }
  body { background: #fff; }
}
