:root {
  --bg: #0e0f12;
  --panel: #16181d;
  --panel-2: #1d2027;
  --text: #e7e9ee;
  --muted: #9aa0ad;
  --border: #2a2e37;
  --accent: #5b8cff;
  --accent-2: #b46bff;
  --code-bg: #1a1d23;
  --max: 820px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 264px; flex: 0 0 264px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; background: var(--panel); border-right: 1px solid var(--border);
  padding: 22px 16px;
}
.content { flex: 1 1 auto; min-width: 0; padding: 40px 32px 80px; }
article { max-width: var(--max); margin: 0 auto; }

/* Topbar (mobile) */
.topbar { display: none; }
.brand {
  font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: .2px;
}
.brand span {
  color: var(--accent-2); font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .12em; vertical-align: middle; margin-left: 2px;
}

/* Sidebar nav */
.nav .nav-home { display: block; font-weight: 700; color: var(--text); margin: 6px 0 14px; }
.nav ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); padding-top: 12px; }
.nav li { margin: 1px 0; }
.nav a {
  display: block; padding: 7px 10px; border-radius: 7px; color: var(--muted);
  font-size: 14.5px;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }

/* Typography */
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 22px; margin: 1.8em 0 .5em; padding-top: .3em; border-top: 1px solid var(--border); }
h3 { font-size: 17px; margin: 1.4em 0 .4em; color: #f2f4f8; }
p, ul, ol { margin: .6em 0; }
ul, ol { padding-left: 1.3em; }
li { margin: .25em 0; }
strong { color: #fff; }
hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* Code */
code {
  background: var(--code-bg); padding: .12em .4em; border-radius: 5px;
  font: 13.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--border);
}
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
pre code { background: none; border: none; padding: 0; }

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: #fff; border-bottom: 2px solid var(--border); }
tr:hover td { background: rgba(255,255,255,.02); }

/* Images */
img { max-width: 100%; max-height: 62vh; width: auto; height: auto; display: block; margin: 1.4em auto; }
/* Tall (portrait) screenshots float so headings + body text flow alongside them
   (two-column). Capped height keeps it contained so it doesn't bleed far past
   its section. NOTE: headings deliberately do NOT clear — that would drop the
   next heading below the image and leave the empty single column. */
.doc-img--float { float: right; max-height: 46vh; margin: 0.2em 0 1rem 1.8rem; }
/* Tables/callouts don't reflow around a float — they'd slide UNDER the image and
   it would overlap them. Push them below the float instead. */
article table, article .alert { clear: both; }
@media (max-width: 820px) {
  .doc-img--float { float: none; max-width: 100% !important; margin: 1.4em auto; }
}

/* Alerts (GitHub-style) */
.alert { margin: 1.2em 0; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); border-left: 4px solid var(--muted); }
.alert p { margin: .3em 0; }
.alert-title { text-transform: uppercase; font-size: 12px; letter-spacing: .08em; font-weight: 700; margin: 0 0 .2em; color: var(--muted); }
.alert-note    { border-left-color: var(--accent); }
.alert-note .alert-title { color: var(--accent); }
.alert-tip     { border-left-color: #43c59e; }
.alert-tip .alert-title { color: #43c59e; }
.alert-warning { border-left-color: #e0a93b; }
.alert-warning .alert-title { color: #e0a93b; }
.alert-important { border-left-color: var(--accent-2); }
.alert-important .alert-title { color: var(--accent-2); }
.alert-caution { border-left-color: #e06b6b; }
.alert-caution .alert-title { color: #e06b6b; }

/* Plain blockquote */
blockquote:not(.alert) { margin: 1em 0; padding: .4em 1em; border-left: 3px solid var(--border); color: var(--muted); }

/* Pager */
.pager { display: flex; justify-content: space-between; margin-top: 3em; padding-top: 1.2em; border-top: 1px solid var(--border); font-size: 14.5px; }

/* Cards (section list) */
.cards { list-style: none; padding: 0; }

footer { max-width: var(--max); margin: 4em auto 0; color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 820px) {
  .topbar { display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 10;
            background: var(--panel); border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .menu-btn { cursor: pointer; font-size: 20px; color: var(--text); }
  .layout { display: block; }
  .sidebar { position: fixed; top: 47px; left: 0; width: 80%; max-width: 300px; height: calc(100vh - 47px);
             transform: translateX(-105%); transition: transform .2s ease; z-index: 9; }
  #nav-toggle:checked ~ .layout .sidebar { transform: translateX(0); }
  .content { padding: 24px 18px 60px; }
}
