.v8-product-gallery {
  --gallery-border: #d9e4e4;
  --gallery-ink: #08283d;
  --gallery-quiet: #516e78;
  min-width: 0;
}

.v8-product-gallery [hidden],
.v8-photo-viewer [hidden] {
  display: none !important;
}

.product-layout .v8-product-gallery .v8-photo-frame {
  height: clamp(330px, 40vw, 590px);
  overflow: hidden;
  border: 1px solid var(--gallery-border);
  border-radius: 7px 7px 0 0;
  background: #fff;
}

.product-layout .v8-product-gallery .v8-photo-frame > button {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 18px;
}

.product-layout .v8-product-gallery .v8-photo-frame > button img {
  width: auto !important;
  height: auto;
  max-width: min(100%, var(--source-width, 100%)) !important;
  max-height: min(100%, var(--source-height, 100%));
  min-height: 0;
  object-fit: contain !important;
  transform: none !important;
}

.v8-product-gallery .v8-photo-frame > button:focus-visible {
  outline-offset: -5px;
}

.v8-gallery-caption {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--gallery-border);
  border-top: 0;
  border-radius: 0 0 7px 7px;
  background: #f2f7f5;
  padding: 13px 15px;
  color: var(--gallery-ink);
}

.v8-photo-description strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.25;
}

.v8-photo-description strong:empty {
  display: none;
}

.v8-photo-type {
  color: #2e5258;
  font-weight: 700;
  font-size: 13px;
}

.v8-photo-note {
  margin: 4px 0 0;
  color: var(--gallery-quiet);
  font-size: 13px;
  line-height: 1.4;
}

.v8-photo-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 10px;
  max-width: 52%;
}

.v8-photo-actions button,
.v8-viewer-choices button {
  min-width: 0;
  padding: 3px 1px;
  border: 0;
  background: transparent;
  color: #123c52;
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: 3px;
  text-decoration: underline;
}

.v8-photo-strip {
  display: flex;
  column-gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 5px 3px 9px;
  margin: 8px -3px 0;
  scrollbar-width: thin;
  scrollbar-color: #b3c7c5 #f3f6f5;
  scroll-snap-type: x proximity;
}

.v8-photo-thumb {
  display: grid;
  align-content: start;
  row-gap: 3px;
  flex: 0 0 clamp(88px, 9vw, 115px);
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--gallery-border);
  border-radius: 6px;
  background: #f5f8f7;
  text-align: left;
  color: var(--gallery-ink);
  scroll-snap-align: start;
}

.v8-photo-thumb[aria-pressed=true] {
  background: #eaf2ee;
  border-color: #325956;
  box-shadow: inset 0 -3px #99d233;
}

.v8-photo-thumb:focus-visible {
  outline-offset: 1px;
}

.v8-photo-thumb img {
  width: 100%;
  height: 62px;
  object-fit: contain;
  background: white;
  border-radius: 3px;
}

.v8-photo-thumb span {
  padding: 3px 3px 6px;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.v8-photo-thumb[aria-pressed=true] span {
  font-weight: 700;
}

.v8-photo-viewer[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.v8-photo-viewer .native-photo-scroll {
  height: 100%;
  min-height: 0;
}

.v8-viewer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 15px;
  row-gap: 2px;
  padding: 6px 16px;
  border-bottom: 1px solid #dbe4e0;
  color: #486772;
  font-size: 13px;
}

.v8-viewer-choices {
  display: flex;
  gap: 5px 15px;
  align-items: center;
  flex-wrap: wrap;
}

.v8-spec-link {
  display: inline-block;
  margin: 0 0 22px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 800px) {
  .product-layout .v8-product-gallery .v8-photo-frame {
    height: clamp(300px, 83vw, 490px);
  }
}

@media (max-width: 480px) {
  .product-layout .v8-product-gallery .v8-photo-frame > button {
    padding: 10px;
  }

  .v8-gallery-caption {
    padding: 10px;
    gap: 6px 10px;
  }

  .v8-photo-actions {
    flex-direction: column;
    align-items: end;
    text-align: right;
  }

  .v8-viewer-meta {
    padding: 6px 9px;
  }
}
