:root {
  --paper: #f4efe6;
  --paper-deep: #ebe4d6;
  --card: #fffcf7;
  --ink: #1c1917;
  --ink-soft: #4a433c;
  --muted: #6f675e;
  --line: #ddd4c6;
  --seal: #9a3b2f;
  --seal-deep: #7a2e24;
  --forest: #2f5d50;
  --forest-soft: #e3ede8;
  --amber: #b57914;
  --amber-soft: #f8edd6;
  --high-soft: #f6e6e2;
  --mid-soft: #f8edd6;
  --low-soft: #e3ede8;
  --shadow: 0 14px 40px rgba(28, 25, 23, 0.07);
  --radius: 20px;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  --max: 1080px;
  --read: 720px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #f8e7d8 0%, transparent 50%),
    radial-gradient(900px 400px at 100% 0%, #e7efe8 0%, transparent 45%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.55;
  font-size: 17px;
}

img, svg { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--seal-deep); }
button { cursor: pointer; }

.wrap {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.28rem;
  letter-spacing: -0.045em;
}
.brand-name span { color: var(--seal); }
.nav {
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 0.95rem;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
}
.nav a:hover { color: var(--ink); }

/* Hero */
.hero { padding: 28px 0 8px; max-width: 38rem; }
.eyebrow {
  color: var(--seal);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin: 0 0 10px;
}
h1 {
  font-family: var(--font-display);
  font-weight: 520;
  letter-spacing: -0.035em;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 14px;
}
.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 36rem;
}

/* Panels */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 22px 0;
}
.dropzone {
  border: 1.5px dashed #cbbfad;
  background: linear-gradient(180deg, #fff 0%, #faf6ef 100%);
  border-radius: 16px;
  padding: 28px 18px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.dropzone.dragover {
  border-color: var(--seal);
  background: #fff7f5;
  transform: translateY(-1px);
}
.dropzone h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 520;
  margin: 8px 0 6px;
}
.dropzone p { margin: 0; color: var(--muted); }
.drop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--seal);
  color: #fffaf6;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.btn:hover { background: var(--seal-deep); }
.btn:focus-visible, .btn-ghost:focus-visible, .chip:focus-visible {
  outline: 3px solid #e8b4ad;
  outline-offset: 2px;
}
.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
}
.btn-ghost:hover { background: var(--paper-deep); }
.btn[disabled], .btn-ghost[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.hint-row, .paste-block { margin-top: 14px; }
.hint-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.seg {
  display: inline-flex;
  background: var(--paper-deep);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
}
.seg button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(28,25,23,0.08);
}

textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid #e8b4ad; outline-offset: 1px; }

/* Samples */
.samples { margin: 8px 0 28px; }
.samples h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 520;
  margin: 0 0 6px;
}
.muted { color: var(--muted); }
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.chip:hover { border-color: #c9bba8; color: var(--ink); background: #fff; }
.chip .tag {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--seal);
}

/* Trust + how */
.trust {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 8px 0 28px;
  padding: 0;
  list-style: none;
}
.trust li {
  background: rgba(255,252,247,0.6);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.95rem;
}
.trust strong { display: block; font-size: 0.95rem; }
.steps {
  display: grid;
  gap: 12px;
  margin: 0 0 32px;
}
.step {
  padding: 4px 0 8px;
}
.step .num {
  font-family: var(--font-display);
  color: var(--seal);
  font-weight: 600;
  font-size: 0.9rem;
}
.step h3 {
  margin: 2px 0 4px;
  font-size: 1.05rem;
}
.step p { margin: 0; color: var(--ink-soft); }

/* Result */
#view-result { display: none; }
#view-result.active, #view-home.active { display: block; }
#view-home { display: block; }

.result-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 12px 0 18px;
}
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper-deep);
  color: var(--ink-soft);
}
.pill.low { background: var(--low-soft); color: var(--forest); }
.pill.medium { background: var(--mid-soft); color: #7a5308; }
.pill.high, .pill.critical { background: var(--high-soft); color: var(--seal-deep); }
.pill.now { background: var(--high-soft); color: var(--seal-deep); }
.pill.soon { background: var(--mid-soft); color: #7a5308; }

.sentences {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 10px;
  margin: 0 0 16px;
}
.sentences h2 {
  font-family: var(--font-display);
  font-weight: 520;
  font-size: 1.05rem;
  margin: 0 0 12px;
  color: var(--seal);
}
.sentences ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: s;
}
.sentences li {
  counter-increment: s;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.4vw, 1.45rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
  padding: 12px 0 14px 2.1rem;
  position: relative;
  border-top: 1px solid var(--line);
}
.sentences li:first-child { border-top: 0; }
.sentences li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 14px;
  color: var(--seal);
  font-size: 0.95rem;
  font-weight: 600;
}

.grid-2 {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.stat .label {
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.stat .value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 4px 0;
  letter-spacing: -0.02em;
}
.stat .notes { color: var(--ink-soft); font-size: 0.95rem; margin: 0; }
.deadlines { margin: 8px 0 0; padding: 0; list-style: none; }
.deadlines li { margin: 6px 0 0; }

.findings, .ask, .draft, .human, .disclaimer-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 8px;
  margin: 0 0 12px;
}
.findings h2, .ask h2, .draft h2, .human h2 {
  font-family: var(--font-display);
  font-weight: 520;
  font-size: 1.2rem;
  margin: 0 4px 8px;
}
.finding {
  border-top: 1px solid var(--line);
  padding: 12px 4px 14px;
}
.finding h3 { margin: 4px 0 6px; font-size: 1.05rem; }
.finding .sev {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.finding .sev.high { color: var(--seal); }
.finding .sev.medium { color: #8a5b0a; }
.finding .sev.low { color: var(--forest); }
blockquote {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--paper);
  border-left: 3px solid var(--seal);
  color: var(--ink-soft);
  font-style: italic;
  font-size: 0.98rem;
}
.finding p { margin: 0; }

.ask ol { margin: 0 0 12px; padding-left: 1.2rem; }
.ask li { margin: 0 0 8px; }
.draft-meta { color: var(--muted); margin: 0 0 8px; font-size: 0.92rem; }
.draft textarea { min-height: 240px; font-size: 0.98rem; }

.human {
  background: var(--high-soft);
  border-color: #e4c4be;
}
.human p { margin: 0 4px 10px; }

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 16px;
}

.disclaimer-box {
  background: transparent;
  box-shadow: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
  padding: 8px 4px 24px;
}
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 40px;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }

/* Status */
.status {
  display: none;
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}
.status.visible { display: block; }
.status.error { background: var(--high-soft); border-color: #e4c4be; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--seal);
  border-radius: 50%;
  display: inline-block;
  vertical-align: -3px;
  margin-right: 8px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Legal page */
.prose { max-width: 42rem; padding: 10px 0 48px; }
.prose h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.prose h2 { font-family: var(--font-display); font-weight: 520; margin-top: 1.6em; }
.prose p, .prose li { color: var(--ink-soft); }

@media (min-width: 720px) {
  .wrap { width: min(var(--max), calc(100% - 56px)); }
  .panel { padding: 22px; }
  .trust { grid-template-columns: repeat(4, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .grid-2 { grid-template-columns: 1.1fr 0.9fr; }
  body { font-size: 18px; }
}

@media print {
  body { background: #fff; }
  .site-header, .site-footer, .actions-row, .btn, .btn-ghost, .nav { display: none !important; }
  .panel, .sentences, .stat, .findings, .ask, .draft { box-shadow: none; }
}
