:root {
  --bg: #0d0f0c;
  --panel: #171914;
  --panel-2: #20231c;
  --ink: #f5f0e8;
  --muted: rgba(245, 240, 232, 0.68);
  --line: rgba(245, 240, 232, 0.14);
  --accent: #d7ff57;
  --accent-2: #ff7043;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.028) 1px, transparent 1px),
    radial-gradient(circle at 76% 14%, rgba(215,255,87,0.16), transparent 28%),
    radial-gradient(circle at 18% 86%, rgba(255,112,67,0.16), transparent 28%),
    var(--bg);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.gallery-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.gallery-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

.back-link,
.counter {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 13px;
  background: rgba(245, 240, 232, 0.06);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.24em;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-family: "Archivo", sans-serif;
  font-size: clamp(34px, 7vw, 84px);
  line-height: 0.9;
  letter-spacing: 0;
}

.viewer {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
}

.stage {
  margin: 0;
  min-height: min(68vh, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(245,240,232,0.08), rgba(245,240,232,0.02)),
    var(--panel);
  overflow: hidden;
}

.stage img {
  display: block;
  width: 100%;
  height: min(64vh, 680px);
  object-fit: contain;
  background: #070807;
  cursor: zoom-in;
}

figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  color: var(--muted);
  font-size: 12px;
}

#imageTitle {
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-button,
.lightbox-nav,
.close-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 240, 232, 0.08);
  color: var(--ink);
  cursor: pointer;
}

.nav-button {
  width: 58px;
  height: 58px;
  font-size: 38px;
}

.nav-button:hover,
.lightbox-nav:hover,
.close-button:hover,
.back-link:hover {
  background: var(--accent);
  color: #11130d;
}

.thumb-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.thumb {
  min-height: 118px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-2);
  cursor: pointer;
}

.thumb[aria-current="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(215,255,87,0.18);
}

.thumb img {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: cover;
}

.empty {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 240, 232, 0.06);
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.92);
  z-index: 20;
}

.lightbox[aria-hidden="false"] {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.close-button {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 46px;
  height: 46px;
  font-size: 30px;
  z-index: 22;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  width: 54px;
  height: 54px;
  transform: translateY(-50%);
  font-size: 36px;
  z-index: 22;
}

.lightbox-prev {
  left: 18px;
}

.lightbox-next {
  right: 18px;
}

@media (max-width: 720px) {
  .gallery-shell {
    width: min(100vw - 16px, 1180px);
    padding-top: 14px;
  }

  .gallery-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .counter {
    width: max-content;
  }

  .viewer {
    grid-template-columns: 1fr;
  }

  .nav-button {
    position: absolute;
    top: calc(50% - 42px);
    z-index: 3;
    width: 46px;
    height: 46px;
    background: rgba(0, 0, 0, 0.46);
  }

  .previous {
    left: 8px;
  }

  .next {
    right: 8px;
  }

  .stage {
    min-height: 0;
  }

  .stage img {
    height: 62vh;
  }

  figcaption {
    flex-direction: column;
  }

  .thumb-strip {
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  }

  .thumb,
  .thumb img {
    min-height: 92px;
    height: 92px;
  }
}
