/* AccessCheck — styles.
   The tool sells accessibility, so it must be exemplary itself: AA contrast in
   both themes, visible focus, no meaning carried by colour alone, and motion
   that respects prefers-reduced-motion. */

:root {
  --bg: #ffffff;
  --bg-raised: #f6f7f9;
  --bg-sunken: #eceef2;
  --text: #16191d;
  --text-muted: #52585f;
  --border: #d3d7de;
  --border-strong: #a8aeb8;
  --accent: #14496b;
  --accent-text: #ffffff;
  --accent-quiet: #e6eef4;
  --blocker: #8a1c11;
  --blocker-bg: #fdecea;
  --serious: #7a4a06;
  --serious-bg: #fdf2e0;
  --moderate: #34495e;
  --moderate-bg: #eef1f5;
  --pass: #17543a;
  --pass-bg: #e5f3ec;
  --focus: #0b5cad;
  --radius: 8px;
  --maxw: 60rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171a;
    --bg-raised: #1d2125;
    --bg-sunken: #24292e;
    --text: #eceef1;
    --text-muted: #b0b7bf;
    --border: #363c43;
    --border-strong: #565e67;
    --accent: #7fb4dc;
    --accent-text: #0d1114;
    --accent-quiet: #1b2b38;
    --blocker: #ff9d92;
    --blocker-bg: #3a1a16;
    --serious: #f0c179;
    --serious-bg: #362713;
    --moderate: #b8c6d6;
    --moderate-bg: #212a33;
    --pass: #85d6ab;
    --pass-bg: #14301f;
    --focus: #8cc2f0;
  }
}

:root[data-theme="dark"] {
  --bg: #14171a;
  --bg-raised: #1d2125;
  --bg-sunken: #24292e;
  --text: #eceef1;
  --text-muted: #b0b7bf;
  --border: #363c43;
  --border-strong: #565e67;
  --accent: #7fb4dc;
  --accent-text: #0d1114;
  --accent-quiet: #1b2b38;
  --blocker: #ff9d92;
  --blocker-bg: #3a1a16;
  --serious: #f0c179;
  --serious-bg: #362713;
  --moderate: #b8c6d6;
  --moderate-bg: #212a33;
  --pass: #85d6ab;
  --pass-bg: #14301f;
  --focus: #8cc2f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* Focus must be obvious for keyboard users — this is table stakes for an a11y tool. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0.75rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  padding: 0.9rem 0;
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.brand {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-sub {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); text-decoration: underline; }
.site-nav a.is-current {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* --------------------------------------------------------- content tables */
.table-scroll {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.table-scroll table {
  border-collapse: collapse;
  width: 100%;
  min-width: 30rem;
  font-size: 0.94rem;
}
.table-scroll caption {
  text-align: left;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}
.table-scroll th,
.table-scroll td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.table-scroll th { background: var(--bg-raised); font-weight: 600; }
.table-scroll tbody tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------ article prose */
main h2 {
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.6rem;
}
main h3 {
  font-size: 1.12rem;
  margin: 1.75rem 0 0.4rem;
}
main ol.plain-list { padding-left: 1.3rem; }
main a { color: var(--accent); }
:root:not([data-theme="light"]) main a { color: var(--accent); }

/* ------------------------------------------------------------------ main */
main { padding: 2.5rem 1.25rem 4rem; }

h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}

.lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  max-width: 46rem;
}

.privacy {
  background: var(--accent-quiet);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 0 0 2rem;
  font-size: 0.95rem;
  max-width: 46rem;
}

/* -------------------------------------------------------------- uploader */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 2.5rem 1.5rem;
  text-align: center;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-quiet);
}
.dropzone-text { margin: 0 0 0.35rem; font-size: 1.05rem; font-weight: 600; }
.dropzone-or { margin: 0 0 0.75rem; color: var(--text-muted); font-size: 0.9rem; }
.dropzone-hint { margin: 0.85rem 0 0; color: var(--text-muted); font-size: 0.85rem; }

/* The real input stays focusable but visually hidden; the label is the button. */
#file-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}
#file-input:focus-visible + .button,
#file-input:focus-visible ~ .button {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.6rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.button:hover { filter: brightness(1.08); }

.button-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
}
.button-secondary:hover { background: var(--bg-sunken); filter: none; }

/* ---------------------------------------------------------------- status */
.status {
  margin: 1.25rem 0 0;
  min-height: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.status:empty { margin: 0; min-height: 0; }
.status.is-error { color: var(--blocker); font-weight: 600; }

/* --------------------------------------------------------------- results */
#results { margin-top: 2.5rem; }

.results-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.6rem;
  margin-bottom: 1.5rem;
}
.results-head h2 { margin: 0; font-size: 1.4rem; }
.results-actions { display: flex; gap: 0.5rem; }

.file-report {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
  background: var(--bg-raised);
}

.file-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.file-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  word-break: break-word;
}
.file-meta { margin: 0.15rem 0 0; font-size: 0.85rem; color: var(--text-muted); }

.score {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 1.5rem;
  white-space: nowrap;
}
.score-out-of { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.score-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.finding {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.finding:last-child { border-bottom: 0; }

.finding-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

/* Severity is carried by the text label itself, not only by colour. */
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge-blocker  { color: var(--blocker);  background: var(--blocker-bg); }
.badge-serious  { color: var(--serious);  background: var(--serious-bg); }
.badge-moderate { color: var(--moderate); background: var(--moderate-bg); }

.finding-title { margin: 0; font-size: 1rem; font-weight: 600; }
.finding-detail { margin: 0 0 0.5rem; color: var(--text); font-size: 0.94rem; }
.finding-foot {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.pass-note {
  padding: 1.25rem 1.15rem;
  background: var(--pass-bg);
  color: var(--pass);
  font-weight: 600;
  margin: 0;
}
.pass-note .pass-sub {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.35rem;
}

.estimate {
  padding: 0.9rem 1.15rem;
  background: var(--bg-sunken);
  font-size: 0.9rem;
  margin: 0;
  border-top: 1px solid var(--border);
}
.estimate strong { font-weight: 700; }

/* -------------------------------------------------------------- explainer */
.explainer { margin-top: 3.5rem; max-width: 46rem; }
.explainer h2 { font-size: 1.35rem; margin: 0 0 0.6rem; letter-spacing: -0.01em; }
.explainer p { color: var(--text-muted); }

.checks { margin: 1.25rem 0 0; }
.checks dt {
  font-weight: 700;
  margin-top: 1.1rem;
  color: var(--text);
}
.checks dd {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
}

.plain-list { color: var(--text-muted); padding-left: 1.2rem; }
.plain-list li { margin-bottom: 0.6rem; }
.plain-list strong { color: var(--text); }

code {
  background: var(--bg-sunken);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
  word-break: break-word;
}

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
  padding: 1.5rem 0;
  margin-top: 4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.site-footer p { margin: 0 0 0.35rem; }
.footer-standards { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 34rem) {
  .file-head { flex-direction: column; align-items: flex-start; }
  .score { font-size: 1.3rem; }
}
