.gallery-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: 22px;
  pointer-events: none;
  position: fixed;
  transition: opacity 0.22s ease;
  z-index: 100;
}

.gallery-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.gallery-modal__backdrop {
  background:
    radial-gradient(ellipse 55% 45% at 82% 8%, rgba(80, 40, 200, 0.22), transparent 64%),
    radial-gradient(ellipse 45% 35% at 12% 88%, rgba(0, 180, 255, 0.14), transparent 64%),
    rgba(2, 5, 12, 0.88);
  backdrop-filter: blur(14px);
  inset: 0;
  position: absolute;
}

.gallery-modal__dialog {
  background:
    linear-gradient(rgba(80, 100, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 100, 255, 0.035) 1px, transparent 1px),
    rgba(5, 8, 16, 0.96);
  background-size: 44px 44px, 44px 44px, auto;
  border: 0.5px solid rgba(100, 120, 255, 0.16);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.54), 0 0 80px rgba(74, 110, 255, 0.12);
  max-height: min(92vh, 920px);
  max-width: min(1120px, 96vw);
  overflow: hidden;
  padding: 28px;
  position: relative;
  width: 100%;
}

.gallery-modal__dialog::after {
  background: linear-gradient(90deg, transparent, rgba(100, 140, 255, 0.16), rgba(180, 100, 255, 0.18), transparent);
  content: '';
  height: 1px;
  left: 0;
  position: absolute;
  right: 0;
  top: 116px;
}

.gallery-modal__close {
  align-items: center;
  aspect-ratio: 1;
  background: rgba(40, 55, 150, 0.12);
  border: 0.5px solid rgba(100, 120, 255, 0.22);
  border-radius: 8px;
  color: rgba(215, 225, 255, 0.82);
  cursor: pointer;
  display: inline-flex;
  font-size: 28px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 20px;
  top: 20px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  width: 42px;
  z-index: 2;
}

.gallery-modal__close:hover,
.gallery-modal__nav:hover {
  background: rgba(60, 80, 200, 0.22);
  border-color: rgba(100, 140, 255, 0.5);
  color: #fff;
}

.gallery-modal__header {
  align-items: flex-end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 44px;
  padding-right: 62px;
}

.gallery-modal__eyebrow {
  align-items: center;
  color: #5570e0;
  display: flex;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  gap: 10px;
  letter-spacing: 0.18em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.gallery-modal__eyebrow::before {
  background: #5570e0;
  content: '';
  display: inline-block;
  height: 1px;
  width: 20px;
}

.gallery-modal__title {
  color: #f0f4ff;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.gallery-modal__controls {
  align-items: center;
  display: flex;
  gap: 18px;
}

.gallery-modal__nav {
  align-items: center;
  aspect-ratio: 1;
  background: rgba(40, 55, 150, 0.12);
  border: 0.5px solid rgba(100, 120, 255, 0.22);
  border-radius: 8px;
  color: rgba(215, 225, 255, 0.82);
  cursor: pointer;
  display: inline-flex;
  font-family: 'Fira Code', monospace;
  font-size: 19px;
  justify-content: center;
  line-height: 1;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  width: 46px;
}

.gallery-modal__counter {
  color: rgba(170, 185, 255, 0.56);
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  min-width: 56px;
  text-align: center;
}

.gallery-modal__slider {
  background: rgba(12, 16, 38, 0.72);
  border: 0.5px solid rgba(100, 120, 255, 0.16);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.gallery-modal__track {
  display: flex;
  transition: transform 0.45s ease;
}

.gallery-modal__slide {
  align-items: center;
  display: flex;
  flex: 0 0 100%;
  justify-content: center;
  min-height: min(64vh, 620px);
  padding: 32px;
}

.gallery-modal__slide img,
.gallery-modal__slide video {
  border: 0.5px solid rgba(100, 120, 255, 0.2);
  border-radius: 12px;
  display: block;
  max-height: min(58vh, 560px);
  max-width: 100%;
  object-fit: contain;
}

.gallery-modal__dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

.gallery-modal__dot {
  background: rgba(100, 120, 255, 0.18);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  height: 7px;
  transition: background 0.2s, width 0.2s;
  width: 22px;
}

.gallery-modal__dot.active {
  background: #7c9bff;
  width: 42px;
}

.project-card[data-open-gallery] {
  cursor: pointer;
}

.project-card[data-open-gallery]:focus-visible {
  outline: 2px solid rgba(124, 155, 255, 0.75);
  outline-offset: 4px;
}

.modal-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .gallery-modal {
    align-items: stretch;
    padding: 0;
  }

  .gallery-modal__dialog {
    border-left: none;
    border-radius: 0;
    border-right: none;
    max-height: 100vh;
    max-width: none;
    overflow-y: auto;
    padding: 18px;
  }

  .gallery-modal__dialog::after {
    top: 120px;
  }

  .gallery-modal__header {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 36px;
    padding-right: 54px;
  }

  .gallery-modal__controls {
    gap: 14px;
  }

  .gallery-modal__slide {
    min-height: 58vh;
    padding: 24px;
  }
}
