/*! Spark & Sugar · product.css — gallery, info column, buy box, accordions, related row, sticky add bar, lightbox
    (docs/REDESIGN.md "Product") */

/* ---------- 1. Layout: gallery ~58% | info ~42%; the shorter column sticks under the header ---------- */
.pdp { padding-block: clamp(16px, 2.4vw, 32px) clamp(48px, 6vw, 88px); }
.pdp__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
@media (min-width: 900px) {
  .pdp__grid { grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); gap: clamp(32px, 4.4vw, 72px); align-items: start; }
  .pdp__media, .pdp__info { position: sticky; top: calc(var(--header-h) + 24px); }
}
@media (max-width: 899.98px) {
  .pdp { padding-top: 0; }
  .pdp__media { width: 100%; max-width: 560px; margin-inline: auto; }
}

/* ---------- 2. Gallery ---------- */
.gallery { position: relative; }
.gallery__stage { position: relative; }
.gallery__track {
  position: relative; display: flex; margin: 0; padding: 0; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.gallery__zoom { display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--lavender-soft); border-radius: var(--radius-img); cursor: zoom-in; }
.gallery__zoom:focus-visible { outline-offset: -2px; }
.gallery__img { width: 100%; height: 100%; object-fit: cover; }

.gallery__nav { position: absolute; inset: 0; pointer-events: none; }
.gallery__arrow {
  position: absolute; top: 50%; translate: 0 -50%; pointer-events: auto;
  border-color: transparent; background: rgb(255 255 255 / .94); opacity: 0;
  transition: opacity var(--dur) var(--ease), background-color var(--dur);
}
.gallery__arrow--prev { left: 14px; }
.gallery__arrow--next { right: 14px; }
.gallery__stage:hover .gallery__arrow, .gallery__arrow:focus-visible { opacity: 1; }
.gallery__arrow:disabled { visibility: hidden; }
.gallery__count { display: none; }

.gallery__dots { display: flex; justify-content: center; gap: 8px; padding-top: 14px; }
.gallery__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); transition: background-color var(--dur), width var(--dur) var(--ease); }
.gallery__dot.is-active { width: 18px; border-radius: 999px; background: var(--ink); }

.gallery__thumbs { display: none; margin: 0; padding: 0; list-style: none; }
.gallery__thumb { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--lavender-soft); border-radius: var(--radius-img); }
.gallery__thumb::after { content: ''; position: absolute; inset: 0; border: 1px solid transparent; transition: border-color var(--dur); }
.gallery__thumb:hover::after { border-color: var(--line-2); }
.gallery__thumb[aria-current="true"]::after { border: 2px solid var(--ink); }
.gallery__thumb-img { width: 100%; height: 100%; object-fit: cover; }

@media (min-width: 900px) {
  /* main photo never taller than the viewport under the sticky header */
  .gallery__stage { width: min(100%, calc((100svh - var(--header-h) - 48px) * .8)); }
  .gallery__dots { display: none; }
  .gallery__thumbs { display: grid; grid-template-columns: repeat(auto-fill, 64px); gap: 10px; margin-top: 12px; }
}
@media (min-width: 1024px) {
  .gallery:not(.gallery--single) { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 16px; align-items: start; }
  .gallery__stage { grid-column: 2; grid-row: 1; }
  .gallery__thumbs { grid-column: 1; grid-row: 1; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 0; }
}
@media (max-width: 899.98px) {
  .gallery__arrow { display: none; }
}
@media (max-width: 599.98px) {
  .gallery__stage { margin-inline: calc(var(--gutter) * -1); }
  .gallery__zoom { border-radius: 0; }
}

/* ---------- 3. Info column ---------- */
.pdp__info { display: grid; align-content: start; justify-items: stretch; min-width: 0; }
.pdp__crumbs { margin-bottom: 16px; }
.pdp__badges { margin-bottom: 12px; }
.pdp__title { font-size: clamp(1.75rem, 1.55rem + .6vw, 2rem); font-weight: 800; line-height: 1.12; letter-spacing: -.012em; }
.pdp__subtitle { margin-top: 6px; color: var(--ink-2); }
.pdp__price { margin-top: 14px; font-size: clamp(1.375rem, 1.28rem + .3vw, 1.5rem); font-weight: 700; }
.pdp__notes { margin-top: 10px; font-size: .9375rem; line-height: 1.45; }
.pdp__notes-label { font-weight: 700; }
.pdp-note { margin-top: 22px; }
.pdp-note p + p, .pdp-note .notice__body p { margin: 0; }

.pdp-buy { display: grid; gap: 12px; margin-top: 24px; }
.pdp-buy__variants { margin-bottom: 6px; }
.pdp-buy__row { display: flex; gap: 12px; }
.pdp-buy__add { flex: 1 1 auto; }
.pdp-buy__qty { flex: none; }
.pdp-buy__soldout { margin-bottom: 4px; }
.pdp-buy__tn { margin-top: 2px; font-size: var(--fs-ui); }
.pdp-buy__tn a { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.pdp-buy__tn a:hover { color: var(--purple); }
.pdp-buy__tn .icon { flex: none; }

.pdp-ship { display: grid; gap: 8px; margin: 22px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); list-style: none; font-size: var(--fs-sm); line-height: 1.45; color: var(--ink-2); }
.pdp-ship li { display: flex; align-items: flex-start; gap: 10px; }
.pdp-ship .icon { flex: none; margin-top: 1px; color: var(--ink); }

.pdp-accs { margin-top: 24px; }
.pdp-details { margin: 0; }
.pdp-details div { display: grid; grid-template-columns: minmax(96px, 36%) minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.pdp-details div:first-child { border-top: 0; padding-top: 0; }
.pdp-details dt { font-weight: 700; }
.pdp-details dd { margin: 0; }
.pdp-includes { padding-left: 1.2em; }

.pdp__share {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 12px; padding: 0;
  border: 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--fs-ui); font-weight: 600; cursor: pointer;
}
.pdp__share span { text-decoration: underline; text-underline-offset: 3px; }
.pdp__share:hover { color: var(--purple); }

/* ---------- 4. Related products ---------- */
.pdp-related { border-top: 1px solid var(--line); }
.section.pdp-related { padding-top: var(--section-y); }

/* ---------- 5. Sticky add bar (phones) ---------- */
.buybar {
  position: fixed; inset: auto 0 0; z-index: 40;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 -10px 28px -20px rgb(42 8 56 / .45);
  translate: 0 110%; visibility: hidden; transition: translate .25s var(--ease), visibility .25s;
}
.buybar.is-visible { translate: 0 0; visibility: visible; }
.buybar__inner { display: flex; align-items: center; gap: 12px; }
.buybar__img { flex: none; width: 40px; height: 50px; object-fit: cover; border-radius: var(--radius-img); background: var(--lavender-soft); }
.buybar__text { flex: 1; min-width: 0; }
.buybar__name { overflow: hidden; font-size: .9375rem; font-weight: 700; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
.buybar__price { font-size: var(--fs-ui); font-weight: 700; }
.buybar__add { flex: none; min-width: 120px; }
/* While the bar shows, the page keeps room for it at the end (the floating WhatsApp button and toasts move up
   through --wa-offset, set by product.js from the bar's real height). */
html.has-buybar body { padding-bottom: 76px; }
@media (min-width: 900px) { .buybar { display: none !important; } }

/* ---------- 6. Lightbox ---------- */
.lightbox {
  width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--white); color: var(--ink); overflow: hidden;
}
.lightbox::backdrop { background: rgb(42 8 56 / .45); }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 8px; }
.lightbox__count { font-size: var(--fs-ui); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.lightbox__close {
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0;
  border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
}
.lightbox__close:hover { background: var(--lavender-soft); }
.lightbox__track {
  position: relative; display: flex; min-height: 0; margin: 0; padding: 0; list-style: none;
  overflow-x: auto; overscroll-behavior: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.lightbox__track::-webkit-scrollbar { display: none; }
.lightbox__slide { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 4px 12px calc(16px + env(safe-area-inset-bottom)); scroll-snap-align: center; scroll-snap-stop: always; }
/* The whole photo always fits: the top bar is ~68px, the slide padding ~20px. */
.lightbox__img { width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 92px - env(safe-area-inset-bottom)); object-fit: contain; border-radius: var(--radius-img); }
@media (min-width: 640px) { .lightbox__img { max-width: calc(100vw - 168px); } }
.lightbox__arrow {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 2; display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0; border: 1px solid var(--line-2); border-radius: 50%;
  background: var(--white); color: var(--ink); cursor: pointer;
}
.lightbox__arrow:hover { border-color: var(--ink); background: var(--ink); color: var(--white); }
.lightbox__arrow:disabled { visibility: hidden; }
.lightbox__arrow--prev { left: 20px; }
.lightbox__arrow--next { right: 20px; }
@media (max-width: 639.98px) { .lightbox__arrow { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .buybar, .gallery__arrow, .gallery__dot { transition: none; }
}
