/* Deslop My Book — the audience is novelists, so the page reads like a
   book page: generous measure, real serif for prose, sans only for UI
   chrome. Theme-aware because plenty of writers work at night. */

:root {
  --ink: #1a1714;
  --ink-soft: #5c554d;
  --paper: #faf8f5;
  --paper-raised: #ffffff;
  --rule: #e2dcd3;
  --accent: #8a2b1f;
  --accent-soft: #f2e6e3;
  --ok: #2f6b4f;
  --warn: #9a6a1a;
  --bad: #a33325;
  --measure: 34rem;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7e0;
    --ink-soft: #a49b90;
    --paper: #171513;
    --paper-raised: #201d1a;
    --rule: #332e29;
    --accent: #d9705f;
    --accent-soft: #2c1f1c;
    --ok: #6cc294;
    --warn: #d9a441;
    --bad: #e0705f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* ── Chrome ─────────────────────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 1.4rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
}
/* The badge carries its own white field — the script lettering is dark
   green and needs it, so it is not made transparent to match the page. */
.wordmark img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wordmark-text span { color: var(--accent); }

.site-header nav {
  display: flex;
  gap: 1.4rem;
  font-family: var(--sans);
  font-size: 0.88rem;
}
.site-header nav a { color: var(--ink-soft); text-decoration: none; }
.site-header nav a:hover { color: var(--accent); }

/* The text column stays at book measure for readability, but the column
   itself is centred — left-aligned against a 1600px viewport reads as a
   broken layout rather than a deliberate one.
   --gutter aligns the header and footer to the same column while letting
   their rules still span the full width. */
:root { --column: 52rem; --gutter: clamp(1rem, 5vw, 3rem); }

main {
  max-width: var(--column);
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
}

.site-header,
.site-footer {
  padding-inline: max(var(--gutter), calc((100vw - var(--column)) / 2 + var(--gutter)));
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.site-footer a { color: inherit; }
.site-footer .fine { max-width: var(--measure); margin-top: 0.4rem; }

/* ── Type ───────────────────────────────────────────────────────────── */

h1 {
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 2.5rem 0 1rem;
  max-width: 18ch;
}
h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 3rem 0 0.8rem;
}
h3 { font-size: 1.1rem; margin: 1.6rem 0 0.4rem; }

.lede {
  font-size: 1.22rem;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin-bottom: 2rem;
}
p { max-width: var(--measure); }

.hero { padding-top: 1rem; }

/* ── Form ───────────────────────────────────────────────────────────── */

.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: clamp(1.2rem, 4vw, 2rem);
  max-width: 40rem;
  margin: 2rem 0;
}

.field { margin-bottom: 1.2rem; }
.field label {
  display: block;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.field .hint {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.35rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

input[type="text"], input[type="file"], select {
  width: 100%;
  padding: 0.65rem 0.7rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
input[type="file"] { padding: 0.5rem; }
input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: 0.5; cursor: progress; }
.btn-lg { font-size: 1.05rem; padding: 0.9rem 1.8rem; }

.alert {
  border-left: 3px solid var(--bad);
  background: var(--accent-soft);
  padding: 0.9rem 1rem;
  border-radius: 0 6px 6px 0;
  font-family: var(--sans);
  font-size: 0.92rem;
  margin-bottom: 1.4rem;
  max-width: 40rem;
}

/* ── Report ─────────────────────────────────────────────────────────── */

.verdict {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.2rem;
}
.verdict .num {
  font-size: clamp(2.6rem, 9vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.verdict .unit {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
  max-width: 16rem;
}

.level {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
.level-low      { background: color-mix(in srgb, var(--ok) 18%, transparent);   color: var(--ok); }
.level-moderate { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.level-high,
.level-severe   { background: color-mix(in srgb, var(--bad) 18%, transparent);  color: var(--bad); }

.offenders {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.9rem;
  margin: 1rem 0;
}
.offenders th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  padding: 0 0.6rem 0.5rem 0;
}
.offenders td {
  padding: 0.6rem 0.6rem 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.offenders td:first-child { font-family: var(--serif); }
.offenders .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.offenders .over { color: var(--bad); font-weight: 600; }

.table-scroll { overflow-x: auto; }

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  max-width: var(--measure);
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.4rem;
  margin-bottom: 1rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.muted { color: var(--ink-soft); font-size: 0.92rem; }
.center-cta { margin: 2rem 0; }

/* ── Slop Index (loaded after the main report) ──────────────────────── */

.slop-slot { min-height: 4rem; }

.loading {
  font-family: var(--sans);
  font-size: 0.9rem;
}
.loading::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots { to { content: "…"; } }

@media (prefers-reduced-motion: reduce) {
  .loading::after { animation: none; content: "…"; }
}

.standout {
  border-left: 3px solid var(--accent);
  padding: 0.8rem 0 0.8rem 1rem;
  margin: 1.2rem 0;
  font-size: 1.08rem;
  max-width: var(--measure);
}
