:root {
  --bg: #05070b;
  --panel: rgba(11, 15, 22, 0.86);
  --panel-strong: rgba(14, 20, 30, 0.96);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef3f9;
  --muted: #9aa7b6;
  --accent: #e8b36a;
  --accent-soft: rgba(232, 179, 106, 0.14);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  background: linear-gradient(180deg, #05070b 0%, #070c13 52%, #04060a 100%);
  color: var(--text);
  color-scheme: dark;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.gallery-page {
  min-height: 100vh;
  padding: 30px 20px 72px;
}

.gallery-page__inner {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.gallery-hero {
  padding: 12px 0 28px;
}

.gallery-hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.gallery-eyebrow {
  margin: 14px 0 0;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.gallery-intro {
  max-width: 58rem;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.gallery-stream {
  column-count: 4;
  column-gap: 16px;
}

.photo-card {
  break-inside: avoid;
  margin: 0 0 16px;
}

.photo-card__button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.photo-card__frame {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(9, 13, 19, 0.92);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.32);
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.photo-card__button:hover .photo-card__frame {
  transform: translateY(-4px);
  border-color: rgba(232, 179, 106, 0.22);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.42);
}

.photo-card__image {
  width: 100%;
  height: auto;
}

.photo-card__title {
  margin: 10px 0 0;
  padding: 0 2px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.25;
  font-weight: 600;
  text-align: left;
}

.image-fallback {
  display: grid;
  width: 100%;
  min-height: 220px;
  place-items: center;
  padding: 20px;
  color: var(--muted);
  text-align: center;
  background: rgba(9, 13, 19, 0.92);
}

.gallery-empty {
  padding: 48px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
}

.gallery-empty p {
  margin: 0;
  color: var(--muted);
}

.viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 6, 10, 0.82);
  backdrop-filter: blur(18px);
}

.viewer-overlay[hidden] {
  display: none;
}

.viewer-shell {
  width: min(1540px, 100%);
  height: min(920px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.62);
}

.viewer-stage {
  position: relative;
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 26px 26px 82px;
  overflow: auto;
  background: #060910;
}

.viewer-image {
  margin: auto;
  max-width: 100%;
  max-height: min(calc(100vh - 154px), 100%);
  border-radius: 8px;
  object-fit: contain;
}

.viewer-close,
.viewer-nav {
  position: absolute;
  z-index: 2;
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(5, 8, 13, 0.72);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  backdrop-filter: blur(12px);
}

.viewer-close {
  top: 18px;
  right: 18px;
}

.viewer-nav {
  top: 50%;
  transform: translateY(-50%);
}

.viewer-nav--prev {
  left: 18px;
}

.viewer-nav--next {
  right: 18px;
}

.viewer-caption {
  position: absolute;
  right: 24px;
  bottom: 22px;
  left: 24px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.viewer-caption h2 {
  max-width: min(720px, 100%);
  margin: 0;
  padding: 10px 16px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(5, 8, 13, 0.68);
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  line-height: 1.2;
  text-align: center;
  backdrop-filter: blur(14px);
}

@media (max-width: 1120px) {
  .gallery-stream {
    column-count: 3;
  }
}

@media (max-width: 860px) {
  .gallery-page {
    padding: 22px 14px 48px;
  }

  .gallery-stream {
    column-count: 2;
  }

  .viewer-overlay {
    padding: 0;
  }

  .viewer-shell {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }

  .viewer-stage {
    min-height: 52vh;
    padding: 58px 14px 78px;
  }
}

@media (max-width: 560px) {
  .gallery-hero h1 {
    font-size: 2.7rem;
  }

  .gallery-stream {
    column-count: 1;
  }
}
