/* QDFS · Granbell UK — Post-Quantum TLS Inspection Terminal
   Themed to match www.granbell.uk: paper ground, ink type, cobalt accent,
   arc highlight, hairline borders. Self-hosted: no external assets, no
   web fonts, no third-party requests. */

:root {
  --paper: #f7f7f4;
  --surface: #ffffff;
  --ink: #0b0d12;
  --ink-2: #3b404c;
  --muted: #5c6270;
  --line: #e2e3de;
  --line-strong: #c9cbc4;
  --cobalt: #1f45e6;
  --cobalt-hover: #1737c0;
  --cobalt-soft: #e8edff;
  --arc: #19c3ff;
  --ok: #14a05a;
  --ok-text: #0e7a44;
  --warn: #b45309;
  --warn-soft: #fdf3e7;
  --error: #b42318;
  /* o app.js pinta o ponto do veredicto com estes nomes */
  --mint: #14a05a;
  --amber: #b45309;
  --red: #b42318;
  --error-soft: #fdf0ee;
  --sans: "Geist Variable", "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono Variable", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--paper); -webkit-text-size-adjust: 100%; color-scheme: only light; }

body {
  margin: 0;
  color: var(--ink);
  font: 15px/1.65 var(--sans);
  background: var(--paper);
  min-height: 100vh;
}

a { color: var(--cobalt); text-decoration: none; border-bottom: 1px solid #1f45e63d; }
a:hover { border-bottom-color: var(--cobalt); color: var(--cobalt-hover); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 28px 80px; }

/* ---------- top bar ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: #ffffffd9;
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .inner {
  max-width: 1080px; margin: 0 auto; padding: 13px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.mark {
  font: 700 12px/1 var(--mono); letter-spacing: .26em; text-transform: uppercase;
  color: var(--ink);
}
.mark small { display: block; margin-top: 6px; color: var(--muted); letter-spacing: .16em; font-weight: 400; }
.topnav { display: flex; gap: 18px; align-items: center; font: 12px/1 var(--mono); letter-spacing: .08em; }
.topnav a { border: 0; color: var(--muted); text-transform: uppercase; }
.topnav a:hover { color: var(--cobalt); }
/* botão de contacto no topo — leva ao formulário oficial do granbell.uk */
.topnav a.nav-cta {
  padding: 9px 16px; border-bottom: 1px solid var(--cobalt);
  font: 700 10.5px/1 var(--mono); letter-spacing: .12em;
  color: #ffffff; background: var(--cobalt);
}
.topnav a.nav-cta:hover {
  background: var(--cobalt-hover); border-color: var(--cobalt-hover); color: #ffffff;
}

/* ---------- hero ---------- */
.hero { padding: 56px 0 30px; border-bottom: 1px solid var(--line); }
.hero h1 {
  font: 600 clamp(28px, 4vw, 44px)/1.12 var(--sans);
  margin: 0 0 14px; letter-spacing: -.02em; color: var(--ink);
}
.hero p.lead { color: var(--ink-2); font-size: 17px; max-width: 70ch; margin: 0; }
.hero p.lead em { font-style: normal; border-bottom: 2px solid var(--arc); }
.kicker {
  font: 700 11px/1 var(--mono); letter-spacing: .28em; text-transform: uppercase;
  color: var(--cobalt); margin-bottom: 18px;
}

/* ---------- verdict ---------- */
.verdict {
  margin-top: 28px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 22px 24px; display: flex; gap: 18px; align-items: flex-start;
  border-left: 3px solid var(--line-strong);
}
.verdict .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.verdict h2 { font: 700 13px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; margin: 0 0 8px; color: var(--ink); }
.verdict p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.state-ok  { color: var(--ok-text); }
.state-warn{ color: var(--warn); }
.state-bad { color: var(--error); }
.verdict.ok   { border-left-color: var(--ok); }
.verdict.warn { border-left-color: var(--warn); }
.verdict.bad  { border-left-color: var(--error); }

/* ---------- sections ---------- */
section { margin-top: 46px; }
h2.sec {
  font: 700 12px/1 var(--mono); letter-spacing: .22em; text-transform: uppercase;
  color: var(--cobalt); margin: 0 0 5px;
}
h2.sec + .secsub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
h3 { font: 600 19px/1.3 var(--sans); margin: 26px 0 10px; color: var(--ink); }

/* ---------- data tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
caption { text-align: left; color: var(--muted); font: 12px/1.5 var(--mono); padding-bottom: 10px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 700 10.5px/1.4 var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); background: #f2f2ee; }
td.k { color: var(--muted); width: 34%; }
td.v { font-family: var(--mono); font-size: 13px; color: var(--ink); word-break: break-word; }
tr:hover td { background: #fbfbf9; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.card { border: 1px solid var(--line); background: var(--surface); padding: 18px 20px; }
.card h3 { margin: 0 0 8px; font: 700 11.5px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.card p { margin: 0; color: var(--ink-2); font-size: 14px; }
.card .tag { font: 700 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; padding: 4px 7px; border: 1px solid; display: inline-block; margin-bottom: 12px; }
.tag-yes { color: var(--ok-text); border-color: #14a05a66; background: #14a05a0f; }
.tag-no  { color: var(--error); border-color: #b4231866; background: #b423180f; }
.tag-nt  { color: var(--warn); border-color: #b4530966; background: var(--warn-soft); }

/* pre dentro de células de tabela não pode empurrar a página:
   quebra de linha em todas as larguras (copiar/colar mantém o conteúdo) */
td.v { word-break: break-word; overflow-wrap: anywhere; }
td.v pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
table { table-layout: auto; max-width: 100%; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font: 700 11.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: #ffffff; background: var(--cobalt); border: 1px solid var(--cobalt);
  padding: 12px 18px; cursor: pointer; border-bottom: 1px solid var(--cobalt);
}
.btn:hover { background: var(--cobalt-hover); border-color: var(--cobalt-hover); }
.btn.ghost { background: transparent; color: var(--cobalt); box-shadow: inset 0 0 0 1px #1f45e659; }
.btn.ghost:hover { background: var(--cobalt-soft); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn.on-dark { background: #ffffff; color: var(--ink); border-color: #ffffff; }
.btn.on-dark:hover { background: var(--arc); border-color: var(--arc); color: var(--ink); }

/* ---------- code ---------- */
pre {
  background: var(--ink); border: 1px solid var(--ink); border-left: 3px solid var(--arc);
  padding: 14px 16px; overflow-x: auto; font: 12.5px/1.7 var(--mono); color: #f2f5f7;
  margin: 12px 0;
}
code { font-family: var(--mono); font-size: .94em; color: var(--ink-2); }
pre code { color: inherit; }
.note { border-left: 2px solid var(--cobalt); padding: 4px 0 4px 14px; color: var(--ink-2); font-size: 14px; margin: 16px 0; }
.note strong { color: var(--ink); font-weight: 600; }

/* ---------- integrity ---------- */
.hash { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }
.sig { font-family: var(--mono); font-size: 11px; color: var(--muted); word-break: break-all; max-height: 96px; overflow: auto; }

/* ---------- tabelas densas (matriz de clientes, QDFS vs NIST) ---------- */
#matrix table, #nist table { font-size: 12.5px; }
/* tabela 05: a 1.ª coluna encolhe até ao maior texto e a coluna STATUS não transborda */
#nist th:first-child, #nist td:first-child { width: 1%; white-space: nowrap; }
#nist th:last-child, #nist td:last-child { width: 1%; white-space: nowrap; }
#nist th:last-child { text-align: left; }
#nist td:last-child { word-break: normal; overflow-wrap: normal; }
#nist .pill { padding: 3px 8px; }
#matrix th, #matrix td, #nist th, #nist td { padding: 9px 10px; }
#matrix th, #nist th { font-size: 9.5px; letter-spacing: .1em; }
#matrix td.k, #matrix td.v, #nist td.k, #nist td.v { line-height: 1.5; }
#matrix td:first-child { min-width: 118px; }

/* ---------- 02 · Certificate analysis — moldura do bloco ---------- */
#certificates {
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--cobalt);
  padding: 24px 26px 22px;
  background: var(--surface);
}
#certificates .card { border-color: var(--line-strong); background: var(--paper); }
#certificates .grid { gap: 16px; }

/* ---------- status pills (QDFS vs NIST) ---------- */
.pill {
  display: inline-block; padding: 3px 9px; border: 1px solid var(--line-strong);
  font: 700 9.5px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap; word-break: keep-all;
}
.pill.ok { color: var(--ok-text); border-color: #14a05a55; background: #14a05a0d; }
.pill.warn { color: var(--warn); border-color: #b4530955; background: var(--warn-soft); }
.pill.muted { color: var(--muted); background: #f2f2ee; }

/* ---------- final call to action ---------- */
.cta-end {
  margin-top: 56px; padding: 30px 0 34px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px;
}
.cta-end .kicker { margin-bottom: 0; color: var(--muted); font-size: 10px; letter-spacing: .22em; }
.cta-end .btn { padding: 14px 22px; }
.arrow { font-size: .95em; line-height: 1; }

/* ---------- footer ---------- */
footer { margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font: 12px/1.8 var(--mono); }
footer .row { display: flex; flex-wrap: wrap; gap: 8px 26px; justify-content: space-between; }

/* ---------- thank-you page ---------- */
.thanks { max-width: 720px; margin: 0 auto; padding: 88px 28px 120px; }
.thanks h1 { font: 600 clamp(26px,3.4vw,38px)/1.15 var(--sans); letter-spacing: -.02em; margin: 0 0 14px; }
.thanks p { color: var(--ink-2); font-size: 16px; }
.thanks .kicker { color: var(--cobalt); }

/* ---------- print ---------- */

/* a topbar passou a ter 6 links: em ecrãs estreitos tem de quebrar linha */
@media (max-width: 900px) {
  .topbar { position: static; }
  .topbar .inner { flex-wrap: wrap; gap: 10px 16px; }
  .topnav { flex-wrap: wrap; gap: 10px 14px; }
  .mark { font-size: 11px; letter-spacing: .18em; white-space: nowrap; }
  .mark small { letter-spacing: .12em; }
}
@media print {
  body { background: #fff; color: #111; }
  .contact-band, .topbar, .btn, footer { display: none; }
  .verdict, .card, table pre { border-color: #ccc; background: #fff; }
}

@media (max-width: 640px) {
  .wrap, .topbar .inner,
  .hero { padding-top: 36px; }
  td.k { width: 42%; }
}

/* ---------- utilities (CSP: style-src 'self' blocks inline styles) ---------- */
.mt16 { margin-top: 16px; }
.mt8 { margin-top: 8px; }
.th-plain { text-transform: none; letter-spacing: 0; }

/* verdict dot: colour comes from the class, dot paints with currentColor */
.verdict .dot { background: currentColor; }
.verdict .dot.idle { color: #7d93a5; }
.verdict .dot.ok { color: var(--mint); }
.verdict .dot.warn { color: var(--amber); }
.verdict .dot.bad { color: var(--red); }

/* round 2 utilities */
.mt22 { margin-top: 22px; }
.mt26 { margin-top: 26px; }
.pre-tight { margin: 8px 0 0; }
.text-bad { color: var(--red); }
.note-ok { border-left-color: var(--mint); }
.foot-note { font-size: 13px; color: var(--muted); margin-top: 34px; }
/* .card p{margin:0} wins on specificity — restore the intended spacing */
.card p.mt16 { margin-top: 16px; }

/* ---------- section 06 — column balance ---------- */
.tscroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nist-std { table-layout: fixed; width: 100%; }
.nist-std th, .nist-std td, .nist-custody th, .nist-custody td { box-sizing: border-box; }
.nist-std col.c-spec { width: 25%; }
.nist-std col.c-req  { width: 31%; }
.nist-std col.c-qdfs { width: 31%; }
.nist-std col.c-st   { width: 13%; }
.nist-std td.k { width: auto; padding-right: 20px; overflow-wrap: anywhere; }
.nist-std td, .nist-custody td { vertical-align: top; }
.nist-std td.v .pill { display: inline-block; margin: 0 0 4px; }
.nist-std th:nth-child(4), .nist-std td:nth-child(4) { padding-left: 0; }
.nist-std td:nth-child(4) { white-space: normal; }
#nist .nist-std th:first-child, #nist .nist-std td:first-child,
#nist .nist-std th:last-child,  #nist .nist-std td:last-child { width: auto; white-space: normal; }
#nist .nist-custody td, #nist .nist-custody th { width: auto; white-space: normal; }
#nist .nist-custody td.v { overflow-wrap: anywhere; }
#nist .nist-std td:last-child .pill { margin: 0 6px 4px 0; }
.nist-custody { table-layout: fixed; }
.nist-custody col.c-k { width: 30%; }
.nist-custody col.c-v { width: 70%; }
.nist-custody td.k { width: auto; }

@media (max-width: 720px) {
  .nist-std, .nist-std tbody, .nist-std tr, .nist-std td,
  .nist-custody, .nist-custody tbody, .nist-custody tr, .nist-custody td { display: block; width: auto; }
  .nist-std thead, .nist-std colgroup { display: none; }
  .nist-std caption, .nist-custody caption { display: block; text-align: left; }
  .nist-std td, .nist-custody td { border: 0; padding: 2px 0; }
  .nist-std tr, .nist-custody tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nist-std td:before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font: 700 9.5px/1.7 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  }
  .nist-std td.k { font-family: var(--mono); font-size: 13px; color: var(--ink); }
  .nist-std td:last-child .pill { margin-top: 2px; }
  .nist-std col.c-spec { width: 28%; }
  .nist-std col.c-st { width: 22%; }
}
