/* Demand Lab v2 design tokens and components (spec §5.12). One file, no build step. */
:root {
  --paper: #f6f1e8;
  --card: #fffdf8;
  --ink: #161411;
  --muted: #5c574e;
  --line: #e6dfd2;
  --line-soft: #eadfcb;
  --accent: #9a3412;
  --accent-text: #9a3412;
  --button-bg: #9a3412;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r1: 10px; --r2: 12px; --r3: 14px;
  --content: 860px;
  --wide: 1100px;
  --serif: Fraunces, Georgia, "Iowan Old Style", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--paper); line-height: 1.55; font-size: 17px; }
[hidden] { display: none !important; }
a { color: var(--accent-text); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: var(--s2); background: var(--ink); color: #fff; padding: var(--s2) var(--s3); border-radius: var(--r1); z-index: 10; }
.skip:focus { left: var(--s2); }
.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; }

/* Header, breadcrumb, footer */
header.top { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
header.top .brand { font-weight: 700; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 20px; }
header.top nav { display: flex; gap: var(--s4); }
header.top nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
nav.crumbs { max-width: var(--content); margin: 0 auto; padding: var(--s3) var(--s5) 0; font-size: 14px; color: var(--muted); }
nav.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
nav.crumbs li + li::before { content: "›"; margin-right: var(--s2); color: var(--muted); }
footer.site { border-top: 1px solid var(--line); padding: var(--s6) var(--s5); color: var(--muted); font-size: 14px; text-align: center; margin-top: var(--s7); }

/* Layout */
main > section, .hero, .prose { max-width: var(--content); margin: 0 auto; padding: var(--s3) var(--s5) var(--s5); }
.hero { padding-top: var(--s7); }
.hero.hub, .table-wrap.wide { max-width: var(--wide); }
.kicker { letter-spacing: .12em; text-transform: uppercase; font-size: 12px; color: var(--accent-text); font-weight: 700; margin: 0 0 var(--s2); }
h1 { font-family: var(--serif); font-size: clamp(30px, 5vw, 50px); line-height: 1.12; margin: var(--s2) 0 var(--s3); font-weight: 700; }
h2 { font-family: var(--serif); font-size: 27px; line-height: 1.2; margin: var(--s6) 0 var(--s3); font-weight: 700; }
h3 { font-family: var(--serif); font-size: 21px; margin: var(--s3) 0 var(--s2); }
.tagline { font-size: 21px; margin: 0 0 var(--s4); }
.lead { font-size: 19px; max-width: 720px; }
.answer-block { font-size: 18px; background: var(--card); border: 1px solid var(--line-soft); border-left: 5px solid var(--accent); padding: var(--s4) var(--s5); margin: var(--s4) 0; border-radius: 0 var(--r2) var(--r2) 0; }
.status { margin: 0 0 var(--s4); }
.chip { display: inline-block; border: 1px solid #e0d6c4; border-radius: 999px; padding: 3px 10px; font-size: 13px; background: #fff; margin: 0 var(--s1) var(--s1) 0; }
.note, .consent, .count, .sources { color: var(--muted); font-size: 14px; }
.notice { background: #fff8e6; border: 1px solid #f1dfa6; border-radius: var(--r2); padding: var(--s3) var(--s4); font-size: 15px; }
.sources a { word-break: break-all; }

/* Buttons and forms */
.btn { background: var(--button-bg); color: #fff; border: 0; border-radius: var(--r1); padding: 12px 18px; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .6; cursor: wait; }
form.wait, form.request, form.search { margin: var(--s4) 0; }
form .row { display: flex; gap: var(--s2); flex-wrap: wrap; }
form input[type="email"], form input[type="search"], form input[type="text"], form textarea, form input[type="number"], form select { flex: 1; min-width: 220px; padding: 12px 14px; border: 1px solid #d7ccb8; border-radius: var(--r1); font: inherit; background: #fff; }
form label { display: block; font-weight: 600; margin: var(--s3) 0 var(--s1); }
form textarea { width: 100%; }
form.search { display: flex; gap: var(--s2); flex-wrap: wrap; max-width: 620px; }
.hp { position: absolute; left: -9999px; top: -9999px; }
.form-msg { min-height: 1.4em; margin: var(--s2) 0 0; font-weight: 600; }
.form-msg.error { color: #a12a1c; }
.form-msg.ok { color: #1f6f4a; }
.count { min-height: 1.4em; }
.turnstile:empty { display: none; }

/* Cards, steps, tables */
.card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r2); padding: var(--s4); }
ol.steps { list-style: none; padding: 0; margin: 0; }
ol.steps li { display: flex; gap: var(--s3); margin: var(--s3) 0; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r2); padding: var(--s4); }
ol.steps .n { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--button-bg); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
ul.personas { padding-left: 20px; }
ul.plain { list-style: none; padding: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; background: var(--card); font-size: 15px; }
th, td { border: 1px solid var(--line-soft); padding: var(--s2) var(--s3); vertical-align: top; text-align: left; }
thead th { background: var(--ink); color: #fff; }
table.compare th[scope="row"] { font-weight: 700; background: #fbf7ef; }
table.catalog th[data-sort] { cursor: pointer; }
table.catalog th[aria-sort="ascending"]::after { content: " ↑"; }
table.catalog th[aria-sort="descending"]::after { content: " ↓"; }
details.faq { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r2); padding: var(--s3) var(--s4); margin: var(--s2) 0; }
details.faq summary { cursor: pointer; font-weight: 700; }
details.faq p { margin: var(--s2) 0 0; }

/* Pricing */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }
.tier { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r3); padding: var(--s4); display: flex; flex-direction: column; }
.tier.highlight { border: 2px solid var(--accent); }
.tier .price { font-family: var(--serif); font-size: 34px; margin: var(--s1) 0 var(--s2); }
.tier .price span { font-size: 16px; color: var(--muted); font-family: var(--sans); }
.tier ul { padding-left: 18px; flex: 1; margin: 0 0 var(--s3); }
.tier .btn { width: 100%; }

/* Related and hub cards */
.related, .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s4); }
.related .card, a.idea { display: flex; flex-direction: column; gap: var(--s1); text-decoration: none; color: inherit; }
a.idea { background: var(--card); border: 1px solid var(--line-soft); border-top: 4px solid var(--accent); border-radius: var(--r3); padding: var(--s4); min-height: 200px; }
a.idea:hover, .related .card:hover { border-color: var(--accent-text); }
a.idea h3 { margin: var(--s1) 0; }
a.idea p { color: var(--muted); flex: 1; margin: 0; }
.k { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); font-weight: 700; }
.f { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); font-size: 13px; margin-top: var(--s2); flex-wrap: wrap; }
.badge { background: #e8f3ec; color: #1f6f4a; border-radius: 999px; padding: 2px 8px; font-weight: 700; }
.group { max-width: var(--wide); margin: 0 auto; padding: 0 var(--s5) var(--s5); }
.group-title { font-size: 22px; margin: var(--s5) 0 var(--s3); }
nav.filters { display: flex; flex-wrap: wrap; gap: var(--s2); max-width: var(--wide); margin: 0 auto; padding: 0 var(--s5) var(--s4); }
nav.filters button { border: 1px solid #d7ccb8; background: #fff; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; }
nav.filters button[aria-pressed="true"], nav.filters button:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { max-width: var(--wide); margin: 0 auto; padding: 0 var(--s5); color: var(--muted); }
.hub-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s4); max-width: var(--wide); margin: var(--s6) auto; padding: 0 var(--s5); }

/* Tools */
section.tool { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r3); padding: var(--s4) var(--s5) var(--s5); }
.tool-root .field { margin: var(--s3) 0; }
.tool-root .result { background: #fbf7ef; border-left: 4px solid var(--accent); padding: var(--s3) var(--s4); margin-top: var(--s4); border-radius: 0 var(--r1) var(--r1) 0; }
.tool-root .formula { font-size: 14px; color: var(--muted); }
table.sheet td { height: 34px; }
table.sheet caption { caption-side: top; text-align: left; font-weight: 700; padding: var(--s2) 0; }
.tool-root .field { display: flex; flex-direction: column; gap: var(--s1); }
.tool-root .chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0; }
.tool-root .chips button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.email-body, .list-text { white-space: pre-wrap; word-break: break-word; font: inherit; background: #fbf7ef; border: 1px solid var(--line-soft); border-radius: var(--r1); padding: var(--s3); margin: var(--s2) 0; overflow-x: auto; }
.tool-root table { margin-top: var(--s3); }

/* Prose pages */
.prose { padding-top: var(--s7); }
.prose h2 { font-size: 24px; }
.prose table { margin: var(--s4) 0; }

@media (max-width: 700px) {
  body { font-size: 16px; }
  header.top { padding: var(--s3) var(--s4); }
  header.top nav { gap: var(--s3); font-size: 14px; }
  main > section, .hero, .prose, .group, nav.filters, .hub-forms, .empty { padding-left: var(--s4); padding-right: var(--s4); }
}
@media print {
  header.top, footer.site, nav.crumbs, form, .btn, .tool-actions, .note, .chip, .status { display: none !important; }
  section.tool { border: 0; padding: 0; }
  body { background: #fff; }
  .email-body, .list-text, .result { border: 0; background: none; padding: 0; }
  a[href]::after { content: ""; }
}
