/* loop-generator site — shared stylesheet */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f8f7;
  --ink: #17211b;
  --ink-soft: #45524a;
  --ink-faint: #6b7a70;
  --line: #e0e6e2;
  --green: #14803c;
  --green-dark: #0d5c2a;
  --green-bg: #e9f6ee;
  --red: #c2382e;
  --red-bg: #fbeceb;
  --amber: #9a6700;
  --amber-bg: #fff5df;
  --code-bg: #0e1512;
  --code-ink: #d5e2d9;
  --code-accent: #7ee2a8;
  --code-muted: #7d8f84;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16.5px;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  white-space: nowrap;
}

pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.85rem;
}
pre code {
  background: none; border: none; padding: 0; white-space: pre;
  font-size: inherit; color: inherit;
}
pre .c { color: var(--code-muted); }   /* comment */
pre .k { color: var(--code-accent); } /* keyword / key */
pre .s { color: #e8d48b; }            /* string */
pre .red { color: #ff8a7a; }          /* failing check */
pre .green { color: var(--code-accent); } /* passing check */

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.site-header .inner {
  max-width: 1060px; margin: 0 auto; padding: 0.7rem 1.4rem;
  display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap;
}
.brand {
  font-family: var(--mono); font-weight: 700; font-size: 1.02rem;
  color: var(--ink); display: flex; align-items: center; gap: 0.55rem;
}
.brand:hover { text-decoration: none; }
.brand .loopmark {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--green); border-top-color: var(--red);
  display: inline-block; transform: rotate(-45deg);
}
.site-nav { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-left: auto; }
.site-nav a { color: var(--ink-soft); font-size: 0.92rem; }
.site-nav a.active { color: var(--green); font-weight: 600; }
.site-nav a.gh { color: var(--ink); font-weight: 600; }

/* ---------- layout ---------- */
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 1.4rem; }
.narrow { max-width: 820px; }

section { padding: 3.4rem 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

h1 { font-size: 2.5rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 1rem; }
h2 { font-size: 1.65rem; letter-spacing: -0.01em; margin: 0 0 1rem; }
h3 { font-size: 1.15rem; margin: 1.8rem 0 0.5rem; }
.kicker {
  font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--green); font-weight: 700;
  margin-bottom: 0.8rem;
}
.lead { font-size: 1.16rem; color: var(--ink-soft); }

/* ---------- hero ---------- */
.hero { padding: 4.6rem 0 3.6rem; }
.hero h1 { font-size: 3rem; max-width: 30ch; }
.hero h1 .red { color: var(--red); }
.hero h1 .green { color: var(--green); }
.hero .lead { max-width: 56ch; }
.cta-row { display: flex; gap: 0.9rem; margin-top: 1.9rem; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 0.68rem 1.35rem; border-radius: 8px;
  font-weight: 600; font-size: 0.98rem; border: 1.5px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.ghost { border-color: var(--line); color: var(--ink); background: var(--bg); }
.btn.ghost:hover { border-color: var(--green); color: var(--green); }
.hero pre { margin-top: 2.4rem; }

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 1.1rem; margin-top: 1.8rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 1.25rem 1.35rem;
}
.card h3 { margin-top: 0; font-size: 1.03rem; }
.card p { margin: 0.4rem 0 0; font-size: 0.94rem; color: var(--ink-soft); }
.card .mono-tag {
  font-family: var(--mono); font-size: 0.78rem; color: var(--green);
  display: block; margin-bottom: 0.35rem;
}

/* ---------- tables ---------- */
table { border-collapse: collapse; width: 100%; margin: 1.4rem 0; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }
td code { white-space: nowrap; }

/* ---------- callouts ---------- */
.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--green);
  background: var(--green-bg); border-radius: 8px;
  padding: 0.9rem 1.2rem; margin: 1.5rem 0; font-size: 0.96rem;
}
.callout.warn { border-left-color: var(--amber); background: var(--amber-bg); }
.callout.danger { border-left-color: var(--red); background: var(--red-bg); }

/* ---------- pass/fail pills ---------- */
.pill {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
  padding: 0.15em 0.6em; border-radius: 99px; white-space: nowrap;
}
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }

/* ---------- flow diagram ---------- */
.flow {
  display: flex; align-items: stretch; gap: 0.6rem; flex-wrap: wrap;
  margin: 2rem 0 0.6rem; font-family: var(--mono); font-size: 0.82rem;
}
.flow .node {
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg);
  padding: 0.7rem 0.95rem; text-align: center; flex: 1 1 130px;
}
.flow .node strong { display: block; font-size: 0.88rem; color: var(--ink); }
.flow .node span { color: var(--ink-faint); font-size: 0.74rem; }
.flow .arrow { align-self: center; color: var(--ink-faint); font-size: 1.1rem; }
.flow .node.hot { border-color: var(--green); background: var(--green-bg); }

/* ---------- docs layout ---------- */
.docs-body { display: grid; grid-template-columns: 220px 1fr; gap: 3rem; padding: 2.6rem 0 4rem; }
.docs-toc { position: sticky; top: 4.4rem; align-self: start; font-size: 0.9rem; }
.docs-toc .toc-title {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint); font-weight: 700; margin-bottom: 0.6rem;
}
.docs-toc a { display: block; color: var(--ink-soft); padding: 0.22rem 0; }
.docs-toc a.active { color: var(--green); font-weight: 600; }
.docs-content { min-width: 0; }
.docs-content h1 { font-size: 2.1rem; }
.docs-content h2 { margin-top: 2.6rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.docs-content h2:first-of-type { border-top: none; }
.docs-content li { margin: 0.35rem 0; }
.docs-content img, .docs-content pre { max-width: 100%; }

@media (max-width: 800px) {
  .docs-body { grid-template-columns: 1fr; }
  .docs-toc { position: static; order: -1; border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1.1rem; }
  .hero h1 { font-size: 2.2rem; }
  .hero h1 br { display: none; }
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); padding: 2.2rem 0 3rem;
  color: var(--ink-faint); font-size: 0.88rem;
}
.site-footer .inner {
  max-width: 1060px; margin: 0 auto; padding: 0 1.4rem;
  display: flex; gap: 1.6rem; flex-wrap: wrap; justify-content: space-between;
}
.site-footer a { color: var(--ink-soft); }

/* ── Landing-page components: threat-model cards + the outcome list ────────── */
.threat { display: grid; gap: 1.1rem; margin-top: 1.8rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.threat .card { border-left: 4px solid var(--red); }
.threat .card .verdict {
  display: block; margin-top: 0.7rem; padding-top: 0.6rem;
  border-top: 1px dashed var(--line); font-size: 0.88rem; color: var(--ink);
}
.threat .card .verdict code { background: var(--green-bg); border-color: transparent; color: var(--green-dark); }
.threat .card .verdict code.bad { background: var(--red-bg); color: var(--red); }
.outcome-list { font-family: var(--mono); font-size: 0.85rem; line-height: 2; color: var(--ink-soft); }
.outcome-list .oc { white-space: nowrap; }
.outcome-list .oc.bad code { background: var(--red-bg); color: var(--red); border-color: transparent; }
.outcome-list .oc.good code { background: var(--green-bg); color: var(--green-dark); border-color: transparent; }
.outcome-list .oc.warn code { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
