/* Rain Builders — docs theme
   Brand: Jet Black #111111, Graphite #252525, Lime #E5FE00,
   Amethyst #8559E3, Cyan #12AAFF, Mint #99FF80, Vermilion #FE5C32, Mist #DAD9D9 */

:root {
  --bg: #111111;
  --surface: #1a1a1a;
  --surface-2: #252525;
  --surface-3: #2e2e2e;
  --border: #333333;
  --border-soft: #2a2a2a;
  --text: #dad9d9;
  --text-dim: #9a9a9a;
  --text-bright: #ffffff;
  --lime: #e5fe00;
  --amethyst: #8559e3;
  --cyan: #12aaff;
  --mint: #99ff80;
  --vermilion: #fe5c32;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --header-h: 60px;
  --sidebar-w: 268px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 20px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  background: rgba(17,17,17,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  z-index: 100;
}
.site-header .logo { display: flex; align-items: center; gap: 10px; }
.site-header .logo img { height: 26px; display: block; }
.site-header .logo .builders-tag {
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--lime); border: 1px solid rgba(229,254,0,0.4); border-radius: 4px;
  padding: 2px 7px; margin-left: 2px; white-space: nowrap;
}
.top-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.top-nav a {
  color: var(--text); font-size: 14.5px; padding: 7px 12px; border-radius: 6px;
  white-space: nowrap;
}
.top-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text-bright); }
.top-nav a.active { color: var(--lime); }
.top-nav a.ext { color: var(--text-dim); }

.hamburger {
  display: none; margin-left: auto; background: none; border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 7px 10px; font-size: 18px; cursor: pointer;
  line-height: 1;
}

/* ---------- Layout ---------- */
.layout { display: flex; padding-top: var(--header-h); min-height: 100vh; }

.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; width: var(--sidebar-w);
  overflow-y: auto; padding: 26px 14px 60px 20px;
  border-right: 1px solid var(--border-soft);
  background: var(--bg);
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar h4 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin: 22px 0 6px; font-weight: 700;
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar a {
  display: block; color: var(--text); font-size: 13.8px; padding: 4.5px 10px;
  border-radius: 6px; border-left: 2px solid transparent;
}
.sidebar a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar a.active { color: var(--lime); border-left-color: var(--lime); background: rgba(229,254,0,0.05); }

.content {
  margin-left: var(--sidebar-w);
  padding: 44px 56px 100px;
  max-width: 980px;
  width: 100%;
}
.content.full { margin-left: 0; max-width: 1100px; margin-inline: auto; }

/* ---------- Typography ---------- */
h1 { font-size: 34px; line-height: 1.2; color: var(--text-bright); margin: 0 0 10px; letter-spacing: -0.01em; }
h2 {
  font-size: 24px; color: var(--text-bright); margin: 52px 0 14px;
  padding-top: 18px; border-top: 1px solid var(--border-soft); letter-spacing: -0.01em;
}
h2:first-of-type { border-top: none; padding-top: 0; margin-top: 28px; }
h3 { font-size: 18.5px; color: var(--text-bright); margin: 34px 0 10px; }
h4 { font-size: 15.5px; color: var(--text-bright); margin: 26px 0 8px; }
p.lead { font-size: 18.5px; color: var(--text-dim); margin: 0 0 26px; max-width: 760px; }
.anchor-link { color: var(--border); margin-left: 8px; font-weight: 400; opacity: 0; transition: opacity .15s; font-size: 0.8em; }
h2:hover .anchor-link, h3:hover .anchor-link, h4:hover .anchor-link { opacity: 1; }
.anchor-link:hover { color: var(--lime); text-decoration: none; }

code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
  color: var(--mint);
}

/* ---------- Code blocks ---------- */
.codeblock {
  position: relative; margin: 16px 0 22px;
  border: 1px solid var(--border-soft); border-radius: 10px;
  background: #161616; overflow: hidden;
}
.codeblock .cb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; background: #1d1d1d; border-bottom: 1px solid var(--border-soft);
}
.codeblock .cb-lang {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.codeblock .cb-copy {
  background: none; border: 1px solid var(--border); color: var(--text-dim);
  font-size: 11.5px; padding: 3px 10px; border-radius: 5px; cursor: pointer;
  font-family: var(--sans); transition: all .15s;
}
.codeblock .cb-copy:hover { color: var(--lime); border-color: var(--lime); }
.codeblock .cb-copy.copied { color: var(--mint); border-color: var(--mint); }
.codeblock pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--mono); font-size: 13.4px; line-height: 1.6;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.codeblock pre code { background: none; padding: 0; color: var(--text); font-size: inherit; }

/* highlight.js dark overrides to match brand */
.hljs { background: transparent !important; color: #d6d6d6; }
.hljs-keyword, .hljs-literal { color: var(--amethyst); }
.hljs-string { color: var(--mint); }
.hljs-number { color: var(--cyan); }
.hljs-title, .hljs-title.function_ { color: var(--lime); }
.hljs-comment { color: #6f6f6f; font-style: italic; }
.hljs-attr, .hljs-property { color: #e8e8e8; }
.hljs-built_in { color: var(--cyan); }
.hljs-params { color: var(--text); }

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

/* ---------- Badges & callouts ---------- */
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em;
  padding: 2.5px 9px; border-radius: 99px; text-transform: uppercase; white-space: nowrap;
}
.badge.live { color: #111; background: var(--mint); }
.badge.dev { color: #111; background: var(--lime); }
.badge.planned { color: var(--text-bright); background: var(--surface-3); border: 1px solid var(--border); }
.badge.yes { color: #111; background: var(--mint); }
.badge.no { color: #fff; background: var(--vermilion); }
.badge.write { color: #fff; background: var(--amethyst); }
.badge.read { color: #111; background: var(--cyan); }
.badge.event { color: #111; background: var(--lime); }

.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--lime);
  background: var(--surface); border-radius: 8px; padding: 14px 18px; margin: 18px 0;
  font-size: 14.5px;
}
.callout.info { border-left-color: var(--cyan); }
.callout.warn { border-left-color: var(--vermilion); }
.callout.purple { border-left-color: var(--amethyst); }
.callout strong { color: var(--text-bright); }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 26px 0; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 20px 20px 18px; color: var(--text);
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--lime); text-decoration: none; transform: translateY(-2px); }
.card .card-icon { font-size: 22px; margin-bottom: 10px; display: block; }
.card h3 { margin: 0 0 6px; font-size: 16.5px; }
.card p { margin: 0; font-size: 13.8px; color: var(--text-dim); line-height: 1.5; }

/* ---------- Hero (home) ---------- */
.hero {
  padding: 70px 0 46px; text-align: left; position: relative;
}
.hero h1 { font-size: 48px; max-width: 720px; }
.hero h1 .accent { color: var(--lime); }
.hero p { font-size: 19px; color: var(--text-dim); max-width: 640px; }
.hero .cta-row { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 8px; font-size: 15px; font-weight: 600;
  transition: all .15s;
}
.btn.primary { background: var(--lime); color: #111; }
.btn.primary:hover { text-decoration: none; filter: brightness(1.08); }
.btn.ghost { border: 1px solid var(--border); color: var(--text-bright); }
.btn.ghost:hover { text-decoration: none; border-color: var(--lime); color: var(--lime); }

/* ---------- CLOB page specifics ---------- */
.arch-stack { display: flex; flex-direction: column; gap: 10px; margin: 24px 0; }
.arch-layer {
  border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px;
  background: var(--surface);
}
.arch-layer .layer-tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); display: block; margin-bottom: 4px;
}
.arch-layer h3 { margin: 0 0 4px; font-size: 16px; }
.arch-layer p { margin: 0; font-size: 13.8px; color: var(--text-dim); }
.arch-layer.l4 { border-left: 3px solid var(--amethyst); }
.arch-layer.l3 { border-left: 3px solid var(--lime); }
.arch-layer.l2 { border-left: 3px solid var(--cyan); }
.arch-layer.l1 { border-left: 3px solid var(--mint); }

.timeline { position: relative; margin: 30px 0 10px; padding-left: 30px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px;
  background: var(--border);
}
.tl-item { position: relative; padding: 0 0 30px; }
.tl-item::before {
  content: ""; position: absolute; left: -27px; top: 5px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--lime);
}
.tl-item.future::before { border-color: var(--border); }
.tl-item .tl-phase {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--lime);
}
.tl-item.future .tl-phase { color: var(--text-dim); }
.tl-item h3 { margin: 2px 0 4px; font-size: 17px; }
.tl-item p { margin: 0; font-size: 14px; color: var(--text-dim); max-width: 640px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 24px 0; }
.stat {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 18px;
}
.stat .stat-val { font-size: 26px; font-weight: 700; color: var(--lime); font-family: var(--mono); }
.stat .stat-label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* ---------- Brand page ---------- */
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin: 22px 0; }
.swatch { border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; background: var(--surface); }
.swatch .sw-color { height: 84px; }
.swatch .sw-meta { padding: 11px 14px; }
.swatch .sw-name { font-size: 13.5px; font-weight: 600; color: var(--text-bright); }
.swatch .sw-hex { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); cursor: pointer; }
.swatch .sw-hex:hover { color: var(--lime); }

.logo-tile {
  border: 1px solid var(--border-soft); border-radius: 10px; padding: 26px;
  display: flex; align-items: center; justify-content: center; min-height: 110px; margin-bottom: 8px;
}
.logo-tile.on-dark { background: var(--bg); }
.logo-tile.on-light { background: #f4f4f4; }
.logo-tile img { max-height: 48px; max-width: 80%; }
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin: 22px 0; }
.logo-grid .dl-links { font-size: 13px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border-soft); margin-top: 40px;
  padding: 34px 56px; margin-left: var(--sidebar-w);
  display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between;
  font-size: 13.5px; color: var(--text-dim);
}
.site-footer.full { margin-left: 0; }
.site-footer .f-links { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--lime); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .content { padding: 36px 32px 80px; }
}
@media (max-width: 860px) {
  .hamburger { display: block; }
  .top-nav {
    display: none; position: fixed; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 10px; gap: 2px; z-index: 99;
  }
  .top-nav.open { display: flex; }
  .top-nav a { width: 100%; padding: 11px 14px; }
  .sidebar {
    transform: translateX(-100%); transition: transform .2s; z-index: 98;
    width: min(82vw, 300px); box-shadow: 4px 0 30px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .content, .site-footer { margin-left: 0; }
  .content { padding: 30px 20px 70px; }
  .site-footer { padding: 28px 20px; }
  .hero h1 { font-size: 34px; }
  .sidebar-toggle {
    display: inline-flex !important;
  }
}
.sidebar-toggle {
  display: none; position: fixed; bottom: 22px; right: 22px; z-index: 97;
  background: var(--lime); color: #111; border: none; border-radius: 99px;
  padding: 12px 18px; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5); align-items: center; gap: 8px;
  font-family: var(--sans);
}
