@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap");

body {
  margin: 0;
  background: #0d0e10;
  font-family: "Montserrat", sans-serif;
}

/* ── PAGE TITLE STRIP ── */
.docs-header {
  position: fixed;
  top: var(--header-h, 7.2rem);
  left: 0;
  right: 0;
  z-index: 10;
  padding: 1.6rem 3.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(
    to bottom,
    rgba(13, 14, 16, 0.98) 60%,
    transparent
  );
  pointer-events: none;
}
.docs-header .docs-title {
  font-size: 0.8rem;
  letter-spacing: 6px;
  color: rgba(255, 255, 255, 0.25);
  font-weight: 500;
  text-transform: uppercase;
}
.docs-header .docs-count {
  font-size: 0.85rem;
  letter-spacing: 3px;
  color: rgba(192, 160, 96, 0.6);
  font-weight: 300;
}

/* ── GRID ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6rem;
  padding: 1.6rem;
  padding-top: calc(var(--header-h, 7.2rem) + 5rem);
  padding-bottom: 12rem;
  box-sizing: border-box;
}

/* ── CERTIFICATE ITEMS ── */
.gallery-item {
  position: relative;
  overflow: hidden;
  background: #1a1b1e;
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  display: block;
}
.gallery-item:hover {
  border-color: rgba(192, 160, 96, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Gold left bar */
.gallery-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 0;
  background: #c0a060;
  transition: height 0.4s ease;
  z-index: 2;
}
.gallery-item:hover::before {
  height: 100%;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gallery-item:hover img {
  transform: scale(1.04);
}

/* Certificate label */
.cert-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(8, 9, 10, 0.9) 0%, transparent 100%);
  padding: 2.4rem 1.6rem 1.2rem;
  font-size: 1rem;
  letter-spacing: 3px;
  color: #fff;
  font-weight: 500;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}
.gallery-item:hover .cert-label {
  opacity: 1;
}

/* ── LIGHTBOX ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 8, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
}
.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 88vh;
  transform: scale(0.94);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lightbox.active .lightbox-media {
  transform: scale(1);
}

.lightbox-media img {
  max-width: 88vw;
  max-height: 84vh;
  object-fit: contain;
  display: none;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
}
.lightbox-media img.visible {
  display: block;
}

/* Close — fixed position, flex centered */
.lightbox-close {
  position: fixed;
  top: 2.4rem;
  right: 3.2rem;
  width: 4.4rem;
  height: 4.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  color: rgba(255, 255, 255, 0.5);
  font-size: 2rem;
  line-height: 1;
  font-weight: 300;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition:
    color 0.2s ease,
    transform 0.25s ease,
    border-color 0.2s ease;
}
.lightbox-close:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Arrows */
.lightbox-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 5.2rem;
  height: 5.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 18, 20, 0.7);
  color: rgba(255, 255, 255, 0.4);
  font-size: 2rem;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
  user-select: none;
  font-family: inherit;
}
.lightbox-arrow:hover {
  background: rgba(192, 160, 96, 0.15);
  border-color: rgba(192, 160, 96, 0.4);
  color: #c0a060;
}
.lightbox-prev {
  left: 2.4rem;
}
.lightbox-next {
  right: 2.4rem;
}

/* Counter */
.lightbox-counter {
  position: fixed;
  bottom: 2.4rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  letter-spacing: 5px;
  color: rgba(255, 255, 255, 0.2);
  font-family: "Montserrat", sans-serif;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.lightbox-counter span {
  color: #c0a060;
  font-size: 1.1rem;
}

/* ── RESPONSIVE ── */
@media screen and (max-width: 940px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    padding-top: calc(var(--header-h, 7.2rem) + 3rem);
    gap: 1.2rem;
  }
  .lightbox-arrow {
    width: 4rem;
    height: 4rem;
    font-size: 1.6rem;
  }
  .lightbox-prev {
    left: 0.8rem;
  }
  .lightbox-next {
    right: 0.8rem;
  }
}
@media screen and (max-width: 520px) {
  .gallery {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}
