/*
 * Project detail modal and carousel.
 */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.modal-open {
  opacity: 1;
  visibility: visible;
}

.modal-panel {
  position: relative;
  width: 65vw;
  min-width: 320px;
  max-width: 900px;
  max-height: 90vh;
  overflow: hidden;
  background: #1a1a1a;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.modal-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #444 #1a1a1a;
}

.modal-panel-scroll::-webkit-scrollbar {
  width: 4px;
}

.modal-panel-scroll::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 0 12px 12px 0;
}

.modal-panel-scroll::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

.modal-panel-scroll::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.modal-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-bottom: 1rem;
  min-height: 2.5rem;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.modal-share {
  background: none;
  border: none;
  color: var(--color-accent-gold);
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.9;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-share svg {
  width: 1.5em;
  height: 1.5em;
}

.modal-share:hover {
  opacity: 1;
}

.modal-share-copied {
  color: var(--color-accent-gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-accent-gold);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.9;
}

.modal-close:hover {
  opacity: 1;
}

.modal-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-slide-title, "Dancing Script", cursive);
  font-size: var(--slide-title-font-size, 1.75rem);
  line-height: 1.3;
  color: var(--color-accent-gold);
  text-align: center;
  margin: 0;
  padding: 0 0.25rem 0 0;
  /* Prevent Chrome/iOS clipping and overlap with body text */
  -webkit-font-smoothing: antialiased;
}

.modal-carousel {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 200px;
}

.modal-arrow {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.modal-arrow:hover {
  opacity: 1;
}

.modal-arrow-desktop img {
  display: block;
  width: 154px;
  height: 392px;
  object-fit: contain;
}

/* Mobile arrows: hidden on desktop, shown inside panel on mobile */
.modal-arrow-mobile {
  display: none;
}

.modal-slide-content {
  flex: 1;
  min-width: 0;
}

.modal-slide-text {
  font-family: var(--font-slide-text, var(--font-body));
  font-size: var(--slide-text-font-size, 0.95rem);
  line-height: 1.6;
  color: var(--color-accent-gold);
  margin-bottom: 1rem;
}

.modal-slide-text:last-child {
  margin-bottom: 0;
}

.modal-slide-media {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.modal-video-wrapper {
  position: relative;
  display: block;
}

.modal-video-wrapper .modal-slide-media {
  width: 100%;
}

.modal-video-wrapper .modal-slide-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

.modal-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s, background 0.2s;
}

/* Hide play button until hover over video (devices with pointer/hover) */
@media (hover: hover) {
  .modal-play-overlay {
    opacity: 0;
  }

  .modal-video-wrapper:hover .modal-play-overlay {
    opacity: 1;
  }
}

.modal-play-overlay:hover {
  background: rgba(0, 0, 0, 0.4);
}

.modal-play-overlay img {
  width: 136px;
  height: 136px;
  opacity: 0.95;
  pointer-events: none;
}

.modal-slide-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
}

.modal-empty {
  color: #888;
  font-style: italic;
}

.modal-slide-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.modal-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: background 0.2s;
}

.modal-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

.modal-dot-active {
  background: var(--color-accent-gold);
}

@media (max-width: 767px) {
  .modal-panel {
    width: 92vw;
  }

  .modal-header-actions {
    margin-right: -0.25rem;
  }

  .modal-overlay {
    gap: 0.5rem;
  }

  .modal-arrow-desktop {
    display: none;
  }

  /* Mobile arrows: inside panel padding, fully visible and pressable */
  .modal-arrow-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    opacity: 0.7;
  }

  .modal-arrow-mobile:hover {
    opacity: 1;
  }

  .modal-arrow-mobile.modal-arrow-prev {
    left: 0.5rem;
  }

  .modal-arrow-mobile.modal-arrow-next {
    right: 0.5rem;
  }

  .modal-arrow-mobile img {
    display: block;
    width: 24px;
    height: 60px;
    object-fit: contain;
  }

  .modal-carousel {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .modal-slide-media-image {
    cursor: pointer;
  }
}

/*
 * Fullscreen image overlay (mobile only) - tap slide image to view fullscreen.
 */
.modal-image-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.modal-image-fullscreen.modal-image-fullscreen-open {
  opacity: 1;
  visibility: visible;
}

.modal-image-fullscreen-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 0;
  opacity: 0.9;
  transition: opacity 0.2s, background 0.2s;
}

.modal-image-fullscreen-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.25);
}

.modal-image-fullscreen-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  padding: 3rem 1rem 1rem;
}
