:root {
  color-scheme: light dark;
  --bg: #111;
  --fg: #eee;
  --muted: #aaa;
  --panel: #181818;
  --panel-hover: #202020;
  --topbar-bg: #141414;
  --line: #2a2a2a;
  --tile-bg: #1a1a1a;
  --panel-shadow: rgba(0, 0, 0, .4);
  --tile-hover-brightness: 1.06;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f4f4f4;
    --fg: #171717;
    --muted: #666;
    --panel: #fff;
    --panel-hover: #e9e9e9;
    --topbar-bg: #fafafa;
    --line: #d4d4d4;
    --tile-bg: #e5e5e5;
    --panel-shadow: rgba(0, 0, 0, .16);
    --tile-hover-brightness: .94;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111;
  --fg: #eee;
  --muted: #aaa;
  --panel: #181818;
  --panel-hover: #202020;
  --topbar-bg: #141414;
  --line: #2a2a2a;
  --tile-bg: #1a1a1a;
  --panel-shadow: rgba(0, 0, 0, .4);
  --tile-hover-brightness: 1.06;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f4;
  --fg: #171717;
  --muted: #666;
  --panel: #fff;
  --panel-hover: #e9e9e9;
  --topbar-bg: #fafafa;
  --line: #d4d4d4;
  --tile-bg: #e5e5e5;
  --panel-shadow: rgba(0, 0, 0, .16);
  --tile-hover-brightness: .94;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--fg); }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-y: scroll;
}
#gallery-content { display: contents; }
#gallery-content[hidden],
#password-gate[hidden] { display: none; }
#password-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}
.password-card {
  width: min(100%, 24rem);
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--topbar-bg);
  box-shadow: 0 .75rem 2.5rem var(--panel-shadow);
  text-align: center;
}
.password-card h1 {
  margin: 0 0 .45rem;
  font-size: 1.25rem;
}
.password-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.45;
}
#password-form {
  display: grid;
  gap: .7rem;
}
.password-label {
  color: var(--fg);
  font-size: .9rem;
  font-weight: 600;
  text-align: left;
}
#gallery-password {
  width: 100%;
  min-height: 2.75rem;
  padding: .6rem .75rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  text-align: left;
}
#gallery-password:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
#password-submit {
  min-height: 2.75rem;
  padding: .6rem .9rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}
#password-submit:hover,
#password-submit:focus-visible { background: var(--panel-hover); }
#password-submit:disabled,
#gallery-password:disabled {
  cursor: wait;
  opacity: .7;
}
#password-status {
  min-height: 1.25rem;
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}
#password-status.password-error { color: #d94a4a; }
.password-noscript {
  margin: 2rem auto;
  padding: 1rem;
  max-width: 32rem;
  text-align: center;
}
#topbar {
  padding:
    calc(.85rem + env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    .35rem
    max(1rem, env(safe-area-inset-left));
  background: var(--topbar-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
#topbar-main {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
#topbar h1 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
}
.page-credit {
  margin-left: .55rem;
  font-size: .68rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}
.page-credit a {
  color: inherit;
  text-decoration: none;
  opacity: .72;
}
.page-credit a:hover, .page-credit a:focus-visible {
  opacity: 1;
  text-decoration: underline;
}
#meta {
  position: relative;
  z-index: 9;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .9rem;
  align-items: center;
  width: 100%;
  padding:
    0
    max(1rem, env(safe-area-inset-right))
    .9rem
    max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
}
#count {
  color: var(--muted);
  font-size: .92rem;
}
.custom-html {
  width: 100%;
  padding:
    .9rem
    max(1rem, env(safe-area-inset-right))
    .9rem
    max(1rem, env(safe-area-inset-left));
  overflow-wrap: anywhere;
  background: var(--topbar-bg);
  color: var(--fg);
}
.custom-html-inner {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  text-align: center;
}
.custom-html-inner > :first-child { margin-top: 0; }
.custom-html-inner > :last-child { margin-bottom: 0; }
.custom-html a {
  color: inherit;
  text-underline-offset: .15em;
}
#custom-header-html { border-bottom: 1px solid var(--line); }
#custom-footer-html {
  border-top: 1px solid var(--line);
  padding-bottom: calc(.9rem + env(safe-area-inset-bottom));
}
#topnav,
#page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}
#topnav {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
#sort-controls {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
#sort-controls[hidden],
#reshuffle[hidden] {
  display: none;
}
#sort-mode,
#reshuffle {
  min-height: 2.3rem;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .45rem;
  font: .88rem/1 system-ui, sans-serif;
}
#sort-mode {
  width: 11rem;
  max-width: calc(100vw - 2rem);
  padding: .35rem 1.75rem .35rem .55rem;
  cursor: pointer;
}
#reshuffle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  padding: 0;
  cursor: pointer;
  font-size: 1.2rem;
}
#sort-mode:hover, #sort-mode:focus-visible,
#reshuffle:hover, #reshuffle:focus-visible {
  background: var(--panel-hover);
}
#sort-mode:disabled, #reshuffle:disabled {
  cursor: progress;
  opacity: .65;
}
.top-link {
  color: inherit;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .45rem;
  padding: .35rem .6rem;
  font-size: .92rem;
}
.top-link:hover, .top-link:focus-visible {
  background: var(--panel-hover);
}
#theme-toggle,
#gallery-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .45rem;
  cursor: pointer;
  user-select: none;
  font: 1.15rem/1 system-ui, sans-serif;
}
#theme-toggle:hover, #theme-toggle:focus-visible,
#gallery-lock:hover, #gallery-lock:focus-visible {
  background: var(--panel-hover);
}
#gallery-lock svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#children-menu {
  position: relative;
}
#children-menu[open] {
  z-index: 30;
}
#children-menu[open]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: transparent;
}
#children-toggle {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .45rem;
  cursor: pointer;
  user-select: none;
  font-size: 1.15rem;
  line-height: 1;
}
#children-toggle::-webkit-details-marker {
  display: none;
}
#children-toggle::marker {
  content: "";
}
#children-toggle:hover, #children-toggle:focus-visible {
  background: var(--panel-hover);
}
#children-menu[open] #children-toggle {
  position: relative;
  z-index: 1;
}
#children-panel {
  position: absolute;
  top: calc(100% + .45rem);
  right: 0;
  width: min(24rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  max-height: min(70vh, 36rem);
  overflow: auto;
  padding: .85rem;
  background: var(--topbar-bg);
  border: 1px solid var(--line);
  border-radius: .55rem;
  box-shadow: 0 .5rem 1.5rem var(--panel-shadow);
  z-index: 1;
}
#children-panel h2 {
  margin: 0 0 .6rem;
  font-size: .95rem;
  color: var(--muted);
  font-weight: 600;
}
#children-panel ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: 0;
  padding: 0;
}
#children-panel a {
  display: block;
  color: inherit;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .45rem;
  padding: .45rem .65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#children-panel a:hover, #children-panel a:focus-visible {
  background: var(--panel-hover);
}
#gallery {
  width: 100%;
  position: relative;
  min-height: 1px;
  overflow-anchor: none;
}
.gallery-row {
  position: absolute;
  left: env(safe-area-inset-left);
  right: env(safe-area-inset-right);
  width: auto;
  display: flex;
  gap: 0;
  overflow: hidden;
  contain: layout paint style;
}
.geometry-load-error {
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--fg);
  text-align: center;
}
.geometry-load-error-inner {
  position: sticky;
  top: calc(4.75rem + env(safe-area-inset-top));
  display: grid;
  justify-items: center;
  gap: .55rem;
  margin: 0 auto;
  max-width: 32rem;
}
.geometry-load-error p { margin: 0; }
.geometry-load-error-detail {
  color: var(--muted);
  font-size: .82rem;
  overflow-wrap: anywhere;
}
.geometry-load-error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
}
.geometry-load-error button {
  min-height: 2.35rem;
  padding: .45rem .75rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--panel-hover);
  color: var(--fg);
  cursor: pointer;
  font: inherit;
}
.geometry-load-error button:hover,
.geometry-load-error button:focus-visible { filter: brightness(1.12); }
.tile {
  display: block;
  min-width: 0;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: var(--tile-bg);
  overflow: hidden;
  text-decoration: none;
  position: relative;
}
.tile.image-loading::before {
  content: "Loading image\2026";
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: .75rem;
  background: transparent;
  color: #fff;
  font-size: .82rem;
  text-align: center;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, .9),
    0 0 10px rgba(0, 0, 0, .65);
  pointer-events: none;
}
.tile.load-error::after {
  content: "Tap to retry";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: .75rem;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: .85rem;
  text-align: center;
  pointer-events: none;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--tile-bg);
  opacity: 0;
  transform: scale(1);
  filter: brightness(1);
  transition: transform 120ms ease, filter 120ms ease;
}
.tile.image-loaded img {
  opacity: 1;
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(255,255,255,.12), transparent 42%),
    linear-gradient(145deg, #252525, #111);
  color: rgba(255, 255, 255, .72);
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.tile.video-no-poster .video-placeholder { display: grid; }
.tile.video-no-poster img { display: none; }
.video-play-indicator {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: clamp(2.3rem, 18%, 4.2rem);
  aspect-ratio: 1;
  display: none;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  background: rgba(0, 0, 0, .56);
  color: #fff;
  box-shadow: 0 .2rem 1rem rgba(0, 0, 0, .4);
  transform: translate(-50%, -50%);
  pointer-events: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.video-play-indicator svg {
  width: 46%;
  height: 46%;
  margin-left: 7%;
  fill: currentColor;
}
.tile.video-tile.image-loaded .video-play-indicator,
.tile.video-tile.video-no-poster .video-play-indicator { display: grid; }
.tile-tooltip {
  position: absolute;
  left: 50%;
  bottom: .45rem;
  z-index: 4;
  max-width: calc(100% - .7rem);
  padding: .28rem .45rem;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: .35rem;
  background: rgba(0, 0, 0, .82);
  color: #eee;
  box-shadow: 0 .2rem .65rem rgba(0, 0, 0, .3);
  font-size: .76rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, .2rem);
  transition:
    opacity 80ms ease,
    transform 80ms ease,
    visibility 0s linear 80ms;
}
.tile.tooltip-visible .tile-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
@media (hover: hover) {
  .tile.image-loaded:hover img,
  .tile.image-loaded:focus-visible img {
    transform: scale(1.025);
    filter: brightness(var(--tile-hover-brightness));
  }
}
@media (prefers-reduced-motion: reduce) {
  .tile img {
    transition: none;
  }
}
#empty {
  display: none;
  padding: 2rem 1rem;
  color: var(--muted);
}
#empty.gallery-load-failure {
  color: var(--fg);
}
.empty-error-detail {
  display: block;
  margin: 0.75rem 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.empty-retry {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.45rem 0.8rem;
  color: var(--fg);
  background: var(--panel);
  cursor: pointer;
}
#client-diagnostics {
  position: fixed;
  left: max(.5rem, env(safe-area-inset-left));
  bottom: max(.5rem, env(safe-area-inset-bottom));
  z-index: 1000;
  margin: 0;
  padding: .5rem .6rem;
  max-width: calc(100vw - 1rem);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: .4rem;
  background: rgba(0, 0, 0, .78);
  color: #eee;
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  pointer-events: none;
  user-select: text;
  -webkit-user-select: text;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#lightbox {
  --exif-panel-width: clamp(17rem, 24vw, 23rem);
  --drawer-control-offset: 0px;
  --drawer-transition: 220ms cubic-bezier(.2, .75, .25, 1);
  --corner-control-size: clamp(2.75rem, 2.5vw, 4rem);
  --secondary-control-size: clamp(1.95rem, 1.75vw, 2.8rem);
  --secondary-control-inset: clamp(.4rem, .375vw, .6rem);
  --corner-control-gap: clamp(.5rem, .35vw, .75rem);
  position: fixed;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100vw;
  width: 100dvw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  background: transparent;
  color: white;
  isolation: isolate;
  touch-action: auto;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
#lightbox::backdrop { background: rgba(0, 0, 0, 0.86); }
#lightbox-shell {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  touch-action: auto;
  overscroll-behavior: none;
}
#lightbox-stage {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding:
    max(.5rem, env(safe-area-inset-top))
    max(.5rem, env(safe-area-inset-right))
    max(.5rem, env(safe-area-inset-bottom))
    max(.5rem, env(safe-area-inset-left));
  cursor: default;
  touch-action: none;
  overscroll-behavior: contain;
}
#lightbox-image {
  position: relative;
  z-index: 0;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  cursor: zoom-in;
}
#lightbox-image.animated {
  will-change: auto;
}
#lightbox-image.animation-proxy {
  opacity: 0;
}
.lightbox-animation {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  margin: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform: none;
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
#lightbox-video {
  position: relative;
  z-index: 0;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
  touch-action: auto;
}
#lightbox-image[hidden],
#lightbox-video[hidden] { display: none; }
#video-playback-error {
  position: absolute;
  z-index: 5;
  width: min(30rem, calc(100% - 2rem));
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: .65rem;
  background: rgba(18, 18, 18, .92);
  color: #f2f2f2;
  box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .45);
  text-align: center;
}
#video-playback-error[hidden] { display: none; }
#video-playback-error p { margin: 0; line-height: 1.45; }
.video-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  margin-top: .85rem;
}
.video-fallback-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: .45rem .75rem;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: .45rem;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  text-decoration: none;
}
.video-fallback-actions a:hover,
.video-fallback-actions a:focus-visible {
  background: rgba(255, 255, 255, .2);
}
#lightbox.video-active #lightbox-stage { touch-action: auto; }
#lightbox-image.zoomed { cursor: grab; }
#lightbox-image.dragging { cursor: grabbing; }
#lightbox-caption {
  grid-column: 1;
  grid-row: 2;
  padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom));
  min-height: 2rem;
  text-align: center;
  font-size: .875rem;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#lightbox-exif {
  position: absolute;
  z-index: 25;
  inset: 0 0 0 auto;
  width: var(--exif-panel-width);
  box-sizing: border-box;
  overflow: auto;
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom))
    1rem;
  border-left: 1px solid rgba(255, 255, 255, .14);
  background: rgba(18, 18, 18, .96);
  color: #eee;
  box-shadow: -.75rem 0 2rem rgba(0, 0, 0, .35);
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(100%, 0, 0);
  transition:
    transform var(--drawer-transition),
    opacity var(--drawer-transition),
    visibility 0s linear 220ms;
}
#lightbox.exif-open {
  --drawer-control-offset: var(--exif-panel-width);
}
#lightbox.exif-open #lightbox-exif {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  transition-delay: 0s;
}
#lightbox-exif h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}
#lightbox-exif-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .2rem;
  margin: 0;
}
#lightbox-exif-list dt {
  margin-top: .65rem;
  color: #aaa;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .025em;
}
#lightbox-exif-list dd {
  margin: 0;
  color: #f2f2f2;
  font-size: .9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
#lightbox-exif-status {
  margin: 1rem 0 0;
  color: #aaa;
  font-size: .8rem;
  line-height: 1.35;
}
.nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  z-index: 20;
  width: 3rem;
  height: 5rem;
  border: 0;
  border-radius: .35rem;
  background: rgba(0,0,0,.35);
  color: white;
  font: 2rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.nav:hover, .nav:focus-visible { background: rgba(0,0,0,.65); }
#prev { left: .5rem; }
#next {
  right: calc(var(--drawer-control-offset) + .5rem);
  transition: right var(--drawer-transition), background-color 120ms ease;
}
#download-original,
#lightbox-info-toggle,
#close {
  position: absolute;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition:
    right var(--drawer-transition),
    background-color 120ms ease,
    border-color 120ms ease;
}
#download-original,
#lightbox-info-toggle {
  top: calc(
    max(.5rem, env(safe-area-inset-top))
    + var(--secondary-control-inset)
  );
  width: var(--secondary-control-size);
  height: var(--secondary-control-size);
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, .42);
  background: rgba(128, 128, 128, .68);
  box-shadow: 0 1px .4rem rgba(0, 0, 0, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
#download-original:hover,
#download-original:focus-visible,
#lightbox-info-toggle:hover,
#lightbox-info-toggle:focus-visible {
  border-color: rgba(255, 255, 255, .68);
  background: rgba(156, 156, 156, .84);
}
#close:hover,
#close:focus-visible {
  background: rgba(0,0,0,.7);
}
#download-original {
  right: calc(
    var(--drawer-control-offset)
    + max(.5rem, env(safe-area-inset-right))
    + var(--corner-control-size)
    + var(--corner-control-gap)
    + var(--secondary-control-size)
    + var(--corner-control-gap)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
#download-original svg {
  display: block;
  width: 66%;
  height: 66%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
#lightbox-info-toggle {
  right: calc(
    var(--drawer-control-offset)
    +
    max(.5rem, env(safe-area-inset-right))
    + var(--corner-control-size)
    + var(--corner-control-gap)
  );
}
#lightbox-info-toggle svg {
  display: block;
  width: 72%;
  height: 72%;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  pointer-events: none;
}
#lightbox-info-toggle[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, .72);
  background: rgba(168, 168, 168, .84);
  color: white;
}
#close {
  top: max(.5rem, env(safe-area-inset-top));
  right: calc(
    var(--drawer-control-offset)
    + max(.5rem, env(safe-area-inset-right))
  );
  width: var(--corner-control-size);
  height: var(--corner-control-size);
  border: 0;
  background: rgba(0,0,0,.45);
  font: clamp(1.6rem, 1.35vw, 2.2rem)/1 system-ui, sans-serif;
}
@media (max-width: 52rem) {
  #lightbox.exif-open { --drawer-control-offset: 0px; }
  #lightbox-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  #lightbox-stage {
    grid-column: 1;
    grid-row: 1;
  }
  #lightbox-caption {
    grid-column: 1;
    grid-row: 2;
  }
  #lightbox-exif {
    inset: auto 0 0;
    width: auto;
    height: min(55dvh, 30rem);
    max-height: calc(100dvh - 4.5rem);
    padding:
      .75rem
      max(1rem, env(safe-area-inset-right))
      max(.75rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
    border-top: 1px solid rgba(255, 255, 255, .14);
    border-left: 0;
    box-shadow: 0 -.75rem 2rem rgba(0, 0, 0, .35);
    transform: translate3d(0, 100%, 0);
  }
  #lightbox.exif-open #lightbox-exif {
    transform: translate3d(0, 0, 0);
  }
  #lightbox-exif h2 { margin-bottom: .35rem; }
  #lightbox-exif-list {
    grid-template-columns: minmax(8rem, .8fr) minmax(0, 1.2fr);
    column-gap: .75rem;
  }
  #lightbox-exif-list dt { margin-top: .35rem; }
  #lightbox-exif-list dd { margin-top: .35rem; }
}
@media (max-width: 32rem) {
  #meta {
    flex-wrap: wrap;
  }
  #topnav {
    min-width: 0;
  }
  #children-panel {
    width: calc(100vw - 2rem);
  }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  #lightbox-exif,
  #next,
  #download-original,
  #lightbox-info-toggle,
  #close { transition: none !important; }
}