*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-soft: #f1f0ed;
  --text: #171717;
  --muted: #6b7280;
  --line: #e2e0dc;
  --dark: #0f172a;          /* slate-900 */
  --darker: #0b1120;        /* sidebar bg */
  --accent: #4f46e5;        /* indigo-600 */
  --accent-muted: #818cf8;  /* indigo-400 */
  --accent-bg: #eef2ff;     /* indigo-50 */
  --accent-border: #c7d2fe; /* indigo-200 */
  --green: #059669;
  --green-bg: #ecfdf5;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(15,23,42,.08);
  --radius: 10px;
  --sidebar-w: 260px;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

/* ─── Top Bar ─── */

.top-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--dark);
  color: #fff;
  padding: 0 1rem;
  height: 60px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  padding: .3rem;
  line-height: 1;
}

.top-bar-left {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  min-width: 0;
}

.top-eyebrow {
  color: var(--accent-muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.top-title {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* ─── Layout ─── */

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ─── Sidebar ─── */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--darker);
  color: rgba(255,255,255,.8);
  overflow-y: auto;
  padding: .75rem 0 2rem;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  z-index: 30;
}

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

.nav-item {
  margin: 0;
}

.nav-item a,
.nav-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1rem .55rem 1.2rem;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  transition: background .12s, color .12s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  line-height: 1.4;
}

.nav-item a:hover,
.nav-toggle:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.nav-item a.active {
  background: rgba(79,70,229,.25);
  color: var(--accent-muted);
  font-weight: 800;
}

.nav-toggle .nav-arrow {
  margin-left: auto;
  font-size: .7rem;
  opacity: .5;
  transition: transform .2s;
  flex-shrink: 0;
}

.nav-toggle.open .nav-arrow {
  transform: rotate(90deg);
}

.nav-icon {
  flex-shrink: 0;
  font-size: 1rem;
  width: 1.4rem;
  text-align: center;
}

.nav-label {
  flex: 1;
  min-width: 0;
}

.nav-children {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  transition: max-height .25s ease, opacity .2s ease;
  max-height: 0;
  opacity: 0;
}

.nav-children.open {
  max-height: 2000px;
  opacity: 1;
}

.nav-children .nav-item a {
  padding-left: 2.6rem;
  font-size: .84rem;
  font-weight: 500;
  color: rgba(255,255,255,.55);
}

.nav-children .nav-item a:hover {
  color: rgba(255,255,255,.85);
}

.nav-children .nav-item a.active {
  color: var(--accent-muted);
  font-weight: 700;
  background: rgba(79,70,229,.15);
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: .4rem 1rem;
}

/* ─── Main ─── */

.main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2rem 3rem;
}

/* ─── Home page ─── */

.welcome {
  padding: 0;
  animation: fadeIn .25s ease;
}

.home-hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

.home-hero-title {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: .02em;
}

.home-hero-desc {
  margin-top: .7rem;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.7;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.home-section {
  margin-top: 1.5rem;
  padding: 0 .25rem;
}

.home-section-title {
  font-size: .9rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: .06em;
  margin-bottom: .8rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--accent-border);
  text-transform: uppercase;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .7rem;
}

.home-card {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: 1rem 1rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.home-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79,70,229,.1);
}

.home-card-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.home-card-title {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text);
  margin-top: .15rem;
}

.home-card-desc {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.4;
  font-weight: 500;
}

/* ─── Quick reference ─── */

.quickref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .7rem;
}

.quickref-card {
  padding: 1rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.quickref-label {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: .04em;
}

.quickref-slogan {
  margin-top: .4rem;
  font-size: .8rem;
  color: var(--accent);
  font-weight: 700;
  line-height: 1.4;
}

.quickref-models {
  margin-top: .4rem;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .02em;
}

/* ─── Recent updates ─── */

.updates-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.updates-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}

.updates-item:last-child {
  border-bottom: none;
}

.updates-item:hover {
  background: var(--surface-soft);
}

.updates-item:hover .updates-arrow {
  transform: translateX(3px);
}

.updates-date {
  flex-shrink: 0;
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .15rem .45rem;
  letter-spacing: .02em;
}

.updates-text {
  flex: 1;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.updates-arrow {
  flex-shrink: 0;
  font-size: .8rem;
  color: var(--accent);
  font-weight: 700;
  transition: transform .15s;
}

/* ─── Breadcrumb ─── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .6rem;
  font-size: .8rem;
  color: var(--muted);
}

.breadcrumb-home {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  transition: color .12s;
}

.breadcrumb-home:hover {
  color: var(--dark);
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--line);
  font-weight: 300;
}

/* ─── Content ─── */

.content-area {
  animation: fadeIn .25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-section {
  margin-bottom: 2rem;
  max-width: 860px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--dark);
  letter-spacing: .02em;
  margin-bottom: .5rem;
}

.page-desc {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* ─── Cards ─── */

.card-group {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

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

.card-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1.1rem;
  cursor: pointer;
  user-select: none;
  transition: background .12s;
}

.card-header:hover {
  background: var(--surface-soft);
}

.card-icon {
  flex-shrink: 0;
  font-size: 1.1rem;
}

.card-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.card-arrow {
  flex-shrink: 0;
  font-size: .75rem;
  color: var(--muted);
  transition: transform .2s;
}

.card.open .card-arrow {
  transform: rotate(90deg);
}

.card-body {
  overflow: hidden;
  transition: max-height .3s ease, opacity .2s ease;
}

.card.collapsed .card-body {
  max-height: 0 !important;
  opacity: 0;
}

.card-inner {
  padding: .2rem 1.1rem 1.1rem;
  border-top: 1px solid var(--line);
}

.card-inner p {
  margin-top: .6rem;
  color: #33302d;
  font-size: .9rem;
  line-height: 1.7;
}

.card-inner p:first-child {
  margin-top: 0;
}

/* ─── Tag pills ─── */

.tag-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .12rem .5rem;
  font-size: .7rem;
  font-weight: 800;
  white-space: nowrap;
}

.tag-green {
  background: var(--green-bg);
  color: var(--green);
}

.tag-blue {
  background: var(--blue-bg);
  color: var(--blue);
}

.tag-amber {
  background: var(--amber-bg);
  color: var(--amber);
}

.tag-red {
  background: var(--red-bg);
  color: var(--red);
}

.tag-accent {
  background: var(--accent-bg);
  color: var(--accent);
}

/* ─── Comparison table ─── */

.comp-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .75rem;
  font-size: .88rem;
}

.comp-table th,
.comp-table td {
  padding: .7rem .8rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.comp-table th {
  background: var(--surface-soft);
  font-weight: 800;
  color: var(--dark);
  font-size: .82rem;
  letter-spacing: .02em;
}

.comp-table tr:last-child td {
  border-bottom: none;
}

.comp-table td:first-child {
  font-weight: 700;
  color: var(--dark);
  white-space: nowrap;
  width: 7rem;
}

/* ─── Nested list ─── */

.nested-list {
  padding-left: 1.2rem;
  margin: .4rem 0;
}

.nested-list li {
  margin: .2rem 0;
  color: #33302d;
  font-size: .88rem;
  line-height: 1.6;
}

.nested-list .note-muted {
  color: var(--muted);
  font-size: .82rem;
}

/* ─── Example box ─── */

.example-box {
  margin: .6rem 0;
  padding: .8rem 1rem;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  background: var(--accent-bg);
}

.example-box-title {
  font-size: .78rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .04em;
  margin-bottom: .25rem;
}

.example-box p {
  color: #33302d;
  font-size: .88rem;
  line-height: 1.6;
  margin-top: .3rem;
}

.example-box p:first-of-type {
  margin-top: 0;
}

.code-inline {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .08rem .35rem;
  font-size: .85rem;
  font-family: "SF Mono", "Fira Code", monospace;
}

/* ─── Divider ─── */

.section-divider {
  height: 1px;
  background: var(--line);
  margin: 1.5rem 0;
}

/* ─── Footer ─── */

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
  padding: 1.2rem 1rem;
  text-align: center;
  flex-shrink: 0;
}

/* ─── Sidebar backdrop (mobile) ─── */

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0,0,0,.36);
}

/* ─── Responsive ─── */

@media (max-width: 820px) {
  .menu-toggle {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform .25s ease;
    height: auto;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    padding: 1rem 1rem 2rem;
  }

  .home-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
  }

  .quickref-grid {
    grid-template-columns: 1fr;
    gap: .6rem;
  }

  .home-hero {
    padding: 1.5rem .5rem 1rem;
  }

  .home-hero-title {
    font-size: 1.4rem;
  }
}

@media (min-width: 821px) {
  .sidebar-backdrop {
    display: none !important;
  }

  .home-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1000px) {
  .home-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
