.product-photo-gallery {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  padding: 18px;
  border-radius: 16px;
  background: #eff3ed;
}

.product-photo-gallery .photo-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 540px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 3px;
}

.product-photo-gallery .photo-thumb {
  flex: 0 0 78px;
  width: 100%;
  min-height: 0;
  padding: 5px;
  border: 1px solid #d8ded6;
  border-radius: 9px;
  background: #fff;
}

.product-photo-gallery .photo-thumb:hover {
  border-color: #00712d;
}

.product-photo-gallery .photo-thumb[aria-pressed="true"] {
  border-color: #00712d;
  box-shadow: 0 0 0 1px #00712d;
}

.product-photo-gallery .photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-photo-gallery .photo-main {
  min-width: 0;
  margin: 0;
}

.product-photo-gallery .photo-enlarge {
  display: block;
  width: 100%;
  height: 540px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  cursor: zoom-in;
}

.product-photo-gallery .photo-main-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-photo-gallery .photo-main figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 2px;
  color: #596451;
  font-size: 11px;
  line-height: 1.5;
}

.product-photo-gallery .photo-main figcaption > span:not(.photo-counter):not(.photo-inline-controls) {
  order: 1;
  flex: 1;
  min-width: 0;
}

.product-photo-gallery .photo-counter {
  order: 2;
  flex: 0 0 auto;
  white-space: nowrap;
}

.product-photo-gallery .photo-inline-controls {
  display: inline-flex;
  order: 3;
  flex: 0 0 auto;
  gap: 8px;
}

.product-photo-gallery .photo-inline-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #d8ded6;
  border-radius: 50%;
  background: #fffdf9;
  color: #163020;
  font: 26px/1 Arial, sans-serif;
}

.product-photo-gallery .photo-inline-controls button:hover:not(:disabled) {
  border-color: #00712d;
  background: #fff;
  color: #00712d;
}

.product-photo-gallery .photo-inline-controls button:disabled {
  opacity: .4;
  cursor: default;
}

.photo-lightbox {
  width: min(1100px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 18px;
  border: 1px solid #d8ded6;
  border-radius: 12px;
  background: #fffdf9;
  color: #163020;
  overflow-y: auto;
}

.photo-lightbox::backdrop {
  background: rgb(22 48 32 / 80%);
}

.photo-lightbox .photo-lightbox-heading,
.photo-lightbox .photo-lightbox-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.photo-lightbox .photo-lightbox-heading {
  margin-bottom: 12px;
}

.photo-lightbox .photo-lightbox-title {
  margin: 0;
  font: 600 18px/1.4 'Bai Jamjuree', Arial, sans-serif;
}

.photo-lightbox .photo-lightbox-image {
  display: block;
  width: 100%;
  height: min(70dvh, 760px);
  object-fit: contain;
  background: #fff;
}

.photo-lightbox .photo-lightbox-controls {
  margin-top: 14px;
}

.photo-lightbox button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid #d8ded6;
  border-radius: 24px;
  background: #fffdf9;
  color: #163020;
  font-size: 13px;
  line-height: 1.4;
}

.photo-lightbox button:hover:not(:disabled) {
  border-color: #00712d;
  background: #eff3ed;
}

.photo-lightbox button:disabled {
  opacity: .4;
  cursor: default;
}

.photo-lightbox .photo-lightbox-counter {
  font-size: 12px;
  white-space: nowrap;
}

.product-photo-gallery button:focus-visible,
.photo-lightbox button:focus-visible {
  outline: 3px solid #00712d;
  outline-offset: 3px;
}

@media (max-width: 1100px) and (min-width: 781px) {
  .product-photo-gallery {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .product-photo-gallery .photo-thumb {
    flex-basis: 72px;
  }

  .product-photo-gallery .photo-enlarge {
    height: 500px;
  }

  .product-photo-gallery .photo-thumbnails {
    max-height: 500px;
  }
}

@media (max-width: 780px) {
  .product-photo-gallery {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
    border-radius: 12px;
  }

  .product-photo-gallery .photo-main {
    grid-row: 1;
  }

  .product-photo-gallery .photo-enlarge {
    height: 360px;
  }

  .product-photo-gallery .photo-thumbnails {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .product-photo-gallery .photo-thumb {
    flex-basis: 62px;
    width: 62px;
    height: 72px;
  }

  .product-photo-gallery .photo-main figcaption {
    padding-top: 12px;
  }

  .photo-lightbox {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 12px;
  }

  .photo-lightbox .photo-lightbox-image {
    height: 65dvh;
  }

  .photo-lightbox button {
    padding-inline: 12px;
  }
}
