:root {
  --paper: #f3eee4;
  --sheet: #fffdf8;
  --ink: #1c1915;
  --muted: #6d655b;
  --rule: #d7cec1;
  --rule-strong: #1c1915;
  --oxblood: #8b1e1e;
  --a: #1d6b3a;
  --b: #215a62;
  --c: #8a5a12;
  --d: #9a3d16;
  --f: #8b1e1e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", Inter, system-ui, sans-serif;
  --mono: "Iowan Old Style", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --mono-ui: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font: 16px/1.5 var(--sans);
  min-height: 100vh;
}
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--oxblood); }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 28px 64px;
}

.masthead { margin-bottom: 28px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.masthead-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: end;
  border-top: 3px double var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  padding: 14px 0 16px;
}
h1 {
  font-family: var(--serif);
  font-size: 56px;
  line-height: 0.95;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.lede {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  max-width: 46em;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 28px;
  align-items: start;
}

.composer, .report {
  background: var(--sheet);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(28, 25, 21, 0.03);
}
.composer { padding: 16px 16px 18px; }
.composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
h2 {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
  font-weight: 700;
}
.samples { display: flex; gap: 6px; }
.samples button, .composer-actions button {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.samples button.on {
  background: var(--ink);
  color: var(--sheet);
  border-color: var(--ink);
}
.samples button:hover, .composer-actions button:hover { border-color: var(--ink); }
.hint { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.mono { font-family: var(--mono-ui); font-size: 0.92em; }
textarea {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  border: 1px solid var(--rule);
  background: #fbf8f2;
  padding: 12px 12px 14px;
  font-family: var(--mono-ui);
  font-size: 11.5px;
  line-height: 1.45;
  border-radius: 0;
}
textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.composer-actions { display: flex; gap: 8px; margin-top: 12px; }
.composer-actions .primary {
  background: var(--ink);
  color: var(--sheet);
  border-color: var(--ink);
  font-weight: 600;
}
.error {
  margin: 10px 0 0;
  color: var(--oxblood);
  font-size: 13px;
}

.report { min-height: 640px; padding: 28px 32px 36px; }
.report[data-ready="true"] { min-height: 0; }
.empty {
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  display: grid;
  place-items: center;
  min-height: 560px;
  text-align: center;
  padding: 24px;
}

.card-head {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 28px;
  align-items: center;
  border-bottom: 3px double var(--rule-strong);
  padding-bottom: 22px;
  margin-bottom: 22px;
}
.stamp {
  font-family: var(--serif);
  font-size: 108px;
  font-weight: 700;
  line-height: 1;
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
  border: 5px double currentColor;
  border-radius: 8px;
  transform: rotate(-7deg);
  letter-spacing: -0.04em;
  user-select: none;
}
.stamp[data-grade="A"] { color: var(--a); }
.stamp[data-grade="B"] { color: var(--b); }
.stamp[data-grade="C"] { color: var(--c); }
.stamp[data-grade="D"] { color: var(--d); }
.stamp[data-grade="F"] { color: var(--f); }

.card-meta .kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.card-meta h3 {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.15;
  margin: 4px 0 8px;
  font-weight: 700;
}
.card-meta .summary { margin: 0; font-size: 15px; }
.meta-line {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.categories { display: grid; gap: 0; margin: 0 0 28px; }
.cat {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.cat:first-child { border-top: 1px solid var(--rule); }
.cat .label { font-weight: 600; }
.cat .blurb { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.cat .mark {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  width: 1.4em;
  text-align: center;
}
.cat .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mark[data-grade="A"] { color: var(--a); }
.mark[data-grade="B"] { color: var(--b); }
.mark[data-grade="C"] { color: var(--c); }
.mark[data-grade="D"] { color: var(--d); }
.mark[data-grade="F"] { color: var(--f); }

.findings-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 8px 0 8px;
}
.find-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.finding {
  border: 1px solid var(--rule);
  padding: 12px 14px 14px;
  break-inside: avoid;
}
.finding-top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
}
.finding h4 {
  font-size: 15px;
  margin: 0;
  font-weight: 650;
  font-family: var(--serif);
}
.sev {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.sev-critical { color: var(--f); }
.sev-high { color: var(--d); }
.sev-medium { color: var(--c); }
.sev-low { color: var(--b); }
.sev-info { color: var(--muted); }
.finding .detail, .finding .fix, .finding .where { margin: 8px 0 0; font-size: 13.5px; }
.finding .fix::before {
  content: "Fix — ";
  font-weight: 700;
  letter-spacing: 0.02em;
}
.finding .where {
  color: var(--muted);
  font-family: var(--mono-ui);
  font-size: 11.5px;
}
.evidence {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono-ui);
  font-size: 12px;
  background: #f3eee4;
  padding: 3px 7px;
}
.notes { margin-top: 18px; color: var(--muted); font-size: 12.5px; }
.how {
  margin-top: 28px;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  color: var(--muted);
  font-size: 12.5px;
}
.how h2 { margin-bottom: 6px; }
.how ul { margin: 0; padding-left: 1.1em; }

footer {
  margin-top: 28px;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  color: var(--muted);
  font-size: 12.5px;
}
footer p { margin: 0; }

@media (max-width: 900px) {
  .layout, .masthead-row, .card-head { grid-template-columns: 1fr; }
  h1 { font-size: 44px; }
  textarea { min-height: 260px; }
  .page { padding: 20px 16px 40px; }
}

@media print {
  body { background: white; }
  .page { max-width: none; padding: 0; }
  .no-print, footer { display: none !important; }
  .layout { display: block; }
  .composer, .report {
    background: white;
    border: 0;
    box-shadow: none;
  }
  .report { padding: 0; min-height: 0; }
  .stamp { transform: none; }
  .finding { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
