/* =========================================================
   VALAPPILA — Gallery Page
   (Header, hero, intro block, lightbox & footer live in common.css)
   ========================================================= */

/* =========================================================
   GALLERY
   ========================================================= */
.gallery {
  background: linear-gradient(#E5231B0D, #E5231B0D), #FFFFFF;
  padding: 90px 0 90px;
  scroll-margin-top: 20px;
}

.gal-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.1;
  color: #000000;
  margin-bottom: 28px;
}

/* ---------- Filters ---------- */
.gal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.gal-filter {
  background: #FFD6D3;
  border-radius: 6px;
  padding: 9px 18px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: #9D0600;
  transition: background var(--transition), color var(--transition);
}

.gal-filter:hover {
  background: #FFC0BD;
}

.gal-filter.is-active {
  background: #9D0600;
  color: #FFFFFF;
}

.gal-filter:focus-visible {
  outline: 2px solid #9D0600;
  outline-offset: 2px;
}

/* ---------- Grid: rows of 2 wide + 3 narrow ---------- */
.gal-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.gal-item {
  position: relative;
  display: block;
  grid-column: span 2;
  height: 320px;
  border-radius: 10px;
  overflow: hidden;
  background: #E9DEDA;
  cursor: zoom-in;
}

.gal-item.is-wide {
  grid-column: span 3;
  height: 400px;
}

.gal-item[hidden] {
  display: none;
}

.gal-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

/* Dark fade so captions stay readable */
.gal-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.7) 100%);
  pointer-events: none;
}

.gal-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  background: #ED241C;
  color: #FFFFFF;
  border-radius: 100px;
  padding: 4px 10px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gal-caption {
  position: absolute;
  left: 18px;
  right: 64px;
  bottom: 18px;
  z-index: 1;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  color: #FFFFFF;
}

.gal-arrow {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
}

.gal-arrow svg {
  width: 13px;
  height: 13px;
  stroke: #ED241C;
  transition: stroke var(--transition);
}

.gal-item:hover img {
  transform: scale(1.06);
}

.gal-item:hover .gal-arrow {
  background: #ED241C;
  transform: rotate(45deg);
}

.gal-item:hover .gal-arrow svg {
  stroke: #FFFFFF;
}

.gal-item:focus-visible {
  outline: 3px solid #ED241C;
  outline-offset: 3px;
}

/* Fade-in on filter / page change */
.gal-grid.is-switching .gal-item:not([hidden]) {
  animation: galIn 0.45s ease both;
}

@keyframes galIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.gal-empty {
  font-family: var(--font-body);
  font-size: 16px;
  color: #746E69;
  text-align: center;
  padding: 40px 0;
}

/* ---------- Pagination ---------- */
.gal-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 44px;
}

.gal-pagination:empty {
  display: none;
}

.gal-page {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid #FFC0BD;
  color: #9D0600;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.gal-page:hover {
  border-color: #ED241C;
}

.gal-page.is-active {
  background: #ED241C;
  border-color: #ED241C;
  color: #FFFFFF;
}

.gal-next {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  color: #ED241C;
}

.gal-next span {
  transition: transform var(--transition);
}

.gal-next:hover span {
  transform: translate(2px, -2px);
}

.gal-next:disabled {
  opacity: 0.4;
  cursor: default;
}

.gal-page:focus-visible,
.gal-next:focus-visible {
  outline: 2px solid #ED241C;
  outline-offset: 3px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1024px) {
  .gallery {
    padding: 80px 0;
  }

  .gal-title {
    font-size: 36px;
  }

  .gal-item {
    height: 240px;
  }

  .gal-item.is-wide {
    height: 300px;
  }
}

@media (max-width: 768px) {
  .gallery {
    padding: 64px 0;
  }

  .gal-title {
    font-size: 32px;
  }

  .gal-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 calc(var(--gutter) * -1) 24px;
    padding: 2px var(--gutter);
    scrollbar-width: none;
  }

  .gal-filters::-webkit-scrollbar {
    display: none;
  }

  .gal-filter {
    flex-shrink: 0;
  }

  /* 2 columns: wide items span both */
  .gal-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .gal-item,
  .gal-item.is-wide {
    grid-column: span 1;
    height: 200px;
  }

  .gal-item.is-wide,
  .gal-item.is-tail {
    grid-column: span 2;
    height: 240px;
  }

  .gal-caption {
    font-size: 14px;
    left: 14px;
    bottom: 14px;
    right: 52px;
  }

  .gal-arrow {
    width: 28px;
    height: 28px;
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 480px) {
  .gallery {
    padding: 52px 0;
  }

  .gal-title {
    font-size: 27px;
  }

  .gal-item {
    height: 170px;
  }

  .gal-item.is-wide,
  .gal-item.is-tail {
    height: 210px;
  }

  .gal-caption {
    font-size: 13px;
  }
}
