/* Isolated photo viewer and keyboard focus states for enhanced controls. */
.ip-focus-ring:focus-visible,
.ip-gallery-trigger:focus-visible {
  outline: 3px solid #947238;
  outline-offset: 4px;
}

.ip-gallery-trigger { cursor: zoom-in; }
body.ip-gallery-open { overflow: hidden; }

dialog.ip-gallery {
  --ip-gallery-ink: #fbfaf7;
  --ip-gallery-gold: #dbc495;
  position: fixed;
  inset: 0;
  width: min(1120px, calc(100% - 40px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 20px;
  background: #262729;
  color: var(--ip-gallery-ink);
  box-shadow: 0 24px 100px rgb(0 0 0 / 32%);
}

dialog.ip-gallery::backdrop { background: rgb(17 18 20 / 88%); }

.ip-gallery .ip-gallery__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 10px 24px;
}

.ip-gallery .ip-gallery__title {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .015em;
}

.ip-gallery .ip-gallery__figure { margin: 0; }

.ip-gallery .ip-gallery__photo {
  display: block;
  width: 100%;
  height: min(70vh, 740px);
  height: min(70dvh, 740px);
  max-height: calc(100dvh - 210px);
  min-height: 120px;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
  background: #1b1c1e;
}

.ip-gallery .ip-gallery__caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
}

.ip-gallery .ip-gallery__description {
  max-width: 65%;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ip-gallery .ip-gallery__navigation {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
}

.ip-gallery .ip-gallery__count {
  min-width: 62px;
  color: #e6e1d7;
  text-align: center;
  font-size: 15px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.ip-gallery .ip-gallery__button {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  min-width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 50%;
  background: transparent;
  color: var(--ip-gallery-ink);
  font: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

.ip-gallery .ip-gallery__button[hidden] { display: none; }
.ip-gallery .ip-gallery__close { font-size: 34px; border-color: transparent; }
.ip-gallery .ip-gallery__button:active { transform: none; }
.ip-gallery .ip-gallery__button:focus-visible { outline: 3px solid var(--ip-gallery-gold); outline-offset: 3px; }

@media (hover: hover) {
  .ip-gallery .ip-gallery__button:hover {
    color: #262729;
    background: var(--ip-gallery-gold);
    border-color: var(--ip-gallery-gold);
  }
}

@media (max-width: 575px) {
  dialog.ip-gallery { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 14px; }
  .ip-gallery .ip-gallery__toolbar { padding: 8px 10px 8px 16px; }
  .ip-gallery .ip-gallery__photo { height: 57vh; height: 57dvh; max-height: calc(100dvh - 240px); }
  .ip-gallery .ip-gallery__caption { flex-direction: column; gap: 14px; padding: 16px; }
  .ip-gallery .ip-gallery__description { max-width: 100%; text-align: center; font-size: 15px; }
  .ip-gallery .ip-gallery__navigation { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .ip-gallery .ip-gallery__button { transition: none; }
}
