/* Shared step-by-step image gallery and preview for compact instruction surfaces. */

.guide-preview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-preview__lead {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--t-text-muted, var(--text-muted));
}

.guide-preview__image {
  display: block;
  width: 100%;
  max-height: 46vh;
  object-fit: contain;
  border: 1px solid var(--t-border, var(--border));
  border-radius: var(--t-radius-row, 16px);
  background: transparent;
}

.guide-preview__image-button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.guide-preview__image-button:active {
  transform: scale(0.99);
}

.guide-preview__image-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--t-primary, var(--primary));
}

.guide-gallery[hidden] {
  display: none !important;
}

.guide-gallery {
  position: fixed;
  inset: 0;
  z-index: 3800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.guide-gallery__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: color-mix(in srgb, var(--t-text, var(--text)) 54%, transparent);
  cursor: pointer;
}

.guide-gallery__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--t-border, var(--border));
  border-radius: 18px;
  background: var(--t-card, var(--card));
  color: var(--t-text, var(--text));
  box-shadow: var(--t-row-shadow-hover);
}

.guide-gallery__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.guide-gallery__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--t-text, var(--text));
}

.guide-gallery__counter {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--t-text-muted, var(--text-muted));
}

.guide-gallery__close,
.guide-gallery__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--t-border, var(--border));
  background: var(--t-surface, var(--bg));
  color: var(--t-text-muted, var(--text-muted));
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.guide-gallery__close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

.guide-gallery__stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: transparent;
  overflow: hidden;
}

.guide-gallery__image {
  display: block;
  width: 100%;
  max-height: min(72vh, 820px);
  object-fit: contain;
}

.guide-gallery__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 38px;
  height: 44px;
  border-radius: var(--t-radius-pill);
  font-size: 30px;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: var(--t-row-shadow);
}

.guide-gallery__nav--prev {
  left: 8px;
}

.guide-gallery__nav--next {
  right: 8px;
}

.guide-gallery__caption {
  margin: 0;
  min-height: 1.35em;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--t-text, var(--text));
}

.guide-gallery__close:active {
  transform: scale(0.96);
}

.guide-gallery__nav:active {
  transform: translateY(-50%) scale(0.96);
}

@media (max-width: 420px) {
  .guide-gallery {
    padding: 0;
    align-items: stretch;
  }

  .guide-gallery__panel {
    max-height: 100vh;
    border-radius: 0;
    border-inline: 0;
    padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0));
  }

  .guide-gallery__image {
    max-height: 76vh;
  }
}
