.gallery-page { position: relative; min-height: 100vh; padding: 6.2rem 1.2rem 4.5rem; font-family: var(--font-localized, 'Outfit', sans-serif); overflow: hidden; }

.gallery-page__backdrop {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 15% 5%, rgba(var(--rgb-gallery-page-backdrop-background), 0.19), transparent 42%),
    radial-gradient(circle at 84% 18%, rgba(var(--rgb-gallery-page-backdrop-background-2), 0.18), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(var(--rgb-gallery-page-backdrop-background-3), 0.1), transparent 55%);
}

.gallery-page__shell { position: relative; z-index: 1; max-width: 1160px; margin: 0 auto; display: grid; gap: 1.2rem; }
.gallery-page__header { display: grid; gap: 0.7rem; text-align: center; animation: galleryFadeUp 0.75s ease both; }

.gallery-page__badge {
  justify-self: center; font-size: 0.72rem; letter-spacing: 0.14em; font-weight: 700;
  border-radius: 999px; padding: 0.34rem 0.9rem;
  color: var(--color-accent); border: 1px solid var(--color-border-strong);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.gallery-page__title { margin: 0; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -0.02em; color: var(--color-text-primary); }
.gallery-page__subtitle { margin: 0 auto; max-width: 700px; color: var(--color-text-secondary); font-size: 1rem; line-height: 1.75; }

.gallery-grid { --stagger-scale: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; justify-items: center; }

.gallery-card {
  width: 100%; max-width: 290px; display: grid; gap: 0.7rem; cursor: pointer;
  justify-items: center; transition: transform 0.25s ease;
  transform: translateY(calc(var(--stagger-y, 0px) * var(--stagger-scale)));
  opacity: 0;
  animation: galleryCardIn 0.7s cubic-bezier(.22,.61,.36,1) both;
}

.phone-frame {
  width: 100%; aspect-ratio: 9 / 19.5; position: relative; border-radius: 42px; padding: 10px;
  background: linear-gradient(145deg, rgb(var(--rgb-phone-frame-background)), rgb(var(--rgb-phone-frame-background-2)) 55%, rgb(var(--rgb-phone-frame-background)));
  box-shadow: 0 18px 36px color-mix(in srgb, var(--color-shadow-rgb) 70%, transparent), inset 0 0 0 1px rgba(var(--rgb-white), 0.22);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.phone-screen { width: 100%; height: 100%; object-fit: cover; border-radius: 34px; background: rgb(var(--rgb-phone-screen-background)); }

.phone-notch {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 34%; height: 22px; border-radius: 0 0 14px 14px; background: rgb(var(--rgb-phone-notch-background)); z-index: 2;
  box-shadow: 0 2px 8px rgba(var(--rgb-black), 0.35);
}

.gallery-card__name { margin: 0; font-size: 0.95rem; line-height: 1.3; color: var(--color-text-primary); text-align: center; transition: transform 0.3s ease, color 0.3s ease; }

.gallery-card:hover .phone-frame { transform: translateY(-6px) scale(1.015); box-shadow: 0 26px 40px color-mix(in srgb, var(--color-shadow-rgb) 78%, transparent), inset 0 0 0 1px rgba(var(--rgb-white), 0.22); }
.gallery-card:hover .gallery-card__name { transform: translateY(-3px); color: var(--color-accent); }

.preview {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: rgba(var(--rgb-preview-background), 0.8); backdrop-filter: blur(5px); padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
}
.preview.is-open { opacity: 1; pointer-events: auto; }

.preview__panel {
  position: relative; width: min(560px, 100%); border-radius: 20px;
  border: 1px solid var(--color-border-soft); background: var(--color-surface);
  padding: 1rem; display: grid; justify-items: center; gap: 0.85rem;
}
.preview.is-open .preview__panel { animation: previewPop 0.36s cubic-bezier(.22,.61,.36,1); }

.preview__phone-frame {
  width: min(320px, 100%); aspect-ratio: 9 / 19.5; position: relative; border-radius: 46px; padding: 12px;
  background: linear-gradient(145deg, rgb(var(--rgb-phone-frame-background)), rgb(var(--rgb-phone-frame-background-2)) 55%, rgb(var(--rgb-phone-frame-background)));
  box-shadow: 0 20px 44px rgba(var(--rgb-black), 0.35), inset 0 0 0 1px rgba(var(--rgb-white), 0.22);
  animation: floatPhone 2.8s ease-in-out infinite;
}

.preview__close {
  position: absolute; top: 0.65rem; inset-inline-end: 0.65rem; width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--color-border-soft); background: color-mix(in srgb, var(--color-bg-page) 92%, transparent);
  color: var(--color-text-primary); cursor: pointer;
}

.preview__title { margin: 0; color: var(--color-text-primary); font-size: 1.05rem; text-align: center; }

.preview__nav {
  position: fixed; top: 50%; transform: translateY(-50%); width: 44px; height: 44px;
  border: 1px solid var(--color-border-soft); border-radius: 999px; font-size: 1.7rem; color: rgb(var(--rgb-white));
  background: rgba(var(--rgb-preview-nav-background), 0.8); cursor: pointer;
}
.preview__nav--prev { left: 1rem; }
.preview__nav--next { right: 1rem; }

@keyframes galleryFadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes galleryCardIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes previewPop { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes floatPhone { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

@media (max-width: 1180px) { .gallery-grid { --stagger-scale: 0.82; grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .gallery-grid { --stagger-scale: 0.58; grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 640px) {
  .gallery-page { padding: 5.5rem 0.75rem 3.4rem; }
  .gallery-grid { --stagger-scale: 0; grid-template-columns: 1fr; }
  .gallery-card { max-width: 280px; transform: translateY(0) !important; }
  .preview__nav { display: none; }
}
