.gallery-page {
  min-height: 100vh;
}

.gallery-page .site-header {
  position: sticky;
}

.gallery-hero {
  padding: 92px 0 48px;
  position: relative;
  overflow: hidden;
}

.gallery-hero::before,
.gallery-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(10px);
}

.gallery-hero::before {
  width: 380px;
  height: 380px;
  right: -170px;
  top: -170px;
  background: radial-gradient(circle, rgba(244, 192, 59, .16), transparent 68%);
}

.gallery-hero::after {
  width: 280px;
  height: 280px;
  left: -150px;
  bottom: -170px;
  background: radial-gradient(circle, rgba(244, 192, 59, .10), transparent 70%);
}

.gallery-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.gallery-hero h1 {
  margin: 12px 0 14px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: .98;
  letter-spacing: -.045em;
}

.gallery-hero p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.5vw, 18px);
}

.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.gallery-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}

.masonry-gallery {
  columns: 3;
  column-gap: 20px;
}

.gallery-item {
  width: 100%;
  margin: 0 0 20px;
  display: inline-block;
  break-inside: avoid;
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: zoom-in;
  isolation: isolate;
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 54%, rgba(0, 0, 0, .74) 100%);
  opacity: .88;
  transition: opacity .3s ease;
}

.gallery-item:hover::after {
  opacity: 1;
}

.gallery-item img,
.gallery-item video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg-3);
  transition: transform .45s ease;
}

.gallery-item:hover img,
.gallery-item:hover video {
  transform: scale(1.025);
}

.gallery-item video {
  min-height: 210px;
  object-fit: cover;
}

.gallery-caption {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
}

.gallery-caption strong {
  font-size: 14px;
  line-height: 1.35;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}

.gallery-type {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(244, 192, 59, .94);
  color: #111;
  font-size: 14px;
}

.gallery-empty {
  padding: 44px 22px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 20px;
  color: var(--muted);
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 8, .90);
  backdrop-filter: blur(18px);
}

.gallery-lightbox.show {
  display: grid;
}

.gallery-lightbox-stage {
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
  position: relative;
}

.gallery-lightbox-media {
  max-width: 100%;
  max-height: calc(100vh - 96px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  background: #05070b;
}

.gallery-lightbox-media img,
.gallery-lightbox-media video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 96px);
  object-fit: contain;
}

.gallery-lightbox-title {
  position: absolute;
  left: 18px;
  bottom: 18px;
  margin: 0;
  padding: 9px 12px;
  border-radius: 12px;
  color: #fff;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(10px);
  font-size: 14px;
}

.gallery-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.gallery-close:hover {
  background: rgba(244,192,59,.18);
  border-color: rgba(244,192,59,.42);
}

.gallery-footer-card {
  padding: 24px;
  text-align: center;
}

.gallery-footer-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

body.gallery-lightbox-open {
  overflow: hidden;
}

@media (max-width: 940px) {
  .masonry-gallery { columns: 2; }
}

@media (max-width: 620px) {
  .gallery-hero { padding: 66px 0 34px; }
  .gallery-hero h1 { font-size: clamp(38px, 13vw, 56px); }
  .gallery-toolbar { align-items: flex-start; flex-direction: column; }
  .masonry-gallery { columns: 1; column-gap: 0; }
  .gallery-item { margin-bottom: 16px; border-radius: 17px; }
  .gallery-lightbox { padding: 14px; }
  .gallery-close { top: 12px; right: 12px; }
}
