/* ── Theme tokens ──────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* semantic palette */
  --ink: #16211d;
  --muted: #586962;
  --paper: #f6f8f5;
  --surface: #ffffff;
  --line: #dbe3dd;
  --green: #1f6a58;
  --green-dark: #173b34;
  --gold: #bc8426;
  --red: #9b3131;

  /* code blocks */
  --code-bg: #0f211c;
  --code-fg: #e9f4ee;
  --code-accent: #79d8bc;
  --code-glow: rgba(255, 255, 255, 0.08);
  --code-font: "SF Mono", "Cascadia Code", "Fira Code", Menlo, monospace;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;

  /* decorative layers */
  --soft: #eef4f0;
  --soft-alt: #edf3ef;
  --review-fg: #dcebe6;
  --review-accent: #91d4c0;

  /* effects */
  --hero-shadow: rgba(24, 53, 46, 0.15);
  --header-bg: rgba(246, 248, 245, 0.94);
  --header-border: rgba(22, 33, 29, 0.08);
  --brand-stripe: rgba(255, 255, 255, 0.76);
  --danger-border: rgba(155, 49, 49, 0.34);
  --strong-color: var(--green-dark);
  --code-note-bg: rgba(31, 106, 88, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;

  --ink: #e0e6e3;
  --muted: #889690;
  --paper: #111413;
  --surface: #191d1b;
  --line: #2b302e;
  --green: #4dbd95;
  --green-dark: #1e2c27;
  --gold: #d4a43a;
  --red: #d46363;

  --code-bg: #0a0f0d;
  --code-fg: #c5d5ce;
  --code-accent: #5cc4a0;
  --code-glow: rgba(255, 255, 255, 0.03);

  --soft: #151917;
  --soft-alt: #121613;
  --review-fg: #e0e6e3;
  --review-accent: #91d4c0;

  --hero-shadow: rgba(0, 0, 0, 0.45);
  --header-bg: rgba(17, 20, 19, 0.94);
  --header-border: rgba(224, 230, 227, 0.05);
  --brand-stripe: rgba(224, 230, 227, 0.3);
  --danger-border: rgba(212, 99, 99, 0.3);
  --strong-color: var(--green);
  --code-note-bg: rgba(77, 189, 149, 0.1);
}

/* ── Reset & base ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Inline code ──────────────────────────────────────────────────── */
:not(pre) > code {
  font-family: var(--code-font);
  font-size: 0.9em;
  color: var(--green);
  background: var(--code-note-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

pre code {
  font-family: var(--code-font);
}

/* ── Typography ───────────────────────────────────────────────────── */
h1, h2, h3, h4, p, li, code {
  overflow-wrap: anywhere;
}

h1 { margin: 0; max-width: 760px; font-size: clamp(40px, 5.8vw, 76px); line-height: 1.04; letter-spacing: 0; }
h2 { margin: 0; font-size: clamp(28px, 3.9vw, 44px); line-height: 1.14; letter-spacing: 0; }
h3 { margin: 0 0 10px; font-size: 18px; line-height: 1.3; letter-spacing: 0; }

/* ── Header ───────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--header-border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}

.header-right {
  display: flex; align-items: center; gap: 14px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 780; white-space: nowrap;
}

.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 46%, var(--brand-stripe) 46% 54%, transparent 54%),
    linear-gradient(180deg, var(--green), var(--gold));
}

.nav {
  display: flex; flex-wrap: wrap; justify-content: flex-end;
  gap: 14px; color: var(--muted); font-size: 14px;
}
.nav a:hover { color: var(--ink); }

/* ── Theme toggle ─────────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; margin-left: 2px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--green); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }

.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ── Section rhythm ───────────────────────────────────────────────── */
.section {
  padding: clamp(56px, 8vw, 98px) clamp(20px, 5vw, 72px);
}

.quickstart-section           { background: var(--soft); }
.setup-section                { background: var(--surface); border-top: 1px solid var(--line); }
.how-section                  { background: var(--paper); }
.delivery-section             { background: var(--soft-alt); }
.review-band                  { /* own bg below */ }

.section-heading {
  max-width: 780px; margin-bottom: 28px;
}
.section-heading.wide { max-width: 920px; }
.section-heading p, .section-heading p {
  color: var(--muted); line-height: 1.76;
}

.eyebrow {
  margin: 0 0 12px; color: var(--green);
  font-size: 12px; font-weight: 830;
  text-transform: uppercase; letter-spacing: 0;
}
.eyebrow code {
  font-size: 11px;
  background: var(--code-note-bg);
  color: var(--green);
  padding: 2px 6px; border-radius: 3px;
  font-weight: 700;
}

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  gap: clamp(28px, 5vw, 72px); align-items: center;
  padding: clamp(48px, 7vw, 88px) clamp(20px, 5vw, 72px) 34px;
}

.hero-copy  { max-width: 720px; }
.hero-text  { margin: 22px 0 0; max-width: 680px; font-size: 18px; color: var(--muted); line-height: 1.76; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.button {
  display: inline-flex; min-height: 44px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0 18px; font-weight: 740;
}
.button.primary { border-color: var(--green-dark); background: var(--green-dark); color: #fff; }
.button.secondary { background: var(--surface); }

.hero-media { margin: 0; }
.hero-media img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 24px 68px var(--hero-shadow);
}
.hero-media figcaption { margin-top: 12px; color: var(--muted); font-size: 14px; }

/* ── Quick Start section ──────────────────────────────────────────── */
.quickstart-section { background: var(--soft); }

.quickstart-prompt {
  margin: 28px 0 34px; padding: 24px 28px;
  border-radius: var(--radius);
  background: var(--code-bg); color: var(--code-fg);
  box-shadow: inset 0 0 0 1px var(--code-glow);
  overflow-x: auto; font-size: 15px; line-height: 1.8;
}
.quickstart-prompt code { white-space: pre-wrap; word-break: break-word; }

.quickstart-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
}
.quickstart-grid article {
  min-height: 200px; padding: 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.quickstart-grid h3 { margin: 0 0 8px; font-size: 17px; }
.quickstart-grid p  { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.68; }

.qs-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin-bottom: 12px;
  border-radius: 50%; background: var(--green); color: #fff;
  font-size: 14px; font-weight: 800;
}

/* ── Setup section ────────────────────────────────────────────────── */
.setup-section { background: var(--surface); border-top: 1px solid var(--line); }

.setup-card {
  padding: 22px 26px; margin-bottom: 28px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--soft);
}
.setup-card h3 { margin: 0 0 8px; font-size: 18px; }
.setup-card p  { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }

.setup-clients {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px;
}
.setup-client {
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface);
}
.setup-client h4 {
  margin: 0; padding: 16px 22px; font-size: 16px; font-weight: 750;
  background: var(--soft); border-bottom: 1px solid var(--line);
}
.setup-client p { margin: 0 22px 10px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.setup-client p:first-of-type { margin-top: 16px; }
.setup-client p:last-of-type  { margin-bottom: 16px; }

.setup-code {
  margin: 8px 22px 14px; padding: 14px 16px;
  border-radius: var(--radius-sm); background: var(--code-bg); color: var(--code-accent);
  font-size: 13px; line-height: 1.6; overflow-x: auto;
}
.setup-code code { white-space: pre; }

.setup-note {
  padding: 16px 20px; border-radius: var(--radius);
  background: var(--soft); color: var(--muted);
  font-size: 14px; line-height: 1.65; border: 1px solid var(--line);
}
.setup-note p { margin: 0; }

/* ── How it works section ─────────────────────────────────────────── */
.how-section { background: var(--paper); }

.workflow-steps {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px; margin: 0 0 40px; padding: 0; list-style: none;
}
.workflow-steps li {
  display: grid; grid-template-columns: 54px minmax(0, 1fr);
  gap: 18px; min-height: 150px; padding: 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.workflow-steps span { color: var(--gold); font-weight: 850; }
.workflow-steps strong { display: block; font-size: 18px; }
.workflow-steps p { margin: 10px 0 0; color: var(--muted); line-height: 1.68; }

.tool-index { margin-bottom: 40px; }
.tool-index h3 { margin-bottom: 14px; }

.how-table {
  overflow: hidden; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, 0.3fr) minmax(0, 1fr);
  gap: 1px; border-top: 1px solid var(--line);
}
.table-row:first-child { border-top: 0; }
.table-row span, .table-row strong { padding: 14px 18px; line-height: 1.55; }

.table-head { background: var(--green-dark); color: #fff; font-weight: 760; }
.table-row strong { color: var(--strong-color); }

.how-guardrails h3 { margin-bottom: 18px; }

.guardrails-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
.guardrails-col {
  padding: 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.guardrails-col ul { display: grid; gap: 9px; margin: 10px 0 0; padding-left: 20px; }
.guardrails-col li { color: var(--muted); line-height: 1.68; font-size: 14px; }

.guardrails-danger { color: var(--red); font-size: 15px; font-weight: 750; margin: 0 0 4px; }
.guardrails-ok    { color: var(--green); font-size: 15px; font-weight: 750; margin: 0 0 4px; }
.guardrails-err   { color: var(--gold); font-size: 15px; font-weight: 750; margin: 0 0 4px; }

.guardrails-col:first-child { border-color: var(--danger-border); }

/* ── Delivery section ─────────────────────────────────────────────── */
.review-band {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.22fr);
  gap: 34px; align-items: start; margin-bottom: 40px; padding: 44px 32px;
  border-radius: var(--radius-lg);
  background: var(--green-dark); color: #fff;
}
.review-band .eyebrow { color: var(--review-accent); }

.review-list { display: grid; gap: 12px; }
.review-list p {
  margin: 0; border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius); padding: 16px 18px;
  color: var(--review-fg); background: rgba(255, 255, 255, 0.05);
  line-height: 1.68;
}

.delivery-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.74fr) minmax(0, 1.26fr);
  gap: 18px;
}

.checklist {
  display: grid; gap: 12px; align-content: start;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; background: var(--surface);
}
.checklist label {
  display: grid; grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px; color: var(--muted); line-height: 1.48;
}
.checklist input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--green); }

.handoff-template {
  margin: 0; overflow-x: auto; border-radius: var(--radius); padding: 22px;
  background: var(--code-bg); color: var(--code-fg);
  box-shadow: inset 0 0 0 1px var(--code-glow);
}
.handoff-template code { font-size: 14px; line-height: 1.68; white-space: pre; }

/* ── Footer ───────────────────────────────────────────────────────── */

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 12px; padding: 22px clamp(20px, 5vw, 72px);
  border-top: 1px solid var(--line); color: var(--muted);
  background: var(--surface); font-size: 14px;
}
.site-footer a:hover { color: var(--ink); }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 1040px) {
  .hero, .review-band,
  .delivery-layout, .setup-clients {
    grid-template-columns: 1fr;
  }
  .quickstart-grid, .guardrails-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; gap: 10px; }
  .nav { gap: 10px 14px; font-size: 13px; }

  .hero {
    grid-template-columns: 1fr; padding-top: 34px;
  }

  .quickstart-grid, .workflow-steps, .guardrails-grid, .checklist {
    grid-template-columns: 1fr;
  }
  .workflow-steps li { grid-template-columns: 1fr; min-height: 0; }
  .table-row, .table-head { grid-template-columns: 1fr; }
  .table-head { display: none; }

  h1 { font-size: 38px; }
  .quickstart-prompt, .handoff-template { padding: 18px; }
  .quickstart-prompt code, .handoff-template code { white-space: pre-wrap; word-break: break-word; }
}
