/* ═══════════════════════════════════════════════════════════
   Clavex Developer Portal — Shared Stylesheet
   docs.clavex.eu
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --bg:     #0D1F2D;
  --bg-2:   #112233;
  --bg-3:   #162B40;
  --bg-4:   #1C3350;
  --rule:   #1E3448;
  --muted:  #3E6070;
  --body:   #7AAABB;
  --text:   #C4DFF0;
  --bright: #E8F4FF;
  --teal:   #5DCAA5;
  --teal-d: #1D9E75;
  --teal-p: #0D3028;
  --amber:  #F5C842;
  --red:    #E85A6A;
  --blue:   #7ABEEE;
  --font:   'Plus Jakarta Sans', sans-serif;
  --mono:   'IBM Plex Mono', monospace;
  --nav-h:  60px;
  --sb-w:   256px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(93,202,165,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93,202,165,.02) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ── Top nav ─────────────────────────────────────────────── */

.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(13,31,45,.95);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}

.nav-logo {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none;
}
.nav-logo-icon { width: 26px; height: 26px; flex-shrink: 0; }
.nav-logo-text { font-family: var(--font); font-size: 1.15rem; line-height: 1; display: flex; align-items: baseline; }
.nav-logo-cl   { font-weight: 300; color: var(--text); }
.nav-logo-avex { font-weight: 700; color: var(--teal); }
.nav-logo-sep  { margin: 0 .5rem; color: var(--rule); font-weight: 300; }
.nav-logo-sub  { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: .04em; }

.nav-right {
  display: flex; align-items: center; gap: 1.5rem;
}
.nav-link {
  font-size: .78rem; font-weight: 500; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; transition: color .18s;
}
.nav-link:hover { color: var(--teal); }
.nav-btn {
  font-family: var(--font); font-size: .75rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: .38rem 1rem; border-radius: 4px;
  border: 1px solid var(--rule); color: var(--body);
  background: transparent; text-decoration: none; transition: all .18s;
}
.nav-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ── Layout ──────────────────────────────────────────────── */

.docs-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-h);
  position: relative; z-index: 1;
}

/* ── Sidebar ─────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: var(--nav-h); left: 0; bottom: 0;
  width: var(--sb-w);
  background: var(--bg-2);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  padding: 1.5rem 0 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.sb-section { margin-bottom: 1.75rem; }
.sb-section-title {
  font-family: var(--mono); font-size: .62rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  padding: 0 1.2rem .55rem;
  border-bottom: 1px solid var(--rule); margin-bottom: .5rem;
}
.sb-link {
  display: flex; align-items: center; gap: .5rem;
  padding: .38rem 1.2rem;
  font-size: .84rem; color: var(--body); text-decoration: none;
  transition: all .15s; border-left: 2px solid transparent;
}
.sb-link:hover { color: var(--teal); background: rgba(93,202,165,.04); }
.sb-link.active {
  color: var(--teal); background: var(--teal-p);
  border-left-color: var(--teal); font-weight: 500;
}
.sb-link-icon { font-size: .9em; opacity: .7; flex-shrink: 0; }

/* ── Content area ────────────────────────────────────────── */

.content-main {
  margin-left: var(--sb-w);
  flex: 1; min-width: 0;
  padding: 3rem 3.5rem 6rem;
  max-width: calc(var(--sb-w) + 820px);
}

/* ── Page header ─────────────────────────────────────────── */

.page-eyebrow {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--teal);
  display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem;
}
.page-eyebrow::before { content: ''; display: block; width: 24px; height: 1px; background: var(--teal); }

.page-title {
  font-size: clamp(1.9rem, 3.5vw, 2.8rem); font-weight: 300; line-height: 1.15;
  color: var(--bright); letter-spacing: -.025em; margin-bottom: .9rem;
}
.page-title strong { font-weight: 700; color: var(--teal); }

.page-lead {
  font-size: 1rem; color: var(--body); line-height: 1.8; max-width: 640px;
  margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--rule);
}

/* ── Typography ──────────────────────────────────────────── */

h2 { font-size: 1.35rem; font-weight: 700; color: var(--bright); letter-spacing: -.015em; margin: 2.5rem 0 .75rem; }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--text); margin: 1.75rem 0 .55rem; }
h4 { font-size: .9rem; font-weight: 600; color: var(--body); text-transform: uppercase; letter-spacing: .06em; margin: 1.25rem 0 .4rem; }

p { font-size: .9rem; color: var(--body); line-height: 1.8; margin-bottom: .9rem; }

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

code {
  font-family: var(--mono); font-size: .82em;
  color: var(--teal); background: var(--teal-p);
  padding: .1rem .35rem; border-radius: 3px;
}

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

ul, ol { padding-left: 1.4rem; margin-bottom: .9rem; }
li { font-size: .9rem; color: var(--body); line-height: 1.8; margin-bottom: .15rem; }

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

/* ── Terminal / code blocks ──────────────────────────────── */

.terminal {
  background: var(--bg-2); border: 1px solid var(--rule);
  border-radius: 8px; overflow: hidden;
  font-family: var(--mono); font-size: .76rem;
  position: relative; margin: 1rem 0 1.25rem;
}
.terminal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--teal-d), transparent);
}
.terminal-bar {
  background: var(--bg-3); padding: .5rem 1rem;
  display: flex; align-items: center; gap: .4rem;
  border-bottom: 1px solid var(--rule);
}
.terminal-label { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-r { background: #e85a6a; } .dot-y { background: #f5c842; } .dot-g { background: #5dcaa5; }

.terminal-body { padding: 1.1rem 1.2rem; line-height: 2; overflow-x: auto; }

.t-comment { color: var(--muted); }
.t-prompt   { color: var(--teal); user-select: none; }
.t-cmd      { color: var(--bright); }
.t-out      { color: var(--body); }
.t-ok       { color: var(--teal); }
.t-err      { color: var(--red); }
.t-key      { color: var(--teal); }
.t-val      { color: var(--amber); }
.t-url      { color: var(--blue); }
.t-dim      { color: var(--rule); }
.t-str      { color: var(--amber); }
.t-kw       { color: #B57BFF; }
.t-type     { color: var(--blue); }

/* ── Steps ───────────────────────────────────────────────── */

.steps { display: flex; flex-direction: column; gap: .25rem; margin: 1.5rem 0; }

.step {
  display: grid; grid-template-columns: 44px 1fr; gap: 1.25rem;
  padding-bottom: 2.5rem; position: relative;
}
.step:not(:last-child)::before {
  content: ''; position: absolute; left: 21px; top: 44px; bottom: 0; width: 1px;
  background: var(--rule);
}
.step-num {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(93,202,165,.35); background: var(--teal-p);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .82rem; font-weight: 700; color: var(--teal);
  flex-shrink: 0; margin-top: .05rem;
}
.step-title { font-size: 1.1rem; font-weight: 700; color: var(--bright); margin-bottom: .45rem; letter-spacing: -.01em; }
.step-desc { font-size: .88rem; color: var(--body); line-height: 1.75; margin-bottom: .9rem; }
.step-desc code { font-family: var(--mono); font-size: .82em; color: var(--teal); background: var(--teal-p); padding: .1rem .35rem; border-radius: 3px; }

/* ── Callouts ────────────────────────────────────────────── */

.callout {
  border-left: 3px solid var(--amber); background: rgba(245,200,66,.05);
  border-radius: 0 6px 6px 0; padding: .85rem 1.1rem;
  margin: 1rem 0 1.25rem; font-size: .84rem; color: var(--body); line-height: 1.7;
}
.callout strong { color: var(--amber); }
.callout code { font-family: var(--mono); font-size: .82em; color: var(--teal); }
.callout-teal  { border-left-color: var(--teal); background: rgba(93,202,165,.05); }
.callout-teal strong { color: var(--teal); }
.callout-red   { border-left-color: var(--red); background: rgba(232,90,106,.05); }
.callout-red strong { color: var(--red); }

/* ── Tabs ────────────────────────────────────────────────── */

.tabs { margin: 1.25rem 0; }
.tab-list {
  display: flex; gap: 0; border-bottom: 1px solid var(--rule); margin-bottom: 0;
}
.tab-btn {
  font-family: var(--mono); font-size: .74rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding: .55rem 1.1rem;
  border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: all .15s; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--teal); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Badges / pills ──────────────────────────────────────── */

.badge {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .08em;
  text-transform: uppercase; padding: .2rem .55rem;
  border: 1px solid var(--rule); border-radius: 3px; color: var(--muted);
  display: inline-block;
}
.badge-teal  { border-color: rgba(93,202,165,.3); color: var(--teal); background: var(--teal-p); }
.badge-amber { border-color: rgba(245,200,66,.25); color: var(--amber); background: rgba(245,200,66,.06); }
.badge-red   { border-color: rgba(232,90,106,.25); color: var(--red);   background: rgba(232,90,106,.06); }
.badge-blue  { border-color: rgba(122,190,238,.25); color: var(--blue);  background: rgba(122,190,238,.06); }

/* ── Cards / feature grid ────────────────────────────────── */

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem; margin: 1.5rem 0;
}
.card {
  background: var(--bg-2); border: 1px solid var(--rule); border-radius: 8px;
  padding: 1.2rem; transition: border-color .18s;
}
.card:hover { border-color: rgba(93,202,165,.3); }
.card-icon { font-size: 1.5rem; margin-bottom: .6rem; }
.card-title { font-size: .9rem; font-weight: 700; color: var(--bright); margin-bottom: .35rem; }
.card-desc { font-size: .8rem; color: var(--body); line-height: 1.65; }
.card-link { display: block; margin-top: .75rem; font-size: .78rem; color: var(--teal); }

/* ── Table ───────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: .84rem; }
th { text-align: left; padding: .55rem .85rem; font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--rule); }
td { padding: .6rem .85rem; color: var(--body); border-bottom: 1px solid rgba(30,52,72,.5); vertical-align: top; }
td:first-child { font-family: var(--mono); font-size: .8rem; color: var(--teal); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(93,202,165,.03); }

/* ── Flow diagram ────────────────────────────────────────── */

.flow {
  background: var(--bg-2); border: 1px solid var(--rule); border-radius: 8px;
  padding: 1.5rem; margin: 1.25rem 0;
  font-family: var(--mono); font-size: .78rem;
}
.flow-row { display: flex; align-items: center; gap: .75rem; margin: .35rem 0; color: var(--body); }
.flow-actor { background: var(--bg-3); border: 1px solid var(--rule); border-radius: 4px; padding: .2rem .6rem; color: var(--teal); font-size: .74rem; white-space: nowrap; }
.flow-arrow { color: var(--muted); flex-shrink: 0; }
.flow-label { color: var(--body); font-size: .74rem; }
.flow-note  { color: var(--muted); font-size: .7rem; padding-left: 1rem; margin-top: .15rem; }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .content-main { margin-left: 0; padding: 2rem 1.5rem 4rem; }
  .card-grid { grid-template-columns: 1fr; }
}
