/* === Guide Layout === */
.guide-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-2xl);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
  min-height: calc(100vh - var(--header-height));
}

/* === Guide Sidebar === */
.guide-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-xl));
  align-self: start;
  max-height: calc(100vh - var(--header-height) - var(--space-2xl));
  overflow-y: auto;
}

.guide-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.guide-sidebar-title {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  margin-bottom: var(--space-sm);
  padding: 0 var(--space-md);
  position: relative;
  padding-left: calc(var(--space-md) + 10px);
}

.guide-sidebar-title::before {
  content: '';
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gradient-warm);
}

.guide-sidebar a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--border-radius);
  transition: all 0.15s;
}

.guide-sidebar a:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.guide-sidebar a.active {
  color: var(--color-primary);
  background: var(--color-primary-light);
  font-weight: 600;
  border-left: 3px solid transparent;
  border-image: var(--gradient-warm) 1;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.guide-sidebar a.guide-sidebar-sub {
  padding-left: calc(var(--space-md) + 12px);
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-light);
  background: none;
  border-left: 2px solid var(--color-border);
  border-radius: 0;
  margin-left: var(--space-md);
  line-height: 1.4;
}

.guide-sidebar a.guide-sidebar-sub:hover {
  color: var(--color-primary);
  background: none;
  border-left-color: var(--color-primary);
}

.guide-sidebar a.guide-sidebar-sub.active {
  color: var(--color-primary);
  font-weight: 600;
  background: none;
  border-left: 2px solid transparent;
  border-image: var(--gradient-warm) 1;
}

/* === Guide Sidebar Groups (expand/collapse) === */
.guide-sidebar-group { display: flex; flex-direction: column; }
.guide-sidebar a.has-children { display: flex; align-items: center; justify-content: space-between; }
.guide-sidebar-chevron { display: none; }
.guide-sidebar-children { display: flex; flex-direction: column; }

/* === Guide Content === */
.guide-content {
  min-width: 0;
  max-width: 800px;
}

.guide-content h2[id] {
  scroll-margin-top: calc(var(--header-height) + var(--space-xl));
}

.guide-content h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-md);
}

.guide-content > .subtitle {
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2xl);
}

/* Guide content h2 — gradient underline */
.guide-content .content h2 {
  border-bottom: none;
  position: relative;
  padding-bottom: var(--space-sm);
}

.guide-content .content h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 2px;
  background: var(--gradient-warm);
  border-radius: 1px;
}

/* === Guide Screenshots === */
.guide-screenshot {
  margin: var(--space-xl) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.guide-screenshot-pair {
  display: flex;
  gap: var(--space-lg);
  justify-content: center;
  margin: var(--space-xl) 0;
  flex-wrap: wrap;
}

.guide-screenshot-pair .guide-screenshot {
  margin: 0;
}

.guide-screenshot-img {
  width: 280px;
  height: auto;
  border-radius: 32px;
  box-shadow: var(--shadow-xl);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.guide-screenshot-img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-xl), 0 0 30px rgba(242, 110, 99, 0.08);
}

.guide-screenshot-caption {
  text-align: center;
  color: var(--color-text-light);
  font-size: var(--font-size-xs);
  margin-top: var(--space-sm);
}

@media (max-width: 640px) {
  .guide-screenshot-img {
    width: 220px;
    border-radius: 24px;
  }
}

/* === Mobile Sidebar Toggle === */
.guide-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 50;
  width: 48px;
  height: 48px;
  background: var(--gradient-warm);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-lg), var(--glow-primary);
  align-items: center;
  justify-content: center;
}

.guide-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 59;
}

@media (max-width: 768px) {
  .guide-layout {
    grid-template-columns: 1fr;
    padding: var(--space-lg) var(--space-md);
  }

  .guide-sidebar {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 60;
    background: var(--color-bg);
    padding: var(--space-lg) var(--space-lg);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: none;
  }

  .guide-sidebar.open {
    display: block;
  }

  .guide-sidebar-toggle {
    display: flex;
  }

  .guide-sidebar-overlay.open {
    display: block;
  }

  .guide-sidebar-chevron { display: block; width: 16px; height: 16px; transform: rotate(-90deg); transition: transform 0.2s; }
  .guide-sidebar-group.expanded .guide-sidebar-chevron { transform: rotate(0deg); }
  .guide-sidebar-children { overflow: hidden; max-height: 0; transition: max-height 0.25s ease; }
  .guide-sidebar-group.expanded .guide-sidebar-children { max-height: 500px; }
  .guide-sidebar.no-transition .guide-sidebar-children { transition: none; }
}
