.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn--small {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem var(--layout-pad-x, 1.25rem);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  transition: transform 0.25s ease, box-shadow 0.2s ease;
  will-change: transform;
}

body.nav-header-hidden .navbar {
  transform: translateY(-100%);
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .navbar {
    transition: none;
  }
}

.navbar__spacer {
  flex: 1;
  min-width: 0;
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.navbar__nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.navbar__nav a:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.navbar__nav a.is-active {
  color: var(--accent);
  font-weight: 600;
}

.navbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.navbar__logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  box-shadow: var(--shadow);
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar__menu-btn {
  display: none;
}

/* Desktop: fixed width, fixed position, scrolls independently (ChatGPT / docs-style) */
@media (min-width: 961px) {
  .sidebar {
    position: fixed;
    top: var(--site-header-height);
    left: 0;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: calc(100vh - var(--site-header-height));
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
    z-index: 100;
    transition: top 0.25s ease, height 0.25s ease;
  }

  body.nav-header-hidden .sidebar {
    top: 0;
    height: 100vh;
  }
}

@media (min-width: 961px) and (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}

.sidebar__inner {
  padding: 0.65rem 0.85rem 1rem 0.75rem;
}

/* Doc sidebar: search first, then group → topic tree */
.sidebar__doc-root {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar__search-input {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 0.15rem;
}

.sidebar__search-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
}

.sidebar__doc-tree {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar__doc-tree .sidebar__group {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar__topic-link.is-active {
  color: var(--accent);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.sidebar__search-results {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 0.15rem;
}

.sidebar__search-section {
  border-radius: 8px;
  padding: 0.35rem 0;
}

.sidebar__search-heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.sidebar__search-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar__search-list li {
  margin: 0.2rem 0;
}

.sidebar__search-list a {
  display: block;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

.sidebar__search-list a:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
}

.sidebar__search-hit {
  display: block;
  padding: 0.35rem 0.4rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.sidebar__empty {
  margin: 0;
  font-size: 0.9rem;
}

.topic-header {
  margin-bottom: 1.5rem;
}

.topic-section {
  margin-bottom: 2rem;
}

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.topic-list li {
  margin: 0.35rem 0;
}

.topic-list a {
  color: var(--accent);
  font-weight: 500;
}

.topic-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.topic-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.topic-card__media img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.topic-card__body {
  padding: 0.85rem 1rem 1rem;
}

.topic-card__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.topic-card__title a {
  color: var(--text);
}

.topic-card__title a:hover {
  color: var(--accent);
}

.topic-card__excerpt {
  margin: 0;
  font-size: 0.9rem;
}

/* Nested disclosure sections (click summary to expand/collapse lists) */
.sidebar__tree-root {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar__disclosure {
  border-radius: 8px;
}

.sidebar__disclosure + .sidebar__disclosure {
  border-top: 1px solid var(--border);
  padding-top: 0.35rem;
  margin-top: 0.25rem;
}

.sidebar__summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  padding: 0.45rem 0.4rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  list-style: none;
  border-radius: 8px;
  user-select: none;
  transition: background 0.15s ease;
}

.sidebar__summary::-webkit-details-marker {
  display: none;
}

.sidebar__summary::marker {
  content: "";
}

.sidebar__summary::before {
  content: "▶";
  font-size: 0.5rem;
  line-height: 1;
  color: var(--text-muted);
  display: inline-block;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar__disclosure[open] > .sidebar__summary::before {
  transform: rotate(90deg);
}

.sidebar__summary:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.sidebar__nested-wrap {
  padding: 0.15rem 0 0.5rem 1.35rem;
  border-left: 2px solid color-mix(in srgb, var(--border) 80%, var(--accent));
  margin: 0.15rem 0 0.35rem 0.5rem;
}

.sidebar__nav {
  display: grid;
  gap: 0.35rem;
}

.sidebar__nav--nested {
  padding-top: 0.15rem;
}

.sidebar__nav a {
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  display: block;
}

.sidebar__nav a:hover,
.sidebar__nav a.is-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.sidebar__tree,
.sidebar__nested {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0 0;
}

.sidebar__tree > li {
  margin: 0.15rem 0;
}

.sidebar__tree a {
  color: var(--text-muted);
  display: block;
  padding: 0.3rem 0.35rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.sidebar__tree a:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* Tutorials: nested <details> per subject (Admin / Developer) — independent of parent “Tutorials” */
.sidebar__nested-wrap--tutorials {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.25rem;
}

.sidebar__subdisclosure {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 40%, var(--bg-elevated));
}

.sidebar__subsummary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.4rem 0.45rem;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
  list-style: none;
  border-radius: 8px;
  user-select: none;
}

.sidebar__subsummary::-webkit-details-marker {
  display: none;
}

.sidebar__subsummary::marker {
  content: "";
}

.sidebar__subsummary::before {
  content: "▶";
  font-size: 0.45rem;
  line-height: 1;
  color: var(--text-muted);
  display: inline-block;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar__subdisclosure[open] > .sidebar__subsummary::before {
  transform: rotate(90deg);
}

.sidebar__subsummary:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.sidebar__subpanel {
  padding: 0 0.35rem 0.45rem 0.85rem;
}

.sidebar__tree-nested {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.5rem;
  border-left: 1px solid var(--border);
}

.sidebar__tree-nested li {
  margin: 0.2rem 0;
}

.sidebar__tree-nested a {
  color: var(--text-muted);
  display: block;
  padding: 0.3rem 0.35rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.sidebar__tree-nested a:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.blog-card {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.blog-card--compact {
  grid-template-columns: 140px minmax(0, 1fr);
  padding: 1rem;
}

.blog-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  min-height: 160px;
  background: var(--border);
}

.blog-card--compact .blog-card__media img {
  min-height: 100px;
}

.blog-card__category {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.blog-card__title {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.blog-card__title a {
  color: inherit;
}

.blog-card__title a:hover {
  color: var(--accent);
}

.blog-card__excerpt {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.pagination ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
  margin: 2rem 0 0;
}

.pagination__btn {
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.pagination__btn.is-current {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb__sep {
  margin: 0 0.35rem;
  opacity: 0.6;
}

.article-header {
  margin-bottom: 1.5rem;
}

.article-cover img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.article-title {
  font-size: clamp(2rem, 3vw, 2.75rem);
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.article-meta span::before {
  content: "·";
  margin-right: 0.75rem;
  opacity: 0.5;
}

.article-meta span:first-child::before {
  content: "";
  margin: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem var(--layout-pad-x, 1.25rem) 2rem;
  margin-top: 3rem;
  background: var(--bg-elevated);
}

@media (min-width: 961px) {
  .site-footer {
    padding-left: calc(var(--sidebar-width) + var(--layout-pad-x, 1.25rem));
  }
}

.site-footer__grid {
  max-width: var(--layout-max, 1280px);
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

@media (min-width: 1360px) {
  .site-footer__grid {
    gap: 2.25rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (min-width: 1800px) {
  .site-footer__grid {
    grid-template-columns: minmax(260px, 1.35fr) repeat(3, minmax(180px, 1fr));
  }
}

.site-footer__brand {
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.site-footer__label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.site-footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer__links a {
  color: var(--text);
}

.site-footer__copy {
  max-width: var(--layout-max, 1280px);
  margin: 2rem auto 0;
  padding-left: var(--layout-pad-x, 1.25rem);
  padding-right: var(--layout-pad-x, 1.25rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hero {
  padding: 2rem 0 0.5rem;
}

.hero__title {
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 0 0 1rem;
  letter-spacing: -0.04em;
}

.hero__lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: min(60ch, 100%);
  margin: 0 0 1.5rem;
}

@media (min-width: 1360px) {
  .hero {
    padding: 2.5rem 0 0.75rem;
  }

  .hero__lead {
    font-size: 1.2rem;
    max-width: min(68ch, 100%);
  }
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* Match visual weight of primary CTA — ghost was easy to miss in dark mode */
.hero__actions .btn--ghost {
  min-height: 2.75rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.hero__actions .btn--ghost:hover {
  background: var(--bg);
}

.search-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.search-panel form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-panel input {
  flex: 1;
  min-width: 200px;
  font: inherit;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
