:root {
  --pink: #ff4d8d;
  --orange: #ff7a5a;
  --accent: linear-gradient(135deg, var(--orange), var(--pink));
  --accent-solid: #ff5f7f;
  --bg: #ffffff;
  --surface: #f7f7fa;
  --surface-2: #f0f1f5;
  --text: #15151b;
  --muted: #646875;
  --muted-2: #8b8f9b;
  --border: #e3e4e9;
  --shadow: 0 12px 35px rgba(15, 15, 20, 0.08);
  --info-bg: #eef6ff;
  --info-border: #4c9cff;
  --warning-bg: #fff8df;
  --warning-border: #f0bd35;
  --danger-bg: #fff0f1;
  --danger-border: #ef5d67;
  --code-bg: #f3f4f7;
  --nav-bg: rgba(255,255,255,.86);
  --header-height: 72px;
  --sidebar-width: 270px;
}

html[data-theme="dark"] {
  --bg: #0f0f14;
  --surface: #15151d;
  --surface-2: #1b1b24;
  --text: #f8f8fb;
  --muted: #b6bac7;
  --muted-2: #858a99;
  --border: #292a34;
  --shadow: 0 18px 50px rgba(0,0,0,.3);
  --info-bg: #111f31;
  --info-border: #4c9cff;
  --warning-bg: #2a2412;
  --warning-border: #d9a928;
  --danger-bg: #2b1619;
  --danger-border: #e65d67;
  --code-bg: #1a1b23;
  --nav-bg: rgba(15,15,20,.86);
}

[data-theme-toggle] {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;

    white-space: nowrap;
    vertical-align: middle;
    line-height: 1;
}

[data-theme-toggle] svg {
    display: inline-block !important;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    margin: 0 !important;
    position: static !important;
}

[data-theme-toggle] span {
    display: inline !important;
    margin: 0 !important;
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
  transition: background .2s ease, color .2s ease;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }

.navbar {
  position: fixed;
  inset: 0 0 auto;
  height: var(--header-height);
  padding: 0 6vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}
.nav-left .logo { display: flex; align-items: center; gap: .6rem; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; display: block; }
.logo-text { color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.2rem; letter-spacing: .02em; }
.nav-right { display: flex; align-items: center; gap: 1.65rem; }
.nav-link { color: var(--text); text-decoration: none; font-size: .95rem; }
.nav-link:hover { color: var(--orange); }
.nav-dropdown { position: relative; }
.dropdown {
  position: absolute; top: 140%; left: 0; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .6rem;
  box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.dropdown a { display:block; padding:.6rem .8rem; border-radius:8px; color:var(--muted); text-decoration:none; font-size:.9rem; }
.dropdown a:hover { background: var(--surface-2); color: var(--text); }
.nav-dropdown:hover .dropdown, .nav-dropdown:focus-within .dropdown { opacity:1; visibility:visible; transform:translateY(0); }
.nav-dropdown::after { content:""; position:absolute; left:0; top:100%; width:100%; height:12px; }
.nav-button {
  padding:.6rem 1.4rem; border-radius:999px; background:var(--accent); color:#111; font-weight:650;
  text-decoration:none; font-size:.9rem;
}
.nav-button:hover { opacity:.9; }
.theme-toggle {
  min-width: 42px; height: 42px; border:1px solid var(--border); border-radius:999px;
  background:var(--surface); color:var(--text); cursor:pointer; display:grid; place-items:center;
  transition:transform .15s ease, background .2s ease, border-color .2s ease;
}
.theme-toggle:hover { transform:translateY(-1px); border-color:var(--orange); }
.theme-toggle svg { width:18px; height:18px; }
.menu-toggle { display:none; background:none; border:0; color:var(--text); cursor:pointer; font-size:1.6rem; }
.mobile-menu {
  position:fixed; top:0; right:0; width:min(300px,88vw); height:100dvh; padding:6rem 2rem 2rem;
  background:var(--bg); display:flex; flex-direction:column; gap:1rem; transform:translateX(100%);
  transition:transform .3s ease; z-index:999; border-left:1px solid var(--border); box-shadow:-15px 0 45px rgba(0,0,0,.15);
}
.mobile-menu.is-open { transform:translateX(0); }
.mobile-menu a, .mobile-menu summary { color:var(--text); text-decoration:none; cursor:pointer; }
.mobile-menu details a { display:block; padding:.45rem 0 .45rem 1rem; color:var(--muted); font-size:.92rem; }
.mobile-theme { margin-top:auto; display:flex; align-items:center; justify-content:space-between; padding-top:1rem; border-top:1px solid var(--border); }
.mobile-theme button { border:1px solid var(--border); background:var(--surface); color:var(--text); border-radius:999px; padding:.55rem .8rem; cursor:pointer; }
.mobile-cta { margin-top:.5rem; padding:.7rem 1rem; text-align:center; border-radius:999px; background:var(--accent); color:#111 !important; font-weight:650; }

/* Documentation layout */
.docs-shell {
  width:100%;
  max-width:1500px;
  margin:0 auto;
  padding:calc(var(--header-height) + 32px) 5vw 64px;
  display:grid;
  grid-template-columns:var(--sidebar-width) minmax(0, 1fr);
  gap:64px;
  flex:1 0 auto;
}
.docs-sidebar {
  position:sticky;
  top:calc(var(--header-height) + 28px);
  align-self:start;
  max-height:calc(100dvh - var(--header-height) - 56px);
  overflow:auto;
  padding-right:10px;
}
.docs-sidebar-title { margin:0 0 14px; font-size:.78rem; text-transform:uppercase; letter-spacing:.1em; color:var(--muted-2); }
.docs-nav { display:flex; flex-direction:column; gap:4px; }
.docs-nav-item, .docs-nav-subitem {
  position:relative; display:block; text-decoration:none; color:var(--muted); border-radius:7px; transition:.15s ease;
}
.docs-nav-item { padding:8px 12px 8px 18px; font-weight:550; }
.docs-nav-subitem { padding:6px 12px 6px 34px; font-size:.9rem; }
.docs-nav-item:hover, .docs-nav-subitem:hover { color:var(--text); background:var(--surface); }
.docs-nav-item.is-active, .docs-nav-subitem.is-active { color:var(--accent-solid); font-weight:750; background:transparent; }
.docs-nav-item.is-active::before, .docs-nav-subitem.is-active::before {
  content:""; position:absolute; left:0; top:5px; bottom:5px; width:3px; border-radius:4px; background:var(--accent);
}
.docs-nav-group { margin-bottom:4px; }
.docs-nav-sublist { margin:2px 0 6px; }
.docs-nav-subitem.is-active + * { color:var(--muted); }
.docs-nav-group.has-active-sub .docs-nav-item:not(.is-active) { color:var(--muted-2); font-weight:650; }

.docs-content { min-width:0; max-width:900px; width:100%; }
.docs-breadcrumbs { display:flex; flex-wrap:wrap; gap:6px; align-items:center; color:var(--muted-2); font-size:.85rem; margin-bottom:24px; }
.docs-breadcrumbs a { text-decoration:none; }
.docs-breadcrumbs a:hover { color:var(--orange); }
.docs-header { margin-bottom:38px; }
.docs-title { margin:0 0 8px; font-size:clamp(2rem,4vw,3.25rem); line-height:1.1; letter-spacing:-.035em; }
.docs-subtitle { margin:0 0 22px; color:var(--muted); font-size:1.1rem; max-width:760px; }
.docs-meta { display:flex; flex-wrap:wrap; align-items:center; gap:14px; color:var(--muted-2); font-size:.84rem; }
.author-box { display:flex; align-items:center; gap:9px; padding:6px 10px 6px 6px; border:1px solid var(--border); border-radius:999px; background:var(--surface); color:var(--text); }
.author-avatar { width:27px; height:27px; border-radius:50%; display:grid; place-items:center; background:var(--accent); color:#111; font-size:.72rem; font-weight:800; }
.meta-divider { width:1px; height:18px; background:var(--border); }
.tags { display:flex; flex-wrap:wrap; gap:6px; }
.tag { border:1px solid var(--border); background:var(--surface); border-radius:999px; padding:3px 8px; color:var(--muted); font-size:.75rem; }

.docs-content h2 { margin:44px 0 14px; font-size:1.65rem; line-height:1.25; }
.docs-content h3 { margin:30px 0 10px; font-size:1.2rem; }
.docs-content p { margin:0 0 16px; color:var(--muted); }
.docs-content ul, .docs-content ol { margin:0 0 18px; padding-left:1.3rem; color:var(--muted); }
.docs-content li { margin:5px 0; }
.docs-content strong { color:var(--text); }
.docs-content code { background:var(--code-bg); border:1px solid var(--border); border-radius:5px; padding:.12em .35em; font-size:.9em; }
.code-block { margin:18px 0; overflow:auto; padding:18px; border:1px solid var(--border); border-radius:12px; background:var(--code-bg); }
.code-block pre { margin:0; color:var(--text); font: .88rem/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.callout { display:flex; gap:13px; margin:22px 0; padding:16px 18px; border:1px solid; border-left-width:4px; border-radius:12px; }
.callout-icon { flex:0 0 auto; width:24px; height:24px; display:grid; place-items:center; border-radius:50%; font-weight:800; }
.callout-content { min-width:0; }
.callout-title { margin:0 0 3px; font-weight:750; color:var(--text); }
.callout p { margin:0; }
.callout-info { background:var(--info-bg); border-color:var(--info-border); }
.callout-info .callout-icon { background:var(--info-border); color:white; }
.callout-warning { background:var(--warning-bg); border-color:var(--warning-border); }
.callout-warning .callout-icon { background:var(--warning-border); color:#111; }
.callout-danger { background:var(--danger-bg); border-color:var(--danger-border); }
.callout-danger .callout-icon { background:var(--danger-border); color:white; }

.image-slot { margin:22px 0; min-height:230px; border:1px dashed var(--muted-2); border-radius:14px; background:var(--surface); display:flex; align-items:center; justify-content:center; text-align:center; padding:30px; color:var(--muted-2); }
.image-slot strong { display:block; color:var(--text); margin-bottom:5px; }
.image-slot.small { min-height:150px; }
.image-slot.tall { min-height:360px; }
.image-slot.with-frame { box-shadow:inset 0 0 0 5px var(--surface-2); }

.docs-buttons { display:flex; flex-wrap:wrap; gap:10px; margin:18px 0 24px; }
.docs-btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:40px; padding:9px 15px; border-radius:9px; text-decoration:none; border:1px solid transparent; cursor:pointer; font-weight:650; font-size:.9rem; }
.docs-btn-primary { background:var(--accent); color:#111; }
.docs-btn-secondary { background:var(--surface); color:var(--text); border-color:var(--border); }
.docs-btn-outline { background:transparent; color:var(--accent-solid); border-color:var(--accent-solid); }
.docs-btn-danger { background:var(--danger-bg); color:var(--danger-border); border-color:var(--danger-border); }
.docs-btn-ghost { background:transparent; color:var(--muted); }
.docs-btn:hover { transform:translateY(-1px); }
.docs-link { color:var(--accent-solid); font-weight:650; text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:3px; }
.docs-link-card { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:16px 18px; margin:18px 0; border:1px solid var(--border); border-radius:12px; text-decoration:none; background:var(--surface); }
.docs-link-card:hover { border-color:var(--orange); }
.docs-link-card span:last-child { color:var(--accent-solid); }

.docs-footer { margin-top:auto; border-top:1px solid var(--border); padding:28px 5vw; color:var(--muted-2); font-size:.82rem; }
.docs-footer-inner { max-width:1500px; margin:auto; display:flex; justify-content:space-between; align-items:center; gap:20px; }
.docs-footer a { text-decoration:none; margin-left:16px; }
.docs-footer a:hover { color:var(--orange); }

.docs-mobile-sidebar { display:none; }

@media (max-width: 950px) {
  .nav-right { display:none; }
  .menu-toggle { display:block; }
  .docs-shell { grid-template-columns:1fr; gap:24px; padding-left:5vw; padding-right:5vw; }
  .docs-sidebar { display:none; }
  .docs-mobile-sidebar { display:block; }
  .docs-mobile-select {
    width:100%; padding:11px 13px; border:1px solid var(--border); border-radius:9px; background:var(--surface); color:var(--text);
  }
  .docs-content { max-width:none; }
}

@media (max-width: 600px) {
  :root { --header-height:64px; }
  .navbar { padding:0 4vw; }
  .docs-shell { padding:calc(var(--header-height) + 20px) 4vw 44px; }
  .docs-meta { gap:9px; }
  .meta-divider { display:none; }
  .docs-title { font-size:2rem; }
  .docs-subtitle { font-size:1rem; }
  .docs-footer-inner { flex-direction:column; align-items:flex-start; }
  .docs-footer a { margin:0 14px 0 0; }
}
/* Client-side documentation navigation */
#docs-content.is-switching {
  opacity: .55;
  transition: opacity .08s ease;
}
.docs-error {
  padding: 48px 0;
}
.docs-error h1 {
  margin: 0 0 12px;
}
