/* Plainly — a deliberately plain palette.
 *
 * No gradient on the header, and nothing violet. That combination is the most
 * recognised "an AI made this" signal on the web, and a tool about not sounding
 * machine-made cannot afford to look machine-made.
 *
 * System font stack: no font CDN, because a font CDN hands every visitor's IP
 * address to a third party on page load and nothing here discloses that. It
 * also keeps the CSP at 'self'.
 */

:root {
  --paper: #faf8f4;
  --paper-2: #f2efe9;
  --ink: #23201c;
  --ink-2: #514b43;
  --ink-3: #6b645a;
  --rule: #d9d4ca;
  --accent: #8c3a1e;          /* rust; 6.6:1 on --paper */
  --accent-soft: #f6e6df;
  --high: #a3301c;
  --medium: #8a5a12;
  --low: #5c6470;
  --focus: #1c4f8c;
  --shadow: 0 1px 2px rgba(35, 32, 28, .06), 0 6px 20px rgba(35, 32, 28, .05);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16150f;
    --paper-2: #1e1c16;
    --ink: #f0ebe1;
    --ink-2: #c9c2b5;
    --ink-3: #a49c8e;
    --rule: #38342b;
    --accent: #e8a184;        /* 7.4:1 on --paper */
    --accent-soft: #33241d;
    --high: #f0907c;
    --medium: #d9ab5e;
    --low: #a3aab6;
    --focus: #8ab8f0;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; z-index: 10; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

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

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

/* --- masthead ------------------------------------------------------------ */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 26px 0 22px;
}
.wordmark {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
}
.tagline { margin: 4px 0 0; color: var(--ink-2); max-width: 60ch; }

/* --- layout -------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  padding: 28px 0 8px;
}
@media (min-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}

.section-h {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-3);
  margin: 0 0 12px;
  font-weight: 700;
}

/* --- controls ------------------------------------------------------------ */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: var(--ink-2); font-weight: 600; }

select, textarea, .btn-quiet {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  /* 3:1 minimum on an interactive control boundary — WCAG 1.4.11. A hairline
   * that looks tasteful at #e5e0d8 measures 1.3:1 and fails outright. */
  border: 1px solid var(--ink-3);
  border-radius: 8px;
  padding: 8px 11px;
}
select { min-width: 15rem; }
.btn-quiet { cursor: pointer; }
.btn-quiet:hover { background: var(--paper-2); }

textarea {
  width: 100%;
  min-height: 380px;
  resize: vertical;
  padding: 16px;
  line-height: 1.7;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
@media (min-width: 900px) { textarea { min-height: 520px; } }

.hint { font-size: 13px; color: var(--ink-3); margin: 8px 0 0; }

/* --- scores -------------------------------------------------------------- */

.scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.score {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.score-n { font-size: 34px; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; }
.score-l {
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-3); font-weight: 700; margin-top: 2px;
}
.score-d { font-size: 12.5px; color: var(--ink-2); margin-top: 7px; }

.trade {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-2);
  min-height: 1.6em;
}
.trade strong { color: var(--ink); }

.suggest {
  margin: 0 0 14px; padding: 9px 12px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
}

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

.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.finding {
  border: 1px solid var(--rule);
  border-left-width: 4px;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 14px;
  background: var(--paper);
}
.finding.high { border-left-color: var(--high); }
.finding.medium { border-left-color: var(--medium); }
.finding.low { border-left-color: var(--low); }

.f-head {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
  margin-bottom: 5px;
}
.f-rule {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; color: var(--ink-2);
}
.f-sev {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700;
}
.finding.high .f-sev { color: var(--high); }
.finding.medium .f-sev { color: var(--medium); }
.finding.low .f-sev { color: var(--low); }
.f-line { font-size: 12px; color: var(--ink-3); margin-left: auto; }

.f-msg { margin: 0 0 6px; font-size: 14.5px; }
.f-exc {
  margin: 0 0 6px; font-size: 13px; color: var(--ink-2);
  border-left: 2px solid var(--rule); padding-left: 10px;
  font-style: italic; overflow-wrap: anywhere;
}
.f-fix { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.f-fix::before { content: "→ "; color: var(--accent); font-style: normal; }

.empty { color: var(--ink-3); font-size: 14px; }

/* --- notes --------------------------------------------------------------- */

.notes {
  border-top: 1px solid var(--rule);
  margin-top: 34px;
  padding: 30px 0 10px;
}
.notes h2 { font-size: 19px; margin: 0 0 18px; letter-spacing: -.01em; }
.notes-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.notes-grid h3 { font-size: 15px; margin: 0 0 6px; }
.notes-grid p { margin: 0; font-size: 14px; color: var(--ink-2); }

.method { margin-top: 26px; }
.method summary {
  cursor: pointer; font-weight: 600; font-size: 14.5px;
  padding: 8px 0;
}
.method p { font-size: 14px; color: var(--ink-2); max-width: 78ch; }
.method code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; background: var(--paper-2); padding: 1px 5px; border-radius: 4px;
}

footer {
  border-top: 1px solid var(--rule);
  margin-top: 26px; padding: 18px 20px 40px;
  font-size: 13px; color: var(--ink-3);
}

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

/* The skip target is focusable (tabindex="-1") so the link moves FOCUS, not
 * just the viewport -- without it Safari scrolls but leaves focus at the top of
 * the document, so the next Tab goes back to the header.
 *
 * It deliberately keeps its focus ring. Suppressing it was the obvious tidy-up
 * and it is wrong twice over: the only person who lands here is a keyboard
 * user, for whom the ring is the confirmation that the skip worked; and
 * `outline: none` anywhere in a stylesheet is the exact pattern that strips
 * rings by accident elsewhere. :focus-visible already limits it to keyboard
 * use, which is all the narrowing this needs.
 */
