/* CodeBeast docs — layout after vocaloop.ai/documentation, CodeBeast palette. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --header: rgba(255, 255, 255, 0.86);
  --line: #e5e7eb;
  --line-soft: #f0f1f4;
  --ink: #0f1422;
  --ink-2: #374151;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;
  --accent: #178a4c;         /* CodeBeast green, darkened for AA text on white */
  --accent-bright: #34c77b;  /* brand green, for fills and rules */
  --accent-soft: #e8f7ef;
  --accent-ink: #0d6b39;
  --code-bg: #f3f4f6;
  --code-ink: #0d6b39;
  --pre-bg: #0d1018;
  --pre-ink: #e6e9f2;
  --hover: #f3f4f6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --note: #2563eb;  --note-soft: #eff5ff;
  --tip: #178a4c;   --tip-soft: #ecf8f1;
  --warn: #b45309;  --warn-soft: #fff7eb;
  --admin: #6d4bff; --admin-soft: #f3f0ff;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --top-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0c0e;
    --surface: #141518;
    --surface-2: #101113;
    --header: rgba(17, 18, 20, 0.86);
    --line: #26282e;
    --line-soft: #1d1f23;
    --ink: #f2f4f8;
    --ink-2: #c9ced8;
    --ink-3: #9aa2b1;
    --ink-4: #6e7686;
    --accent: #4fd38d;
    --accent-bright: #34c77b;
    --accent-soft: rgba(52, 199, 123, 0.12);
    --accent-ink: #7fe3ae;
    --code-bg: #1e2025;
    --code-ink: #7fe3ae;
    --pre-bg: #0a0b0e;
    --pre-ink: #e6e9f2;
    --hover: #1c1e22;
    --shadow: none;
    --note: #6aa1ff;  --note-soft: rgba(80, 140, 255, 0.1);
    --tip: #4fd38d;   --tip-soft: rgba(52, 199, 123, 0.1);
    --warn: #f0b35a;  --warn-soft: rgba(255, 180, 84, 0.1);
    --admin: #a794ff; --admin-soft: rgba(124, 92, 255, 0.12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0c0e;
  --surface: #141518;
  --surface-2: #101113;
  --header: rgba(17, 18, 20, 0.86);
  --line: #26282e;
  --line-soft: #1d1f23;
  --ink: #f2f4f8;
  --ink-2: #c9ced8;
  --ink-3: #9aa2b1;
  --ink-4: #6e7686;
  --accent: #4fd38d;
  --accent-bright: #34c77b;
  --accent-soft: rgba(52, 199, 123, 0.12);
  --accent-ink: #7fe3ae;
  --code-bg: #1e2025;
  --code-ink: #7fe3ae;
  --pre-bg: #0a0b0e;
  --pre-ink: #e6e9f2;
  --hover: #1c1e22;
  --shadow: none;
  --note: #6aa1ff;  --note-soft: rgba(80, 140, 255, 0.1);
  --tip: #4fd38d;   --tip-soft: rgba(52, 199, 123, 0.1);
  --warn: #f0b35a;  --warn-soft: rgba(255, 180, 84, 0.1);
  --admin: #a794ff; --admin-soft: rgba(124, 92, 255, 0.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 20px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent-bright); color: #06130b; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

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

.top {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  background: var(--header);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 88rem; height: 100%; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; }
.logo { height: 24px; width: auto; display: block; }
.logo-on-dark { display: none; }
:root[data-theme="dark"] .logo-on-light { display: none; }
:root[data-theme="dark"] .logo-on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .logo-on-dark { display: block; }
}
.brand-docs {
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--accent); padding: 2px 9px; border-radius: 999px;
  background: var(--accent-soft);
}
.search-btn {
  margin-left: 18px;
  display: flex; align-items: center; gap: 8px;
  width: 260px; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink-3);
  font: inherit; font-size: 13.5px; cursor: pointer; text-align: left;
}
.search-btn:hover { border-color: var(--ink-4); }
.search-btn span { flex: 1; }
.search-btn svg, .search-field svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; flex: none; }
kbd {
  font-family: var(--font); font-size: 11px; font-weight: 500; line-height: 1;
  padding: 3px 6px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-3);
}
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-link { font-size: 14px; color: var(--ink-3); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.top-link:hover { color: var(--ink); background: var(--hover); }
.theme-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: pointer;
}
.theme-btn:hover { background: var(--hover); color: var(--ink); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.btn-app {
  margin-left: 6px; padding: 7px 14px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap;
  background: linear-gradient(180deg, #4bd68d, #1f9e57); color: #06130b;
  box-shadow: 0 6px 18px -10px rgba(52, 199, 123, 0.9);
}
.btn-app:hover { filter: brightness(1.05); }

.side-toggle {
  display: none; width: 36px; height: 36px; margin-left: -6px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  align-items: center; justify-content: center;
}
.side-toggle span, .side-toggle span::before, .side-toggle span::after {
  display: block; width: 16px; height: 1.6px; background: var(--ink); border-radius: 2px; position: relative;
}
.side-toggle span::before, .side-toggle span::after { content: ""; position: absolute; left: 0; }
.side-toggle span::before { top: -5px; }
.side-toggle span::after { top: 5px; }

/* ------------------------------------------------------------ shell */

.shell {
  max-width: 88rem; margin: 0 auto; padding: 32px 32px 64px;
  display: grid; grid-template-columns: 240px minmax(0, 1fr) 210px; gap: 40px;
  align-items: start;
}
.shell-home, .shell:not(:has(.toc)) { grid-template-columns: 240px minmax(0, 1fr); }

.side {
  position: sticky; top: calc(var(--top-h) + 24px);
  max-height: calc(100vh - var(--top-h) - 40px); overflow-y: auto;
  padding: 0 8px 32px 0; font-size: 14px;
  scrollbar-width: thin;
}
.side-home {
  display: block; margin-bottom: 18px; padding: 0 10px;
  font-weight: 600; color: var(--ink); text-decoration: none;
}
.side-home.on, .side-home:hover { color: var(--accent); }
.side-group { margin-bottom: 20px; }
.side-divider { border-top: 1px solid var(--line); padding-top: 16px; }
.side-label {
  padding: 0 10px; margin-bottom: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4);
}
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; margin: 1px 0; border-radius: 7px;
  color: var(--ink-3); text-decoration: none; line-height: 1.45;
  transition: background 0.12s, color 0.12s;
}
.side li a:hover { background: var(--hover); color: var(--ink); }
.side li a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side .ext { font-size: 11px; opacity: 0.6; }
.scrim { display: none; }

/* ------------------------------------------------------------ article */

.doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 30px 40px 26px;
  min-width: 0;
}
.doc-kicker {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px;
}
.doc h1 { margin: 0 0 14px; font-size: 30px; line-height: 1.2; letter-spacing: -0.025em; font-weight: 700; color: var(--ink); }
.doc h2 {
  margin: 40px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  font-size: 20px; line-height: 1.3; letter-spacing: -0.015em; font-weight: 650; color: var(--ink);
}
.doc h3 { margin: 28px 0 8px; font-size: 16.5px; line-height: 1.35; font-weight: 650; color: var(--ink); }
.doc h4 { margin: 22px 0 6px; font-size: 14.5px; font-weight: 650; color: var(--ink); }
.doc h2, .doc h3, .doc h4 { position: relative; }
.anchor {
  position: absolute; left: -20px; padding-right: 6px;
  color: var(--ink-4); text-decoration: none; font-weight: 500; opacity: 0;
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc h4:hover .anchor { opacity: 1; }
.doc p { margin: 12px 0; color: var(--ink-2); }
.doc strong { color: var(--ink); font-weight: 600; }
.doc a:not(.anchor) { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.doc a:not(.anchor):hover { text-decoration-color: currentColor; }
.doc ul, .doc ol { margin: 12px 0; padding-left: 24px; color: var(--ink-2); }
.doc li { margin: 5px 0; }
.doc li > p { margin: 6px 0; }
.doc li::marker { color: var(--ink-4); }
.doc ol.steps { list-style: none; counter-reset: step; padding-left: 0; }
.doc ol.steps > li { counter-increment: step; position: relative; padding-left: 38px; margin: 10px 0; }
.doc ol.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 650; font-family: var(--mono);
  color: var(--accent-ink); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent-bright) 35%, transparent);
}
.doc ol.steps ol.steps > li::before { width: 20px; height: 20px; font-size: 11px; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.doc img { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }

.doc code {
  font-family: var(--mono); font-size: 0.86em;
  padding: 2px 6px; border-radius: 5px;
  background: var(--code-bg); color: var(--code-ink);
  overflow-wrap: anywhere;
}
.code { position: relative; margin: 16px 0; border-radius: 10px; background: var(--pre-bg); border: 1px solid var(--line); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.65; }
.code pre code { background: none; padding: 0; color: var(--pre-ink); font-size: inherit; overflow-wrap: normal; }
.code-lang {
  position: absolute; top: 8px; right: 66px;
  font-family: var(--mono); font-size: 11px; color: #7b8396; text-transform: lowercase;
}
.copy {
  position: absolute; top: 6px; right: 8px;
  font: 500 11.5px var(--font); color: #aab2c4;
  padding: 3px 8px; border-radius: 6px; cursor: pointer;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0; transition: opacity 0.15s;
}
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy.done { color: #7fe3ae; }

.table { margin: 16px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; color: var(--ink);
  background: var(--surface-2); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 9px 14px; vertical-align: top; color: var(--ink-2); border-bottom: 1px solid var(--line-soft); line-height: 1.55; }
.table tr:last-child td { border-bottom: 0; }
.table td code { white-space: nowrap; overflow-wrap: normal; }

blockquote { margin: 16px 0; padding: 2px 16px; border-left: 3px solid var(--line); color: var(--ink-3); }

.callout {
  margin: 18px 0; padding: 12px 16px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  background: var(--c-soft);
}
.callout-title { font-size: 13px; font-weight: 650; color: var(--c); margin-bottom: 2px; }
.callout p { margin: 4px 0; }
.callout ul, .callout ol { margin: 6px 0; }
.callout-note { --c: var(--note); --c-soft: var(--note-soft); }
.callout-tip { --c: var(--tip); --c-soft: var(--tip-soft); }
.callout-warning { --c: var(--warn); --c-soft: var(--warn-soft); }
.callout-admin { --c: var(--admin); --c-soft: var(--admin-soft); }
.callout-limit { --c: var(--ink-3); --c-soft: var(--surface-2); }

.badge {
  display: inline-block; vertical-align: 1px;
  font-size: 11px; font-weight: 600; line-height: 1; letter-spacing: 0.02em;
  padding: 4px 7px; border-radius: 999px; white-space: nowrap;
}
.badge-admin { color: var(--admin); background: var(--admin-soft); }
.badge-owner { color: var(--note); background: var(--note-soft); }

.doc-foot { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-3); }

/* ------------------------------------------------------------ on this page */

.toc {
  position: sticky; top: calc(var(--top-h) + 24px);
  max-height: calc(100vh - var(--top-h) - 40px); overflow-y: auto;
  font-size: 13px; padding-top: 4px;
}
.toc-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block; padding: 4px 0 4px 12px; margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-3); text-decoration: none; line-height: 1.4;
}
.toc .toc-3 a { padding-left: 24px; font-size: 12.5px; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--accent); border-left-color: var(--accent-bright); }

/* ------------------------------------------------------------ home */

.home h1 { margin: 0 0 12px; font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; font-weight: 700; }
.home h2 { margin: 0 0 18px; font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.home p { color: var(--ink-2); }
.home a { color: inherit; }
.home code { font-family: var(--mono); font-size: 0.86em; padding: 2px 6px; border-radius: 5px; background: var(--code-bg); color: var(--code-ink); }
.hero { display: grid; grid-template-columns: 3fr 2fr; gap: 36px; align-items: center; margin-bottom: 52px; }
.hero-lede { font-size: 17.5px; line-height: 1.75; color: var(--ink) !important; margin: 0 0 14px; }
.hero-sub { margin: 0 0 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink) !important;
}
.btn:hover { border-color: var(--ink-4); }
.btn-primary { background: linear-gradient(180deg, #4bd68d, #1f9e57); border-color: transparent; color: #06130b !important; }
.btn-primary:hover { filter: brightness(1.05); }

.flow { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px 20px 16px; box-shadow: var(--shadow); }
.flow-head { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 12px; }
.flow-task { font-size: 14px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.flow-task small { display: block; font-size: 11.5px; color: var(--ink-4); margin-bottom: 2px; }
.flow ol { list-style: none; margin: 0; padding: 0; }
.flow li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 6px 0; font-size: 13.5px; border-top: 1px dashed var(--line); }
.flow li:first-child { border-top: 0; }
.flow .k { font-size: 12px; font-weight: 600; color: var(--ink-4); padding-top: 1px; }
.flow .v { color: var(--ink-2); }
.flow .ok { color: var(--accent); font-weight: 600; }
.flow .pr { font-family: var(--mono); font-size: 12.5px; color: var(--accent-ink); background: var(--accent-soft); padding: 1px 6px; border-radius: 5px; }

.home-sec { margin-bottom: 48px; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.stages li { border-top: 2px solid var(--accent-bright); padding-top: 14px; }
.stages .n { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-right: 6px; }
.stages b { font-weight: 650; color: var(--ink); }
.stages p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-3); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card {
  display: block; padding: 16px 18px; border-radius: 12px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent-bright) 55%, var(--line)); transform: translateY(-1px); }
.card b { display: block; font-size: 14.5px; font-weight: 650; color: var(--ink); margin-bottom: 4px; }
.card span { display: block; font-size: 13.5px; line-height: 1.55; color: var(--ink-3); }
.card .tag { display: inline-block; margin-bottom: 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }

/* ------------------------------------------------------------ search */

.search { position: fixed; inset: 0; z-index: 80; background: rgba(5, 7, 12, 0.5); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.search-panel { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45); overflow: hidden; }
.search-field { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.search-field input { flex: 1; height: 52px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 6px; max-height: 60vh; overflow-y: auto; }
.search-results:empty { display: none; }
.search-results a { display: block; padding: 9px 12px; border-radius: 9px; text-decoration: none; }
.search-results a[aria-selected="true"] { background: var(--accent-soft); }
.sr-path { font-size: 11.5px; color: var(--ink-4); }
.sr-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.sr-snip { font-size: 13px; color: var(--ink-3); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-snip mark, .sr-title mark { background: none; color: var(--accent); font-weight: 650; }
.sr-empty { padding: 18px 14px; font-size: 14px; color: var(--ink-3); }

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

@media (max-width: 1240px) {
  .shell { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .stages { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .top-in { padding: 0 16px; gap: 10px; }
  .side-toggle { display: flex; }
  .search-btn { margin-left: auto; width: 36px; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .top-right { margin-left: 0; }
  .top-link { display: none; }
  .shell, .shell-home, .shell:not(:has(.toc)) { display: block; padding: 16px 16px 48px; }
  .side {
    position: fixed; top: var(--top-h); left: 0; bottom: 0; z-index: 50;
    width: 290px; max-height: none; padding: 20px 14px 40px;
    background: var(--surface); border-right: 1px solid var(--line);
    transform: translateX(-100%); transition: transform 0.2s ease;
  }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: var(--top-h) 0 0 0; z-index: 45; background: rgba(5, 7, 12, 0.4); }
  .doc { padding: 22px 18px 20px; border-radius: 12px; }
  .doc h1 { font-size: 26px; }
  .anchor { display: none; }
  .home h1 { font-size: 28px; }
}
@media (max-width: 560px) {
  .brand-docs { display: none; }
  .stages, .cards { grid-template-columns: 1fr; }
  .btn-app { padding: 7px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
