/* ==========================================================
   1. DESIGN TOKENS & RESET
   ========================================================== */
:root {
  --bg: #080b1f;
  --bg-2: #0d1230;
  --text: #eef0ff;
  --muted: #9aa0c8;
  --violet: #8b5cf6;
  --violet-2: #a855f7;
  --blue: #4f7cff;
  --cyan: #22d3ee;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Category colours */
  --c-nature: #4ade80;
  --c-architecture: #a78bfa;
  --c-travel: #fb923c;
  --c-animals: #f472b6;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(139, 92, 246, 0.22), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(79, 124, 255, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 60%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  animation: pageIn 0.9s var(--ease) both;
}

body.no-scroll { overflow: hidden; }

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--violet), var(--blue)); border-radius: 10px; border: 2px solid var(--bg); }
* { scrollbar-width: thin; scrollbar-color: var(--violet) var(--bg); }

/* Keyboard focus */
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* ==========================================================
   2. BACKGROUND GLOW
   ========================================================== */
.bg-glow {
  position: fixed;
  width: 420px; height: 420px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
  animation: float 14s ease-in-out infinite alternate;
}
.bg-glow--one { background: var(--violet); top: 30%; left: -140px; }
.bg-glow--two { background: var(--blue); bottom: -120px; right: -120px; animation-delay: -6s; }

/* ==========================================================
   3. HERO
   ========================================================== */
.hero {
  text-align: center;
  padding: 56px 20px 26px;
}
.hero__eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.hero__title {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.05;
}
.hero__title span {
  background: linear-gradient(90deg, var(--violet), var(--violet-2) 50%, var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 300;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
}
.hero__line {
  width: 90px; height: 3px;
  margin: 18px auto 0;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--violet), var(--cyan), transparent);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.8);
}

/* ==========================================================
   4. FILTER BUTTONS
   ========================================================== */
.container { width: min(1280px, 100% - 40px); margin-inline: auto; }

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 34px;
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 500;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.3s var(--ease), background 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.filter-btn svg { width: 18px; height: 18px; }
.filter-btn:hover { transform: translateY(-2px); border-color: rgba(139, 92, 246, 0.6); }
.filter-btn.is-active {
  background: linear-gradient(135deg, var(--violet), var(--violet-2));
  border-color: transparent;
  box-shadow: 0 8px 28px rgba(139, 92, 246, 0.45);
}

/* ==========================================================
   5. GALLERY GRID & CARDS
   ========================================================== */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding-bottom: 60px;
}

.card {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  animation: cardIn 0.7s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: transform 0.35s var(--ease), opacity 0.3s ease, box-shadow 0.4s;
}
.card:hover {
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55), 0 0 30px rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.5);
}

/* Filter states */
.card.is-leaving { opacity: 0 !important; transform: scale(0.9) !important; animation: none; }
.card.is-hidden { display: none; }

.card__btn { display: block; width: 100%; height: 100%; position: relative; text-align: left; }

.card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease), filter 0.5s;
}
.card:hover img { transform: scale(1.08); filter: brightness(0.7); }

/* Category tag */
.card__tag {
  position: absolute;
  top: 14px; left: 14px;
  padding: 5px 13px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
  background: rgba(10, 12, 30, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
}
.card[data-category="Nature"] .card__tag { color: var(--c-nature); }
.card[data-category="Architecture"] .card__tag { color: var(--c-architecture); }
.card[data-category="Travel"] .card__tag { color: var(--c-travel); }
.card[data-category="Animals"] .card__tag { color: var(--c-animals); }

/* Hover overlay */
.card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(to top, rgba(5, 7, 22, 0.88), transparent 60%);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.card:hover .card__overlay,
.card__btn:focus-visible .card__overlay { opacity: 1; transform: none; }

/* Touch devices have no hover, so keep the overlay visible */
@media (hover: none) {
  .card__overlay { opacity: 1; transform: none; }
}
.card__title { font-weight: 600; font-size: 1.05rem; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.card__view {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(10, 12, 30, 0.6);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.35s var(--ease), background 0.3s;
}
.card__view svg { width: 17px; height: 17px; }
.card:hover .card__view { background: var(--violet); transform: scale(1.12); }

/* ==========================================================
   6. FOOTER
   ========================================================== */
.footer {
  text-align: center;
  padding: 28px 20px 36px;
  color: var(--muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--glass-border);
  background: rgba(8, 11, 31, 0.6);
}
.footer strong { color: var(--violet-2); font-weight: 600; }

/* ==========================================================
   7. LIGHTBOX
   ========================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  background: rgba(5, 7, 20, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }

.lb-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr);
  gap: 28px;
  align-items: center;
  width: min(1000px, 100%);
  max-height: calc(100vh - 40px);
  padding: 22px;
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--glass-border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(139, 92, 246, 0.18);
  transform: translateY(24px) scale(0.95);
  transition: transform 0.45s var(--ease);
}
.lightbox.is-open .lb-panel { transform: none; }

.lb-figure { border-radius: 16px; overflow: hidden; background: #000; }
.lb-figure img {
  width: 100%;
  max-height: calc(100vh - 120px);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: opacity 0.25s ease, transform 0.4s var(--ease);
}
.lb-figure img.is-swapping { opacity: 0; transform: scale(0.98); }

.lb-info { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding-right: 40px; }
.lb-counter {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}
.lb-title { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 600; line-height: 1.15; }
.lb-category {
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  color: var(--violet-2);
}
.lb-category[data-cat="Nature"] { color: var(--c-nature); }
.lb-category[data-cat="Architecture"] { color: var(--c-architecture); }
.lb-category[data-cat="Travel"] { color: var(--c-travel); }
.lb-category[data-cat="Animals"] { color: var(--c-animals); }
.lb-desc { color: var(--muted); font-weight: 300; font-size: 0.95rem; }

/* Lightbox buttons */
.lb-btn {
  display: grid; place-items: center;
  width: 48px; height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(10, 12, 30, 0.7);
  border: 1px solid var(--glass-border);
  transition: background 0.3s, transform 0.3s var(--ease), box-shadow 0.3s;
}
.lb-btn svg { width: 22px; height: 22px; }
.lb-btn:hover { background: var(--violet); box-shadow: 0 0 24px rgba(139, 92, 246, 0.6); transform: scale(1.08); }
.lb-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; z-index: 2; }

/* ==========================================================
   8. ANIMATIONS
   ========================================================== */
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardIn { to { opacity: 1; transform: none; } }
@keyframes float {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(60px, -40px) scale(1.15); }
}

/* ==========================================================
   9. RESPONSIVE
   ========================================================== */
@media (max-width: 1100px) {
  .gallery { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 16px; }

  .lightbox { flex-wrap: wrap; align-content: center; }
  .lb-panel {
    grid-template-columns: 1fr;
    gap: 16px;
    order: 1;
    overflow-y: auto;
    padding: 16px;
  }
  .lb-info { padding-right: 0; }
  .lb-close { top: 10px; right: 10px; background: rgba(10, 12, 30, 0.85); }
  .lb-prev, .lb-next { order: 2; }
  .lb-prev { margin-right: 24px; }
}

@media (max-width: 560px) {
  .hero { padding-top: 40px; }
  .gallery { grid-template-columns: 1fr; }
  .filters { gap: 8px; }
  .filter-btn { padding: 9px 16px; font-size: 0.92rem; }
  /* Hover overlay is always visible on touch screens */
  .card:hover img { transform: none; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
