/* =============================
   ** PORTFOLIO PAGE STYLES **
   ============================= */
:root {
  --gallery-gap: 18px;
}

.gallery-page {
  padding: calc(var(--nav-height) + var(--nav-top) + 24px) 6% 90px;
  background: var(--site-bg);
}

.gallery-hero {
  max-width: 980px;
  margin: 50px auto 32px;
  text-align: right;
}

.gallery-hero h1 {
  margin: 8px 0 12px;
  font-size: clamp(30px, 4vw, 44px);
}

.gallery-sub {
  color: var(--muted-color);
  margin: 0;
}

.gallery-loader {
  text-align: center;
  padding: 16px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  color: var(--muted-color);
  max-width: 240px;
  margin: 0 auto 20px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gallery-gap);
  width: 100%;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  background: #ffffff;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gallery-item img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

.gallery-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 34px rgba(0, 0, 0, 0.16);
}

.post-title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%);
  color: #ffffff;
  font-weight: 700;
  text-align: right;
}

/* =============================
   ** MODAL **
   ============================= */
.gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  box-sizing: border-box;
}

.modal-inner-wrapper {
  position: relative;
  max-width: 1100px;
  width: 100%;
  background: #0f0f0f;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

#expanded-img {
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  background: #000;
}

.expanded-title {
  padding: 14px 16px;
  color: #ffffff;
  font-weight: 700;
  text-align: right;
  background: rgba(0,0,0,0.6);
}

.nav-btn {
  background: rgba(255,255,255,0.15);
  color: #ffffff;
  border: none;
  padding: 14px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 22px;
  transition: background 0.2s ease;
}

.nav-btn:hover { background: rgba(255,255,255,0.35); }

.prev-btn { margin-left: 10px; }
.next-btn { margin-right: 10px; }

.inner-close-btn {
  position: absolute;
  top: 10px;
  left: 12px;
  color: #ffffff;
  font-size: 28px;
  cursor: pointer;
  z-index: 2;
}

/* =============================
   ** RESPONSIVE **
   ============================= */
@media (max-width: 768px) {
  .gallery-page {
    padding: calc(var(--nav-height) + var(--nav-top) + 14px) 5% 60px;
  }

  .gallery-item img {
    height: 220px;
  }

  .modal-inner-wrapper {
    max-width: 100%;
  }
}
