@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;600&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@catppuccin/palette/css/catppuccin.css');

/* Apply Catppuccin Mocha palette */
body {
  font-family: 'Lexend', sans-serif;
  background-color: var(--ctp-mocha-base);
  color: var(--ctp-mocha-text);
  margin: 0;
  padding: 0;
}

header {
  background: var(--ctp-mocha-mantle);
  text-align: center;
  padding: 1rem;
  border-bottom: 1px solid var(--ctp-mocha-surface0);
}

h1 {
  margin: 0;
  color: var(--ctp-mocha-lavender);
  font-weight: 600;
}

.grid {
  display: flex;
  flex-wrap: wrap;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 16px;
  justify-content: center;
}

figure {
  margin: 0;
  background: var(--ctp-mocha-surface0);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

figure:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

img {
  height: 200px;             /* fixed consistent thumbnail height */
  width: auto;               /* adjusts width automatically */
  object-fit: contain;       /* no cropping */
  background-color: var(--ctp-mocha-crust); /* fill behind letterboxing */
  cursor: pointer;
  display: block;
  margin-inline: auto;       /* centers images horizontally in the grid cell */
}

figcaption {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.9rem;
  color: var(--ctp-mocha-sky);
}

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 27, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  z-index: 999;
  overflow: auto; /* ✅ allows scrolling if needed */
  padding: 1rem;
}

#lightbox.hidden {
  display: none;
}

#lightbox img {
  max-width: 100%;
  max-height: 100vh;
  width: auto;
  height: auto;
  object-fit: contain; /* ✅ keeps aspect ratio */
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}


#close {
  position: absolute;
  top: 20px;
  right: 25px;
  background: var(--ctp-mocha-surface1);
  color: var(--ctp-mocha-text);
  border: none;
  border-radius: 6px;
  font-size: 26px;
  cursor: pointer;
  padding: 5px 10px;
  transition: background 0.2s;
}

#close:hover {
  background: var(--ctp-mocha-lavender);
  color: var(--ctp-mocha-base);
}

footer {
  text-align: center;
  padding: 1rem;
  background: var(--ctp-mocha-mantle);
  color: var(--ctp-mocha-text);
  font-size: 0.85rem;
}


/* Back button */
.back-btn {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--ctp-mocha-rosewater);
  text-decoration: none;
  cursor: pointer;
}

.back-btn:hover {
  color: var(--ctp-mocha-teal);
  text-decoration: underline;
}

.progressive img {
  transition: filter 0.6s ease;
}

.progressive img.loaded {
  filter: blur(0);
}
