/* g-modal — unified image gallery & video player */

.g-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  visibility: hidden;
  transition: visibility 0.3s;
}

.g-modal.active {
  visibility: visible;
}

/* overlay */
.g-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.g-modal.active .g-modal-overlay {
  opacity: 1;
}

/* container */
.g-modal-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

/* close button */
.g-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
}

.g-modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}

/* body — shared */
.g-modal-body {
  position: relative;
  max-width: 1200px;
  max-height: 90vh;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s ease;
}

.g-modal.active .g-modal-body {
  transform: scale(1);
  opacity: 1;
}

/* body — image */
.g-modal-body--image {
  display: flex;
  align-items: center;
  justify-content: center;
}

.g-modal-image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
}

/* body — video */
.g-modal-body--video {
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.g-modal-video-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
}

.g-modal-video-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  object-fit: contain;
}

.g-modal-video-wrap--iframe iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* prev / next arrows */
.g-modal-prev,
.g-modal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 5;
  line-height: 1;
  padding: 0;
}

.g-modal-prev:hover,
.g-modal-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.g-modal-prev { left: 16px; }
.g-modal-next { right: 16px; }

.g-modal-prev::before,
.g-modal-next::before {
  content: '';
  display: block;
  width: 14px;
  height: 14px;
  border-color: #fff;
  border-style: solid;
}

.g-modal-prev::before {
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
  margin-left: 3px;
}

.g-modal-next::before {
  border-width: 2px 2px 0 0;
  transform: rotate(45deg);
  margin-right: 3px;
}

/* counter */
.g-modal-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  z-index: 5;
}

/* closing */
.g-modal.closing { visibility: visible; }
.g-modal.closing .g-modal-overlay { opacity: 0; }
.g-modal.closing .g-modal-body { transform: scale(0.9); opacity: 0; }

/* mobile */
@media (max-width: 768px) {
  .g-modal-close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 20px;
  }

  .g-modal-container {
    padding: 10px;
  }

  .g-modal-prev,
  .g-modal-next {
    width: 36px;
    height: 36px;
  }

  .g-modal-prev::before,
  .g-modal-next::before {
    width: 11px;
    height: 11px;
  }

  .g-modal-prev { left: 8px; }
  .g-modal-next { right: 8px; }
}
