:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --sidebar-bg: #fafafa;
  --text: #1a1a1e;
  --text-muted: #5a5a63;
  --border: #e2e2e6;
  --accent: #d97b3f;
  --code-bg: #f0efec;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --bg-alt: #1d1d22;
    --sidebar-bg: #19191d;
    --text: #ececef;
    --text-muted: #9a9aa2;
    --border: #2c2c33;
    --accent: #e59a63;
    --code-bg: #232329;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); }
code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .85em;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1.2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}
.topbar .brand {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.topbar .brand:hover { color: var(--accent); }
.topbar .top-links { display: flex; gap: 1.1rem; font-size: .9rem; align-items: center; }
.topbar .top-links a { text-decoration: none; color: var(--text-muted); }
.topbar .top-links a:hover { color: var(--accent); }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
  padding: .3rem .6rem;
  cursor: pointer;
}

/* Body layout: sidebar + content */
.body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.4rem 1rem 2rem;
  font-size: .88rem;
}
.sidebar h4 {
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: .72rem;
  color: var(--text-muted);
  margin: 1.3rem 0 .5rem;
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: .1rem 0; }
.sidebar a {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  text-decoration: none;
  color: var(--text-muted);
  padding: .4rem .6rem;
  border-radius: 6px;
  line-height: 1.3;
}
.sidebar a:hover { background: var(--bg-alt); color: var(--text); }
.sidebar a.active { background: var(--bg-alt); color: var(--accent); font-weight: 600; }
.sidebar a .cat {
  font-size: .68rem;
  color: var(--text-muted);
  white-space: nowrap;
  align-self: center;
}

.content {
  padding: 2.4rem 2.2rem 4rem;
  max-width: 780px;
}

/* Home page */
.hero h1 { font-size: 1.9rem; margin: 0 0 .5rem; }
.hero p { color: var(--text-muted); max-width: 62ch; }
.section-title {
  margin: 2.4rem 0 .8rem;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: .4rem;
}
table.addon-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.addon-table th, table.addon-table td {
  text-align: left;
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--border);
}
table.addon-table th { color: var(--text-muted); font-weight: 600; font-size: .8rem; }

/* Addon page */
.page-head { margin-bottom: 1.6rem; }
.page-head h1 { font-size: 1.7rem; margin: 0 0 .5rem; }
.badges { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.badge {
  font-size: .72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .6rem;
  white-space: nowrap;
}
.page-links { font-size: .9rem; margin-top: .3rem; }
.page-links a { margin-right: 1.1rem; text-decoration: none; }
.page-links a:hover { text-decoration: underline; }

article h2 { font-size: 1.15rem; margin: 2rem 0 .6rem; }
article h2:first-of-type { margin-top: 1.6rem; }
article ul { padding-left: 1.3rem; }
article li { margin: .3rem 0; }
article p { margin: .6rem 0; }
.feature-list li strong { color: var(--text); }

.media-note {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: .8rem 1rem;
  color: var(--text-muted);
  font-size: .88rem;
  margin: 1rem 0;
}

.demo-video {
  display: block;
  width: 100%;
  max-width: 720px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 1rem 0;
}
article img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 1rem 0;
}
article h3 {
  font-size: 1rem;
  margin: 1.6rem 0 .5rem;
}

.prevnext {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: .9rem;
}
.prevnext a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  max-width: 45%;
}
.prevnext a:hover .pn-title { color: var(--accent); }
.prevnext .pn-dir { color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.prevnext .pn-title { font-weight: 600; }
.prevnext .next { text-align: right; margin-left: auto; }

footer.site-footer {
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: .85rem;
}

/* Mobile */
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .body { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    top: 53px;
    height: calc(100vh - 53px);
    transform: translateX(-100%);
    transition: transform .18s ease;
    z-index: 15;
    width: 82vw;
    max-width: 320px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 2px 0 12px rgba(0,0,0,.15); }
  .content { padding: 1.6rem 1.2rem 3rem; }
}
