/* Secondary Research Sprint — editorial research playbook */

:root {
  --paper: #f4efe6;
  --paper-2: #ece5d8;
  --card: #faf7f0;
  --ink: #141310;
  --ink-2: #3d382f;
  --muted: #6e665a;
  --line: #d8cfbe;
  --line-strong: #b9ad97;
  --green: #12463a;
  --green-soft: #dfe8e2;
  --amber: #b4762a;
  --rust: #a8412a;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --maxw: 780px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(18, 70, 58, 0.05), transparent 45%),
    radial-gradient(circle at 88% 30%, rgba(180, 118, 42, 0.06), transparent 50%);
  background-attachment: fixed;
}

::selection { background: rgba(18, 70, 58, 0.18); }

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  z-index: 100;
  font-family: var(--sans);
}
.skip:focus { left: 16px; top: 16px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(20px, 4vw, 56px);
  background: rgba(244, 239, 230, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--paper);
}

.topbar-links { display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #f7f4ec;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(18, 70, 58, 0.18); }
.btn.ghost { background: transparent; color: var(--green); }
.btn.ghost:hover { background: rgba(18, 70, 58, 0.07); box-shadow: none; }
.btn.small { padding: 8px 15px; font-size: 13px; }

/* ---------- hero ---------- */

.hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 104px) clamp(20px, 4vw, 56px) clamp(32px, 5vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 26px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: "";
  width: 34px;
  height: 2px;
  background: var(--green);
  display: block;
}

h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(48px, 7.4vw, 92px);
  line-height: 0.96;
  letter-spacing: -0.02em;
  margin: 0 0 26px;
  font-variation-settings: "opsz" 72;
}
h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--green);
}

.lead {
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 34em;
  margin: 0 0 32px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-meta span {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 12px;
}

/* hero card: the loop */

.loop-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 26px 26px 22px;
  box-shadow: 0 18px 50px -30px rgba(20, 19, 16, 0.45);
  transform: rotate(-0.6deg);
}
.loop-card h2 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 18px;
}
.loop-step {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 14.5px;
}
.loop-step:first-of-type { border-top: 0; }
.loop-num { font-family: var(--mono); font-size: 12px; color: var(--green); }
.loop-tier {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--green-soft);
  color: var(--green);
  white-space: nowrap;
}
.loop-tier.gen { background: rgba(180, 118, 42, 0.13); color: var(--amber); }

/* ---------- layout ---------- */

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px) 96px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 44px;
}

.toc {
  position: sticky;
  top: 96px;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.5;
}
.toc-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex;
  gap: 10px;
  padding: 6px 0 6px 12px;
  color: var(--ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--line-strong);
  padding-top: 3px;
}
.toc a:hover { color: var(--green); border-left-color: var(--line-strong); }
.toc a.active { color: var(--green); border-left-color: var(--green); font-weight: 500; }
.toc a.active::before { color: var(--green); }

.content { min-width: 0; max-width: var(--maxw); }

/* ---------- sections ---------- */

section { padding: 8px 0 40px; scroll-margin-top: 96px; }

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 3.4vw, 42px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  font-variation-settings: "opsz" 48;
}
h2 em { font-style: italic; font-weight: 400; }

h3 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 34px 0 10px;
}

p { margin: 0 0 18px; }
p.big { font-size: 21px; line-height: 1.5; }

.lede { color: var(--ink-2); }

ul, ol { margin: 0 0 20px; padding-left: 1.15em; }
li { margin-bottom: 8px; }
li::marker { color: var(--line-strong); }

strong { font-weight: 600; }
em { font-style: italic; }

/* pull quote */
.pull {
  border-left: 3px solid var(--green);
  padding: 6px 0 6px 22px;
  margin: 30px 0;
  font-size: 23px;
  line-height: 1.42;
  font-style: italic;
  color: var(--ink);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 22px 0 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}
thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper-2);
  vertical-align: bottom;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-2);
}
tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child { color: var(--ink); font-weight: 500; }
td code, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- callouts ---------- */

.callout {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 3px;
  padding: 20px 24px;
  margin: 26px 0;
  font-size: 17px;
  line-height: 1.55;
}
.callout p:last-child { margin-bottom: 0; }
.callout .callout-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  display: block;
  margin-bottom: 8px;
}
.callout.warn { border-left-color: var(--rust); }
.callout.warn .callout-title { color: var(--rust); }
.callout.note { border-left-color: var(--amber); }
.callout.note .callout-title { color: var(--amber); }

/* ---------- code ---------- */

pre {
  position: relative;
  background: #1b1a17;
  color: #e9e3d6;
  border-radius: 4px;
  padding: 22px 24px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  margin: 22px 0;
  box-shadow: 0 16px 40px -28px rgba(20, 19, 16, 0.7);
}
pre code { font-family: inherit; }
pre .c { color: #8c8574; }
pre .k { color: #9ec9b7; }
pre .h { color: #d8a868; }

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 -12px;
}

.copy-btn {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: 3px;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { border-color: var(--green); color: var(--green); }
.copy-btn.done { border-color: var(--green); color: var(--green); background: var(--green-soft); }

/* ---------- file tree ---------- */

.tree {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.9;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 24px;
  margin: 22px 0;
  color: var(--ink-2);
}
.tree .dir { color: var(--green); font-weight: 500; }
.tree .dim { color: var(--muted); }

/* ---------- module cards ---------- */

.module {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  margin: 26px 0;
  overflow: hidden;
}
.module-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(236, 229, 216, 0.7), rgba(250, 247, 240, 0));
}
.module-num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--paper);
  background: var(--green);
  border-radius: 3px;
  padding: 5px 9px;
}
.module-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.budget {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid rgba(180, 118, 42, 0.4);
  background: rgba(180, 118, 42, 0.08);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}
.module-body { padding: 6px 24px 20px; }
.module-body p, .module-body li { font-size: 17px; }
.module-body h4 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin: 22px 0 8px;
}
.module-body ol, .module-body ul { margin-bottom: 6px; }
.module-body .table-wrap { margin-top: 4px; }

/* ---------- follow-up grid ---------- */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin: 22px 0;
}
.mini-card {
  border: 1px solid var(--line);
  border-top: 3px solid var(--green);
  border-radius: 3px;
  background: var(--card);
  padding: 20px 20px 16px;
}
.mini-card h4 {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
}
.mini-card p { font-size: 15px; line-height: 1.55; margin: 0; color: var(--ink-2); }

/* ---------- routing split ---------- */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}
.tier {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 22px;
  background: var(--card);
}
.tier h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--green);
}
.tier.gen h4 { color: var(--amber); }
.tier p { font-size: 15.5px; margin: 0; color: var(--ink-2); }

/* ---------- cost list ---------- */

.cost-list {
  list-style: none;
  padding: 0;
  margin: 22px 0;
  counter-reset: cost;
}
.cost-list li {
  counter-increment: cost;
  position: relative;
  padding: 14px 0 14px 46px;
  border-top: 1px solid var(--line);
  font-size: 16.5px;
  line-height: 1.55;
}
.cost-list li:last-child { border-bottom: 1px solid var(--line); }
.cost-list li::before {
  content: counter(cost, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--line-strong);
}
.cost-list strong { font-weight: 600; }

/* ---------- download block ---------- */

.download {
  background: var(--ink);
  color: #efe9dc;
  border-radius: 6px;
  padding: clamp(28px, 4vw, 44px);
  margin: 20px 0 0;
}
.download h2 { color: #f7f3ea; margin-bottom: 12px; }
.download h2 em { color: #9ec9b7; }
.download p { color: #c8c0b0; max-width: 46ch; }
.download .btn { background: #f7f3ea; color: var(--ink); border-color: #f7f3ea; }
.download .btn.ghost { background: transparent; color: #f7f3ea; border-color: rgba(247, 243, 234, 0.4); }
.download .btn.ghost:hover { background: rgba(247, 243, 234, 0.1); }
.dl-files {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: rgba(247, 243, 234, 0.16);
  border: 1px solid rgba(247, 243, 234, 0.16);
  border-radius: 4px;
  overflow: hidden;
  margin: 28px 0 0;
}
.dl-files a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 14px 18px;
  background: #1b1a17;
  color: #efe9dc;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12.5px;
  transition: background 0.15s;
}
.dl-files a:hover { background: #262420; }
.dl-files a span { color: #8c8574; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.dl-files a:hover span { color: #9ec9b7; }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--line);
  padding: 40px clamp(20px, 4vw, 56px) 64px;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--muted);
}
footer p { margin: 0; }
footer a { color: var(--ink-2); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #f7f3ea;
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 12px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reveal ---------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover { transform: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .loop-card { transform: none; max-width: 520px; }
  .shell { grid-template-columns: 1fr; padding-top: 32px; }
  .toc {
    position: static;
    border-bottom: 1px solid var(--line);
    padding-bottom: 20px;
  }
  .toc ol { columns: 2; column-gap: 24px; }
  .toc li { break-inside: avoid; }
  .content { max-width: 100%; }
}

@media (max-width: 620px) {
  body { font-size: 18px; }
  .topbar { padding: 12px 18px; }
  .brand span { display: none; }
  .toc ol { columns: 1; }
  .split { grid-template-columns: 1fr; }
  .module-head { grid-template-columns: auto 1fr; row-gap: 8px; }
  .budget { grid-column: 2; justify-self: start; }
  pre { font-size: 12px; padding: 18px; }
  footer { flex-direction: column; }
}

@media print {
  .topbar, .toc, .download .btn, .copy-btn, .toast { display: none; }
  body { background: #fff; font-size: 11pt; }
  .shell { display: block; }
  section { page-break-inside: avoid; }
}
