body.gallery {
  --gallery-ink: var(--portal-ink);
  --gallery-blue: var(--portal-blue);
  --gallery-rule: var(--portal-rule);
  --gallery-faint-rule: var(--portal-faint-rule);
}
.gallery .gallery-frame {
  display: grid;
  grid-template-columns: minmax(170px, 21%) minmax(0, 1fr);
  min-height: 385px;
  gap: clamp(18px, 3vw, 38px);
}
.gallery main, .gallery-nav { min-width: 0; }
.gallery main > p, .gallery .gallery-nav div { color: inherit; font: inherit; }
.gallery :is(main, .gallery-nav) a { font-size: inherit; }
.gallery .gallery-frame h1 {
  color: var(--gallery-blue);
  font: 700 clamp(22px, 3vw, 34px)/1.2 Verdana, Arial, sans-serif;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
  margin: 0 0 12px;
}
.gallery main > p { margin-block: 0 14px; }
.gallery-nav {
  border-inline-end: 1px solid var(--gallery-faint-rule);
  padding-inline-end: 14px;
  overflow-wrap: anywhere;
}
.gallery-nav > a { display: block; margin-bottom: 8px; }
.gallery .gallery-nav > a:first-child {
  font-size: 17px;
  margin-bottom: 12px;
}
.gallery-nav h2 {
  margin: 22px 0 9px;
  padding-top: 11px;
  border-top: 1px solid var(--gallery-faint-rule);
  font: 700 13px/1.4 Verdana, Arial, sans-serif;
}
.gallery details { margin-block: 6px; }
.gallery summary { cursor: pointer; color: var(--gallery-blue); }
.gallery-section { padding-inline-start: 8px; border-inline-start: 1px solid var(--gallery-faint-rule); }
.gallery-section a { display: block; margin: 5px 0 0 11px; }
#gallery-search { width: 100%; margin-top: 6px; }
.gallery .gallery-people-list {
  margin: 4px 0 0; padding: 0; border: 1px solid var(--gallery-rule);
  background: #fffff8; list-style: none;
}
.gallery .gallery-people-list li {
  padding: 6px 8px; color: var(--gallery-blue); font: inherit; overflow-wrap: anywhere; cursor: pointer;
}
.gallery-people-list li:hover, .gallery-people-list [aria-selected="true"] { background: var(--gallery-blue); color: white; }
#gallery-people-status { margin: 4px 0 0; }
.gallery [hidden] { display: none !important; }
.sr-gallery { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.gallery :is(input, select, textarea) { max-width: 100%; box-sizing: border-box; font: inherit; color: inherit; }
.gallery :is(main, .gallery-nav) :is(input:not([type=file]), select, textarea) {
  border: 1px solid var(--gallery-rule);
  border-radius: 2px;
  background: #fffffa;
  padding: 5px 7px;
}
.gallery :is(main, .gallery-nav) :focus-visible { outline: 2px solid var(--gallery-blue); outline-offset: 2px; }
.gallery :is(.gallery-tools, .gallery-add-section) form { display: flex; flex-wrap: wrap; align-items: end; gap: 5px; margin-block: 6px; }
.gallery-tools { border-block: 1px dashed #c6c6b7; padding-block: 7px; margin-bottom: 18px; }
.gallery-tools label, .gallery-add-section label { display: grid; gap: 3px; min-width: 0; }
.gallery-tools small { flex-basis: 100%; }
.gallery-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery button { font: inherit; color: white; background: var(--gallery-blue); border: 1px solid var(--gallery-blue); padding: 5px 9px; cursor: pointer; }
.gallery button:disabled { opacity: .5; cursor: default; }
.gallery button.gallery-link { border: 0; padding: 0; color: #2f6582; background: none; text-decoration: underline; }
#gallery-status[data-error], #gallery-viewer-status { color: #9c271b; }
.gallery .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 156px), 1fr));
  gap: 15px;
  padding-block: 5px;
  font: inherit;
}
.gallery-grid > p { font: inherit; color: inherit; }
.gallery-grid > p { grid-column: 1 / -1; }
.gallery-tile { min-width: 0; margin: 0; }
.gallery-tile img {
  box-sizing: border-box;
  display: block; width: 100%; height: auto; aspect-ratio: 4/3; object-fit: contain;
  border: 1px solid #deddd0;
  background: #f0efe1;
}
.gallery-preview { display: block; }
.gallery-preview:hover img { border-color: #7d99a1; }
.gallery-album > a { display: block; overflow-wrap: anywhere; }
.gallery-album > a img { margin-bottom: 6px; }
.gallery-album > span { display: block; font-size: .9em; }
.gallery-album > span a { display: inline; }
.gallery-photo-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }
.gallery-photo-actions button { padding-inline: 5px; }
.gallery-pages { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
#gallery-viewer { position: fixed; inset: 0; margin: auto; width: fit-content; min-width: min(220px, 88vw); height: fit-content; min-height: 55px; padding: 0; border: 0; background: #171b1e; touch-action: pan-y; }
#gallery-viewer::backdrop { background: rgb(12 17 20 / 85%); }
#gallery-full { display: block; max-width: min(94vw, 1400px); max-height: 94dvh; margin-inline: auto; object-fit: contain; }
#gallery-full:not([src]) { display: none; }
#gallery-viewer button { position: absolute; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid #fff8; border-radius: 50%; background: #171b1ee8; color: #fff; font: 24px/1 Arial,sans-serif; }
#gallery-viewer .gallery-close { top: 6px; right: 6px; }
#gallery-viewer :is(.gallery-prev,.gallery-next) { top: 50%; transform: translateY(-50%); }
.gallery-prev { left: 6px; }
.gallery-next { right: 6px; }
#gallery-index { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: #171b1ee8; color: white; padding: 2px 6px; }
#gallery-viewer-status { padding: 6px 46px; color: white; }
html:has(#gallery-viewer[open]) { overflow: hidden; }
.gallery-section a { overflow-wrap: anywhere; }
.gallery-section-manage { font-size: .87em; }
.gallery-tools textarea { box-sizing: border-box; max-width: 100%; font: inherit; }
.gallery-photo-actions { justify-content: space-between; align-items: center; }
.gallery button.gallery-grip {
  border: 0; padding: 0 4px; background: none; color: #2f6582;
  font: 17px/1 Arial, sans-serif; cursor: grab; touch-action: none;
}
.gallery-photo-actions .gallery-link { font-size: 10px; }
.gallery-photo-dragging { opacity: .45; }
.gallery-drop-before { outline: 2px solid #2f6582; outline-offset: 2px; }
.gallery-drop-after { outline: 2px dashed #2f6582; outline-offset: 2px; }
.gallery-drag-preview { position: fixed; z-index: 5; pointer-events: none; max-width: 73px; max-height: 60px; opacity: .85; }


@media (max-width: 760px) {
  .gallery .gallery-frame { grid-template-columns: minmax(135px, 25%) minmax(0, 1fr); min-height: 300px; gap: 18px; }
}
@media (max-width: 680px) {
  .gallery .gallery-frame { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .gallery-nav { border: 0; border-block-end: 1px solid var(--gallery-faint-rule); padding: 0 0 12px; }
  .gallery-nav > a { display: inline-block; margin-inline-end: 10px; }
  .gallery-nav h2 { margin-top: 12px; padding-top: 0; border: 0; }
  .gallery .gallery-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
}

.gallery-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.gallery .gallery-album-edit form { display: grid; justify-items: start; width: min(100%, 300px); }
.gallery-album-edit label, .gallery-caption-edit label { display: grid; width: 100%; gap: 3px; }
.gallery-caption-edit { font-size: 10px; }
.gallery-caption-edit textarea { box-sizing: border-box; width: 100%; margin-bottom: 3px; font: inherit; }
#gallery-caption {
  box-sizing: border-box; margin: 0; padding: 7px 10px; max-width: min(94vw, 700px); max-height: 72px;
  color: white; text-align: center; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap;
}
#gallery-viewer:has(#gallery-caption:not([hidden])) #gallery-full { max-height: calc(94dvh - 76px); }
#gallery-viewer:has(#gallery-caption:not([hidden])) #gallery-index { bottom: auto; top: 6px; }
