/* Bloch Genesis-4 Developer Portal — self-contained stylesheet, no external assets */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --bg-code: #f4f5f7;
  --text: #1b2330;
  --muted: #5b6472;
  --border: #e3e6ea;
  --accent: #2b4fd8;
  --accent-soft: #e8edfb;
  --warn-bg: #fdf6e3;
  --warn-border: #d9a520;
  --danger-bg: #fdefef;
  --danger-border: #c94848;
  --ok-bg: #eaf6ee;
  --ok-border: #3d9960;
  --badge-live-bg: #e2f2e8;
  --badge-live-fg: #1d6b3d;
  --badge-next-bg: #fbf1d8;
  --badge-next-fg: #8a6410;
  --badge-refused-bg: #f9e3e3;
  --badge-refused-fg: #9c2f2f;
  --header-h: 56px;
  --nav-w: 268px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117;
    --bg-alt: #141924;
    --bg-code: #161c28;
    --text: #dbe2ec;
    --muted: #8b94a3;
    --border: #232a38;
    --accent: #7d97ff;
    --accent-soft: #1b2340;
    --warn-bg: #2a2310;
    --warn-border: #b98d2e;
    --danger-bg: #2b1717;
    --danger-border: #b04a4a;
    --ok-bg: #14261b;
    --ok-border: #3d9960;
    --badge-live-bg: #17301f;
    --badge-live-fg: #6fcb92;
    --badge-next-bg: #322a12;
    --badge-next-fg: #dcb54e;
    --badge-refused-bg: #331a1a;
    --badge-refused-fg: #e08a8a;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1117;
  --bg-alt: #141924;
  --bg-code: #161c28;
  --text: #dbe2ec;
  --muted: #8b94a3;
  --border: #232a38;
  --accent: #7d97ff;
  --accent-soft: #1b2340;
  --warn-bg: #2a2310;
  --warn-border: #b98d2e;
  --danger-bg: #2b1717;
  --danger-border: #b04a4a;
  --ok-bg: #14261b;
  --ok-border: #3d9960;
  --badge-live-bg: #17301f;
  --badge-live-fg: #6fcb92;
  --badge-next-bg: #322a12;
  --badge-next-fg: #dcb54e;
  --badge-refused-bg: #331a1a;
  --badge-refused-fg: #e08a8a;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.62;
}

code, pre, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

/* ---------- header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
  font-size: 18px;
}
.brand .sub { font-weight: 400; color: var(--muted); font-size: 13px; }
.header-spacer { flex: 1; }
.header-links { display: flex; gap: 14px; font-size: 13.5px; }
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 13px;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
#nav-toggle { display: none; }

/* ---------- layout ---------- */
.layout { display: flex; }

.sidenav {
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  width: var(--nav-w);
  overflow-y: auto;
  padding: 18px 10px 40px 16px;
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  z-index: 30;
}
.sidenav h5 {
  margin: 18px 6px 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidenav h5:first-child { margin-top: 2px; }
.sidenav ul { list-style: none; margin: 0 0 4px; padding: 0; }
.sidenav a {
  display: block;
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--text);
  font-size: 13.5px;
}
.sidenav a.method-link { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.sidenav a:hover { background: var(--accent-soft); text-decoration: none; }
.sidenav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

main {
  margin-left: var(--nav-w);
  padding: calc(var(--header-h) + 24px) 40px 40px;
  max-width: calc(var(--nav-w) + 900px);
  width: 100%;
}
main > section { margin-bottom: 56px; }

/* ---------- typography ---------- */
h1 { font-size: 30px; line-height: 1.25; margin: 0 0 10px; }
h2 {
  font-size: 23px;
  margin: 0 0 14px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  position: relative;
}
section:first-of-type h2 { border-top: none; padding-top: 0; }
h3 { font-size: 18px; margin: 30px 0 8px; position: relative; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 20px 0 6px; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 24px; }
li { margin-bottom: 4px; }
.lead { font-size: 17px; color: var(--muted); }
.hanchor {
  margin-left: 8px;
  color: var(--muted);
  opacity: 0;
  font-weight: 400;
  font-size: 0.85em;
}
h2:hover .hanchor, h3:hover .hanchor { opacity: 1; }
hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* ---------- code ---------- */
code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}
pre {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.55;
}
pre code { background: none; border: none; padding: 0; font-size: inherit; }
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 5px;
  font-size: 11.5px;
  padding: 3px 9px;
  cursor: pointer;
  opacity: 0.75;
}
.copy-btn:hover { opacity: 1; color: var(--accent); border-color: var(--accent); }
.copy-btn.done { color: var(--ok-border); border-color: var(--ok-border); opacity: 1; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-alt); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td code { white-space: nowrap; }
td.wrap code { white-space: normal; word-break: break-all; }

/* ---------- callouts ---------- */
.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--bg-alt);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 0 0 16px;
}
.callout > :last-child { margin-bottom: 0; }
.callout.warn { border-left-color: var(--warn-border); background: var(--warn-bg); }
.callout.danger { border-left-color: var(--danger-border); background: var(--danger-bg); }
.callout.ok { border-left-color: var(--ok-border); background: var(--ok-bg); }
.callout .title { font-weight: 700; display: block; margin-bottom: 4px; }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 1px 7px;
  vertical-align: 2px;
  margin-left: 8px;
}
.badge.live { background: var(--badge-live-bg); color: var(--badge-live-fg); }
.badge.next { background: var(--badge-next-bg); color: var(--badge-next-fg); }
.badge.refused { background: var(--badge-refused-bg); color: var(--badge-refused-fg); }

.sig {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 0 0 12px;
  overflow-x: auto;
  white-space: nowrap;
}

.method { border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 34px; }
.method:first-of-type { border-top: none; margin-top: 0; }

.kv { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

/* ---------- footer ---------- */
.site-footer {
  margin-left: var(--nav-w);
  border-top: 1px solid var(--border);
  padding: 26px 40px 46px;
  color: var(--muted);
  font-size: 13.5px;
}
.site-footer .links { margin-bottom: 8px; }
.site-footer .links a { margin-right: 18px; }
.site-footer .verify { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- mobile ---------- */
.nav-overlay { display: none; }

@media (max-width: 980px) {
  #nav-toggle { display: inline-block; }
  .sidenav {
    transform: translateX(-105%);
    transition: transform 0.18s ease-out;
    box-shadow: none;
    width: min(var(--nav-w), 84vw);
  }
  body.nav-open .sidenav { transform: translateX(0); box-shadow: 0 0 32px rgba(0,0,0,0.35); }
  body.nav-open .nav-overlay {
    display: block;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: rgba(0,0,0,0.35);
    z-index: 25;
  }
  main, .site-footer { margin-left: 0; padding-left: 20px; padding-right: 20px; }
  .header-links { display: none; }
  h1 { font-size: 25px; }
}

@media (max-width: 520px) {
  .brand .sub { display: none; }
}
