/* SPWS Designer shell. One theme system, light + dark via tokens.
   Instrument aesthetic: restrained, bordered, one accent, mono numbers. */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1917;
  --text-soft: #57534e;
  --line: #d6d3d1;
  --accent: #0e7490;
  --accent-ink: #ffffff;
  --block: #b91c1c;
  --warn: #a16207;
  --doc: #44403c;
  --ok: #15803d;
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181a;
    --surface: #1e2124;
    --text: #e7e5e4;
    --text-soft: #a8a29e;
    --line: #3f3f46;
    --accent: #22b8d4;
    --accent-ink: #062a33;
    --block: #f87171;
    --warn: #fbbf24;
    --doc: #a8a29e;
    --ok: #4ade80;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

/* header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header nav {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-header a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}
.site-header a:hover { color: var(--accent); }
.brand { font-weight: 700; margin-right: auto; }
.brand .wt {
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--text-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* type */
h1 { font-size: 1.9rem; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }
.lede { color: var(--text-soft); max-width: 65ch; margin: 0 0 2rem; }

/* home */
.intro { margin: 1.5rem 0 2.5rem; }
.tool-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.tool-row {
  display: block;
  padding: 1.25rem 0.25rem;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.tool-row h2 { margin: 0 0 0.25rem; color: var(--accent); }
.tool-row p { margin: 0; color: var(--text-soft); max-width: 65ch; }
.tool-row:hover h2 { text-decoration: underline; }
.provenance { margin-top: 3rem; }
.provenance p { color: var(--text-soft); max-width: 65ch; }

/* forms */
.calc-form fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem;
  margin: 0 0 1.5rem;
}
.calc-form legend { font-weight: 600; padding: 0 0.5rem; }
.field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 1rem;
}
.field label { font-weight: 500; font-size: 0.92rem; }
.field input, .field select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  max-width: 26rem;
}
.field input:focus-visible, .field select:focus-visible,
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.field.checkbox { flex-direction: row; align-items: baseline; gap: 0.5rem; }
.field.checkbox input { max-width: none; }
.help { font-size: 0.85rem; color: var(--text-soft); margin: 0; max-width: 60ch; }

button[type="submit"] {
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.5rem;
  cursor: pointer;
}
button[type="submit"]:active { transform: translateY(1px); }

.form-error {
  border: 1px solid var(--block);
  border-radius: var(--radius);
  color: var(--block);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
}

/* results */
.results { border-top: 2px solid var(--accent); margin-top: 2.5rem; padding-top: 0.5rem; }
.result-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.result-table th, .result-table td {
  text-align: left;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}
.result-table td { font-family: var(--mono); }
.result-table tr:last-child th, .result-table tr:last-child td { border-bottom: none; }
.headline-row th, .headline-row td { font-weight: 700; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

/* findings */
.finding-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.finding {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.6rem 0.9rem;
}
.sev-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}
.sev-block { border-left: 4px solid var(--block); }
.sev-block .sev-badge { color: var(--block); }
.sev-warn { border-left: 4px solid var(--warn); }
.sev-warn .sev-badge { color: var(--warn); }
.sev-doc .sev-badge, .sev-info .sev-badge { color: var(--doc); }
.rule-id { font-family: var(--mono); font-size: 0.85rem; color: var(--text-soft); flex-shrink: 0; }
.finding-msg { max-width: 62ch; }
.all-clear { color: var(--ok); font-weight: 500; }

/* trace */
.trace { margin-top: 1.5rem; }
.trace summary { cursor: pointer; font-weight: 500; }
.trace ol {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.7;
  padding-left: 2rem;
}

/* footer */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.85rem;
}
.site-footer p { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem; }

@media (max-width: 640px) {
  .site-header nav { gap: 0.9rem; font-size: 0.9rem; }
  h1 { font-size: 1.5rem; }
}
