.dir-hero:has(> .court-gallery) {
  row-gap: 16px;
}

@media (min-width: 901px) {
  .dir-hero:has(> .court-gallery) {
    grid-template-rows: auto 1fr;
    row-gap: 12px;
  }

  .dir-hero > .court-gallery {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
  }

  .dir-hero > .court-gallery-details {
    grid-column: 1;
  }
}

.court-gallery {
  min-width: 0;
  gap: 10px;
}

.court-gallery .court-gallery-track {
  display: flex;
  min-height: 0;
  aspect-ratio: 4 / 3;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
}

.court-gallery[data-gallery-enhanced] .court-gallery-track {
  scrollbar-width: none;
}

.court-gallery[data-gallery-enhanced] .court-gallery-track::-webkit-scrollbar {
  display: none;
}

.court-gallery-photo {
  display: block;
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  cursor: zoom-in;
}

.court-gallery-photo:focus-visible {
  outline-offset: -5px;
}

.court-gallery-photo img,
.court-gallery-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.court-gallery-controls:not([hidden]),
.court-gallery-dialog-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.court-gallery-thumbs,
.court-gallery-pager {
  display: flex;
  align-items: center;
  gap: 6px;
}

.court-gallery-thumbs {
  flex: 1 1 0;
  overflow-x: auto;
  padding: 4px;
}

.court-gallery-controls button,
.court-gallery-dialog-controls :is(a, button) {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line2);
  border-radius: var(--rctrl);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.court-gallery-controls button:hover,
.court-gallery-dialog-controls :is(a, button):hover {
  border-color: var(--court);
  color: var(--court);
}

.court-gallery-thumbs button {
  flex: 0 0 clamp(52px, 5vw, 68px);
  aspect-ratio: 4 / 3;
  padding: 3px;
}

.court-gallery-thumbs button[aria-current="true"] {
  border: 2px solid var(--court);
  padding: 2px;
}

.court-gallery-thumbs img {
  border-radius: 7px;
  background: #0d1f2c;
}

.court-gallery-pager {
  flex: none;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.court-gallery-pager button {
  padding: 0;
  font-size: 25px;
  line-height: 1;
}

.court-gallery-pager button[aria-disabled="true"] {
  opacity: .45;
  cursor: default;
}

.court-gallery-dialog {
  width: max-content;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  margin: auto;
  padding: 12px;
  border: 0;
  border-radius: var(--rc);
  color: var(--ink);
  background: var(--card);
}

.court-gallery-dialog::backdrop {
  background: rgb(4 12 20 / 82%);
}

.court-gallery-dialog-controls {
  margin-bottom: 10px;
}

.court-gallery-dialog-controls :is(a, button) {
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
}

.court-gallery-dialog img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 1360px);
  max-height: calc(100vh - 106px);
  max-height: calc(100dvh - 106px);
  object-fit: contain;
}

@media (max-width: 900px) {
  .court-gallery-thumbs {
    display: none;
  }

  .court-gallery-controls:not([hidden]) {
    justify-content: center;
  }
}
