/* =========================================================================
   sp-guide.css — cofounder /how-to guide-reader layout (window-scroll variant)
   All classes are prefixed `spg-`. Fonts come from global CSS vars set by the
   shared shell (--font-neoris, --font-ibm-plex-mono, --font-departure).
   ========================================================================= */

.spg-page {
  --spg-neoris: var(--font-neoris, "TT Neoris", ui-sans-serif, system-ui, sans-serif);
  --spg-mono: var(--font-ibm-plex-mono, var(--font-mono, "IBM Plex Mono", ui-monospace, monospace));
  --spg-departure: var(--font-departure, "Departure Mono", ui-monospace, monospace);
  --spg-ink: rgb(23, 23, 23);
  --spg-muted-8: rgba(38, 35, 35, 0.8);
  --spg-muted-7: rgba(38, 35, 35, 0.7);
  --spg-muted-5: rgba(38, 35, 35, 0.5);
  --spg-blue: rgb(0, 126, 199);

  font-family: var(--spg-neoris);
  color: var(--spg-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.spg-page *,
.spg-page *::before,
.spg-page *::after {
  box-sizing: border-box;
}

/* ---------------------------------------------------------------- Hero -- */

.spg-hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 120px 24px 0;
}

.spg-hero-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 100px;
  padding: 4px 8px;
  background: rgba(38, 35, 35, 0.05);
  font-family: var(--spg-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--spg-muted-5);
}

.spg-hero-title {
  margin: 16px 0 0;
  max-width: 720px;
  font-family: var(--spg-neoris);
  font-size: 40px;
  line-height: 46px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--spg-muted-8);
}

.spg-hero-intro {
  margin: 16px 0 0;
  max-width: 640px;
  font-family: var(--spg-neoris);
  font-size: 15px;
  line-height: 24px;
  font-weight: 460;
  color: var(--spg-muted-7);
}

/* ------------------------------------------------------------ Body row -- */

.spg-body {
  display: flex;
  gap: 56px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 120px;
  align-items: flex-start;
}

/* ------------------------------------------------------ Sidebar / TOC -- */

.spg-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 110px;
  align-self: flex-start;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
}

.spg-toc {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.spg-toc-group {
  margin: 20px 0 8px;
  font-family: var(--spg-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.03em;
  color: var(--spg-muted-5);
}

.spg-toc-group:first-child {
  margin-top: 0;
}

.spg-toc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
  text-decoration: none;
  color: inherit;
}

.spg-toc-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(38, 35, 35, 0.25);
  background: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.spg-toc-item.is-active .spg-toc-dot {
  border-color: rgb(178, 231, 255);
  background: rgb(178, 231, 255);
}

.spg-toc-label {
  font-family: var(--spg-neoris);
  font-size: 16px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--spg-muted-7);
  transition: color 0.15s ease;
}

.spg-toc-item:hover .spg-toc-label {
  color: var(--spg-ink);
}

.spg-toc-item.is-active .spg-toc-label {
  color: var(--spg-ink);
}

/* --------------------------------------------------------- Dark CTA -- */

.spg-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  padding: 6px 12px;
  background: rgb(23, 23, 23);
  color: #fff;
  border: 1px solid rgb(56, 56, 56);
  font-family: var(--spg-neoris);
  font-size: 16px;
  line-height: 1;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(64, 64, 64, 0.12),
    inset 0 2px 0 rgba(255, 255, 255, 0.24),
    0 3px 4px rgba(0, 0, 0, 0.16);
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.spg-cta:hover {
  background: rgb(38, 38, 38);
}

.spg-cta:active {
  transform: translateY(1px);
}

.spg-cta-ic {
  flex-shrink: 0;
}

.spg-download {
  margin-top: 24px;
  align-self: flex-start;
}

/* ---------------------------------------------------- Reading column -- */

.spg-reading {
  flex: 1;
  min-width: 0;
  max-width: 720px;
}

.spg-section {
  max-width: 640px;
}

.spg-heading {
  margin: 48px 0 16px;
  font-family: var(--spg-neoris);
  font-size: 24px;
  line-height: 33.6px;
  font-weight: 530;
  color: var(--spg-muted-8);
  scroll-margin-top: 100px;
}

.spg-subheading {
  margin-top: 36px;
}

.spg-section-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 100px;
  margin: 48px 0 0;
  padding: 4px 8px;
  background: rgba(38, 35, 35, 0.05);
  font-family: var(--spg-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--spg-muted-5);
}

.spg-section-badge + .spg-heading {
  margin-top: 12px;
}

.spg-p {
  margin: 0 0 16px;
  font-family: var(--spg-neoris);
  font-size: 15px;
  line-height: 24px;
  font-weight: 460;
  color: var(--spg-muted-7);
}

.spg-list {
  margin: 0 0 16px;
  padding-left: 20px;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spg-list li {
  font-family: var(--spg-neoris);
  font-size: 15px;
  line-height: 24px;
  font-weight: 460;
  color: var(--spg-muted-7);
}

.spg-list li::marker {
  color: rgba(38, 35, 35, 0.4);
}

/* --------------------------------------------------------- Framed image -- */

.spg-figure {
  margin: 32px 0;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgb(232, 231, 230);
  background: rgba(242, 242, 237, 0.24);
  overflow: hidden;
}

.spg-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

/* ------------------------------------------------------------- Callout -- */

.spg-callout {
  margin: 0 0 56px;
  padding: 22px 20px;
  border-radius: 16px;
  border: 1px solid rgb(215, 232, 255);
  background: rgb(247, 251, 255);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.spg-callout-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.spg-callout-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 100px;
  padding: 4px 8px;
  background: rgb(221, 240, 255);
  font-family: var(--spg-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--spg-blue);
  white-space: nowrap;
}

.spg-callout-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spg-callout-title {
  font-family: var(--spg-neoris);
  font-size: 16px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--spg-ink);
}

.spg-callout-text {
  margin: 0;
  font-family: var(--spg-neoris);
  font-size: 13px;
  line-height: 20px;
  font-weight: 460;
  color: var(--spg-muted-7);
}

/* ------------------------------------------------ Mobile drawer toggle -- */

.spg-toc-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgb(232, 231, 230);
  background: #fff;
  font-family: var(--spg-mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: var(--spg-ink);
  cursor: pointer;
}

/* --------------------------------------------------------- Responsive -- */

@media (max-width: 767.98px) {
  .spg-hero {
    padding: 96px 20px 0;
  }
  .spg-hero-title {
    font-size: 32px;
    line-height: 38px;
  }

  .spg-body {
    flex-direction: column;
    gap: 0;
    padding: 24px 20px 80px;
  }

  .spg-reading {
    max-width: none;
    width: 100%;
  }
  .spg-section,
  .spg-callout {
    max-width: none;
  }

  .spg-toc-toggle {
    display: inline-flex;
  }

  /* Sidebar becomes a slide-in drawer */
  .spg-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    max-height: none;
    z-index: 60;
    padding: 84px 24px 24px;
    background: rgb(245, 245, 242);
    transform: translateX(-100%);
    transition: transform 0.28s ease;
  }

  .spg-sidebar.spg-open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
  }

  .spg-download {
    margin-top: 28px;
  }
}

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