:root {
  --bg-page: #000;
  --bg-panel: #212529;
  --text-main: #f2f2f2;
  --border-light: #f1f0f0;
  --catg-bg: #ff804a;
  --subcatg-bg: #6b9fed;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Main page wrapper */
.gallery-page {
  background-color: var(--bg-panel);
  min-height: 100vh;
  padding: 24px 20px 40px;
}

/* Top filter area */
.gallery-filters {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
  align-items: start;
  margin-bottom: 32px;
}

/* Left column: categories */
.category-column {
  display: flex;
  padding: 15px;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  align-items: center;
  justify-content: center;
}

/* Right area: subcategories wrap horizontally */
.subcategory-column {
  display: flex;
  padding: 15px;
  gap: 16px 18px;
  flex-wrap: wrap;
  text-align: center;
  align-items: center;
  justify-content: center;
}

/* Link pills */
.catg-links,
.subcatg-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-main);
  border-radius: 999px;
  padding: 10px 18px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transition:
    filter 0.15s ease,
    transform 0.15s ease;
}

.catg-links {
  min-width: 210px;
  background-color: var(--catg-bg);
}

.subcatg-links {
  min-width: 230px;
  background-color: var(--subcatg-bg);
}

.catg-links:hover,
.subcatg-links:hover {
  color: #fff;
  text-decoration: none;
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.active-link {
  box-shadow: 0 0 0 2px #fff inset;
}

.gallery-header {
  text-align: center;
  margin-bottom: 30px;
}

.gallery-header h1 {
  font-size: 2rem;
  color: #fff;
  margin-bottom: 6px;
}

.gallery-header p {
  color: #aaa;
  font-size: 0.95rem;
}

/* Gallery area */
.gallery-layout {
  width: 100%;
  margin-top: 0;
  display: block;
  overflow-y: auto;
  background-color: transparent;
}

.masonry {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  padding: 0;
}

.masonry .tile {
  flex: 0 0 calc((100% - 80px) / 5); /* 5 items max per row */
  max-width: calc((100% - 80px) / 5);
  min-width: 240px;
  text-decoration: none;
}

.masonry .tile img {
  width: 100%;
  display: block;
}
/* Each tile */
.tile {
  display: block;
  width: 100%;
  margin: 0;
  text-decoration: none;
  cursor: zoom-in;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.tile img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border-light);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.tile:hover img {
  opacity: 0.6;
}

.img-title {
  width: 100%;
  margin: 0;
  color: #fff;
  padding: 6px 8px;
  font-size: 12px;
  text-align: center;
  text-transform: capitalize;
  border-bottom: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  background-color: var(--bg-panel);
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* Tablet / mobile */
@media (max-width: 992px) {
  .gallery-filters {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .category-column {
    align-items: center;
  }

  .subcategory-column {
    justify-content: center;
  }

  .catg-links,
  .subcatg-links {
    min-width: 220px;
  }
}

@media (max-width: 576px) {
  .gallery-page {
    padding: 20px 14px 32px;
  }

  .masonry {
    grid-template-columns: 1fr;
  }

  .catg-links,
  .subcatg-links {
    min-width: 100%;
  }
}
