/* =====================================================
   Lumora Gallery - Professional Responsive Gallery CSS
   Beginner-friendly comments are included throughout.
   ===================================================== */

/* Design tokens required by the platform */
:root {
  --background: 252 70% 97%;
  --foreground: 235 35% 13%;
  --primary: 265 88% 58%;
  --primary-foreground: 0 0% 100%;
  --secondary: 190 88% 50%;
  --secondary-foreground: 235 35% 13%;
  --muted: 240 18% 92%;
  --muted-foreground: 238 12% 42%;
  --destructive: 0 78% 58%;
  --border: 240 22% 84%;
  --card: 0 0% 100%;

  --shadow-sm: 0 8px 24px hsl(235 35% 13% / 0.08);
  --shadow-md: 0 18px 45px hsl(235 35% 13% / 0.14);
  --shadow-lg: 0 30px 80px hsl(235 35% 13% / 0.24);

  --transition-fast: 180ms ease;
  --transition-smooth: 350ms cubic-bezier(0.2, 0.8, 0.2, 1);

  --radius-sm: 12px;
  --radius-md: 22px;
  --radius-lg: 34px;
}

/* Dark mode token overrides */
.dark {
  --background: 235 38% 9%;
  --foreground: 240 35% 96%;
  --primary: 270 95% 68%;
  --primary-foreground: 0 0% 100%;
  --secondary: 188 90% 56%;
  --secondary-foreground: 235 38% 9%;
  --muted: 236 24% 18%;
  --muted-foreground: 240 16% 74%;
  --destructive: 0 84% 64%;
  --border: 238 20% 28%;
  --card: 236 30% 14%;

  --shadow-sm: 0 8px 24px hsl(0 0% 0% / 0.24);
  --shadow-md: 0 18px 45px hsl(0 0% 0% / 0.34);
  --shadow-lg: 0 30px 80px hsl(0 0% 0% / 0.5);
}

/* Basic reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: hsl(var(--foreground));
  background:
    radial-gradient(circle at top left, hsl(var(--primary) / 0.22), transparent 32rem),
    radial-gradient(circle at bottom right, hsl(var(--secondary) / 0.2), transparent 30rem),
    linear-gradient(135deg, hsl(var(--background)), hsl(var(--muted)));
  overflow-x: hidden;
}

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

button {
  font-family: inherit;
}

/* Loading screen */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: hsl(var(--background));
  transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-card {
  display: grid;
  gap: 1rem;
  place-items: center;
  padding: 2rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--card) / 0.78);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.spinner {
  width: 54px;
  height: 54px;
  border: 5px solid hsl(var(--primary) / 0.16);
  border-top-color: hsl(var(--primary));
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Shared layout shell */
.section-shell {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
  background: hsl(var(--background) / 0.72);
  border-bottom: 1px solid hsl(var(--border) / 0.7);
  backdrop-filter: blur(18px);
}

.nav-container {
  min-height: 72px;
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: hsl(var(--foreground));
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: hsl(var(--primary-foreground));
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  50% { transform: rotate(12deg) scale(1.06); }
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.nav-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.9rem;
  border-radius: 999px;
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
}

.theme-toggle,
.primary-btn,
.secondary-btn,
.filter-btn {
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 0.9rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  color: hsl(var(--foreground));
  background: hsl(var(--card) / 0.72);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  border-color: hsl(var(--primary) / 0.55);
}

.theme-text {
  display: none;
}

/* Hero */
.hero {
  display: grid;
  gap: 2rem;
  align-items: center;
  padding: 4rem 0 2.5rem;
}

.eyebrow {
  color: hsl(var(--primary));
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero h1,
.section-heading h2,
.showcase h2 {
  font-family: "Playfair Display", Georgia, serif;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero h1 {
  max-width: 760px;
  margin-top: 0.8rem;
  font-size: clamp(2.5rem, 12vw, 5.7rem);
}

.hero-description {
  max-width: 650px;
  margin-top: 1.2rem;
  color: hsl(var(--muted-foreground));
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.8rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.hero-stats span {
  padding: 0.7rem 0.9rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--card) / 0.62);
  color: hsl(var(--muted-foreground));
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.hero-stats strong {
  color: hsl(var(--primary));
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.2rem;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.primary-btn {
  color: hsl(var(--primary-foreground));
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
  box-shadow: var(--shadow-md);
}

.secondary-btn {
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.72);
}

.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-3px);
}

.hero-preview {
  min-height: 430px;
  position: relative;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, hsl(var(--card) / 0.72), hsl(var(--card) / 0.28));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.hero-preview::before {
  content: "";
  position: absolute;
  inset: 12%;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.28), hsl(var(--secondary) / 0.24));
  filter: blur(30px);
  border-radius: 999px;
  animation: glowMove 6s ease-in-out infinite;
}

.orbit-ring {
  position: absolute;
  inset: 55px;
  border: 1px dashed hsl(var(--primary) / 0.36);
  border-radius: 50%;
  animation: rotateRing 18s linear infinite;
}

@keyframes rotateRing {
  to { transform: rotate(360deg); }
}

@keyframes glowMove {
  50% { transform: scale(1.18) translateY(-10px); filter: blur(42px); }
}

.preview-card {
  position: absolute;
  display: grid;
  place-items: center;
  gap: 0.45rem;
  width: 145px;
  height: 145px;
  border: 1px solid hsl(var(--border) / 0.8);
  border-radius: 30px;
  background: hsl(var(--card) / 0.64);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  animation: floatCard 5s ease-in-out infinite;
}

.preview-card span {
  font-size: 2.6rem;
}

.preview-card p {
  font-weight: 800;
}

.preview-one {
  top: 32px;
  left: 30px;
}

.preview-two {
  right: 28px;
  top: 105px;
  animation-delay: 700ms;
}

.preview-three {
  left: 76px;
  bottom: 34px;
  animation-delay: 1300ms;
}

.preview-four {
  right: 44px;
  bottom: 36px;
  animation-delay: 1900ms;
}

@keyframes floatCard {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-14px) rotate(2deg); }
}

/* Category filters */
.categories,
.gallery-section,
.reels-section,
.showcase {
  padding: 2.5rem 0;
}

.section-heading {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.3rem;
}

.section-heading h2 {
  font-size: clamp(2rem, 7vw, 3.5rem);
}

.filter-buttons {
  display: flex;
  gap: 0.8rem;
  overflow-x: auto;
  padding: 0.2rem 0 0.8rem;
  scrollbar-width: thin;
}

.filter-btn {
  flex: 0 0 auto;
  padding: 0 1.1rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  color: hsl(var(--foreground));
  background: hsl(var(--card) / 0.68);
  font-weight: 800;
  transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.filter-btn:hover,
.filter-btn.active {
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  transform: translateY(-2px);
}

/* Gallery grid */
.gallery-heading {
  align-items: end;
}

.gallery-note {
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.gallery-card {
  position: relative;
  min-height: 310px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  background: hsl(var(--card));
  box-shadow: var(--shadow-sm);
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  animation: enterGallery 620ms var(--transition-smooth) forwards;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-fast);
}

@keyframes enterGallery {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.gallery-card:hover,
.gallery-card:focus-visible {
  border-color: hsl(var(--primary) / 0.5);
  box-shadow: var(--shadow-lg);
  transform: translateY(-8px) scale(1.01);
  outline: none;
}

.gallery-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background-size: cover;
  background-position: center;
  transition: transform var(--transition-smooth), filter var(--transition-smooth);
}

.gallery-art::after,
.reel-art::after,
.lightbox-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 15%, hsl(0 0% 100% / 0.18), transparent 26%),
    linear-gradient(to top, hsl(235 35% 7% / 0.42), transparent 58%);
  pointer-events: none;
}

.gallery-art span,
.reel-art span,
.lightbox-art span {
  position: relative;
  z-index: 1;
}

.gallery-art span {
  font-size: 3.8rem;
  opacity: 0.9;
  filter: drop-shadow(0 18px 28px hsl(0 0% 0% / 0.34));
  transition: transform var(--transition-smooth), opacity var(--transition-smooth);
}

.gallery-shine {
  position: absolute;
  inset: -40% auto auto -45%;
  width: 60%;
  height: 180%;
  background: linear-gradient(90deg, transparent, hsl(0 0% 100% / 0.28), transparent);
  transform: rotate(24deg);
  transition: left 650ms ease;
}

.gallery-card:hover .gallery-shine,
.gallery-card:focus-visible .gallery-shine {
  left: 110%;
}

.gallery-card:hover .gallery-art {
  transform: scale(1.08);
  filter: saturate(1.18) contrast(1.05);
}

.gallery-card:hover .gallery-art span {
  transform: scale(1.14) rotate(5deg);
  opacity: 1;
}

.gallery-overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 5rem 1.1rem 1.1rem;
  color: white;
  background: linear-gradient(to top, hsl(235 35% 8% / 0.9), transparent);
}

.gallery-overlay span {
  display: inline-flex;
  margin-bottom: 0.55rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: white;
  background: hsl(0 0% 100% / 0.18);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: capitalize;
  backdrop-filter: blur(12px);
}

.gallery-overlay h3 {
  font-size: 1.25rem;
  margin-bottom: 0.3rem;
}

.gallery-overlay p {
  color: hsl(0 0% 100% / 0.82);
  line-height: 1.5;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--card) / 0.55);
}

.empty-state span {
  font-size: 3rem;
}

.empty-state h3 {
  margin: 0.8rem 0 0.4rem;
}

.empty-state p {
  color: hsl(var(--muted-foreground));
}

/* Reels style vertical image viewer */
.reels-frame {
  padding: 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, hsl(var(--card) / 0.7), hsl(var(--primary) / 0.08));
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.reels-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 78vw);
  gap: 1rem;
  overflow-x: auto;
  padding: 0.25rem 0.15rem 1rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.reel-card {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid hsl(0 0% 100% / 0.18);
  border-radius: 30px;
  background: hsl(var(--card));
  box-shadow: var(--shadow-sm);
  scroll-snap-align: center;
  transform: translateY(18px);
  opacity: 0;
  animation: enterGallery 620ms var(--transition-smooth) forwards;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.reel-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.reel-art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background-size: cover;
  background-position: center;
  transition: transform var(--transition-smooth), filter var(--transition-smooth);
}

.reel-art span {
  font-size: clamp(4.2rem, 18vw, 7.5rem);
  opacity: 0.9;
  filter: drop-shadow(0 24px 38px hsl(0 0% 0% / 0.32));
  animation: reelIconFloat 4s ease-in-out infinite;
}

@keyframes reelIconFloat {
  50% { transform: translateY(-12px) scale(1.08); }
}

.reel-card:hover .reel-art {
  transform: scale(1.06);
  filter: saturate(1.15) contrast(1.05);
}

.reel-content {
  position: absolute;
  inset: auto 0 0;
  padding: 7rem 1.15rem 1.15rem;
  color: white;
  background: linear-gradient(to top, hsl(235 35% 6% / 0.92), hsl(235 35% 6% / 0.42), transparent);
}

.reel-pill {
  display: inline-flex;
  margin-bottom: 0.65rem;
  padding: 0.36rem 0.78rem;
  border-radius: 999px;
  background: hsl(0 0% 100% / 0.18);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: capitalize;
  backdrop-filter: blur(12px);
}

.reel-content h3 {
  font-size: 1.45rem;
  margin-bottom: 0.35rem;
}

.reel-content p {
  color: hsl(0 0% 100% / 0.84);
  line-height: 1.55;
}

.reel-open {
  min-height: 44px;
  margin-top: 1rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 999px;
  color: hsl(var(--primary-foreground));
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 30px hsl(0 0% 0% / 0.18);
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.reel-open:hover,
.reel-open:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

/* Showcase */
.showcase-card {
  padding: 2rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, hsl(var(--card) / 0.72), hsl(var(--primary) / 0.12));
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.showcase-card p:last-child {
  max-width: 780px;
  margin-top: 1rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.75;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox.active {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: hsl(235 35% 5% / 0.82);
  backdrop-filter: blur(12px);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: center;
  animation: modalPop 260ms ease both;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94) translateY(18px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.lightbox-image-wrap {
  overflow: hidden;
  border: 1px solid hsl(0 0% 100% / 0.18);
  border-radius: var(--radius-lg);
  background: hsl(var(--card));
  box-shadow: var(--shadow-lg);
}

.lightbox-art {
  position: relative;
  min-height: 360px;
  display: grid;
  place-items: center;
  background-size: cover;
  background-position: center;
}

.lightbox-art span {
  font-size: clamp(4.6rem, 18vw, 9rem);
  opacity: 0.92;
  filter: drop-shadow(0 24px 38px hsl(0 0% 0% / 0.32));
}

.lightbox-caption {
  padding: 1.2rem;
  background: hsl(var(--card));
}

.lightbox-caption span {
  display: inline-flex;
  margin-bottom: 0.6rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.12);
  font-weight: 800;
  text-transform: capitalize;
}

.lightbox-caption h3 {
  font-size: clamp(1.4rem, 5vw, 2.4rem);
}

.lightbox-caption p {
  margin-top: 0.45rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.65;
}

.lightbox-close,
.lightbox-nav {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid hsl(0 0% 100% / 0.24);
  color: white;
  background: hsl(0 0% 100% / 0.14);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.lightbox-close:hover,
.lightbox-nav:hover {
  transform: scale(1.06);
  background: hsl(var(--primary));
}

.lightbox-close {
  position: absolute;
  top: -58px;
  right: 0;
  font-size: 1.15rem;
}

.lightbox-nav {
  font-size: 2rem;
}

.prev,
.next {
  justify-self: center;
}

/* Footer */
.footer {
  padding: 2rem 1rem calc(2rem + env(safe-area-inset-bottom));
  text-align: center;
  color: hsl(var(--muted-foreground));
}

/* Tablet screens */
@media (min-width: 640px) {
  .theme-text {
    display: inline;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .reels-track {
    grid-auto-columns: 340px;
  }

  .lightbox-content {
    grid-template-columns: 56px 1fr 56px;
  }

  .prev {
    grid-column: 1;
    grid-row: 1;
  }

  .lightbox-image-wrap {
    grid-column: 2;
    grid-row: 1;
  }

  .next {
    grid-column: 3;
    grid-row: 1;
  }
}

/* Desktop screens */
@media (min-width: 900px) {
  .nav-links {
    display: flex;
  }

  .hero {
    grid-template-columns: 1.15fr 0.85fr;
    padding: 5.5rem 0 3rem;
  }

  .gallery-heading {
    grid-template-columns: 1fr auto;
  }

  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .gallery-card:nth-child(6n + 1),
  .gallery-card:nth-child(6n + 4) {
    min-height: 390px;
  }

  .reels-frame {
    padding: 1.2rem;
  }

  .reels-track {
    grid-auto-columns: 360px;
  }
}

/* Reduce motion for users who prefer less animation */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}