/* Research Linter — web UI
 *
 * A linter for scientific papers, so the visual language is a compiler's:
 * monospace where the product is precise (rule ids, numbers, quoted evidence),
 * a serif where the product is making an argument, and a grotesque for
 * everything a reader actually has to read.
 *
 * Two rules this file keeps:
 *   1. No glyph is ever used as an icon. Every separator, marker and bullet is
 *      a border, a background or a text character that carries meaning.
 *      There is no icon font, no SVG sprite, no emoji.
 *   2. Nothing is a decorative "shape". Where a box appears it is a measurement
 *      (a confidence bar, a severity rule, a table cell).
 */

@import url("fonts/fonts.css");

/* ------------------------------------------------------------------ tokens */

:root {
  /* Surfaces: near-black, warmed a few degrees so the archival photography in
     the sections does not sit on a cold grey plate. */
  --ink:        #0b0c0f;
  --ink-2:      #101116;
  --surface:    #14161b;
  --surface-2:  #191c22;
  --line:       #24272e;
  --line-soft:  #1c1f25;

  /* Text ramp. Four steps, each with a job: reading, supporting, metadata,
     and the quietest tone that is still readable.

     Every step clears WCAG AA (4.5:1) against `--surface-2`, the lightest
     panel any of them sits on — see `check_contrast` in
     web/tools/audit_redlines.py, which fails the build if one stops doing so.
     The first version had `--fg-faint: #565b66`, which measured **2.87:1**:
     illegible, and used for evidence locations and evidence values, i.e.
     exactly the metadata this product tells you to check for yourself. */
  --fg:         #edeae3;
  --fg-muted:   #a5a9b4;
  --fg-dim:     #949aa6;
  --fg-faint:   #808591;

  /* Severity. Distinguished by hue AND by treatment (border weight, label
     text), never by an icon. */
  --error:      #ff6b5e;
  --error-bg:   rgba(255, 107, 94, 0.07);
  --warning:    #f0b24a;
  --warning-bg: rgba(240, 178, 74, 0.07);
  --info:       #6fa8dc;
  --info-bg:    rgba(111, 168, 220, 0.07);

  /* One accent, used sparingly: the "this is the product's own voice" colour. */
  --accent:     #62d3a4;
  --accent-dim: rgba(98, 211, 164, 0.14);
  --accent-line:rgba(98, 211, 164, 0.42);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  /* The arrows face sits first but carries only U+2190-2194, so the browser
     uses it for `paper.pdf → PaperIR` and skips to Martian Mono for every
     other character. Without it the arrow is drawn by whatever monospace the
     operating system happens to supply, i.e. differently on every machine. */
  --mono:  "Research Linter Arrows", "Martian Mono", "IBM Plex Mono",
           "DejaVu Sans Mono", ui-monospace, monospace;

  --wrap: 1140px;
  --wrap-narrow: 860px;
  --pad: clamp(20px, 5vw, 64px);

  --r-sm: 3px;
  --r:    5px;
  --r-lg: 8px;
}

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

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1.16; }
h1, h2, h3 { font-family: var(--serif); letter-spacing: -0.012em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
code, pre, kbd { font-family: var(--mono); }
img { max-width: 100%; height: auto; display: block; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 0; }
::selection { background: var(--accent-dim); color: var(--fg); }

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

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--ink);
  padding: 10px 16px; z-index: 100; font-weight: 600;
}
.skip:focus { left: 8px; top: 8px; }

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

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.wrap-narrow { max-width: var(--wrap-narrow); margin: 0 auto; padding: 0 var(--pad); }

.mono { font-family: var(--mono); font-variant-ligatures: none; }
.tnum { font-variant-numeric: tabular-nums; }

/* The small caps-ish label used above sections and on metadata keys. */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.lede {
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.6;
  color: var(--fg-muted);
  max-width: 62ch;
}

.section { padding: clamp(64px, 9vw, 118px) 0; border-top: 1px solid var(--line-soft); }
.section-tight { padding: clamp(48px, 6vw, 76px) 0; border-top: 1px solid var(--line-soft); }

.section-title {
  font-size: clamp(28px, 3.6vw, 42px);
  margin: 0 0 16px;
  max-width: 22ch;
}

/* ------------------------------------------------------------------- chrome */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 12, 15, 0.88);
  backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 28px;
  height: 60px;
}
.brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg);
  white-space: nowrap;
}
.brand .brand-mark { color: var(--accent); }
.site-nav { display: flex; gap: 24px; margin-left: auto; align-items: center; }
.site-nav a {
  font-size: 14px;
  color: var(--fg-muted);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  /* A two-word nav label must never break across lines: "Lint a / paper"
     reads as two items. */
  white-space: nowrap;
}
.site-nav a:hover { color: var(--fg); border-bottom-color: var(--line); }
.site-nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent-line); }
/* Between 320px and 620px the header has to hold a monospace wordmark and
   three two-word labels. Below 380px the labels shrink rather than wrap, and
   the wordmark keeps a floor of 10px so it stays readable. */
@media (max-width: 620px) {
  .site-header .wrap { gap: 10px; height: 54px; padding-inline: 14px; }
  .site-nav { gap: 13px; }
  .site-nav a { font-size: 12.5px; }
  .brand { font-size: 12px; }
}
@media (max-width: 400px) {
  .site-header .wrap { gap: 8px; padding-inline: 12px; }
  .site-nav { gap: 10px; }
  .site-nav a { font-size: 11.5px; }
  .brand { font-size: 10.5px; }
}

.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 44px 0 64px;
  font-size: 13px;
  color: var(--fg-dim);
}
.site-footer .cols {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: 32px;
}
@media (max-width: 700px) { .site-footer .cols { grid-template-columns: 1fr; gap: 26px; } }
.site-footer h4 {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--fg-faint); margin: 0 0 12px;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a:hover { color: var(--accent); }

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

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--sans);
  font-size: 15px; font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  text-align: center;
}
.btn:hover { background: var(--surface-2); border-color: #30343d; color: var(--fg); }
.btn-primary {
  background: var(--accent); color: #06110c; border-color: var(--accent);
}
.btn-primary:hover { background: #7ee0b6; border-color: #7ee0b6; color: #06110c; }
.btn-ghost { background: transparent; }
.btn-lg { font-size: 16px; padding: 14px 26px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ------------------------------------------------------------------- hero */

/* Split hero: the argument sets on the left, a real archive photograph holds
   the right half at full strength. The photograph is not wallpaper behind the
   text — it is a panel of the layout, which is why the text never sits on it.
   Below 900px the panel drops away and the type takes the full width. */
.hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  background: var(--ink);
}
.hero .wrap {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: stretch;
}
.hero-figure {
  position: relative;
  margin: 0;
  align-self: stretch;
  min-height: 340px;
  overflow: hidden;
  border-left: 1px solid var(--line-soft);
}
.hero-figure img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  object-position: 50% 46%;
  /* Graded to sit inside the page's palette. A stock photograph at full
     saturation next to a near-black interface reads as a different product;
     this keeps the photograph real while making it belong to this one. */
  filter: saturate(.42) contrast(.96) brightness(.68);
}
.hero-figure::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, var(--ink) 0%, rgba(11,12,15,.3) 12%, rgba(11,12,15,0) 40%),
    linear-gradient(180deg, rgba(11,12,15,.36) 0%, rgba(11,12,15,0) 22%, rgba(11,12,15,.94) 100%);
}
.hero-figure figcaption {
  position: absolute; left: 22px; right: 22px; bottom: 20px;
  z-index: 1;
  font-family: var(--mono); font-size: 11px; line-height: 1.65;
  color: rgba(237, 234, 227, .82);
  text-shadow: 0 1px 14px rgba(11, 12, 15, 1), 0 0 30px rgba(11, 12, 15, .9);
}
.hero-figure figcaption b {
  display: block; color: var(--fg); font-weight: 500; margin-bottom: 4px;
}
.hero-figure figcaption a { border-bottom: 1px solid rgba(237,234,227,.32); }
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-figure { min-height: 240px; border-left: 0; border-top: 1px solid var(--line-soft); }
  .hero-figure::after {
    background: linear-gradient(180deg, var(--ink) 0%, rgba(11,12,15,.18) 30%, rgba(11,12,15,.66) 100%);
  }
}
.hero-inner { padding: clamp(56px, 9vw, 116px) 0 clamp(44px, 6vw, 76px); }

.hero h1 {
  font-size: clamp(38px, 6.6vw, 76px);
  line-height: 1.03;
  letter-spacing: -0.022em;
  margin: 0 0 26px;
  max-width: 17ch;
}
.hero h1 em { font-style: italic; color: var(--accent); }

/* The pipeline line: `paper.pdf -> PaperIR -> rules -> warnings`.
   This is a real description of the architecture, set as the product's spine. */
/* Martian Mono is a wide monospace, so this line needs a smaller size on
   narrow screens than the clamp alone gives it — otherwise the last step wraps
   on its own and the arrow that connects it is orphaned. */
.pipeline {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 12px;
  font-family: var(--mono);
  font-size: clamp(10px, 2.6vw, 13.5px);
  color: var(--fg-muted);
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}
.pipeline li { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.pipeline li + li::before {
  content: "\2192";
  color: var(--fg-faint);
  font-size: 1.05em;
}
.pipeline .step { color: var(--fg); }
.pipeline .step-hl { color: var(--accent); }

.hero-meta {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  font-family: var(--mono); font-size: 12px; color: var(--fg-dim);
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}
.hero-meta b { color: var(--fg-muted); font-weight: 500; }

/* ------------------------------------------------------------- finding card
 *
 * The product's unit of value, so it gets the most design weight. Everything
 * here exists to make one question answerable at a glance: "why does this
 * finding hold?"
 */

.finding {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r);
  padding: 22px 24px;
  margin: 0;
}
.finding + .finding { margin-top: 16px; }
.finding.sev-error   { border-left-color: var(--error); }
.finding.sev-warning { border-left-color: var(--warning); }
.finding.sev-info    { border-left-color: var(--info); }
@media (max-width: 560px) { .finding { padding: 18px 16px; } }

.finding-head {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.rule-id {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--ink-2);
  color: var(--fg-muted);
}
.sev-error   .rule-id { color: var(--error);   border-color: rgba(255,107,94,.3); }
.sev-warning .rule-id { color: var(--warning); border-color: rgba(240,178,74,.3); }
.sev-info    .rule-id { color: var(--info);    border-color: rgba(111,168,220,.3); }

.rule-name { font-size: 13px; color: var(--fg-dim); }

/* Severity is a word, not a dot. A linter's output should be greppable. */
.sev-label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  margin-left: auto;
}
.sev-error   .sev-label { color: var(--error); }
.sev-warning .sev-label { color: var(--warning); }
.sev-info    .sev-label { color: var(--info); }

.finding-title {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 10px;
  letter-spacing: -0.005em;
}
.finding-loc {
  font-family: var(--mono); font-size: 12px; color: var(--fg-dim);
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px;
}
.finding-loc .loc-key { color: var(--fg-faint); }

.finding-expl { color: var(--fg-muted); font-size: 15px; margin: 0 0 16px; }
.finding-action {
  font-size: 14.5px;
  color: var(--fg);
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
  margin: 0 0 4px;
}
.finding-action .act-key {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--fg-faint);
  display: block; margin-bottom: 6px;
}

/* Confidence is a measurement, so it is shown as a bar with its number.
   Both together: the number is the fact, the bar is the comparison. */
.conf { display: flex; align-items: center; gap: 10px; }
.conf-track {
  width: 64px; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden;
}
.conf-fill { height: 100%; background: var(--fg-dim); }
.sev-error .conf-fill { background: var(--error); }
.sev-warning .conf-fill { background: var(--warning); }
.sev-info .conf-fill { background: var(--info); }
.conf-num { font-family: var(--mono); font-size: 11.5px; color: var(--fg-muted); }

/* ------------------------------------------------------------- evidence
 *
 * The soul of the product, so the quote is set in the reading serif at full
 * size — bigger than the explanation — and never truncated. If a reader cannot
 * check the quote, the finding is just an opinion.
 */

.evidence { margin-top: 18px; display: grid; gap: 12px; }
.evidence-head {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--fg-faint);
}
.ev {
  background: var(--ink-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 14px 16px;
}
.ev-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--fg-dim);
  margin-bottom: 9px;
}
.ev-kind { color: var(--accent); }
.ev-src { color: var(--fg-muted); }
.ev-loc { color: var(--fg-faint); }
.ev-quote {
  margin: 0;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--fg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ev-quote::before { content: "\201C"; color: var(--fg-faint); }
.ev-quote::after  { content: "\201D"; color: var(--fg-faint); }
.ev-values {
  margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-family: var(--mono); font-size: 12px;
  padding-top: 10px; border-top: 1px solid var(--line-soft);
}
.ev-values div { display: flex; gap: 8px; }
.ev-values dt { color: var(--fg-faint); }
.ev-values dd { margin: 0; color: var(--fg); }
.ev-link {
  display: inline-block; margin-top: 10px;
  font-family: var(--mono); font-size: 12px;
  color: var(--info);
  border-bottom: 1px solid rgba(111,168,220,.3);
  overflow-wrap: anywhere;
}
.ev-link:hover { color: var(--accent); border-bottom-color: var(--accent-line); }

/* ------------------------------------------------------------------ rule pages */

.rule-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 26px 28px;
}
.rule-card + .rule-card { margin-top: 18px; }
@media (max-width: 560px) { .rule-card { padding: 20px 18px; } }
.rule-card-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 14px;
  margin-bottom: 14px;
}
.rule-card h3 { font-size: 22px; font-family: var(--serif); }
.rule-card .q {
  font-family: var(--serif); font-style: italic; font-size: 18px;
  color: var(--fg-muted); margin: 0 0 18px;
}
.rule-block { margin-top: 18px; }
.rule-block h4 {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--fg-faint); margin: 0 0 10px;
}
.rule-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.rule-list li {
  padding-left: 18px; position: relative; color: var(--fg-muted); font-size: 15px;
}
/* The marker is a rule (a hairline), i.e. a typographic element, not a bullet icon. */
.rule-list li::before {
  content: ""; position: absolute; left: 0; top: .68em;
  width: 9px; height: 1px; background: var(--accent-line);
}
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 3px 8px; color: var(--fg-dim); background: var(--ink-2);
}
.tag-on { color: var(--accent); border-color: var(--accent-line); }

/* ------------------------------------------------------------- lists/tables */

.spec { border-top: 1px solid var(--line-soft); margin: 0; }
.spec div {
  display: grid; grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 8px 24px; padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
}
@media (max-width: 620px) { .spec div { grid-template-columns: 1fr; gap: 4px; } }
.spec dt { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); }
.spec dd { margin: 0; font-size: 15px; color: var(--fg-muted); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.stat { background: var(--surface); padding: 18px 20px; }
.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat span {
  display: block; margin-top: 6px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--fg-dim);
}
.stat.is-error b { color: var(--error); }
.stat.is-warning b { color: var(--warning); }
.stat.is-info b { color: var(--info); }

/* --------------------------------------------------------- landing pieces */

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line-soft); border: 1px solid var(--line-soft);
  border-radius: var(--r); overflow: hidden; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
.step-cell { background: var(--surface); padding: 28px 26px; }
.step-num {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  letter-spacing: .12em; display: block; margin-bottom: 16px;
}
.step-cell h3 { font-size: 21px; margin: 0 0 12px; }
.step-cell p { color: var(--fg-muted); font-size: 15px; }

/* Real photographs, captioned with their source. Restrained: they sit in a
   strip, not behind the copy, and each one is a real archival artefact that
   says something about how research is stored and checked. */
.plate { margin: 0; }
.plate img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  filter: saturate(.8);
}
.plate figcaption {
  margin-top: 11px;
  font-family: var(--mono); font-size: 11px; line-height: 1.55;
  color: var(--fg-faint);
}
.plate figcaption b { color: var(--fg-dim); font-weight: 500; display: block; }
.plate figcaption a { border-bottom: 1px solid var(--line); }
.plate-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
}
@media (max-width: 900px) { .plate-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .plate-grid { grid-template-columns: 1fr; } }

.example-list { display: grid; gap: 14px; }
.example {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 24px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); padding: 18px 20px;
}
.example:hover { border-color: #30343d; background: var(--surface-2); }
.example h4 { font-family: var(--sans); font-size: 15.5px; font-weight: 600; margin: 0 0 6px; }
.example .meta { font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); }
.example .go { font-family: var(--mono); font-size: 12px; color: var(--accent); white-space: nowrap; }
@media (max-width: 620px) { .example { grid-template-columns: 1fr; } }

/* -------------------------------------------------------------- upload/app */

.panel {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); padding: 26px 28px;
}
@media (max-width: 560px) { .panel { padding: 20px 17px; } }

/* The drop target is the page's one large affordance, so its boundary is
   deliberately the highest-contrast hairline in the interface: an inset outline
   plus a hairline inset shadow, both borders, no drawn shape. */
.drop {
  display: block;
  border: 1px dashed #3a3f4a;
  outline: 1px dashed #22262e;
  outline-offset: 4px;
  border-radius: var(--r);
  padding: 46px 24px;
  text-align: center;
  background: var(--ink-2);
  transition: border-color .15s, background .15s, outline-color .15s;
  cursor: pointer;
}
.drop:hover, .drop.is-over {
  border-color: var(--accent);
  outline-color: var(--accent-line);
  background: var(--accent-dim);
}
.drop.is-over { border-style: solid; }
.drop-title { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.drop-hint { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); margin: 0; }
.drop-file {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  margin: 14px 0 0; overflow-wrap: anywhere;
}

.field { margin-top: 24px; }
.field label {
  display: block; font-family: var(--mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-dim); margin-bottom: 9px;
}
.field input[type="text"] {
  width: 100%; padding: 12px 14px;
  font-family: var(--mono); font-size: 14px;
  background: var(--ink-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.field input[type="text"]::placeholder { color: var(--fg-faint); }
.field input[type="text"]:focus { border-color: var(--accent-line); outline: none; }
.field .field-hint { font-size: 12.5px; color: var(--fg-faint); margin: 8px 0 0; }

/* Progress: a staged checklist plus a measured bar. Both are driven by the
   server's real stage, never by a client-side timer. */
.progress { margin-top: 26px; }
.progress-bar {
  height: 3px; background: var(--line); border-radius: 2px; overflow: hidden;
  margin-bottom: 20px;
}
.progress-fill {
  height: 100%; width: 0; background: var(--accent);
  transition: width .5s ease-out;
}
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.stages li {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px;
  align-items: baseline; font-size: 14px; color: var(--fg-faint);
}
/* The marker is a word from the mono font, never an icon: three dots while a
   stage is pending, ">>" while it is the one running, "OK" once it is done.
   ASCII only, so it cannot render as a missing-glyph box. */
.stages .mark {
  font-family: var(--mono); font-size: 11px; line-height: 1.5;
  color: var(--fg-faint);
}
.stages li.is-done { color: var(--fg-muted); }
.stages li.is-done .mark { color: var(--accent); }
.stages li.is-current { color: var(--fg); }
.stages li.is-current .mark { color: var(--fs-current, var(--fg)); }
.stages li.is-current .mark::after { content: ""; }
.stages .stage-note {
  display: block; font-family: var(--mono); font-size: 11.5px;
  color: var(--fg-dim); margin-top: 3px;
}
.job-log {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.75;
  color: var(--fg-dim);
  max-height: 210px; overflow-y: auto;
}
.job-log div { overflow-wrap: anywhere; }
.job-log div:last-child { color: var(--fg-muted); }
.job-elapsed { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); }

/* The return link. A run outlasts anyone's patience, so the URL is shown as a
   first-class affordance rather than hidden behind the address bar. The field
   is mono to match every other machine-produced string on the page, and it is
   readonly-and-selectable so the Ctrl-C fallback works where the clipboard API
   is unavailable (no secure context on a plain-HTTP LAN demo). */
.job-return { padding-top: 16px; border-top: 1px solid var(--line-soft); }
.job-url {
  flex: 1 1 260px; min-width: 0;
  font-family: var(--mono); font-size: 11.5px;
  color: var(--fg-muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px;
}
.job-url:focus { outline: 2px solid var(--accent-line); outline-offset: 1px; }

.alert {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  background: var(--surface-2);
  font-size: 14.5px;
  margin-top: 20px;
}
.alert-error { border-left-color: var(--error); color: var(--fg); }
.alert-warn  { border-left-color: var(--warning); color: var(--fg-muted); }
.alert-info  { border-left-color: var(--info); color: var(--fg-muted); }
/* Neither a failure nor a finding: a rule that correctly declined to run. The
   neutral rule keeps it from reading as a problem the way a coloured border
   would. */
.alert-quiet { border-left-color: var(--line); color: var(--fg-dim); }
.alert b { display: block; margin-bottom: 4px; color: var(--fg); }

/* ----------------------------------------------------------- report page */

.report-head { padding: clamp(36px, 5vw, 60px) 0 30px; border-bottom: 1px solid var(--line-soft); }
.report-head h1 {
  font-size: clamp(27px, 4vw, 44px);
  margin: 0 0 16px; max-width: 26ch;
}
.report-meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  font-family: var(--mono); font-size: 12px; color: var(--fg-dim);
}
.report-meta a { border-bottom: 1px solid var(--line); }
/* Provenance note beside the source link: quieter than the link it qualifies,
   because it is a caveat about the link rather than information in its own
   right. Uses --fg-faint, the quietest tone that still clears WCAG AA — checked
   against --surface-2 by web/tools/audit_redlines.py. */
.report-meta .src-note { color: var(--fg-faint); }
.report-body { padding-top: 34px; }

.sev-section { margin-top: 40px; }
.sev-section:first-child { margin-top: 0; }
.sev-head {
  display: flex; align-items: baseline; gap: 14px;
  padding-bottom: 12px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.sev-head h2 { font-family: var(--mono); font-size: 13px; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 600; }
.sev-head .n { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); }
.sev-head .blurb { font-size: 13px; color: var(--fg-dim); margin-left: auto; max-width: 46ch; text-align: right; }
@media (max-width: 700px) { .sev-head .blurb { display: none; } }
.sev-head.sev-error h2 { color: var(--error); }
.sev-head.sev-warning h2 { color: var(--warning); }
.sev-head.sev-info h2 { color: var(--info); }

.side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 44px; align-items: start; }
@media (max-width: 940px) { .side { grid-template-columns: 1fr; gap: 36px; } }
/* A clean report has one short card against a full-height aside. Letting the
   finding column stretch would leave a screen of dead space beside the
   statistics, so in that case the aside moves under the message as a row of
   blocks. The blocks themselves keep their own internal layout — overriding
   `.kv`'s display here would break the label/value rows. */
.side.is-sparse { grid-template-columns: minmax(0, 1fr); gap: 30px; }
.side.is-sparse .side-aside {
  position: static;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 26px 40px;
  align-items: start;
}
/* In the row layout the hairline between blocks is redundant — the column gap
   already separates them. */
.side.is-sparse .side-aside .aside-block + .aside-block {
  margin-top: 0; padding-top: 0; border-top: 0;
}
@media (max-width: 620px) {
  .side.is-sparse .side-aside { grid-template-columns: 1fr; }
  .side.is-sparse .side-aside .aside-block + .aside-block {
    margin-top: 4px; padding-top: 20px; border-top: 1px solid var(--line-soft);
  }
}
.side-aside {
  position: sticky; top: 80px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); padding: 20px 22px;
}
@media (max-width: 940px) { .side-aside { position: static; } }
/* Each block in the aside is separated by a hairline rather than by whitespace
   alone, so "what was read" and "how this ran" cannot be misread as one list. */
.side-aside h3 {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--fg-faint);
  margin: 0 0 16px; font-weight: 500;
}
.side-aside h3 + .kv { margin-top: 0; }
.side-aside .aside-block + .aside-block {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line-soft);
}
.kv { display: grid; gap: 10px; margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; }
.kv dt { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--fg-muted); font-variant-numeric: tabular-nums; }

.empty {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); padding: 38px 30px; text-align: center;
}
.empty h3 { font-size: 21px; margin: 0 0 12px; }
.empty p { color: var(--fg-muted); max-width: 54ch; margin: 0 auto 8px; }
/* An empty report has three meanings and they are not interchangeable. The
   two that are not "clean paper" carry a colour so they cannot be skimmed as
   good news. */
.empty-bad { border-color: rgba(255, 107, 94, .3); border-left: 3px solid var(--error); text-align: left; }
.empty-bad h3 { color: var(--error); }
.empty-bad p { margin-inline: 0; }
.empty-unknown { border-color: var(--line); border-left: 3px solid var(--fg-faint); text-align: left; }
.empty-unknown h3 { color: var(--fg); }
.empty-unknown p { margin-inline: 0; }

/* ---------------------------------------------- extraction health panel
 *
 * Claims about our own reading, not about the paper. Styled as a diagnostic
 * panel rather than as finding cards so the two are never confused.
 */
.health {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 18px 22px;
}
.health-error { border-left-color: var(--error); background: var(--error-bg); }
.health-note { border-left-color: var(--info); background: var(--info-bg); }
.health-unknown { border-left-color: var(--fg-faint); background: var(--surface-2); }
.health-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px;
  margin-bottom: 10px;
}
.health-tag {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
}
.health-error .health-tag { color: var(--error); }
.health-note .health-tag { color: var(--info); }
.health-unknown .health-tag { color: var(--fg-dim); }
.health-sub { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); }
.health-lead { font-size: 15px; color: var(--fg-muted); margin: 0; max-width: 78ch; }
.health-lead strong { color: var(--fg); }
.health-groups { margin-top: 16px; display: grid; gap: 14px; }
.health-sev {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; margin-bottom: 7px;
}
.health-sev .n { color: var(--fg-faint); margin-left: 4px; }
.health-sev.sev-error { color: var(--error); }
.health-sev.sev-warning { color: var(--warning); }
.health-sev.sev-note { color: var(--fg-dim); }
.health-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.health-list li {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  font-size: 14.5px;
}
.health-code {
  display: inline-block;
  font-family: var(--mono); font-size: 11px;
  color: var(--fg-faint);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 1px 6px; margin-right: 8px;
  vertical-align: 1px;
}
.health-msg { color: var(--fg); }
.health-detail {
  display: block; margin-top: 4px;
  color: var(--fg-dim); font-size: 13.5px; max-width: 78ch;
}

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
  padding: 14px 0 0;
}
.toolbar .spacer { margin-left: auto; }
.btn-sm { font-size: 13px; padding: 8px 13px; }

details.raw {
  margin-top: 40px; border-top: 1px solid var(--line-soft); padding-top: 20px;
}
details.raw summary {
  font-family: var(--mono); font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-dim); cursor: pointer;
}
details.raw summary:hover { color: var(--fg); }
details.raw pre {
  margin: 18px 0 0; padding: 18px;
  background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  font-size: 12px; line-height: 1.7; color: var(--fg-muted);
  overflow-x: auto; max-height: 460px;
}

/* ---------------------------------------------------------------- error */

.error-page { padding: clamp(70px, 12vw, 150px) 0; }
.error-code {
  font-family: var(--mono); font-size: 13px; letter-spacing: .2em;
  color: var(--error); margin: 0 0 20px;
}
.error-page h1 { font-size: clamp(30px, 5vw, 52px); margin: 0 0 20px; }
.error-page .detail { color: var(--fg-muted); max-width: 62ch; margin-bottom: 32px; }

/* ------------------------------------------------------------- utilities */

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; } .mt-4 { margin-top: 34px; } .mt-5 { margin-top: 48px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.dim { color: var(--fg-dim); }
.muted { color: var(--fg-muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* Visually hidden but still in the tab order and the accessibility tree.
   `display: none` would take a control out of both, which is wrong for a file
   input a sighted keyboard user is expected to reach. */
.vh {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
/* The file input is clipped, so its focus ring would be invisible. Draw it on
   the drop zone instead, which is what the user sees as the control. */
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

@media print {
  .site-header, .site-footer, .toolbar, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .finding { break-inside: avoid; border-color: #ccc; background: #fff; }
  .ev { background: #f7f7f7; }
}
