/* Styles for the Feature Guide / Tutorials page */

.guide-page {
  padding: var(--space-3xl) 0;
  /* No overflow-x:hidden here — it would turn .guide-page into the
     sticky containing block, breaking the desktop TOC's scroll-with-page
     behaviour. Horizontal overflow is already prevented by the
     `max-width: 100%` rule below applied to all descendants. */
}

.guide-page *,
.guide-page *::before,
.guide-page *::after {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.guide-page__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

/* Guide Header */
.guide-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-3xl);
}

.guide-header h1 {
  margin-bottom: var(--space-md);
}

.guide-header p {
  font-size: var(--text-lg);
  color: var(--color-on-surface-muted);
  margin-bottom: 0;
}

/* Table of Contents */
.guide-toc {
  background-color: var(--color-surface-variant);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  padding: var(--space-xl);
}

.guide-toc__title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-lg);
}

.guide-toc__list {
  list-style: none;
}

.guide-toc__list li {
  margin-bottom: var(--space-sm);
}

/* Group header inside the TOC: short uppercase label that visually
   separates a cluster of related sub-items without being clickable. */
.guide-toc__group {
  list-style: none;
  margin-bottom: var(--space-lg);
}

.guide-toc__group + .guide-toc__group {
  margin-top: var(--space-md);
}

.guide-toc__group-title {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  padding: 0 var(--space-md);
  margin-bottom: var(--space-xs);
}

.guide-toc__sublist {
  list-style: none;
}

.guide-toc__sublist li {
  margin-bottom: var(--space-xs);
}

.guide-toc__list a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-on-surface);
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-standard);
}

.guide-toc__list a:hover {
  background-color: var(--color-surface);
  color: var(--color-primary);
  text-decoration: none;
}

.guide-toc__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Guide Content */
.guide-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xl);
}

/* Feature Sections */
.guide-section {
  scroll-margin-top: calc(var(--space-4xl) + 60px);
}

.guide-section__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.guide-section__icon {
  width: 48px;
  height: 48px;
  padding: var(--space-md);
  background-color: var(--color-surface-variant);
  border-radius: var(--radius-md);
  color: var(--color-primary);
}

.guide-section__icon svg {
  width: 100%;
  height: 100%;
}

.guide-section__title {
  font-size: var(--text-2xl);
  margin-bottom: 0;
}

.guide-section__content {
  line-height: 1.8;
}

.guide-section__content p {
  margin-bottom: var(--space-lg);
}

.guide-section__content ul,
.guide-section__content ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
}

.guide-section__content li {
  margin-bottom: var(--space-sm);
}

/* Feature Cards within sections */
.guide-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

.guide-feature-grid--two-col {
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .guide-feature-grid--two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.guide-feature-card {
  background-color: var(--color-surface-variant);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.guide-feature-card__title {
  font-size: var(--text-md);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-sm);
}

.guide-feature-card__text {
  font-size: var(--text-sm);
  color: var(--color-on-surface-muted);
  margin-bottom: 0;
}

/* Keyboard shortcuts styling */
kbd {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  background-color: var(--color-surface-variant);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 0 var(--color-outline);
}

.shortcuts-list {
  list-style: none;
  padding: 0;
}

.shortcuts-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-outline);
}

.shortcuts-list li:last-child {
  border-bottom: none;
}

.shortcut-action {
  color: var(--color-on-surface);
}

.shortcut-keys {
  display: flex;
  gap: var(--space-xs);
}

/* Screenshot container */
.guide-screenshot {
  display: inline-block;
  margin: var(--space-xl) auto;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  line-height: 0; /* Remove any line-height spacing */
  font-size: 0; /* Remove any font-based spacing */
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}

.guide-screenshot:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

/* Center the screenshot in its parent */
.guide-section__content .guide-screenshot {
  display: block;
  width: fit-content;
}

.guide-screenshot__image {
  max-width: min(400px, 100%);
  height: auto;
  display: block;
  line-height: normal;
  font-size: initial;
  border-radius: var(--radius-lg);
  margin-left: auto;
  margin-right: auto;
}

/* Lightbox overlay */
.guide-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease-standard),
              visibility var(--duration-normal) var(--ease-standard);
  cursor: pointer;
}

.guide-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.guide-lightbox__image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform var(--duration-normal) var(--ease-emphasized);
}

.guide-lightbox.is-open .guide-lightbox__image {
  transform: scale(1);
}

.guide-lightbox__close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  width: 48px;
  height: 48px;
  background-color: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-full);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--duration-fast) var(--ease-standard);
}

.guide-lightbox__close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.guide-lightbox__close svg {
  width: 24px;
  height: 24px;
}

.guide-lightbox__hint {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-sm);
}

/* Placeholder styles (fallback if image missing) */
.guide-screenshot__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-md);
  opacity: 0.5;
}

.guide-screenshot__text {
  font-size: var(--text-sm);
  margin-bottom: 0;
}

/* Tips box */
.guide-tip {
  display: flex;
  gap: var(--space-md);
  background-color: var(--color-info);
  color: white;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
}

.guide-tip__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.guide-tip__content {
  flex: 1;
}

.guide-tip__title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-xs);
}

.guide-tip__text {
  font-size: var(--text-sm);
  margin-bottom: 0;
  opacity: 0.9;
}

/* Responsive */
@media (min-width: 1024px) {
  .guide-page__inner {
    grid-template-columns: 280px 1fr;
    gap: var(--space-3xl);
  }

  .guide-toc {
    position: sticky;
    top: calc(var(--space-xl) + 60px);
    /* Cap to the visible portion of the viewport (= total height minus
       the sticky offset minus a small bottom breathing margin) so a tall
       menu on a short laptop screen stays fully reachable by scrolling
       inside the TOC itself instead of disappearing below the fold. */
    max-height: calc(100vh - var(--space-xl) - 60px - var(--space-xl));
    overflow-y: auto;
    /* Slim, on-demand scrollbar — only shows when content actually
       overflows so the TOC still looks clean on tall screens. */
    scrollbar-width: thin;
  }
}
