/* ============================================================
   8byte LOS Documentation — shared "module" design system
   Used by /modules/**  (per-repo Tech + Product deep-dive pages)
   Reuses the color tokens from the main site (index.html) so the
   two doc generations feel like one product.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #F0F2F5;
  --surface:  #FFFFFF;
  --surface2: #F7F8FA;
  --border:   #DAE0E8;
  --accent:   #1877F2;
  --accent2:  #1565D8;
  --accent-dark: #0D47A1;
  --green:    #31A24C;
  --orange:   #F5841F;
  --red:      #E04040;
  --cyan:     #0EA5E9;
  --purple:   #7C3AED;
  --text:     #1C2B33;
  --text2:    #606B85;
  --text3:    #8A94A6;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
  --card-shadow-hover: 0 4px 16px rgba(24,119,242,0.10), 0 8px 28px rgba(0,0,0,0.05);

  /* per-repo accent so a reader always knows which repo they're in */
  --repo-backend:  #0D47A1;
  --repo-webv1:    #31A24C;
  --repo-partner:  #7C3AED;
  --repo-providers: #0EA5E9;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
}

code, .mono { font-family: 'JetBrains Mono', monospace; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Sidebar ─────────────────────────────────────────────── */
.doc-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  padding: 20px 16px 40px;
}
.doc-sidebar .brand-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  padding: 6px 8px 18px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
  font-weight: 800; font-size: 14px; letter-spacing: -0.2px;
}
.doc-sidebar .brand-link .dot {
  width: 10px; height: 10px; border-radius: 3px; background: var(--accent); flex-shrink: 0;
}
.doc-sidebar .nav-group { margin-bottom: 18px; }
.doc-sidebar .nav-group-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text3); padding: 0 8px 6px;
}
.doc-sidebar a.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px; border-radius: 8px; text-decoration: none;
  color: var(--text2); font-size: 13.5px; font-weight: 600;
  transition: background .15s, color .15s;
}
.doc-sidebar a.nav-item:hover { background: var(--surface2); color: var(--text); }
.doc-sidebar a.nav-item.active { background: rgba(24,119,242,0.1); color: var(--accent2); }
.doc-sidebar a.nav-item .rd {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.doc-sidebar .repo-block { border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.doc-sidebar .repo-block-title {
  font-size: 12.5px; font-weight: 800; padding: 2px 4px 6px; display:flex; align-items:center; gap:7px;
}

/* ── Main content shell ──────────────────────────────────── */
.doc-main { flex: 1; min-width: 0; }

.doc-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 28px 44px;
}
.doc-header .crumb { font-size: 12.5px; color: var(--text3); font-weight: 600; margin-bottom: 8px; }
.doc-header .crumb a { color: var(--text3); text-decoration: none; }
.doc-header .crumb a:hover { color: var(--accent); }
.doc-header h1 { font-size: 28px; font-weight: 900; letter-spacing: -0.5px; }
.doc-header p.subtitle { color: var(--text2); margin-top: 6px; font-size: 14.5px; max-width: 760px; }
.doc-header .tabs { display: flex; gap: 8px; margin-top: 18px; }
.doc-header .tab {
  padding: 8px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 700;
  text-decoration: none; color: var(--text2); background: var(--surface2); border: 1px solid var(--border);
}
.doc-header .tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.doc-header .as-of { font-size: 11.5px; color: var(--text3); margin-top: 14px; font-weight: 600; }

.doc-body { padding: 36px 44px 100px; max-width: 1040px; }

/* ── Callouts ────────────────────────────────────────────── */
.callout {
  border-radius: 12px; padding: 16px 18px; margin: 18px 0 26px;
  border: 1px solid; font-size: 14px; line-height: 1.6;
}
.callout strong { font-weight: 800; }
.callout.correction { background: #FFF4E5; border-color: #F5C97A; color: #7A4A00; }
.callout.info       { background: #EAF3FF; border-color: #AFD3FF; color: #0D3F7A; }
.callout.risk        { background: #FDEAEA; border-color: #F3AFAF; color: #7A0D0D; }
.callout.new         { background: #EAFBF0; border-color: #A9E3BE; color: #0E5B27; }
.callout .label {
  display: inline-block; font-size: 10.5px; font-weight: 900; letter-spacing: 0.6px;
  text-transform: uppercase; margin-bottom: 6px; opacity: 0.8;
}

/* ── Sections ────────────────────────────────────────────── */
section.doc-section { margin-bottom: 48px; scroll-margin-top: 100px; }
section.doc-section h2 {
  font-size: 21px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px;
}
section.doc-section h2 .num {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text3); font-weight: 600;
}
section.doc-section > p.lead { color: var(--text2); margin-bottom: 18px; font-size: 14.5px; max-width: 760px; }
h3.sub-head { font-size: 15.5px; font-weight: 800; margin: 22px 0 10px; color: var(--text); }

/* ── Cards / grids ───────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 14px 0; }
.info-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; box-shadow: var(--card-shadow);
}
.info-card .k { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); margin-bottom: 6px; }
.info-card .v { font-size: 14px; font-weight: 700; color: var(--text); }
.info-card .d { font-size: 12.5px; color: var(--text2); margin-top: 4px; }

/* ── Tables ──────────────────────────────────────────────── */
table.doc-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 13.5px; margin: 14px 0 22px; }
table.doc-table th {
  background: var(--surface2); text-align: left; padding: 10px 14px; font-weight: 800;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text2);
  border-bottom: 1px solid var(--border);
}
table.doc-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text); }
table.doc-table tr:last-child td { border-bottom: none; }
table.doc-table tr:hover td { background: var(--surface2); }
table.doc-table code { background: var(--surface2); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ── Badges / pills ──────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.2px; }
.pill-blue   { background: rgba(24,119,242,.12); color: var(--accent2); }
.pill-purple { background: rgba(124,58,237,.12); color: var(--purple); }
.pill-green  { background: rgba(49,162,76,.12); color: var(--green); }
.pill-orange { background: rgba(245,132,31,.12); color: #B15E10; }
.pill-red    { background: rgba(224,64,64,.12); color: var(--red); }
.pill-gray   { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }

/* ── Flow / step lists (non-mermaid fallback & annotations) ─ */
.flow-steps { list-style: none; counter-reset: step; margin: 16px 0; }
.flow-steps > li {
  counter-increment: step; position: relative; padding: 4px 0 20px 40px; border-left: 2px solid var(--border); margin-left: 14px;
}
.flow-steps > li:last-child { border-left-color: transparent; padding-bottom: 2px; }
.flow-steps > li::before {
  content: counter(step); position: absolute; left: -15px; top: 0;
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  font-weight: 800; font-size: 12.5px; display: flex; align-items: center; justify-content: center;
}
.flow-steps > li .step-title { font-weight: 800; font-size: 14.5px; margin-bottom: 3px; }
.flow-steps > li .step-body { font-size: 13.5px; color: var(--text2); }
.flow-steps > li.branch::before { background: var(--orange); }
.flow-steps > li.terminal::before { background: var(--red); }

/* ── Mermaid diagram containers ──────────────────────────── */
.diagram-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; margin: 16px 0 26px; box-shadow: var(--card-shadow); overflow-x: auto;
}
.diagram-card .diagram-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); margin-bottom: 14px; }
.mermaid { display: flex; justify-content: center; }

/* ── Code blocks ─────────────────────────────────────────── */
pre.code-block {
  background: #16202B; color: #DCE6F0; border-radius: 12px; padding: 16px 18px;
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px; overflow-x: auto; margin: 14px 0 22px; line-height: 1.6;
}
pre.code-block .c-dir { color: #6EC8FF; }
pre.code-block .c-cmt { color: #7C8B9C; }

ul.plain-list { padding-left: 20px; margin: 10px 0 18px; }
ul.plain-list li { margin-bottom: 6px; font-size: 14px; color: var(--text); }
ul.plain-list li strong { color: var(--text); }

/* ── Repo hub landing (modules/index.html) ──────────────────*/
.hub-hero {
  background: linear-gradient(135deg, #1877F2 0%, #1565D8 45%, #0D47A1 100%);
  border-radius: 20px; padding: 40px 36px; color: #fff; margin-bottom: 34px;
}
.hub-hero h1 { font-size: 30px; font-weight: 900; letter-spacing: -0.6px; margin-bottom: 10px; }
.hub-hero p { opacity: .92; max-width: 680px; font-size: 14.5px; line-height: 1.7; }
.repo-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.repo-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px;
  box-shadow: var(--card-shadow); border-top: 4px solid var(--accent);
}
.repo-card h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.repo-card .tag { font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: 10px; display:block; }
.repo-card p { font-size: 13.5px; color: var(--text2); margin-bottom: 16px; line-height: 1.6; }
.repo-card .links { display: flex; gap: 10px; }
.repo-card .links a {
  flex: 1; text-align: center; padding: 9px 0; border-radius: 9px; font-size: 13px; font-weight: 800;
  text-decoration: none; border: 1px solid var(--border); color: var(--text);
}
.repo-card .links a.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Provider cards (External Providers module) ─────────────*/
.category-toc {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 28px;
  padding: 14px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px;
}
.category-toc a {
  font-size: 12px; font-weight: 700; color: var(--text2); text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px;
  transition: color .15s, border-color .15s;
}
.category-toc a:hover { color: var(--accent2); border-color: var(--accent); }

.provider-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--card-shadow); scroll-margin-top: 90px;
}
.provider-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.provider-head .p-name { font-size: 15.5px; font-weight: 800; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.provider-purpose { font-size: 13.5px; color: var(--text2); line-height: 1.6; margin-bottom: 12px; max-width: 760px; }
.status-live     { background: rgba(49,162,76,.12); color: var(--green); }
.status-new      { background: rgba(24,119,242,.12); color: var(--accent2); }
.status-pending  { background: rgba(245,132,31,.14); color: #B15E10; }
.status-risk     { background: rgba(224,64,64,.12); color: var(--red); }
.status-unrelated{ background: var(--surface2); color: var(--text3); border: 1px solid var(--border); }

.provider-rows { display: grid; grid-template-columns: 110px 1fr; gap: 7px 14px; margin-bottom: 10px; }
.provider-rows .pr-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--text3); padding-top: 2px; }
.provider-rows .pr-value { font-size: 13px; color: var(--text); line-height: 1.6; }
.provider-rows .pr-value code { background: var(--surface2); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

.endpoint-list { list-style: none; margin: 0 0 10px; display: flex; flex-direction: column; gap: 5px; }
.endpoint-list li { font-size: 12px; font-family: 'JetBrains Mono', monospace; color: var(--text); line-height: 1.6; display: flex; gap: 8px; align-items: flex-start; }
.endpoint-list .m { flex-shrink: 0; font-weight: 800; font-size: 10px; padding: 2px 6px; border-radius: 5px; letter-spacing: .3px; margin-top: 2px; }
.m-get { background: rgba(14,165,233,.14); color: var(--cyan); }
.m-post { background: rgba(49,162,76,.14); color: var(--green); }
.m-patch, .m-put { background: rgba(245,132,31,.14); color: #B15E10; }
.m-delete { background: rgba(224,64,64,.14); color: var(--red); }
.m-sdk { background: rgba(124,58,237,.14); color: var(--purple); }
.endpoint-list .url-desc { color: var(--text2); font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12.5px; }

.provider-notes {
  font-size: 12.5px; color: var(--text2); line-height: 1.65; background: var(--surface2);
  border-radius: 10px; padding: 10px 13px; margin-top: 4px;
}
.provider-notes strong { color: var(--text); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  body { display: block; }
  .doc-sidebar { position: relative; height: auto; width: 100%; }
  .doc-header, .doc-body { padding-left: 20px; padding-right: 20px; }
}
