/* ==========================================================================
   PÁGINA DE DETALHE — ESTRUTURA RESPONSIVA DE SCROLL E GALERIA STICKY
   ========================================================================== */

/* 1. Mobile e Tablet (<= 860px) — Fluxo Vertical Natural */
.detail-layout {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  padding: 0 0 20px;
  background: var(--store-background, var(--sd-white));
  overflow: visible;
}

.detail-gallery {
  position: static;
  width: 100%;
  padding: 0;
  background: var(--store-background, var(--sd-white));
}

.detail-photo--gallery {
  position: relative;
  aspect-ratio: 1.1;
  max-height: 350px;
  width: 100%;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
}

.detail-photo--gallery img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  background: transparent;
  transition: opacity 160ms ease, transform 220ms ease;
}

.detail-photo--gallery img.is-changing {
  opacity: 0.35;
  transform: scale(0.99);
}

.detail-thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 18px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.detail-thumbnail {
  position: relative;
  width: 58px;
  height: 58px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 auto;
  aspect-ratio: 1;
  overflow: hidden;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.detail-thumbnail:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
}

.detail-thumbnail:focus-visible {
  outline: 2px solid var(--store-primary, var(--loja-primary));
  outline-offset: 2px;
}

.detail-thumbnail.is-active {
  border-color: var(--store-primary, var(--loja-primary));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--store-primary, var(--loja-primary)) 20%, transparent);
}

.detail-thumbnail img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 6px;
}

.detail-gallery-hint {
  margin: 8px 18px 0;
  color: var(--sd-slate-500, #64748b);
  font-size: 11px;
  text-align: center;
}

.detail-content {
  padding: 18px 18px 0;
  min-width: 0;
  background: var(--store-background, var(--sd-white));
}

.detail-type {
  display: inline-block;
  color: var(--store-primary, var(--loja-primary));
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-content h1 {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--store-heading-color, var(--store-text-primary, var(--store-on-background, #0f172a)));
  word-break: break-word;
}

.detail-price {
  display: block;
  margin-top: 10px;
  color: var(--store-price, var(--store-primary));
  font-size: 22px;
  font-weight: 800;
}

.detail-description {
  margin: 14px 0 0;
  color: var(--sd-slate-600, #475569);
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

@media (max-width: 460px) {
  .detail-thumbnails {
    padding-inline: 14px;
  }
  .detail-gallery-hint {
    margin-inline: 14px;
  }
}

/* 2. Desktop e Notebook (>= 861px) — Grid em 2 Colunas com Galeria Sticky */
@media (min-width: 861px) {
  .detail-layout {
    display: grid;
    grid-template-columns: minmax(360px, 440px) 1fr;
    gap: 36px;
    align-items: start;
    padding: 24px 36px 36px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    overflow: visible;
  }

  .detail-gallery {
    position: sticky !important;
    top: 96px !important;
    align-self: start !important;
    z-index: 10;
    padding: 0;
    background: transparent;
    overflow: visible;
  }

  .detail-photo--gallery {
    aspect-ratio: 1;
    max-height: 380px;
    border-radius: 14px;
    border: 1px solid var(--sd-slate-200, #e2e8f0);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    padding: 10px;
    box-sizing: border-box;
  }

  .detail-thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 0 0;
  }

  .detail-thumbnail {
    width: 62px;
    height: 62px;
    min-width: 44px;
    min-height: 44px;
  }

  .detail-gallery-hint {
    margin: 8px 0 0;
    text-align: center;
    font-size: 11px;
  }

  .detail-content {
    padding: 0;
    background: transparent;
  }

  .detail-content h1 {
    font-size: 28px;
    color: var(--store-heading-color, var(--store-text-primary, var(--store-on-background, #0f172a)));
  }

  .detail-price {
    font-size: 24px;
  }

  .detail-description {
    font-size: 13.5px;
  }
}
