/* ============================================================
   Wayforth Docs — styles.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:ital,wght@0,400;0,600;1,400&display=swap');

/* 1. Variables */
:root {
  --bg:           #080d1c;
  --bg-surface:   #0c1225;
  --bg-elevated:  #111b30;
  --bg-hover:     #162036;
  --border:       #1c2d47;
  --border-soft:  #172136;

  --text:         #b4c6d8;
  --text-dim:     #506070;
  --text-muted:   #3a4f62;
  --text-bright:  #e4edf8;

  --accent:       #3b82f6;
  --accent-light: #60a5fa;
  --accent-glow:  rgba(59,130,246,0.12);
  --cyan:         #22d3ee;
  --green:        #34d399;
  --yellow:       #fbbf24;
  --red:          #f87171;
  --purple:       #a78bfa;
  --orange:       #fb923c;

  --code-bg:      #05091a;

  --sidebar-w:    264px;
  --header-h:     56px;
  --content-max:  860px;

  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:         'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

  --radius:       6px;
  --radius-lg:    10px;
  --ease:         150ms ease;
}

/* 2. Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; }

/* 3. Base */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-light); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--cyan); }

h1, h2, h3, h4 {
  color: var(--text-bright);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; margin-bottom: 0.6rem; }
h2 {
  font-size: 1.35rem;
  margin-top: 2.75rem;
  margin-bottom: 0.75rem;
  padding-top: 2.75rem;
  border-top: 1px solid var(--border-soft);
}
h2:first-of-type, section:first-child h2 { border-top: none; padding-top: 0; margin-top: 0; }
h3 { font-size: 1.05rem; margin-top: 1.75rem; margin-bottom: 0.5rem; }
h4 { font-size: 0.9rem; margin-top: 1.25rem; margin-bottom: 0.4rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.3rem; }

strong { color: var(--text-bright); font-weight: 600; }
em { color: var(--text-bright); }

code {
  font-family: var(--mono);
  font-size: 0.855em;
  background: var(--bg-elevated);
  color: var(--cyan);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg);
  border-radius: 0;
  overflow-x: auto;
  padding: 1.2rem 1.4rem;
  margin: 0;
  line-height: 1.65;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.855rem;
  color: var(--text-bright);
}

hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* 4. Layout */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  background: rgba(8,13,28,0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.5rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-bright);
  text-decoration: none;
}
.logo:hover { color: var(--text-bright); }
.logo-mark {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #3b82f6, #22d3ee);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem; color: #fff;
  flex-shrink: 0;
}
.logo-text { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; }
.logo-docs {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}
.header-links { display: flex; align-items: center; gap: 1.5rem; }
.header-link {
  color: var(--text-dim);
  font-size: 0.825rem;
  font-weight: 500;
  text-decoration: none;
}
.header-link:hover { color: var(--text); }
.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

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

/* 5. Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 1.25rem 0.875rem;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.search-wrap { position: relative; margin-bottom: 1.25rem; }
.search-wrap input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 7px 10px 7px 32px;
  outline: none;
  transition: border-color var(--ease);
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-muted); }
.search-icon {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-size: 0.85rem;
}
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
  z-index: 99;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.sr-item {
  display: block;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--bg-hover); color: var(--text-bright); }
.sr-item strong { color: var(--accent-light); display: block; margin-bottom: 1px; }
.sr-item span { font-size: 0.72rem; color: var(--text-dim); }
.sr-empty { padding: 0.6rem 0.75rem; font-size: 0.8rem; color: var(--text-dim); }

.nav-group { margin-bottom: 1.75rem; }
.nav-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 0.375rem;
  margin-bottom: 0.4rem;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: all var(--ease);
  margin-bottom: 1px;
}
.nav-link:hover { color: var(--text); background: var(--bg-elevated); }
.nav-link.active { color: var(--accent-light); background: var(--accent-glow); font-weight: 500; }
.nav-link .icon { font-style: normal; font-size: 0.85rem; width: 16px; text-align: center; }

.toc-link {
  display: block;
  padding: 0.28rem 0.5rem 0.28rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--ease);
  margin-bottom: 1px;
  border-left: 2px solid transparent;
}
.toc-link:hover { color: var(--text); border-left-color: var(--border); }
.toc-link.active { color: var(--accent-light); border-left-color: var(--accent); }

/* 6. Content */
.content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3.5rem 5rem;
}
.content-inner { max-width: var(--content-max); }

.page-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  margin-bottom: 0.75rem;
}
.page-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.6rem;
}
.page-lead {
  font-size: 1.1rem;
  color: var(--text-dim);
  line-height: 1.65;
  margin-bottom: 2.5rem;
  max-width: 640px;
}

section { margin-bottom: 0.5rem; }

/* 7. Code blocks */
.code-block {
  margin: 1.25rem 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.cb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: 36px;
}
.cb-lang {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.cb-dots { display: flex; gap: 5px; }
.cb-dot { width: 10px; height: 10px; border-radius: 50%; }
.cb-dot.red   { background: #ff5f57; }
.cb-dot.yellow { background: #ffbd2e; }
.cb-dot.green  { background: #28ca41; }
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 4px;
  transition: all var(--ease);
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.copy-btn.copied { border-color: var(--green); color: var(--green); }

/* 8. Tables */
.tbl-wrap { overflow-x: auto; margin: 1.25rem 0; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead { background: var(--bg-elevated); }
th {
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.015); }

/* 9. Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.b-get    { background: rgba(52,211,153,0.12); color: var(--green);        border: 1px solid rgba(52,211,153,0.25); }
.b-post   { background: rgba(59,130,246,0.12); color: var(--accent-light); border: 1px solid rgba(59,130,246,0.25); }
.b-delete { background: rgba(248,113,113,0.12); color: var(--red);         border: 1px solid rgba(248,113,113,0.25); }

.pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}
.pill-free    { background: rgba(100,116,139,0.2); color: #94a3b8; }
.pill-builder { background: rgba(52,211,153,0.12); color: var(--green); }
.pill-starter { background: rgba(59,130,246,0.12); color: var(--accent-light); }
.pill-pro     { background: rgba(167,139,250,0.12); color: var(--purple); }
.pill-growth  { background: rgba(251,191,36,0.12); color: var(--yellow); }
.pill-req     { background: rgba(248,113,113,0.12); color: var(--red); }
.pill-opt     { background: rgba(100,116,139,0.12); color: var(--text-dim); }

/* 10. Callouts */
.callout {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border-left: 3px solid;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}
.callout p:last-child { margin-bottom: 0; }
.cn { background: rgba(59,130,246,0.07); border-color: var(--accent); }
.ct { background: rgba(52,211,153,0.07); border-color: var(--green); }
.cw { background: rgba(251,191,36,0.07); border-color: var(--yellow); }
.callout strong { font-weight: 700; }
.cn strong { color: var(--accent-light); }
.ct strong { color: var(--green); }
.cw strong { color: var(--yellow); }

/* 11. Params */
.params { margin: 1rem 0; }
.param-row {
  display: grid;
  grid-template-columns: 170px 90px 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: start;
  font-size: 0.875rem;
}
.param-row:last-child { border-bottom: none; }
.pname { font-family: var(--mono); font-size: 0.82rem; color: var(--cyan); font-weight: 600; }
.ptype { font-family: var(--mono); font-size: 0.78rem; color: var(--purple); padding-top: 2px; }
.pdesc { color: var(--text); line-height: 1.6; }
.pdesc .default { color: var(--text-dim); font-family: var(--mono); font-size: 0.78rem; display: block; margin-top: 2px; }

/* 12. Method signature */
.sig {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  overflow-x: auto;
  margin: 1rem 0;
  white-space: nowrap;
}
.sig .fn { color: var(--accent-light); font-weight: 600; }
.sig .kw { color: var(--purple); }
.sig .tp { color: var(--purple); }
.sig .df { color: var(--text-dim); }
.sig .ret { color: var(--green); }

/* 13. Step list */
.steps { counter-reset: step; margin: 1.5rem 0; }
.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  counter-increment: step;
}
.step::before {
  content: counter(step);
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--accent-glow);
  border: 1px solid rgba(59,130,246,0.4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  color: var(--accent-light);
  margin-top: 4px;
}
.step-body { flex: 1; min-width: 0; }
.step-body h3 { margin-top: 0; margin-bottom: 0.4rem; }

/* 14. Service cards */
.svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.svc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: border-color var(--ease);
}
.svc-card:hover { border-color: rgba(59,130,246,0.4); }
.svc-slug { font-family: var(--mono); font-size: 0.8rem; font-weight: 700; color: var(--cyan); margin-bottom: 0.25rem; }
.svc-name { font-size: 0.825rem; color: var(--text-bright); font-weight: 500; margin-bottom: 0.35rem; }
.svc-meta { font-size: 0.75rem; color: var(--text-dim); display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* 15. Category grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
  margin: 1.25rem 0;
}
.cat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
}
.cat-slug { font-family: var(--mono); font-size: 0.78rem; color: var(--cyan); }
.cat-name { color: var(--text); font-size: 0.8rem; }

/* 16. Status codes */
.sc { display: inline-block; font-family: var(--mono); font-size: 0.8rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.sc-2 { background: rgba(52,211,153,0.12); color: var(--green); }
.sc-4 { background: rgba(251,191,36,0.12); color: var(--yellow); }
.sc-5 { background: rgba(248,113,113,0.12); color: var(--red); }
.sc-401 { background: rgba(248,113,113,0.12); color: var(--red); }

/* 17. Rail tracks */
.rail {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 0.75rem 0;
  align-items: flex-start;
}
.rail-letter {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem;
}
.ra { background: rgba(59,130,246,0.15); color: var(--accent-light); }
.rb { background: rgba(52,211,153,0.15); color: var(--green); }
.rc { background: rgba(167,139,250,0.15); color: var(--purple); }
.rail-body { flex: 1; }
.rail-title { font-weight: 700; font-size: 0.95rem; color: var(--text-bright); margin-bottom: 0.25rem; }
.rail-desc { font-size: 0.875rem; color: var(--text-dim); margin: 0; }

/* 18. Topup cards */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.75rem; margin: 1.25rem 0; }
.pkg-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  text-align: center;
}
.pkg-price { font-size: 1.6rem; font-weight: 800; color: var(--text-bright); letter-spacing: -0.03em; }
.pkg-calls { font-size: 0.9rem; color: var(--green); font-weight: 600; margin: 0.1rem 0; }
.pkg-name { font-family: var(--mono); font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.3rem; }

/* 19. WRI meter */
.wri-row { display: flex; align-items: center; gap: 0.75rem; margin: 0.35rem 0; }
.wri-label { width: 80px; font-size: 0.82rem; color: var(--text-dim); }
.wri-bar { flex: 1; height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.wri-fill { height: 100%; border-radius: 3px; }
.wri-val { width: 36px; text-align: right; font-family: var(--mono); font-size: 0.78rem; color: var(--text-dim); }

/* 20. Mobile */
@media (max-width: 960px) {
  .content { padding: 1.75rem 1.5rem 4rem; }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 260ms ease;
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: flex; align-items: center; gap: 5px; }
}
@media (max-width: 640px) {
  .header-links .header-link:not(:last-child) { display: none; }
  .content { padding: 1.25rem 1rem 3rem; }
  .param-row { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
  .param-row .pdesc { grid-column: 1 / -1; }
  .page-title { font-size: 1.75rem; }
  h2 { font-size: 1.2rem; }
}

/* 21. Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #2a3f5c; }

/* 22. Prism overrides */
code[class*="language-"],
pre[class*="language-"] {
  font-family: var(--mono) !important;
  font-size: 0.855rem !important;
  text-shadow: none !important;
  background: transparent !important;
}
:not(pre) > code[class*="language-"] { background: var(--bg-elevated) !important; }
.token.comment,
.token.prolog     { color: #4a6882; font-style: italic; }
.token.string     { color: #9ecf66; }
.token.number,
.token.boolean    { color: #e8a44a; }
.token.keyword,
.token.operator   { color: #b08ef0; }
.token.function   { color: #5bb5f7; }
.token.class-name { color: #f0c060; }
.token.punctuation{ color: #5a7a90; }
.token.property   { color: #81c8f5; }
.token.builtin    { color: #5bb5f7; }
.token.parameter  { color: var(--text); }
.token.attr-name  { color: #b08ef0; }
.token.attr-value { color: #9ecf66; }
.token.tag        { color: var(--red); }

/* 23. Utility */
.mt-0 { margin-top: 0 !important; }
.mb-sm { margin-bottom: 0.5rem; }
.mono { font-family: var(--mono); }
.dim  { color: var(--text-dim); }
