.gallery-section {
  background: #f4e4dc;
}

.gallery-frame {
  display: block;
  width: min(100%, 868px);
  height: calc(min(100vw - 36px, 868px) * 0.5625 + 138px);
  margin: 0 auto;
  border: 0;
}

.gallery-page {
  margin: 0;
  padding: 24px;
  color: #31413c;
  font-family: Arial, sans-serif;
}

.gallery-page * {
  box-sizing: border-box;
}

.gallery-display {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 22px;
  background: #e0e9e1;
  box-shadow: 0 18px 35px -12px rgba(49, 65, 60, 0.32), 0 4px 12px rgba(49, 65, 60, 0.16);
}

.gallery-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-image[hidden],
.gallery-message[hidden],
.gallery-controls[hidden] {
  display: none;
}

.gallery-message {
  margin: 20px;
  text-align: center;
}

.gallery-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.gallery-arrow {
  flex: 0 0 40px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #50685c;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.gallery-arrow:hover:not(:disabled) {
  background: #e0e9e1;
}

.gallery-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.gallery-thumbnails {
  display: flex;
  flex: 1;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 4px;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}

.gallery-thumbnails::-webkit-scrollbar {
  display: none;
}

.gallery-thumbnails li {
  flex: 0 0 calc((100% - 40px) / 5);
}

.gallery-thumbnail {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 3px solid transparent;
  border-radius: 10px;
  background: #e0e9e1;
  cursor: pointer;
}

.gallery-thumbnail[aria-pressed="true"] {
  border-color: #31413c;
}

.gallery-thumbnail:focus-visible,
.gallery-arrow:focus-visible {
  outline: 2px solid #31413c;
  outline-offset: 2px;
}

.gallery-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-count {
  position: absolute;
  top: 16px;
  right: 16px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(49, 65, 60, 0.8);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.gallery-count:empty {
  display: none;
}

.gallery-noscript {
  text-align: center;
}

@media (max-width: 600px) {
  .gallery-thumbnails li {
    flex-basis: calc((100% - 20px) / 3);
  }

  .gallery-arrow {
    flex-basis: 36px;
  }
}
