/* ==========================
   CERTIFICATION PAGE
========================== */

body {
  background: #f8f7f3;
}

/* Heading */

.page-title {
  text-align: center;
  font-size: 52px;
  font-weight: 700;
  color: #1d3928;
  margin: 70px 0 40px;
}

/* Gallery */

.gallery {
  max-width: 1400px;
  margin: auto;
  padding: 0 20px 80px;

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 35px;
}

/* Card */

.certificate {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;

  cursor: pointer;

  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);

  transition: all 0.35s ease;
}

.certificate:hover {
  transform: translateY(-10px);

  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Image */

.certificate img {
  width: 100%;
  height: 420px;

  object-fit: contain;
  background: #fff;

  padding: 15px;

  transition: transform 0.4s ease;
}

.certificate:hover img {
  transform: scale(1.03);
}

/* Overlay */

.certificate::before {
  content: "";

  position: absolute;
  inset: 0;

  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.65),
    rgba(0, 0, 0, 0.15),
    transparent
  );

  opacity: 0;
  transition: 0.3s;
}

.certificate:hover::before {
  opacity: 1;
}

.certificate::after {
  content: "🔍 View Certificate";

  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  color: #fff;
  font-size: 16px;
  font-weight: 600;

  opacity: 0;

  transition: 0.3s;
}

.certificate:hover::after {
  opacity: 1;
}

/* Title */

.certificate-title {
  position: absolute;

  bottom: 0;
  left: 0;

  width: 100%;

  padding: 20px;

  color: #fff;
  font-size: 18px;
  font-weight: 600;

  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);

  z-index: 2;
}

/* ==========================
   MODAL
========================== */

.certificate-modal {
  display: none;

  position: fixed;
  inset: 0;

  background: rgba(0, 0, 0, 0.95);

  z-index: 99999;

  justify-content: center;
  align-items: center;

  padding: 20px;
}

.certificate-modal.active {
  display: flex;
}

.modal-image {
  max-width: 95%;
  max-height: 95vh;

  border-radius: 12px;

  animation: zoomIn 0.3s ease;
}

.close-btn {
  position: absolute;

  top: 20px;
  right: 30px;

  color: #fff;

  font-size: 50px;
  line-height: 1;

  cursor: pointer;

  transition: 0.3s;
}

.close-btn:hover {
  transform: scale(1.1);
}

/* Animation */

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobile */

@media (max-width: 768px) {
  .page-title {
    font-size: 36px;
  }

  .gallery {
    gap: 20px;
  }

  .certificate img {
    height: 300px;
  }

  .certificate-title {
    font-size: 16px;
  }

  .close-btn {
    font-size: 40px;
    right: 20px;
  }
}

/* for zoomed model center  */
/* ==========================
   MODAL (Fix for centering)
========================== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 99999;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal#modal {
  display: none; /* fallback */
}

.modal.active {
  display: flex;
}

.modal img {
  max-width: 95%;
  max-height: 95vh;
  border-radius: 12px;
  animation: zoomIn 0.3s ease;
  object-fit: contain;
}

.close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 50px;
  line-height: 1;
  cursor: pointer;
  transition: 0.3s;
}

.close:hover {
  transform: scale(1.1);
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .close {
    font-size: 40px;
    right: 20px;
    top: 15px;
  }

  .modal img {
    max-width: 90%;
    max-height: 85vh;
  }
}
