:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #eef2ff;
  --text: #1f2937;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --border: #dbe4f0;
  --code-bg: #111827;
  --code-text: #e5e7eb;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --content-width: 760px;
  --sidebar-width: 300px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%);
  color: var(--text);
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

.site {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(219, 228, 240, 0.9);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100vh - 70px);
}

.sidebar {
  position: fixed;
  inset: 70px auto 0 0;
  width: min(88vw, 340px);
  background: rgba(255, 255, 255, 0.98);
  border-right: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 999;
  box-shadow: var(--shadow);
}

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

.sidebar-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.nav-section {
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.nav-section summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1rem;
  font-weight: 700;
  background: #f8fbff;
  border-bottom: 1px solid var(--border);
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

.nav-list {
  display: grid;
  gap: 0.25rem;
  padding: 0.4rem;
}

.nav-list a {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.96rem;
}

.nav-list a:hover,
.nav-list a:focus-visible,
.nav-list a.active {
  background: var(--surface-2);
  outline: none;
  color: var(--accent-2);
  font-weight: 700;
}

.content-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.content {
  width: min(100%, var(--content-width));
  display: grid;
  gap: 1rem;
  padding-bottom: 2rem;
}

.hero,
.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero,
.card {
  padding: 1.2rem;
}

.eyebrow {
  display: inline-block;
  background: var(--surface-2);
  color: var(--accent-2);
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  margin-bottom: 0.8rem;
}

h1, h2, h3 {
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.7rem;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  margin-bottom: 0.7rem;
}

h3 {
  font-size: 1.05rem;
  margin-bottom: 0.45rem;
}

.lead {
  margin: 0;
  color: #334155;
  font-size: 1.05rem;
  max-width: 62ch;
}

.section-intro {
  color: var(--muted);
  margin: 0;
}

.info-grid,
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.info-box,
.chapter {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfdff;
  padding: 0.95rem;
}

.intro-list,
.step-list,
.check-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.55rem;
}

.code {
  margin: 0.8rem 0;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  white-space: pre;
}

.task {
  background: var(--surface-2);
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  padding: 1rem;
  margin-top: 0.9rem;
}

.warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 1rem;
  margin-top: 0.9rem;
}

.nav-bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-bottom a {
  color: var(--accent);
  font-weight: 700;
}

.overlay {
  position: fixed;
  inset: 70px 0 0 0;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 998;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #eff6ff;
  padding: 0.12rem 0.38rem;
  border-radius: 6px;
}

@media (min-width: 980px) {
  .menu-toggle {
    display: none;
  }

  .layout {
    grid-template-columns: minmax(260px, var(--sidebar-width)) 1fr;
  }

  .sidebar {
    position: sticky;
    inset: 70px auto auto auto;
    width: auto;
    max-height: calc(100vh - 70px);
    transform: none;
    box-shadow: none;
    border-right: 1px solid var(--border);
    background: transparent;
    padding: 1rem;
  }

  .sidebar-inner {
    position: sticky;
    top: 0;
  }

  .content-wrap {
    padding: 1.25rem 1.5rem 2rem;
  }

  .overlay {
    display: none;
  }
}

@media (max-width: 600px) {
  .content-wrap {
    padding: 0.85rem;
  }

  .hero,
  .card {
    padding: 1rem;
  }

  .nav-bottom {
    flex-direction: column;
  }
}