.gallery-page {
  --gal-ink: #141414;
  --gal-muted: #667085;
  --gal-brand: #e23d29;
  --gal-dark: #0f1115;
  --gal-card: #171a21;
  --gal-line: rgba(255, 255, 255, 0.08);
  margin-bottom: 80px;
}

.gallery-hero {
  position: relative;
  overflow: hidden;
  padding: 28px 0 18px;
  min-height: min(72vh, 720px);
  background:
    radial-gradient(ellipse 55% 45% at 72% 48%, rgba(90, 150, 255, 0.16), transparent 58%),
    radial-gradient(ellipse 40% 35% at 20% 30%, rgba(226, 61, 41, 0.12), transparent 50%),
    linear-gradient(180deg, #0b0c10 0%, #12151c 55%, #161a22 100%);
  color: #f5f5f4;
}

.gallery-hero-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.2fr);
  gap: 18px 28px;
  align-items: center;
  min-height: min(58vh, 560px);
}

.gallery-hero-copy {
  position: relative;
  z-index: 2;
  padding: 12px 0 24px;
}

.gallery-kicker {
  margin: 0 0 10px;
  color: #8eb6ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.gallery-hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.gallery-lead {
  margin: 0 0 16px;
  max-width: 34ch;
  color: #c8cdd8;
  font-size: 16px;
  line-height: 1.7;
}

.gallery-lead strong {
  color: #fff;
  font-weight: 700;
}

.gallery-hint {
  margin: 0;
  color: #8b93a7;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.gallery-hero-stage {
  position: relative;
  height: min(560px, 62vh);
  min-height: 320px;
}

.gallery-sphere-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  background: transparent;
}

.gallery-sphere-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

.gallery-sphere-empty {
  position: absolute;
  inset: 18% 12%;
  display: grid;
  place-items: center;
  color: #9ca3af;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.gallery-body {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 0;
}

.gallery-frames {
  width: auto;
  margin: 28px 16px 40px;
  padding: 0;
}

.gallery-frames-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 18px;
  padding: 0;
}

.gallery-frames-bar h2,
.gallery-toolbar h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  color: var(--gal-ink);
}

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

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.gallery-chip {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.gallery-chip.is-active,
.gallery-chip:hover {
  background: var(--gal-brand);
  border-color: var(--gal-brand);
  color: #fff;
}

.gallery-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(320px, 100%);
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.gallery-search input {
  flex: 1;
  border: 0;
  outline: none;
  font: inherit;
  background: transparent;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.gallery-card {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border: 0;
  padding: 0;
  border-radius: 0;
  background: #111;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gallery-card:hover {
  opacity: 0.92;
  transform: scale(1.01);
  z-index: 1;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-empty {
  margin: 28px 0;
  text-align: center;
  color: var(--gal-muted);
}

.gallery-more {
  margin: 28px 0 0;
  text-align: center;
  padding: 0;
}

@media (max-width: 991.98px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 14, 0.88);
}

.gallery-lightbox-inner {
  position: relative;
  width: min(920px, 100%);
  max-height: min(86vh, 900px);
}

.gallery-lightbox-inner img {
  display: block;
  width: 100%;
  max-height: min(78vh, 820px);
  object-fit: contain;
  border-radius: 12px;
  background: #000;
}

.gallery-lightbox-caption {
  margin: 12px 0 0;
  color: #fff;
  text-align: center;
  font-weight: 600;
}

.gallery-lightbox-close {
  position: absolute;
  top: -14px;
  right: -6px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  cursor: pointer;
}

.gallery-form-wrap {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto 70px;
  padding: 28px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(149, 157, 165, 0.16);
}

.gallery-field {
  margin-bottom: 16px;
}

.gallery-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.gallery-existing {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.gallery-existing-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.gallery-existing-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.gallery-existing-item label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px;
  font-size: 12px;
  background: #fafafa;
}

.gallery-error {
  margin: 8px 0 0;
  color: var(--gal-brand);
  font-size: 14px;
  font-weight: 600;
}

.gallery-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

[x-cloak] {
  display: none !important;
}

@media (max-width: 991.98px) {
  .gallery-hero-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .gallery-hero-stage {
    height: min(440px, 58vh);
    order: -1;
  }

  .gallery-hero-copy {
    text-align: left;
    padding-top: 0;
  }
}

@media (max-width: 767px) {
  .gallery-hero {
    padding-top: 18px;
    min-height: 0;
  }

  .gallery-frames {
    margin: 20px 10px 28px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .gallery-form-wrap {
    padding: 20px 16px;
  }
}
