/* ═══════════════════════════════════════════════════════════════
   brasa — buy.css
   Shop module: carousel gallery + sticky buy dock (desktop)
   + mobile bottom bar, zoom modal, details drawer.
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   TOKENS
   ───────────────────────────────────────────── */
.shop {
  --shop-line:        #E8E8E8;
  --shop-ink:         #1B1B1B;
  --shop-mute:        #6B6B6B;
  --shop-terracotta:  var(--color-terracotta);
  --shop-terracotta-deep: #A85E32;
  --shop-viewport-h:  calc(100dvh - var(--header-height));

  width: 100%;
  background: var(--color-white);
  color: var(--shop-ink);
  position: relative;
}

/* Layout: gallery + sticky dock */
.shop__layout {
  display: block;
}

@media (min-width: 1024px) {
  .shop__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    align-items: stretch;
    max-width: 1180px;
    margin-inline: auto;
  }

  .product-page .shop__layout {
    max-width: none;
    margin-inline: 0;
    padding-inline: 0;
  }
}

/* ─────────────────────────────────────────────
   GALLERY — single-viewport carousel
   Desktop : one image, viewport height · sticky
   Mobile  : swipe carousel + arrows + dots
   ───────────────────────────────────────────── */
.shop__main {
  min-width: 0;
}

.shop__gallery {
  background: var(--color-white);
}

@media (min-width: 1024px) {
  .shop__gallery {
    position: sticky;
    top: var(--header-height);
    height: var(--shop-viewport-h);
    display: flex;
    flex-direction: column;
  }

  .shop__gallery .shop__slider {
    flex: 1;
    min-height: 0;
  }

  .shop__gallery .shop__thumbs {
    flex-shrink: 0;
  }
}

.shop__slider {
  position: relative;
  background: var(--color-white);
  overflow: hidden;
}

@media (min-width: 1024px) {
  .shop__slider {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
}

.shop__slider-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
  outline: none;
}

@media (min-width: 1024px) {
  .shop__slider-viewport {
    flex: 1 1 auto;
    min-height: 0;
    aspect-ratio: unset;
  }
}

.shop__slider-track {
  display: flex;
  width: 100%;
  height: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  transition: transform 0.65s var(--ease-out-expo);
  will-change: transform;
}

.shop__slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  padding: clamp(16px, 3vh, 32px) clamp(16px, 4vw, 40px);
}

.shop__slide img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}

@media (min-width: 1024px) {
  .shop__slide {
    padding: clamp(24px, 4vh, 48px) clamp(28px, 4vw, 56px);
  }

  .shop__slide img {
    max-width: min(100%, 400px);
    max-height: min(100%, calc(var(--shop-viewport-h) - 120px));
  }
}

/* Arrow navigation */
.shop__slider-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--shop-line);
  border-radius: 50%;
  color: var(--shop-ink);
  cursor: pointer;
  opacity: 0.9;
  transform: translateY(-50%);
  transition: opacity 0.35s ease, background 0.35s ease, transform 0.25s ease;
}

.shop__slider-nav span {
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  transform: translateY(-1px);
}

.shop__slider-nav--prev { left: clamp(12px, 2vw, 20px); }
.shop__slider-nav--next { right: clamp(12px, 2vw, 20px); }

.shop__slider-nav:focus-visible {
  outline: 2px solid var(--color-royal-blue);
  outline-offset: 2px;
}

.shop__slider-nav:active {
  transform: translateY(-50%) scale(0.98);
}

/* Footer: dots + counter */
.shop__slider-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--shop-line);
}

@media (min-width: 1024px) {
  .shop__slider-footer {
    flex-shrink: 0;
    padding: 16px 24px 20px;
  }
}

.shop__slider-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.shop__slider-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #D4D4D4;
  cursor: pointer;
  transition: width 0.45s var(--ease-out-expo),
              border-radius 0.45s var(--ease-out-expo),
              background 0.4s ease;
}

.shop__slider-dot[aria-current="true"] {
  width: 28px;
  border-radius: 4px;
  background: var(--shop-terracotta);
}

.shop__slider-count {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--shop-mute);
  min-width: 3.5ch;
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  .shop__slider-track,
  .shop__slider-nav {
    transition: none;
  }
}

/* ─────────────────────────────────────────────
   BUY DOCK — sticky aside (desktop)
   ───────────────────────────────────────────── */
.shop__aside {
  background: var(--color-white);
  padding: clamp(36px, 7vw, 56px) clamp(20px, 5vw, 40px) clamp(96px, 14vw, 112px);
}

@media (min-width: 1024px) {
  .shop__aside {
    position: sticky;
    top: var(--header-height);
    align-self: start;
    min-height: var(--shop-viewport-h);
    display: flex;
    align-items: center;
    padding: clamp(48px, 6vh, 80px) clamp(28px, 2.5vw, 40px);
    border-left: 1px solid var(--shop-line);
  }
}

.shop__aside-inner {
  width: 100%;
  max-width: 320px;
  margin-inline: auto;
}

@media (min-width: 1024px) {
  .shop__aside-inner {
    max-width: none;
    margin-inline: 0;
  }
}

.shop__title {
  font-family: var(--font-body);
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--shop-ink);
  margin: 0 0 10px;
}

.shop__price {
  font-size: 15px;
  font-weight: 400;
  color: var(--shop-ink);
  margin: 0 0 clamp(28px, 4vh, 36px);
}

.shop__buy {
  margin-bottom: 18px;
}

.shop__cta {
  width: 100%;
}

.shop__cta:focus-visible {
  outline-offset: 3px;
}

.shop__meta {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.55;
  color: var(--shop-mute);
  margin: 0 0 24px;
}

/* Hidden when product page uses .shop__tags instead */
.shop__tags ~ .shop__meta {
  display: none;
}

.shop__details-link {
  display: inline-block;
  padding: 0;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--shop-mute);
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  cursor: pointer;
  transition: color 0.3s ease;
}

/* ─────────────────────────────────────────────
   MOBILE STICKY BUY BAR
   ───────────────────────────────────────────── */
.shop-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--shop-line);
  transform: translateY(110%);
  transition: transform 0.45s var(--ease-out-expo);
  pointer-events: none;
}

.shop-bar--visible {
  transform: translateY(0);
  pointer-events: auto;
}

.shop-bar__info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.shop-bar__name {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--shop-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-bar__price {
  font-size: 11px;
  color: var(--shop-mute);
  margin-top: 2px;
}

.shop-bar__cta {
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .shop-bar {
    display: none;
  }
}

/* ─────────────────────────────────────────────
   DETAILS DRAWER
   ───────────────────────────────────────────── */
.details-drawer {
  position: fixed;
  inset: 0;
  z-index: 1800;
  visibility: hidden;
  pointer-events: none;
}

.details-drawer--open,
.details-drawer--closing {
  visibility: visible;
}

.details-drawer--open {
  pointer-events: auto;
}

.details-drawer--closing {
  pointer-events: none;
}

.details-drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.4);
  opacity: 0;
  transition: opacity 0.55s var(--ease-out-expo);
}

.details-drawer--open .details-drawer__overlay {
  opacity: 1;
}

.details-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  transform: translateX(100%);
  transition: transform 0.65s var(--ease-out-expo);
  box-shadow: -8px 0 40px rgba(10, 10, 10, 0.08);
}

.details-drawer--open .details-drawer__panel {
  transform: translateX(0);
}

.details-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(20px, 3vh, 28px) clamp(20px, 4vw, 32px);
  border-bottom: 1px solid var(--shop-line);
  flex-shrink: 0;
}

.details-drawer__title {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0;
}

.details-drawer__close {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--shop-line);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--shop-ink);
  background: var(--color-white);
}

.details-drawer__close-icon {
  display: block;
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  transform: translateY(-1px);
}

.details-drawer__close svg {
  width: 14px;
  height: 14px;
}

.details-drawer__close svg line {
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.details-drawer__foot {
  flex-shrink: 0;
  padding: clamp(16px, 3vh, 24px) clamp(20px, 4vw, 32px) clamp(24px, 4vh, 32px);
  border-top: 1px solid var(--shop-line);
}

.details-drawer__close-btn {
  width: 100%;
  padding: 15px 24px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-white);
  background: var(--shop-terracotta);
  border: 1px solid var(--shop-terracotta);
  cursor: pointer;
  transition: background 0.35s ease, border-color 0.35s ease;
}

.details-drawer__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(24px, 4vh, 36px) clamp(20px, 4vw, 32px) clamp(32px, 5vh, 48px);
}

.details-drawer__section + .details-drawer__section {
  margin-top: clamp(28px, 4vh, 40px);
}

.details-drawer__section h3 {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--shop-ink);
  margin: 0 0 14px;
}

.details-drawer__section p {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.75;
  color: #2A2A2A;
  margin: 0;
}

.details-drawer__section p + p {
  margin-top: 12px;
}

.details-drawer__section ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.details-drawer__section ul li {
  position: relative;
  padding-left: 18px;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.65;
  color: #2A2A2A;
}

.details-drawer__section ul li::before {
  content: '';
  position: absolute;
  top: 11px;
  left: 0;
  width: 8px;
  height: 1px;
  background: var(--shop-terracotta);
}

/* ─────────────────────────────────────────────
   ZOOM MODAL
   ───────────────────────────────────────────── */
.zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--color-white);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.zoom-modal--open {
  visibility: visible;
  opacity: 1;
}

.zoom-modal__viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}

.zoom-modal--zoomed .zoom-modal__viewport {
  cursor: zoom-out;
}

.zoom-modal__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform: scale(1);
  transform-origin: 50% 50%;
  transition: transform 0.5s var(--ease-out-expo);
  pointer-events: none;
  user-select: none;
}

.zoom-modal--zoomed .zoom-modal__image {
  transform: scale(2);
  transition: transform 0.45s var(--ease-out-expo);
}

.zoom-modal__close {
  position: absolute;
  top: clamp(16px, 2vh, 28px);
  right: clamp(16px, 2vw, 28px);
  z-index: 10;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: #1B1B1B;
  -webkit-tap-highlight-color: transparent;
}

.zoom-modal__close-icon {
  display: block;
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  color: #1B1B1B;
  transform: translateY(-1px);
}

.zoom-modal__hint {
  position: absolute;
  bottom: clamp(14px, 2vh, 28px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6B6B6B;
  pointer-events: none;
  opacity: 0.85;
}

.zoom-modal--zoomed .zoom-modal__hint::before {
  content: 'Click to zoom out';
}

.zoom-modal:not(.zoom-modal--zoomed) .zoom-modal__hint::before {
  content: 'Click image to zoom';
}

@media (max-width: 768px) {
  .zoom-modal__close {
    top: max(16px, env(safe-area-inset-top, 16px));
    right: max(16px, env(safe-area-inset-right, 16px));
    width: 48px;
    height: 48px;
  }

  .zoom-modal__close-icon {
    font-size: 32px;
  }

  .details-drawer__panel {
    width: 100%;
  }
}

/* ─────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .shop-bar,
  .shop__cta,
  .zoom-modal,
  .zoom-modal__image,
  .details-drawer__overlay,
  .details-drawer__panel {
    transition: none;
  }
}
