/* Gallery Strip & Lightbox / Modals */
.lightbox,
.proj-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(2, 22, 38, 0.68);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox.active,
.proj-modal.active {
  display: flex;
}

.proj-modal-panel {
  background: var(--glass-bg);

  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 8px 8px 10px 10px;

  backdrop-filter: blur(16px) saturate(200%);
  -webkit-backdrop-filter: blur(16px) saturate(200%);
  width: 100%;
  max-width: 820px;
  max-height: 86vh;
  overflow-y: auto;
  position: relative;
  padding: 44px 24px 24px 24px;
  animation: vistaModalPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  color: var(--ink-body);
}

/* Vista Window Glass Specular Reflection Highlight */
.proj-modal-panel::before,
.lightbox-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: var(--glass-bg);

  border-radius: 7px 7px 0 0;
  pointer-events: none;
  z-index: 2;
}

[data-theme="dark"] .proj-modal-panel {
  background:
    linear-gradient(180deg,
      rgba(40, 105, 155, 0.72) 0%,
      rgba(20, 65, 105, 0.5) 30px,
      rgba(10, 40, 70, 0.35) 34px,
      var(--glass-bg-card) 100%);
  border: 1px solid rgba(125, 211, 252, 0.45);

}

[data-theme="dark"] .proj-modal-panel::before,
[data-theme="dark"] .lightbox-content::before {
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.38) 0%,
      rgba(255, 255, 255, 0.1) 48%,
      rgba(56, 189, 248, 0) 50%,
      rgba(56, 189, 248, 0.15) 100%);
}

@keyframes vistaModalPop {
  0% {
    transform: scale(0.92) translateY(16px);
    opacity: 0;
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-titlebar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 68px 0 12px;
  z-index: 10;
  user-select: none;
}

.modal-title-text,
.lightbox-caption {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: "Segoe UI", "Segoe UI Variable", -apple-system, BlinkMacSystemFont, Tahoma, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(2, 40, 70, 0.8), 0 0 10px rgba(56, 189, 248, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  width: 100%;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

[data-theme="dark"] .modal-title-text,
[data-theme="dark"] .lightbox-caption {
  color: #f0f9ff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 12px rgba(56, 189, 248, 0.65);
}

.modal-title-icon {
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  flex-shrink: 0;
}

.lb-project {
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}

.lb-sep {
  color: rgba(255, 255, 255, 0.65);
  font-weight: 400;
  margin: 0 1px;
  flex-shrink: 0;
}

.lb-alt {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 2;
}

.proj-modal-close,
.lightbox-close {
  position: absolute;
  top: 0;
  right: 10px;
  width: 48px;
  height: 22px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg,
      #fca5a5 0%,
      #f87171 45%,
      #ef4444 49%,
      #dc2626 51%,
      #b91c1c 100%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-top: none;
  color: #ffffff;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 12;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 2px rgba(0, 0, 0, 0.35),
    0 1px 4px rgba(220, 38, 38, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
  padding: 0;
}

.proj-modal-close:hover,
.lightbox-close:hover {
  background: linear-gradient(180deg,
      #fecaca 0%,
      #f87171 42%,
      #ef4444 48%,
      #dc2626 51%,
      #991b1b 100%);
  border-color: #ffffff;
  box-shadow:
    inset 0 1px 1px #ffffff,
    0 0 14px rgba(239, 68, 68, 0.9),
    0 2px 6px rgba(0, 0, 0, 0.45);
  transform: none;
}

.proj-modal-close:active,
.lightbox-close:active {
  background: linear-gradient(180deg,
      #7f1d1d 0%,
      #991b1b 45%,
      #b91c1c 52%,
      #dc2626 100%);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

.lightbox-content {
  width: fit-content;
  max-width: min(94vw, 1200px);
  min-width: min(92vw, 360px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    linear-gradient(180deg,
      rgba(200, 235, 255, 0.6) 0%,
      rgba(125, 200, 245, 0.38) 30px,
      rgba(56, 160, 225, 0.15) 34px,
      rgba(255, 255, 255, 0.08) 35px,
      var(--glass-bg-card) 100%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px 8px 10px 10px;

  padding: 38px 10px 10px 10px;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  animation: vistaModalPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

[data-theme="dark"] .lightbox-content {
  background:
    linear-gradient(180deg,
      rgba(40, 105, 155, 0.68) 0%,
      rgba(20, 65, 105, 0.48) 30px,
      rgba(10, 40, 70, 0.3) 34px,
      var(--glass-bg-card) 100%);
  border-color: rgba(125, 211, 252, 0.45);

}

.lightbox-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: none;
}

.lightbox-content img {
  display: block;
  max-width: min(90vw, 1160px);
  max-height: 74vh;
  width: auto;
  height: auto;
  border-radius: 5px;
  object-fit: contain;
}

.lightbox-video-wrap {
  position: relative;
  width: min(90vw, 840px, calc(68vh * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: var(--glass-bg);
}

.lightbox-video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.pm-gallery-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-top: 8px;
  padding-bottom: 12px;
  padding-left: 2px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.6) rgba(255, 255, 255, 0.15);
}

.pm-gallery-strip::-webkit-scrollbar {
  height: 8px;
}

.pm-gallery-strip::-webkit-scrollbar-track {
  background: rgba(2, 132, 199, 0.08);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.pm-gallery-strip::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3), inset 0 1px 1px #ffffff;
  cursor: pointer;
}

.pm-gallery-strip::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #7dd3fc 0%, #0369a1 100%);
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.5), inset 0 1px 2px #ffffff;
}

[data-theme="dark"] .pm-gallery-strip {
  scrollbar-color: rgba(56, 189, 248, 0.7) rgba(15, 23, 42, 0.4);
}

[data-theme="dark"] .pm-gallery-strip::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(56, 189, 248, 0.2);
}

[data-theme="dark"] .pm-gallery-strip::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.8) 0%, rgba(2, 132, 199, 0.9) 100%);
  border: 1px solid rgba(125, 211, 252, 0.5);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

[data-theme="dark"] .pm-gallery-strip::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
}

.pm-gallery-card {
  flex: 0 0 240px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  cursor: pointer;
  background: var(--glass-bg);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .pm-gallery-card {
  border-color: rgba(56, 189, 248, 0.35);
}

.pm-gallery-card:hover {
  transform: translateY(-3px);
  border-color: #ffffff;
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.35);
}

.pm-gallery-img-wrap,
.pm-gallery-video-wrap {
  width: 100%;
  height: 180px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: var(--glass-bg);
  cursor: pointer;
}

.pm-gallery-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.pm-gallery-card:hover .pm-gallery-img-wrap img {
  transform: scale(1.06);
}

.pm-gallery-card--video {
  flex: 0 0 320px;
}

.pm-gallery-video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  pointer-events: none;
}

.pm-gallery-click-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
  background: transparent;
}

.pm-gallery-overlay-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 4;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.pm-gallery-card:hover .pm-gallery-overlay-badge {
  opacity: 1;
  transform: translateY(0);
}

.pm-gallery-video-label {
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-title);
  text-align: center;
  background: var(--glass-bg);
  border-top: 1px solid rgba(2, 132, 199, 0.15);
  transition: background 0.2s ease, color 0.2s ease;
}

[data-theme="dark"] .pm-gallery-video-label {
  background: var(--glass-bg);
  border-top-color: rgba(56, 189, 248, 0.25);
  color: #e0f2fe;
}

@media (max-width: 768px) {

  .lightbox,
  .proj-modal {
    padding: 12px 8px;
  }

  .proj-modal-panel {
    padding: 38px 14px 14px 14px;
    border-radius: 8px;
    max-height: 92vh;
  }

  .modal-titlebar {
    height: 30px;
    padding: 0 58px 0 8px;
  }

  .modal-title-text,
  .lightbox-caption {
    font-size: 11.5px;
    width: 100%;
  }

  .proj-modal-close,
  .lightbox-close {
    top: 0;
    right: 6px;
    width: 44px;
    height: 22px;
    font-size: 13px;
  }

  .lightbox-content {
    width: 100%;
    max-width: 100%;
    padding: 34px 8px 8px 8px;
    border-radius: 8px;
  }

  .lightbox-video-wrap {
    width: 100%;
    max-width: 95vw;
    aspect-ratio: 16 / 9;
    border-radius: 5px;
  }

  .lightbox-content img {
    max-width: 95vw;
    max-height: 68vh;
    border-radius: 5px;
  }

  .pm-gallery-strip {
    gap: 10px;
  }

  .pm-gallery-card {
    flex: 0 0 clamp(190px, 66vw, 240px);
  }

  .pm-gallery-card--video {
    flex: 0 0 clamp(230px, 78vw, 290px);
  }

  .pm-gallery-img-wrap,
  .pm-gallery-video-wrap {
    height: 155px;
  }

  .pm-gallery-overlay-badge {
    opacity: 0.95;
    transform: translateY(0);
    font-size: 10.5px;
    padding: 3px 8px;
  }
}