/* Drafting-sheet aesthetic: Cynbit talks in blueprints, so the audit reads like a survey
   of one. Cool paper, ink-navy type, one blueprint accent, severity carried by colour + text. */
:root {
  --paper: #f3f6f9;
  --sheet: #ffffff;
  --ink: #172235;
  --ink-soft: #4a5a70;
  --line: #c9d3df;
  --line-soft: #e2e8ef;
  --blue: #1d4f91;
  --blue-wash: #e7eef8;
  --code-bg: #eef2f7;
  --critical: #8e1b3a;
  --high: #b42318;
  --medium: #a64a07;
  --low: #2e6f95;
  --info: #5d6b7e;
  --sans: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1726;
    --sheet: #132034;
    --ink: #dce4ef;
    --ink-soft: #9fb0c6;
    --line: #2c3d56;
    --line-soft: #1f2e44;
    --blue: #86b4f0;
    --blue-wash: #18294a;
    --code-bg: #0b1320;
    --critical: #f08aa5;
    --high: #f59a8f;
    --medium: #f0b36b;
    --low: #8cc4e6;
    --info: #a7b4c6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1726; --sheet: #132034; --ink: #dce4ef; --ink-soft: #9fb0c6; --line: #2c3d56;
  --line-soft: #1f2e44; --blue: #86b4f0; --blue-wash: #18294a; --code-bg: #0b1320;
  --critical: #f08aa5; --high: #f59a8f; --medium: #f0b36b; --low: #8cc4e6; --info: #a7b4c6;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 1rem); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.68 var(--serif);
  text-rendering: optimizeLegibility;
}
a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--sheet); padding: 0.5rem 1rem; z-index: 20; }
.skip:focus { left: 1rem; }

/* Masthead: the title block of a drawing sheet. */
.masthead { border-bottom: 1px solid var(--line); background: var(--sheet); }
.masthead-inner { max-width: 76rem; margin: 0 auto; padding: 3.5rem 1.5rem 2rem; }
.kicker { font: 500 0.9rem/1.4 var(--sans); color: var(--ink-soft); margin: 0 0 0.75rem; }
.masthead h1 {
  font: 700 clamp(2.2rem, 5vw, 3.6rem)/1.04 var(--sans);
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  max-width: 18ch;
}
.sub { font-size: 1.15rem; color: var(--ink-soft); margin: 0 0 2rem; max-width: 60ch; }
.sheet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.sheet > div { padding: 0.7rem 1rem; border-right: 1px solid var(--line); }
.sheet > div:last-child { border-right: 0; }
.sheet dt { font: 500 0.8rem/1.3 var(--sans); color: var(--ink-soft); }
.sheet dd { margin: 0.15rem 0 0; font: 600 1rem/1.35 var(--sans); }

/* Two columns: severity rail + report. */
.layout {
  max-width: 76rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
.rail { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 1.25rem); max-height: calc(100vh - 2.5rem); overflow-y: auto; font-family: var(--sans); }
.rail summary { font-weight: 600; font-size: 0.95rem; cursor: pointer; padding: 0.25rem 0; list-style: none; }
.rail summary::-webkit-details-marker { display: none; }
.rail ol { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.rail a { color: var(--ink); text-decoration: none; display: flex; gap: 0.5rem; align-items: baseline; padding: 0.22rem 0.4rem; border-radius: 3px; }
.rail a:hover { background: var(--blue-wash); }
.rail-section a { font-weight: 600; font-size: 0.88rem; margin-top: 0.7rem; }
.rail-finding a { font-size: 0.84rem; line-height: 1.35; color: var(--ink-soft); }
.rail .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; flex: none; transform: translateY(-0.05rem); background: currentColor; }
.rail .rid { font-weight: 600; color: var(--ink); flex: none; width: 2.6rem; }
.rail .rtext { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dot.sev-critical { color: var(--critical); } .dot.sev-high { color: var(--high); }
.dot.sev-medium { color: var(--medium); } .dot.sev-low { color: var(--low); } .dot.sev-info { color: var(--info); }

/* Report body */
.report { max-width: 46rem; min-width: 0; }
.report h2 {
  font: 700 1.7rem/1.2 var(--sans);
  letter-spacing: -0.015em;
  margin: 3.5rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
}
.report > h2:first-child { margin-top: 0; }
.report h3 { font: 600 1.25rem/1.3 var(--sans); margin: 2.25rem 0 0.5rem; }
.report h3.finding-title { padding-top: 1.25rem; border-top: 1px solid var(--line); }
.report h3 .anchor { color: var(--blue); text-decoration: none; margin-right: 0.35rem; }
.report p, .report li { max-width: 68ch; }
.report ul, .report ol { padding-left: 1.3rem; }
.report li { margin: 0.3rem 0; }
.report strong { font-weight: 600; }

.meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.25rem 0 1rem; font-family: var(--sans); }
.conf { font-size: 0.85rem; color: var(--ink-soft); }
.conf::before { content: "Confidence: "; }
.sev {
  display: inline-block;
  font: 600 0.78rem/1 var(--sans);
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.sev-critical { color: var(--critical); } .sev-high { color: var(--high); } .sev-medium { color: var(--medium); }
.sev-low { color: var(--low); } .sev-info { color: var(--info); }

.table-wrap { overflow-x: auto; margin: 1.25rem 0; border: 1px solid var(--line); border-radius: 4px; background: var(--sheet); }
table { border-collapse: collapse; width: 100%; font: 0.9rem/1.45 var(--sans); }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-weight: 600; background: var(--paper); border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td a.fid { font-weight: 600; text-decoration: none; white-space: nowrap; }

code { font: 0.86em/1.5 var(--mono); background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 3px; }
pre {
  font: 0.82rem/1.6 var(--mono);
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}
pre code { background: none; padding: 0; font-size: inherit; }

.foot { border-top: 1px solid var(--line); padding: 1.5rem; text-align: center; font: 0.88rem/1.5 var(--sans); color: var(--ink-soft); }

/* Folder listings */
.listing .report { margin: 0 auto; padding: 2rem 1.5rem; }
.listing h1 { font: 700 1.6rem/1.2 var(--sans); }
.listing li { font-family: var(--mono); font-size: 0.95rem; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 1.5rem; padding-top: 1.25rem; }
  .rail { position: static; max-height: none; border: 1px solid var(--line); border-radius: 4px; background: var(--sheet); padding: 0.75rem 1rem; }
  .rail details:not([open]) ol { display: none; }
  .masthead-inner { padding-top: 2.25rem; }
  .sheet > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .sheet > div:last-child { border-bottom: 0; }
}
@media print {
  .rail, .skip { display: none; }
  .layout { display: block; }
  body { background: #fff; }
}
