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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #fafafa;
  color: #222;
  line-height: 1.5;
}

/* Page layout */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.page-header h1 {
  font-size: 2.4rem;
  margin-bottom: 0.5rem;
}

.page-header p {
  font-size: 1rem;
  color: #555;
  margin-bottom: 1.5rem;
}

.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 1.15rem;
  color: #5a5a5a;
  font-style: italic;
  margin-top: 0.4rem;
  opacity: 0.9;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.filter {
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: #e8e8e8;
  color: #333;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.filter:hover {
  transform: translateY(-1px);
  background: #ddd;
}

.filter.active {
  background: #222;
  color: #fff;
}

/* Masonry gallery using CSS columns */
.gallery {
  column-count: 3;
  column-gap: 1.5rem;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.gallery-item img {
  width: 100%;
  display: block;
  height: auto;
}

.caption {
  padding: 0.6rem 0.75rem 0.8rem;
}

.caption h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #222;
}

/* hover */
.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

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

.lightbox.hidden {
  display: none;
}

.lightbox:not(.hidden) {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

.lightbox-content {
  position: relative;
  max-width: 900px;
  max-height: 90vh;
  width: min(90vw, 900px);
  background: #111;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  z-index: 101;
}

.lightbox img {
  width: 100%;
  height: auto;
  display: block;
}

.lightbox-caption {
  padding: 0.75rem 1rem 1rem;
  color: #f8f8f8;
}

.lightbox-caption h3 {
  font-size: 1rem;
}

.lightbox-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 1rem;
}

/* Responsive columns */
@media (max-width: 900px) {
  .gallery {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  .page {
    padding-top: 2rem;
  }

  .gallery {
    column-count: 1;
  }
}
/* Masonry layout */
.masonry {
  column-count: 3;
  column-gap: 1rem;
  margin-top: 1rem;
}

.masonry {
  transition: all 0.3s ease;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.3s ease;
}

.gallery-item.loaded {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

/* Filters */
.filters {
  margin: 20px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter {
  padding: 8px 14px;
  border: none;
  background: #ddd;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}

.filter.active {
  background: #333;
  color: white;
}

/* Responsive */
@media (max-width: 800px) {
  .masonry {
    column-count: 2;
  }
}

@media (max-width: 500px) {
  .masonry {
    column-count: 1;
  }
}
/* Hover caption fade-in */
.gallery-item {
  position: relative;
  overflow: hidden;
}

.gallery-item .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  color: white;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  font-size: 14px;
  pointer-events: none;
}

.gallery-item:hover .caption {
  opacity: 1;
  transform: translateY(0);
}
/* Blur-up image loading */
.gallery-item img {
  width: 100%;
  display: block;
  border-radius: 8px;
  filter: blur(12px);
  transition: filter 0.4s ease;
}

.gallery-item img.loaded {
  filter: blur(0px);
}
/* Lightbox Overlay */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox img {
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: white;
}

.lightbox-caption {
  text-align: center;
  color: white;
  margin-top: 10px;
  font-size: 18px;
}

/* Backdrop click area */
.lightbox-backdrop {
  position: absolute;
  inset: 0;
}
/* Lightbox arrows */
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  padding: 14px 18px;
  font-size: 32px;
  cursor: pointer;
  color: white;
  border-radius: 50%;
  backdrop-filter: blur(4px);
  transition: 0.2s ease;
  z-index: 999999;
}

.lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.35);
}

.left-arrow {
  left: -60px;
}

.right-arrow {
  right: -60px;
}

@media (max-width: 600px) {
  .left-arrow {
    left: -30px;
  }
  .right-arrow {
    right: -30px;
  }
}
/* Hide arrows on phones */
@media (max-width: 600px) {
  .lightbox-arrow {
    display: none !important;
  }
}
