/**
 * Product page UI — gallery, unified toolbar, icon bar, mobile sticky
 */

:root {
  --product-toolbar-h: 2.75rem;
}

/* Gallery — balanced size for mixed aspect ratios */
.product-carousel--clean .product-carousel__viewport {
  min-height: 0;
  max-height: min(52vh, 480px);
  aspect-ratio: 5 / 4;
  height: auto;
  background: rgba(26, 26, 26, 0.04);
}

.product-carousel--clean .carousel__slide--product img {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: min(52vh, 480px);
  object-fit: contain;
  object-position: center center;
  background: rgba(26, 26, 26, 0.03);
}

/* Unified toolbar — carousel nav + actions on one line */
.product-shop__toolbar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: var(--product-toolbar-h);
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(26, 26, 26, 0.1);
  box-sizing: border-box;
}

.product-shop__toolbar-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-height: var(--product-toolbar-h);
}

.product-shop__toolbar-nav .carousel__controls {
  position: static;
  transform: none;
  left: auto;
  bottom: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  height: var(--product-toolbar-h);
  min-height: var(--product-toolbar-h);
  margin: 0;
  padding: 0;
  max-width: none;
}

.product-shop__toolbar-nav .carousel__controls .carousel__nav--ctrl {
  width: var(--product-toolbar-h);
  height: var(--product-toolbar-h);
  min-width: var(--product-toolbar-h);
  min-height: var(--product-toolbar-h);
}

.product-shop__toolbar-nav .carousel__controls .carousel__nav--ctrl .carousel__chev {
  width: 0.45rem;
  height: 0.45rem;
  border-width: 1.75px;
  opacity: 0.65;
}

.product-shop__toolbar-nav .carousel__controls .carousel__dots {
  gap: 0.35rem;
  padding: 0 0.1rem;
}

.product-shop__toolbar-nav .carousel__controls .carousel__dots button {
  width: 1.1rem !important;
  min-width: 1.1rem !important;
  max-width: 1.1rem !important;
  height: 2px !important;
  opacity: 0.2;
}

.product-shop__toolbar-nav .carousel__controls .carousel__dots button.is-active {
  opacity: 1;
  transform: none;
}

.product-shop__toolbar-actions {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  min-width: 0;
  min-height: var(--product-toolbar-h);
}

.product-shop__toolbar:not(:has(.product-shop__toolbar-nav)) .product-shop__toolbar-actions {
  justify-content: stretch;
}

/* Space before specs */
.product-shop__specs-block {
  margin-top: 0.5rem;
  padding-top: 1.75rem;
}

.product-shop__specs > div {
  padding: 0.8rem 0;
  gap: 0.45rem 0.75rem;
}

.product-shop__specs > div + div {
  border-top: 1px solid rgba(26, 26, 26, 0.06);
}

.product-shop__specs dd {
  line-height: 1.55;
}

/* Real links */
.product-page .product-kicker__link {
  color: var(--ink, #1a1a1a) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(26, 26, 26, 0.35);
}

.product-page .product-kicker__link:hover {
  text-decoration-color: var(--ink, #1a1a1a);
  opacity: 1 !important;
}

.product-page .product-shop__title-row h1 {
  text-decoration: none;
}

/* Form — no quantity */
.product-buy__row--name-only {
  grid-template-columns: 1fr;
}

.product-buy__actions {
  display: none;
}

/* Icon action bar — segmented control */
.product-icon-bar {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  box-shadow: none;
  min-height: var(--product-toolbar-h);
  height: var(--product-toolbar-h);
}

.product-shop__toolbar-actions .product-icon-bar {
  width: auto;
  max-width: 100%;
}

.product-shop__toolbar:not(:has(.product-shop__toolbar-nav)) .product-icon-bar {
  width: 100%;
}

.product-icon-bar__btn {
  display: grid;
  place-items: center;
  flex: 0 0 var(--product-toolbar-h);
  width: var(--product-toolbar-h);
  height: var(--product-toolbar-h);
  min-width: var(--product-toolbar-h);
  padding: 0;
  margin: 0;
  border: 0;
  border-right: 1px solid rgba(26, 26, 26, 0.16);
  background: #fff;
  color: var(--ink, #1a1a1a);
  text-decoration: none !important;
  cursor: pointer;
  border-radius: 0;
  box-shadow: none;
  transition: background-color 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.product-icon-bar__btn:first-child {
  border-left: 1px solid rgba(26, 26, 26, 0.16);
}

.product-icon-bar__btn:last-child {
  border-right: 1px solid rgba(26, 26, 26, 0.16);
}

.product-icon-bar__icon,
.product-icon-bar__btn .ti {
  font-size: 1.22rem;
  line-height: 1;
  vertical-align: middle;
  text-decoration: none !important;
  -webkit-font-smoothing: antialiased;
}

.product-icon-bar__btn--primary .product-icon-bar__icon,
.product-icon-bar__btn--primary .ti {
  font-size: 1.28rem;
}

.product-icon-bar__btn--primary {
  flex: 1 1 auto;
  width: auto;
  min-width: 5rem;
  max-width: none;
  background: var(--ink, #1a1a1a);
  color: #f6f1ea;
}

.product-icon-bar__btn--wa {
  color: #128c7e;
}

@media (hover: hover) {
  .product-icon-bar__btn:not(.product-icon-bar__btn--primary):hover,
  .product-icon-bar__btn:not(.product-icon-bar__btn--primary):focus-visible {
    background: rgba(26, 26, 26, 0.06);
    color: var(--ink, #1a1a1a);
    transform: none;
  }

  .product-icon-bar__btn--wa:not(.product-icon-bar__btn--primary):hover,
  .product-icon-bar__btn--wa:focus-visible {
    color: #128c7e;
  }

  .product-icon-bar__btn--primary:hover,
  .product-icon-bar__btn--primary:focus-visible {
    filter: brightness(1.08);
    background: var(--ink, #1a1a1a);
    color: #f6f1ea;
  }

  .product-shop__toolbar-nav .carousel__controls .carousel__nav--ctrl:hover .carousel__chev,
  .product-shop__toolbar-nav .carousel__controls .carousel__nav--ctrl:focus-visible .carousel__chev {
    opacity: 1;
  }
}

.product-icon-bar__btn.is-copied {
  background: #1a5c2e !important;
  color: #fff !important;
}

.product-shop__actions--secondary,
.product-page .product-cta.btn-bar {
  display: none !important;
}

/* Desktop — toolbar spans both columns */
@media (min-width: 900px) {
  .product-shop__columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.5rem 2.25rem;
    align-items: start;
  }

  .product-shop__media {
    grid-column: 1;
    grid-row: 1;
  }

  .product-shop__panel {
    grid-column: 2;
    grid-row: 1;
  }

  .product-shop__toolbar {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 0;
    padding-top: 1rem;
    gap: 1.25rem;
  }

  .product-sticky-cta {
    display: none !important;
  }

  .product-shop__toolbar-actions {
    display: flex;
  }
}

/* Mobile — nav in toolbar under image; actions in sticky bar */
@media (max-width: 899px) {
  .product-shop__columns {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .product-shop__toolbar {
    order: 1;
    margin-top: 0.5rem;
    padding-top: 0.65rem;
    border-top: 0;
    justify-content: center;
    min-height: 2.5rem;
  }

  .product-shop__media {
    order: 0;
  }

  .product-shop__panel {
    order: 2;
    margin-top: 1rem;
  }

  .product-shop__toolbar-actions {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .product-shop__toolbar:not(:has(.product-shop__toolbar-nav)) {
    display: none;
  }

  .product-page {
    --product-action-h: var(--nav-btn-size, 3rem);
    --nav-h: calc(
      var(--nav-btn-size, 3rem) + var(--product-action-h) + var(--nav-bar-offset, max(0.65rem, env(safe-area-inset-bottom, 0px))) + 0.35rem
    );
  }

  .product-page .product-detail--shop {
    padding-bottom: calc(var(--nav-h) + 0.5rem);
  }
}

/* Mobile product dock — equal columns aligned with nav row */
@media (max-width: 899px) {
  .lcs-nav--product-dock {
    z-index: 600;
  }

  .lcs-nav--product-dock .lcs-nav__stack {
    gap: 0;
    pointer-events: auto;
  }

  .lcs-nav--product-dock .lcs-nav__mega,
  .lcs-nav--product-dock .lcs-nav__chat {
    margin-bottom: 0.45rem;
  }

  .lcs-nav__dock-unit {
    order: 9;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: var(--linen, #faf7f2);
    border: 1px solid rgba(26, 26, 26, 0.2);
    box-shadow: 3px 3px 0 rgba(26, 26, 26, 0.08);
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .lcs-nav__dock-unit--5 .product-icon-bar--dock-cols-5,
  .lcs-nav__dock-unit--5 .lcs-nav__bar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .lcs-nav__dock-unit--4 .product-icon-bar--dock-cols-4,
  .lcs-nav__dock-unit--4 .lcs-nav__bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .product-sticky-cta--dock {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    position: static;
    background: var(--linen, #faf7f2);
    border: 0;
    box-shadow: none;
    box-sizing: border-box;
  }

  .product-sticky-cta--dock .product-icon-bar {
    width: 100%;
    height: var(--product-action-h, var(--nav-btn-size, 3rem));
    min-height: max(44px, var(--nav-btn-size, 3rem));
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--linen, #faf7f2);
    gap: 0;
  }

  .product-sticky-cta--dock .product-icon-bar__btn,
  .product-sticky-cta--dock .product-icon-bar__cell {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    box-sizing: border-box;
  }

  .product-sticky-cta--dock .product-icon-bar__btn,
  .product-sticky-cta--dock .product-icon-bar__btn--link {
    display: grid;
    place-items: center;
    flex: none;
    background: transparent;
    border: 0;
    border-right: 1px solid rgba(26, 26, 26, 0.15);
    position: relative;
    z-index: 1;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
  }

  .product-sticky-cta--dock .product-icon-bar__cell--spacer {
    display: block;
    border-right: 1px solid rgba(26, 26, 26, 0.15);
    pointer-events: none;
  }

  .product-sticky-cta--dock .product-icon-bar__btn--primary {
    flex: none;
    min-width: 0;
    background: var(--ink, #1a1a1a);
    color: #f6f1ea;
  }

  .product-sticky-cta--dock .product-icon-bar__btn:last-child {
    border-right: 0;
  }

  .lcs-nav__dock-unit .lcs-nav__bar {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border: 0;
    border-top: 1px solid rgba(26, 26, 26, 0.15);
    box-shadow: none;
    gap: 0;
  }

  .lcs-nav__dock-unit .lcs-nav__item {
    width: 100%;
    min-width: 0;
    margin: 0;
  }

  .lcs-nav__dock-unit .lcs-nav__item .lcs-nav__btn {
    width: 100%;
    border-right: 1px solid rgba(26, 26, 26, 0.15);
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }

  .lcs-nav__dock-unit .lcs-nav__item:last-child .lcs-nav__btn {
    border-right: 0;
  }

  .product-sticky-cta--dock .product-icon-bar__icon,
  .product-sticky-cta--dock .product-icon-bar__btn .ti {
    font-size: 1.32rem;
    line-height: 1;
  }
}

@media (min-width: 900px) {
  .product-sticky-cta--dock {
    display: none !important;
  }
}

/* Related — fill only */
@media (hover: hover) {
  .product-page .product-related .shop-card__surface:hover,
  .product-page .product-related .shop-card__link:hover {
    transform: none !important;
  }
}

.product-page .shop-card__surface:hover,
.product-page .shop-card__link:hover {
  transform: none !important;
}
