/* Image links work normally without the native-dialog enhancement. */
a[data-gallery-image] {cursor:zoom-in;}
.gallery-dialog {
  box-sizing:border-box;
  position:fixed;
  inset:0;
  width:100%;
  max-width:none;
  height:100vh;
  height:100dvh;
  max-height:none;
  margin:0;
  padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
  border:0;
  color:#fff;
  background:rgba(10,17,26,.98);
  overflow:hidden;
  overscroll-behavior:contain;
}
.gallery-dialog[open] {display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:10px;}
.gallery-dialog::backdrop {background:rgba(10,17,26,.96);}
.gallery-header {display:flex;align-items:center;gap:16px;min-width:0;}
.gallery-title {margin:0;min-width:0;font-size:1rem;font-weight:600;}
.gallery-count {margin-left:auto;font-size:.9rem;font-variant-numeric:tabular-nums;white-space:nowrap;color:#dbe4ee;}
.gallery-button {
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-width:44px;
  min-height:44px;
  padding:10px 16px;
  border:1px solid #65748a;
  border-radius:8px;
  background:#233146;
  color:#fff;
  font:inherit;
  line-height:1.25;
  cursor:pointer;
  touch-action:manipulation;
}
.gallery-button:hover {background:#34465e;}
.gallery-button:focus-visible {outline:3px solid #ed8936;outline-offset:3px;}
.gallery-button:disabled {opacity:.4;cursor:default;}
.gallery-close {padding:0;flex-shrink:0;font-size:1.8rem;}
.gallery-stage {display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:hidden;}
.gallery-image {display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;}
.gallery-image[hidden],.gallery-error[hidden] {display:none;}
.gallery-error {max-width:32rem;padding:1rem;text-align:center;line-height:1.5;}
.gallery-caption {
  margin:0;
  padding:0 8px;
  max-height:20vh;
  max-height:20dvh;
  overflow:auto;
  overscroll-behavior:contain;
  color:#dbe4ee;
  text-align:center;
  font-size:.94rem;
  line-height:1.5;
  overflow-wrap:anywhere;
}
.gallery-controls {display:flex;justify-content:center;gap:12px;}
@media(max-width:480px) {
  .gallery-dialog {gap:8px;}
  .gallery-header {gap:10px;}
  .gallery-title {font-size:.9rem;}
  .gallery-button {padding:10px 12px;font-size:.85rem;}
  .gallery-close {padding:0;font-size:1.8rem;}
  .gallery-caption {font-size:.85rem;}
  .gallery-controls {gap:8px;}
}
@media(max-height:480px) {
  .gallery-dialog[open] {gap:6px;}
  .gallery-title,.gallery-count,.gallery-caption {font-size:.8rem;}
  .gallery-caption {max-height:14vh;max-height:14dvh;}
}
