:root {
  --gallery-bg: #111613;
  --gallery-panel: rgba(246, 242, 232, .9);
  --gallery-ink: #f6f2e8;
  --gallery-muted: rgba(246, 242, 232, .64);
  --gallery-line: rgba(246, 242, 232, .3);
  --gallery-accent: #d7ff72;
  --gallery-focus: #72e0ff;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.gallery-body {
  margin: 0;
  background: var(--gallery-bg);
  color: var(--gallery-ink);
}

.gallery-shell {
  position: fixed;
  inset: 0;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(6, 8, 7, .2), rgba(6, 8, 7, .78)),
    var(--gallery-bg);
}

.upload-stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(215, 255, 114, .12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(114, 224, 255, .11) 1px, transparent 1px),
    radial-gradient(circle at 76% 24%, rgba(114, 224, 255, .18), transparent 30%),
    #111613;
  background-size: 42px 42px, 42px 42px, auto, auto;
  color: var(--gallery-ink);
}

.upload-stage.is-hidden {
  display: none;
}

.upload-panel {
  width: min(860px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid rgba(246, 242, 232, .24);
  background: rgba(17, 22, 19, .82);
  padding: clamp(22px, 4vw, 42px);
  box-shadow: 0 26px 110px rgba(0, 0, 0, .42);
  backdrop-filter: blur(20px);
}

.upload-back {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 26px;
  color: var(--gallery-muted);
  text-decoration: none;
  font-weight: 800;
}

.upload-back:hover {
  color: var(--gallery-accent);
}

.upload-kicker {
  margin: 0 0 8px;
  color: var(--gallery-focus);
  font-size: .77rem;
  font-weight: 850;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.upload-panel h1 {
  margin: 0;
  max-width: 760px;
  color: var(--gallery-ink);
  font-size: clamp(2.45rem, 8vw, 5.8rem);
  letter-spacing: 0;
}

.upload-lead {
  max-width: 680px;
  margin: 18px 0 28px;
  color: var(--gallery-muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.upload-dropzone {
  display: grid;
  gap: 8px;
  min-height: 164px;
  place-items: center;
  text-align: center;
  border: 1px dashed rgba(246, 242, 232, .44);
  background: rgba(246, 242, 232, .06);
  padding: 26px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragging {
  border-color: var(--gallery-accent);
  background: rgba(215, 255, 114, .09);
}

.upload-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-dropzone-title {
  color: var(--gallery-ink);
  font-size: clamp(1.1rem, 3vw, 1.75rem);
  font-weight: 850;
}

.upload-dropzone-note,
.upload-status {
  color: var(--gallery-muted);
  font-size: .94rem;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.upload-primary,
.upload-secondary {
  border: 1px solid var(--gallery-line);
  border-radius: 999px;
  min-height: 44px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.upload-primary {
  background: var(--gallery-accent);
  border-color: var(--gallery-accent);
  color: #111613;
}

.upload-primary:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.upload-secondary {
  background: transparent;
  color: var(--gallery-ink);
}

.upload-secondary:hover {
  border-color: var(--gallery-focus);
  color: var(--gallery-focus);
}

.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.upload-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(246, 242, 232, .18);
  background: rgba(246, 242, 232, .08);
}

.upload-preview-counter {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(246, 242, 232, .18);
  color: var(--gallery-muted);
  font-weight: 850;
}

#gallery-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.gallery-hud {
  position: fixed;
  top: 22px;
  left: 22px;
  right: 22px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: start;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}

.is-gallery-ready .gallery-hud {
  opacity: 1;
}

.gallery-back,
.gallery-start {
  pointer-events: auto;
  border: 1px solid var(--gallery-line);
  background: rgba(246, 242, 232, .1);
  color: var(--gallery-ink);
  border-radius: 999px;
  min-height: 42px;
  padding: 10px 15px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  backdrop-filter: blur(18px);
}

.gallery-back:hover,
.gallery-start:hover,
.gallery-start:focus-visible {
  border-color: var(--gallery-accent);
  color: var(--gallery-accent);
  outline: none;
}

.gallery-title {
  justify-self: center;
  text-align: center;
  text-shadow: 0 1px 18px rgba(0, 0, 0, .35);
}

.gallery-title p {
  margin: 0 0 2px;
  color: var(--gallery-muted);
  font-size: .73rem;
  font-weight: 850;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.gallery-title h1 {
  margin: 0;
  max-width: none;
  color: var(--gallery-ink);
  font-size: clamp(1.55rem, 3vw, 2.85rem);
  letter-spacing: 0;
}

.gallery-reticle {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(246, 242, 232, .78);
  border-radius: 50%;
  pointer-events: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.gallery-reticle::before,
.gallery-reticle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 1px;
  background: rgba(246, 242, 232, .78);
  transform: translate(-50%, -50%);
}

.gallery-reticle::after {
  width: 1px;
  height: 4px;
}

.is-hovering-photo .gallery-reticle {
  border-color: var(--gallery-accent);
  box-shadow: 0 0 0 7px rgba(215, 255, 114, .12);
  transform: translate(-50%, -50%) scale(1.25);
}

.gallery-help {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(620px, calc(100% - 44px));
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}

.is-gallery-ready .gallery-help {
  opacity: 1;
}

.gallery-help span {
  border: 1px solid rgba(246, 242, 232, .22);
  background: rgba(17, 22, 19, .42);
  color: var(--gallery-muted);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: .78rem;
  font-weight: 750;
  backdrop-filter: blur(14px);
}

.gallery-caption {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 5;
  width: min(360px, calc(100% - 44px));
  border: 1px solid rgba(246, 242, 232, .22);
  background: rgba(17, 22, 19, .68);
  backdrop-filter: blur(18px);
  padding: 18px;
  color: var(--gallery-ink);
}

.gallery-caption p {
  margin: 0 0 8px;
  color: var(--gallery-focus);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.gallery-caption h2 {
  margin: 0;
  color: var(--gallery-ink);
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  letter-spacing: 0;
}

.gallery-empty {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 8;
  width: min(460px, calc(100% - 44px));
  transform: translate(-50%, -50%);
  background: var(--gallery-panel);
  color: #111613;
  border: 1px solid rgba(17, 22, 19, .12);
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .34);
}

.gallery-empty h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  letter-spacing: 0;
}

.gallery-empty p {
  margin: 0;
  color: #4f554f;
}

.photo-focus {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  background: rgba(6, 8, 7, .74);
  backdrop-filter: blur(18px);
}

.photo-focus[hidden] {
  display: none;
}

.photo-focus-frame {
  width: min(1120px, 100%);
  max-height: min(82vh, 780px);
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  background: rgba(246, 242, 232, .94);
  color: #111613;
  border: 1px solid rgba(246, 242, 232, .42);
  box-shadow: 0 30px 120px rgba(0, 0, 0, .48);
}

.photo-focus-frame img {
  width: 100%;
  height: min(82vh, 780px);
  object-fit: contain;
  background: #0d110f;
}

.photo-focus-frame figcaption {
  align-self: end;
  padding: 24px;
}

.photo-focus-frame p {
  margin: 0 0 8px;
  color: rgba(17, 22, 19, .62);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.photo-focus-frame h2 {
  margin: 0;
  color: #111613;
  font-size: clamp(1.45rem, 3vw, 2.55rem);
  letter-spacing: 0;
}

.photo-focus-close {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 13;
  min-height: 42px;
  border: 1px solid rgba(246, 242, 232, .38);
  border-radius: 999px;
  background: rgba(17, 22, 19, .74);
  color: var(--gallery-ink);
  padding: 9px 14px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.photo-focus-close:hover,
.photo-focus-close:focus-visible {
  border-color: var(--gallery-accent);
  color: var(--gallery-accent);
  outline: none;
}

@media (max-width: 720px) {
  .upload-panel {
    max-height: calc(100vh - 28px);
  }

  .gallery-hud {
    top: 14px;
    left: 14px;
    right: 14px;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .gallery-title {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    text-align: left;
  }

  .gallery-back,
  .gallery-start {
    min-height: 38px;
    padding: 8px 12px;
    font-size: .88rem;
  }

  .gallery-help {
    left: 14px;
    bottom: 14px;
    max-width: calc(100% - 28px);
  }

  .gallery-help span {
    padding: 7px 9px;
  }

  .gallery-caption {
    right: 14px;
    bottom: 78px;
    width: calc(100% - 28px);
    padding: 15px;
  }

  .photo-focus-frame {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 28px);
    overflow: auto;
  }

  .photo-focus-frame img {
    height: auto;
    max-height: 64vh;
  }

  .photo-focus-frame figcaption {
    padding: 16px;
  }

  .photo-focus-close {
    top: 14px;
    right: 14px;
  }
}
