/* styles.css */
:root {
  --bg: #141414;
  --panel: #1b1b1b;
  --panel2: #202020;
  --codebg: #2d2c2c;

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);

  --line: rgba(255,255,255,.10);
  --line2: rgba(255,255,255,.14);

  --accent: #236d95;

  --sidebarW: 280px;
  --radius: 4px;
  --shadow: 0 10px 30px rgba(0,0,0,.40);

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

.sidebar__footer {
  margin-top: 30px; /* desktop */
}

.avatar-parent-container {
  background: transparent;
}

@media (max-width: 1024px) {
  .sidebar__footer {
    margin-top: 10px;
  }
}

/* Or target the link directly */
.sidebar__footer .muted-link {
  display: block;
  margin-top: 30px; /* desktop */
}

@media (max-width: 1024px) {
  .sidebar__footer .muted-link {
    margin-top: 10px;
  }
}

@media screen and (max-width: 768px) {
  .topbar__title {
    display: none !important;
  }
}


body.is-locked {
  overflow: hidden;
  height: 100%;
  touch-action: none;
}

a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }
.muted-link { color: var(--muted); }
.muted-link:hover { color: #fff; }

/* Layout */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebarW);
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 16px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
}
.brand:hover { background: rgba(255,255,255,.05); }

.brand__icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.brand__logo {
  height: 18px;
  width: auto;
  max-width: 180px;
  flex: 0 1 auto;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
}
.nav__link {
  padding: 10px;
  border-radius: var(--radius);
  color: var(--muted);
  border: 1px solid transparent;
}
.nav__link:hover {
  color: #fff;
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.06);
}
.nav__link.is-active {
  color: #fff;
  background: rgba(35,109,149,.22);
  border-color: rgba(35,109,149,.45);
}

.sidebar__footer {
  margin-top: 18px;
  padding: 10px 10px 0;
  border-top: 1px solid var(--line);
}

.content {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Topbar */
.topbar {
  flex-shrink: 0;
  z-index: 50;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(20,20,20,.92);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
}

.topbar__left { min-width: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  font-size: 12px;
  color: rgba(255,255,255,.82);
  background: rgba(35,109,149,.18);
  border: 1px solid rgba(35,109,149,.40);
  border-radius: var(--radius);
}

.h1 {
  margin: 10px 0 8px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.lead {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.5;
}

.topbar__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.hint { font-size: 12px; color: var(--muted); }

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--line2);
  background: rgba(255,255,255,.04);
}
.segmented__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.segmented__btn:hover { color: #fff; }
.segmented__btn.is-active {
  color: #fff;
  background: rgba(35,109,149,.32);
  border: 1px solid rgba(35,109,149,.55);
}

/* Burger */
.burger {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--line2);
  background: rgba(255,255,255,.04);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
}
.burger:hover { background: rgba(255,255,255,.06); }
.burger__bar {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,.75);
  border-radius: 2px;
}

/* ───────────────────────────────────────────────
   IMPROVED MOBILE SIDEBAR (Cartesia-style)
   ─────────────────────────────────────────────── */

.topbar__mobile-brand {
  display: none;
}

.topbar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__logoIcon {
  width: 28px;
  height: 28px;
}

.topbar__title {
  font-size: 16px;
  font-weight: 600;
}

/* Mobile sidebar overlay */
.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-sidebar-overlay[hidden] { display: none; }

.mobile-sidebar-overlay.is-open {
  pointer-events: auto;
  opacity: 1;
}

.mobile-sidebar-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.is-open .mobile-sidebar-backdrop { opacity: 1; }

.mobile-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: -320px;
  width: 280px;
  max-width: 85vw;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(0);
  padding: 20px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.is-open .mobile-sidebar {
  transform: translateX(320px);
}

.mobile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.mobile-close:hover { color: #fff; }

.mobile-nav .nav__link {
  padding: 14px 12px;
  font-size: 15px;
}

/* Docs scroll area */
.docs-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 28px;
  -webkit-overflow-scrolling: touch;
}

/* Sections / Cards / Code / etc. (unchanged parts) */
.doc-section { padding-bottom: 24px; }
.doc-section[hidden] { display: none; }
.view-block[hidden] { display: none; }

.card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 8px 0; color: var(--muted); line-height: 1.55; }

.bullets { margin: 10px 0 0; padding-left: 18px; color: var(--muted); }
.bullets li { margin: 6px 0; }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: var(--radius);
  border: 1px solid rgba(35,109,149,.40);
  background: rgba(35,109,149,.15);
  color: rgba(255,255,255,.78);
}

.note {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  line-height: 1.5;
}

code {
  font-family: var(--mono);
  font-size: .95em;
  color: rgba(255,255,255,.90);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 8px;
  color: rgba(255,255,255,.78);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.copy-btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.85);
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
}
.copy-btn:hover { background: rgba(255,255,255,.08); }

pre.code {
  margin: 0;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.10);
  background: var(--codebg);
  overflow: auto;
}
pre.code code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(255,255,255,.90);
}

.kv { display: block; }
.kv__row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,.06);
}
.kv__row:first-child { border-top: 0; }
.kv__k { color: rgba(255,255,255,.85); font-size: 13px; }
.kv__v { color: var(--muted); font-size: 13px; line-height: 1.5; }
.type { color: rgba(255,255,255,.55); font-weight: 500; }

/* Responsive */
@media (min-width: 1025px) {
  .sidebar { display: block; }
  .burger { display: none; }
  .mobile-sidebar-overlay { display: none !important; }
  .topbar__mobile-brand { display: none; }
}

@media (max-width: 1024px) {
  .app { display: block; height: auto; overflow: visible; }
  .sidebar { display: none; }
  .content { height: auto; overflow: visible; display: block; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .topbar__mobile-brand { display: block; flex: 1; }
  .topbar__left { display: none; }
  .topbar__right { flex-direction: row; align-items: center; gap: 12px; }

  .burger { display: flex; }

  .docs-scroll { overflow: visible; padding: 16px 16px 28px; }

  .segmented { font-size: 12px; padding: 3px; }
  .segmented__btn { padding: 6px 10px; }
}

@media (max-width: 560px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .kv__row { grid-template-columns: 1fr; }
}
