:root {
  --bg: #fafaf8;
  --bg-alt: #f2f1ed;
  --surface: #ffffff;
  --ink: #14181f;
  --muted: #4b5563;
  --subtle: #6b7280;
  --border: #e2e1dc;
  --border-strong: #cfcdd4;
  --accent: #b45309;
  --accent-hover: #92400e;
  --accent-soft: #fef3c7;
  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --ok-border: #bbf7d0;
  --bad: #b91c1c;
  --bad-bg: #fef2f2;
  --bad-border: #fecaca;
  --code-bg: #14181f;
  --code-fg: #f3f4f6;
  --text: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 16px/1.62 var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

code {
  font: 0.87em var(--mono);
  background: #ecebe6;
  color: #1f2937;
  padding: 0.1em 0.38em;
  border-radius: 4px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.top-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover { text-decoration: none; }
.brand img { display: block; border-radius: 6px; }

.brand-name {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #f5d08a;
  border-radius: 999px;
  padding: 0.15rem 0.52rem;
}

.top nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  flex-wrap: wrap;
  font-size: 0.92rem;
  font-weight: 500;
}

.top nav a {
  color: var(--muted);
  text-decoration: none;
}

.top nav a:hover { color: var(--ink); text-decoration: none; }

.top nav a.nav-cta {
  color: #ffffff;
  background: var(--ink);
  padding: 0.44rem 0.92rem;
  border-radius: 6px;
  font-weight: 600;
}

.top nav a.nav-cta:hover { background: #262e3b; color: #ffffff; }

/* ---------- Hero ---------- */
.hero {
  padding: 4rem 0 4.2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.95fr);
  gap: 2.8rem;
  align-items: center;
}

.eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.1rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.lede {
  margin: 0 0 1.65rem;
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--muted);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.05rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.72rem 1.25rem;
  border-radius: 7px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.btn:hover { text-decoration: none; }

.btn.primary {
  background: var(--ink);
  color: #ffffff;
}

.btn.primary:hover { background: #262e3b; }

.btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn.secondary:hover { border-color: var(--ink); }

.btn.ghost {
  background: transparent;
  color: #f3f4f6;
  border-color: rgba(255, 255, 255, 0.28);
}

.btn.ghost:hover { border-color: #ffffff; background: rgba(255, 255, 255, 0.08); }

.hero-note {
  margin: 0;
  font-size: 0.86rem;
  color: var(--subtle);
}

/* ---------- Diagram card ---------- */
.diagram-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 14px 36px rgba(20, 24, 31, 0.06);
}

.diag-block {
  border-radius: 8px;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
}

.diag-block.bad {
  background: var(--bad-bg);
  border-color: var(--bad-border);
}

.diag-block.good {
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.diag-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.dot.red { background: var(--bad); }
.dot.green { background: var(--ok); }

.diag-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
}

.diag-badge.bad { color: var(--bad); background: #fee2e2; }
.diag-badge.good { color: var(--ok); background: #dcfce7; }

.diag-body {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #7f1d1d;
}

.diag-arrow {
  text-align: center;
  padding: 0.6rem 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtle);
}

.diag-flow {
  list-style: none;
  margin: 0.55rem 0 0.7rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.diag-flow li {
  background: #ffffff;
  border: 1px solid #d1fae5;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.flow-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ok);
  margin-bottom: 0.12rem;
}

.diag-flow code {
  background: none;
  padding: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.82rem;
}

.diag-foot {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #166534;
}

/* ---------- Sections ---------- */
.section {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.section.alt {
  background: var(--bg-alt);
}

.section-head {
  max-width: 44rem;
  margin-bottom: 2rem;
}

.section-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.section-sub {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.62;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card, .limit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.35rem 1.4rem;
}

.limit-card {
  border-left: 3.5px solid var(--accent);
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.card p, .limit-card p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.58;
  color: var(--muted);
}

.limit-card strong { color: var(--ink); }

/* ---------- Numbered steps ---------- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.step {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.35rem 1.45rem;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-top: 0.1rem;
}

.step-body { min-width: 0; width: 100%; max-width: 100%; flex: 1; }
.step-body p { margin: 0 0 0.65rem; font-size: 0.95rem; color: var(--muted); }
.step-body p:last-child { margin-bottom: 0; }
.step-note { font-size: 0.88rem !important; color: var(--subtle) !important; }

.code-block {
  margin: 0.65rem 0 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 7px;
  max-width: 100%;
  overflow-x: auto;
}

.code-block code {
  background: none;
  color: #fcd34d;
  padding: 0;
  font-size: 0.86rem;
  white-space: pre;
}

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--ink);
  color: #f9fafb;
  border-top: 0;
}

.cta-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.cta-box h2 {
  color: #ffffff;
  margin-bottom: 0.45rem;
}

.cta-box p {
  margin: 0;
  max-width: 38rem;
  color: #d1d5db;
  font-size: 0.98rem;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cta-band .btn.primary {
  background: #d97706;
  color: #14181f;
  font-weight: 700;
}

.cta-band .btn.primary:hover { background: #f59e0b; }

/* ---------- Footer ---------- */
.foot {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 1.8rem 0 2.6rem;
  font-size: 0.88rem;
  color: var(--subtle);
}

.foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.foot p { margin: 0; }
.foot-brand strong { color: var(--ink); }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 2.6rem 0 3rem; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .grid.three { grid-template-columns: minmax(0, 1fr); }
  .grid.two { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .wrap { padding: 0 1.05rem; }
  .section { padding: 2.8rem 0; }
  .top nav { gap: 0.9rem; font-size: 0.86rem; }
  .step { flex-direction: column; gap: 0.7rem; padding: 1.1rem; }
  .card, .limit-card { padding: 1.1rem; }
}

/* ---------- Work Docs (3-column layout matching hogman.network/docs/) ---------- */
.docs-page .top-inner { max-width: 1240px; }
.docs-page .top nav a[aria-current="true"] {
  color: var(--ink);
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.15rem;
}

.docs {
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 215px minmax(0, 1fr) 195px;
  gap: 2.2rem;
  align-items: start;
}

.docs-nav {
  position: sticky;
  top: 5.2rem;
  font-size: 0.9rem;
}

.docs-nav-h {
  margin: 1.15rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--subtle);
}

.docs-nav-h:first-child { margin-top: 0; }

.docs-nav ul,
.docs-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-nav li a {
  display: block;
  padding: 0.34rem 0.65rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2.5px solid transparent;
}

.docs-nav li a:hover {
  color: var(--ink);
  background: var(--bg-alt);
  text-decoration: none;
}

.docs-nav li a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(20, 24, 31, 0.06);
}

.docs-toc {
  position: sticky;
  top: 5.2rem;
  font-size: 0.83rem;
  border-left: 1px solid var(--border);
  padding-left: 0.9rem;
}

.docs-toc li a {
  display: block;
  padding: 0.24rem 0;
  color: var(--subtle);
  line-height: 1.4;
}

.docs-toc li a:hover { color: var(--ink); text-decoration: none; }

.docs-main {
  min-width: 0;
  max-width: 48rem;
}

.docs-h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.8rem, 3.2vw, 2.35rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.docs-h2 {
  margin: 2.2rem 0 0.7rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: 1.32rem;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
  scroll-margin-top: 5.2rem;
}

.docs-h3 {
  margin: 1.5rem 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.docs-main p { margin: 0 0 0.95rem; color: var(--muted); }
.docs-main p strong { color: var(--ink); }
.docs-main .lede { font-size: 1.06rem; color: var(--muted); margin-bottom: 1.4rem; }
.docs-main ul, .docs-main ol { margin: 0 0 1rem; padding-left: 1.35rem; color: var(--muted); }
.docs-main li { margin-bottom: 0.45rem; }
.docs-main li strong { color: var(--ink); }
.docs-main .fine { font-size: 0.85rem; color: var(--subtle); }

/* Terminal blocks + Copy button (docs.js) */
.term-wrap {
  position: relative;
  margin: 0.85rem 0 1.15rem;
}

.docs-main pre.term {
  margin: 0;
  padding: 0.95rem 4.2rem 0.95rem 1.05rem;
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: 8px;
  font: 0.86rem/1.6 var(--mono);
  overflow-x: auto;
  white-space: pre;
}

.docs-main pre.term .p { color: #f59e0b; user-select: none; }
.docs-main pre.term .b { color: #93c5fd; }
.docs-main pre.term .ok { color: #86efac; }
.docs-main pre.term .dim { color: #9ca3af; }

.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  font: 600 0.74rem var(--text);
  color: #e5e7eb;
  background: #272f3d;
  border: 1px solid #3d485c;
  border-radius: 5px;
  padding: 0.28rem 0.58rem;
  cursor: pointer;
}

.copy-btn:hover { background: #374151; color: #ffffff; }

/* Callouts & tables */
.docs-main .callout {
  margin: 1rem 0 1.2rem;
  padding: 0.85rem 1rem;
  background: var(--accent-soft);
  border: 1px solid #f5d08a;
  border-left: 3.5px solid var(--accent);
  border-radius: 7px;
  color: var(--ink);
  font-size: 0.93rem;
}

.docs-main table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.3rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: block;
  overflow-x: auto;
}

.docs-main th, .docs-main td {
  text-align: left;
  padding: 0.62rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.docs-main th {
  background: var(--bg-alt);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.docs-main td { color: var(--muted); }
.docs-main tr:last-child td { border-bottom: 0; }

/* FAQ list */
.docs-faq { margin: 0.6rem 0 1.4rem; }
.docs-faq dt {
  margin: 1.3rem 0 0.35rem;
  font-weight: 750;
  font-size: 1.02rem;
  color: var(--ink);
  scroll-margin-top: 5.2rem;
}
.docs-faq dd {
  margin: 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}
.docs-faq dd:last-child { border-bottom: 0; }

/* Quickstart mini cards */
.docs-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0 1.4rem;
}

.docs-mini-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.95rem 1.05rem;
  text-decoration: none;
  transition: border-color 0.14s;
}

.docs-mini-card:hover { border-color: var(--accent); text-decoration: none; }
.docs-mini-card strong { display: block; color: var(--ink); margin-bottom: 0.25rem; }
.docs-mini-card span { display: block; font-size: 0.88rem; color: var(--muted); }

/* Pager & edit link */
.docs-pager {
  margin: 2.4rem 0 1.1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
}

.pager-link:hover { border-color: var(--accent); text-decoration: none; }
.pager-link.next { text-align: right; }
.pager-dir { font-size: 0.78rem; color: var(--subtle); font-weight: 600; }
.pager-title { font-size: 0.95rem; font-weight: 700; color: var(--ink); }

.docs-edit { margin-top: 0.5rem; }

@media (max-width: 1120px) {
  .docs { grid-template-columns: 205px minmax(0, 1fr); }
  .docs-toc { display: none; }
}

@media (max-width: 820px) {
  .docs { grid-template-columns: minmax(0, 1fr); padding: 1.3rem 1.05rem 3rem; gap: 1.25rem; }
  .docs-nav {
    position: static;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 0.95rem;
  }
  .docs-links, .docs-pager { grid-template-columns: minmax(0, 1fr); }
}
