/* =========================================================
   Serahin — Detail produk
   Loaded after style.css + katalog.css (product cards, band, toast).
   Desktop: photo full height (left) · details scroll (right) ·
            "Produk lainnya" slides over the product section.
   ========================================================= */

/* ---------- 1. Product section ---------- */
.pd-top { display: grid; grid-template-columns: minmax(0, 1fr); background: #fff; }

/* Gallery */
.pd-gallery { position: relative; background: var(--mist); }
.pd-main { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; cursor: zoom-in; }
.pd-main__img { width: 100%; height: 100%; object-fit: cover; transition: opacity .45s var(--ease-out), transform .9s var(--ease-out); }
.pd-main__img.is-swap { animation: pdSwap .55s var(--ease-out); }
@keyframes pdSwap { from { opacity: 0; transform: scale(1.04); } }
.pd-main:hover .pd-main__img { transform: scale(1.02); }
.pd-main__zoom {
  position: absolute; right: 16px; top: 16px;
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, .85); color: var(--ink); font-size: 18px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: .9; transition: transform .35s var(--ease-spring), opacity .3s;
}
.pd-main:hover .pd-main__zoom { transform: scale(1.08); opacity: 1; }

.pd-thumbs { display: flex; gap: 10px; }
.pd-thumb {
  display: block; width: 72px; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  border: 2px solid transparent; box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .45);
  transition: border-color .25s, transform .3s var(--ease-out), opacity .25s;
  opacity: .82;
}
.pd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pd-thumb:hover { opacity: 1; transform: translateY(-2px); }
.pd-thumb.is-active { border-color: #fff; opacity: 1; box-shadow: 0 0 0 2px var(--green), 0 10px 20px -10px rgba(0, 0, 0, .5); }

/* Details */
.pd-info__inner { max-width: 680px; padding: clamp(28px, 4vw, 44px) var(--gutter) clamp(40px, 6vw, 64px); }
.pd-seller { font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; color: var(--ink-2); }
.pd-name { margin-top: 4px; font-family: var(--font-head); font-weight: 600; font-size: clamp(2.2rem, 1.6rem + 2.2vw, 3.4rem); line-height: 1.08; letter-spacing: -.015em; }
.pd-price { margin-top: 8px; font-family: var(--font-head); font-weight: 600; font-size: clamp(2rem, 1.5rem + 1.8vw, 2.9rem); color: var(--green); letter-spacing: -.01em; }

.pd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 18px; font-size: .95rem; color: var(--ink-2); }
.pd-meta__dot { width: 6px; height: 6px; border-radius: 50%; background: #b9bfba; }
.pd-meta__date { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--mint); color: var(--green); }
.pd-meta__date .icon { font-size: 20px; }

.pd-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin-top: 20px; }
.pd-variants { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; border: 0; }
.pd-variants__label { float: left; margin-right: 4px; font-size: .95rem; color: var(--ink-2); }
.pd-variants__label strong { font-weight: 700; color: var(--ink); }
.pd-swatch { position: relative; cursor: pointer; }
.pd-swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pd-swatch__dot {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--sw); border: 2px solid transparent; color: transparent; font-size: 20px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  transition: border-color .25s, color .25s, transform .35s var(--ease-spring);
}
.pd-swatch:hover .pd-swatch__dot { transform: scale(1.06); }
.pd-swatch input:checked + .pd-swatch__dot { border-color: var(--green); color: var(--green); }
.pd-swatch input:focus-visible + .pd-swatch__dot { outline: 3px solid var(--green); outline-offset: 3px; }

.pd-actions { display: flex; align-items: center; gap: 12px; flex: 1 1 230px; max-width: 320px; }
.pd-actions__buy { flex: 1; min-height: 54px; }
.pd-actions .pcard__cart { width: 54px; height: 54px; }

.pd-rule { margin: clamp(28px, 4vw, 40px) 0; border: 0; border-top: 1px solid var(--line); }
.pd-desc__title { font-family: var(--font-head); font-weight: 600; font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); letter-spacing: -.01em; }
.pd-desc p { margin-top: 12px; max-width: 62ch; font-size: .95rem; color: var(--ink-2); line-height: 1.65; }

.pd-back {
  display: inline-flex; align-items: center; gap: 12px;
  margin-bottom: 18px; padding: 4px 0;
  font-size: .95rem; color: var(--green);
}
.pd-back .icon { font-size: 20px; transition: transform .3s var(--ease-out); }
.pd-back:hover .icon { transform: translateX(-4px); }

/* ---------- 2. Other products ---------- */
.pd-more {
  position: relative; z-index: 1;
  padding: clamp(48px, 6vw, 72px) var(--gutter) clamp(64px, 8vw, 100px);
  background: #fff;
}
.pd-more .h2 { margin-bottom: clamp(28px, 3vw, 40px); }
.pd-more__grid { max-width: var(--max); margin: 0 auto; }

/* "Produk lainnya": 4 columns on wide screens */
@media (min-width: 1200px) {
  .pd-more__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 18px; }
  .pd-more__grid .pcard { padding: 14px; }
  .pd-more__grid .pcard__name { font-size: 1.2rem; }
  .pd-more__grid .pcard__price { font-size: 1.55rem; }
  .pd-more__grid .pcard__buy, .pd-more__grid .pcard__cart { min-height: 46px; }
  .pd-more__grid .pcard__cart { width: 46px; height: 46px; font-size: 22px; }
}

/* ---------- 3. Desktop: full-height photo, scrolling details, overlap ---------- */
@media (min-width: 900px) {
  .pd-top {
    position: sticky; top: var(--header-h); z-index: 0;
    grid-template-columns: minmax(0, 655fr) minmax(0, 785fr);
    height: calc(100dvh - var(--header-h));
  }
  .pd-top { grid-template-rows: minmax(0, 1fr); }          /* the row can't grow taller than the screen */
  .pd-gallery { height: 100%; min-height: 0; }
  .pd-main__img { position: absolute; inset: 0; }           /* photo fills the panel without stretching it */
  .pd-thumbs {
    position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
    flex-direction: column;
  }
  .pd-info { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .pd-info__inner { padding-left: clamp(32px, 5vw, 76px); padding-right: clamp(24px, 4vw, 60px); }
  .pd-more {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: 0 -24px 40px -28px rgba(20, 50, 25, .25);
  }
}

/* ---------- 4. Tablet + phone: stacked, no overlap ---------- */
@media (max-width: 899px) {
  .pd-gallery { padding-bottom: 12px; background: #fff; }
  .pd-main { aspect-ratio: 4 / 4.4; height: auto; }
  .pd-thumbs {
    overflow-x: auto; scrollbar-width: none;
    padding: 12px var(--gutter) 4px;
  }
  .pd-thumbs::-webkit-scrollbar { display: none; }
  .pd-thumb { flex: none; width: 64px; }
  .pd-info__inner { padding-top: 12px; }
  .pd-more { border-top: 1px solid var(--line); }
}
@media (max-width: 639px) {
  .pd-main { aspect-ratio: 1 / 1.1; }
  .pd-buy { flex-direction: column; align-items: stretch; gap: 16px; }
  .pd-actions { max-width: none; flex: none; }
  .pd-meta { gap: 10px 12px; }
}

/* ---------- 5. Image viewer ---------- */
.lb {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #101611; color: #fff;
  display: none; flex-direction: column;
}
.lb[open] { display: flex; animation: lbIn .35s var(--ease-out); }
.lb::backdrop { background: transparent; }
@keyframes lbIn { from { opacity: 0; } }
html.lb-open { overflow: hidden; }

.lb__top { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 8px; }
.lb__count { font-size: .9rem; color: rgba(255, 255, 255, .75); font-variant-numeric: tabular-nums; }
.lb__close, .lb__nav {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 22px;
  transition: background-color .25s, transform .3s var(--ease-out);
}
.lb__close:hover, .lb__nav:hover { background: rgba(255, 255, 255, .24); }
.lb__stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 76px; touch-action: pan-y; }
.lb__img {
  width: 100%; height: 100%; object-fit: contain;          /* fills the viewer, keeps proportions */
  user-select: none; -webkit-user-drag: none;
}
.lb__img.is-swap { animation: lbSwap .4s var(--ease-out); }
@keyframes lbSwap { from { opacity: 0; transform: scale(.96); } }
.lb[open] .lb__img:not(.is-swap) { animation: lbZoom .45s var(--ease-out); }
@keyframes lbZoom { from { opacity: 0; transform: scale(.9); } }
.lb__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lb__nav:hover { transform: translateY(-50%) scale(1.06); }
.lb__nav--prev { left: 16px; }
.lb__nav--next { right: 16px; }
.lb__thumbs { display: flex; justify-content: center; gap: 10px; padding: 12px 18px calc(18px + env(safe-area-inset-bottom, 0px)); overflow-x: auto; scrollbar-width: none; }
.lb__thumbs button { flex: none; width: 58px; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 2px solid transparent; opacity: .5; transition: opacity .25s, border-color .25s; }
.lb__thumbs button[aria-current="true"] { opacity: 1; border-color: #fff; }
.lb__thumbs img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 639px) {
  .lb__stage { padding: 8px 12px; }
  .lb__nav { width: 40px; height: 40px; background: rgba(0, 0, 0, .35); }
  .lb__nav--prev { left: 8px; }
  .lb__nav--next { right: 8px; }
  .lb__thumbs { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .lb[open], .lb__img, .pd-main__img { animation: none !important; }
}
