/* ====================================================
   File: /handyman/css/s.css
   Styles for main gallery page (gallery.php)
   ==================================================== */

/* === VARIABLES === */
:root {
  --yellow:        #f8d948;
  --dark-bg:       #292929;
  --light-text:    #f9f9f9;
  --title-bg:      #f8d948;
  --title-color:   #434343;
}

/* === GALLERY SECTION === */
.gallery {
  padding: 80px 0;
  background-color: #fff;
}
.gallery .section-title {
  text-align: center;
  font-size: 2.5rem;
  color: var(--title-color);
  margin-bottom: 40px;
  background-color: var(--title-bg);
  padding: 12px 0;
  width: 100%;
}

/* === GALLERY GRID === */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  justify-content: center;
  margin: 0 auto;
  max-width: calc(200px * 5 + 16px * 4);
}

/* === GALLERY ITEM === */
.gallery-item {
  background-color: var(--dark-bg);
  border: 1px solid var(--yellow);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s, box-shadow 0.3s;
}
.gallery-item:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 8px 16px rgba(255, 215, 0, 0.2);
}

/* === IMAGE CONTAINER === */
.gallery-item .thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.gallery-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.3s;
}
.gallery-item:hover .thumb img {
  transform: scale(1.05);
}

/* === TITLE UNDER IMAGE === */
.gallery-item h3 {
  width: 100%;
  margin: 12px 0;
  font-size: 1.1rem;
  text-align: center;
  color: var(--light-text);
  padding: 8px 0;
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* === PLACEHOLDER FOR MISSING IMAGES === */
.gallery-item .no-preview {
  width: 100%;
  height: 0;
  padding-bottom: 100%; /* square placeholder */
  background: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--yellow);
  font-style: italic;
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 900px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    max-width: calc(180px * 4 + 16px * 3);
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    max-width: calc(140px * 3 + 16px * 2);
  }
}
