.gallery-section {
  padding: 10px 4% 42px;
  scroll-margin-top: 64px;
}

.gallery-shell {
  max-width: 1480px;
  margin: auto;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 4px 0 13px;
}

.gallery-status {
  margin: 0;
  color: #5b6c7e;
  font-size: 13px;
}

.gallery-controls {
  display: flex;
  gap: 8px;
}

.gallery-controls button {
  width: 44px;
  height: 44px;
  border: 1px solid #b8c6d3;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  font-size: 31px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(4, 27, 61, .08);
}

.gallery-controls button:hover:not(:disabled),
.gallery-controls button:focus-visible {
  background: var(--navy);
  color: #fff;
}

.gallery-controls button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.gallery-viewport {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: 12px;
  outline: none;
}

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

.gallery-viewport:focus-visible {
  box-shadow: 0 0 0 3px rgba(42, 155, 83, .3);
}

.gallery {
  display: flex;
  grid-template-columns: none;
  gap: 14px;
  overflow: visible;
}

.gallery-card {
  font: inherit;
  text-align: left;
  color: var(--ink);
  padding: 0;
  min-width: 0;
  flex: 0 0 calc((100% - 42px) / 4);
  border: 1px solid #dbe2e8;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .075);
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform .2s ease, box-shadow .2s ease;
}

.gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(4, 27, 61, .14);
}

.gallery-card:focus-visible {
  outline: 3px solid rgba(42, 155, 83, .45);
  outline-offset: -3px;
}

.gallery-card img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: contain;
  object-position: center;
  background: #e8edf1;
}

.gallery-empty {
  width: 100%;
  margin: 0;
  padding: 28px;
  border: 1px dashed #b8c6d3;
  border-radius: 10px;
  color: #5b6c7e;
  text-align: center;
}

#photoModal[open] {
  width: min(1100px, 94vw);
  max-width: 94vw;
  max-height: 92vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
}

#photoModal .close {
  float: none;
  justify-self: end;
}

#photoModal img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  margin-inline: auto;
  object-fit: contain;
  object-position: center;
}

#photoModal > div {
  width: 100%;
  text-align: center;
}

.gallery-card > span {
  display: block;
  padding: 12px 13px;
  text-align: left;
}

.gallery-card b {
  display: block;
  font-size: 14px;
  color: var(--navy);
}

.gallery-card small {
  display: block;
  margin-top: 5px;
  color: #5e6e7e;
  font-size: 11px;
  line-height: 1.45;
}

.gallery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
}

.gallery-dots {
  display: flex;
  gap: 7px;
  min-height: 12px;
}

.gallery-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #bdc8d1;
  cursor: pointer;
  transition: width .2s ease, background .2s ease;
}

.gallery-dot[aria-current="true"] {
  width: 27px;
  background: var(--green);
}

.gallery-social {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
}

.gallery-social span {
  color: #5b6c7e;
  font-weight: 700;
}

.gallery-social a {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.gallery-social a:hover {
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .gallery-card {
    flex-basis: calc((100% - 28px) / 3);
  }
}

@media (max-width: 760px) {
  .gallery-section {
    padding: 8px 4% 34px;
  }

  .gallery-card {
    min-width: 0;
    flex-basis: 84%;
  }

  .gallery-card img {
    height: 230px;
  }

  .gallery-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .gallery-social {
    justify-content: flex-start;
    gap: 10px;
  }

  .gallery-social span {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-card,
  .gallery-dot {
    transition: none;
  }
}
