/* custom utilities */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Button design (primary: #111827) - enforce solid backgrounds and visibility */
.btn {
    display: inline-block;
    background-color: #111827;
    color: #ffffff !important;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 6px 18px rgba(17,24,39,0.08);
}

.btn:hover,
.btn:focus {
    background-color: #000000;
}

/* inverted style applied by JS when button sits on a dark background */
.btn-inverted {
    background-color: #ffffff !important;
    color: #000000 !important;
}

.btn[disabled],
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* make buttons full width on small screens */
@media (max-width: 640px) {
    .btn {
        display: block;
        width: 100%;
    }
}

/* Card image wrapper to ensure 16:9 aspect, cover, rounded corners and gradient overlay */
.card-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    aspect-ratio: 16 / 9;
    box-shadow: 0 8px 30px rgba(2,6,23,0.08);
}
.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display:block;
}
.card-image-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
}

/* Gallery thumbnails */
.thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    flex: 0 0 auto;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 2px solid transparent;
}
.thumb:hover { transform: translateY(-4px); }
.thumb.active {
    border-color: #111827;
    box-shadow: 0 6px 18px rgba(17,24,39,0.12);
}

/* Main gallery container: ensure smooth opacity transitions */
#main-image,
.main-image {
    transition: opacity 0.3s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Play button on main image */
.gallery-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17,24,39,0.75);
    color: #fff;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 8px 30px rgba(2,6,23,0.12);
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
    opacity: 0; /* hidden by default */
    pointer-events: none;
}
.gallery-play:hover { transform: translate(-50%, -50%) scale(1.03); }

/* show play when hovering the image area or when playing */
.card-image-wrapper:hover .gallery-play,
.card-image-wrapper:focus-within .gallery-play,
.gallery-play.just-clicked {
    opacity: 1;
    pointer-events: auto;
}

/* small progress indicator ring below play button */
.gallery-play .progress {
    position: absolute;
    width: 72px;
    height: 72px;
    border-radius: 9999px;
    border: 2px solid rgba(255,255,255,0.12);
    z-index: 4;
}
.gallery-play.playing .progress {
    animation: gallery-progress 1.5s linear infinite;
}
@keyframes gallery-progress {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Navigation arrows */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.75);
    color: #fff;
    cursor: pointer;
    z-index: 4;
    box-shadow: 0 8px 30px rgba(2, 6, 23, 0.12);
    transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
    opacity: 0;
    pointer-events: none;
    border: none;
    padding: 0;
}
.gallery-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    background: rgba(17, 24, 39, 0.9);
}

.gallery-arrow-prev {
    left: 16px;
}
.gallery-arrow-next {
    right: 16px;
}

/* Show arrows on desktop hover */
.card-image-wrapper:hover .gallery-arrow {
    opacity: 1;
    pointer-events: auto;
}

/* Hide arrows on mobile */
@media (max-width: 768px) {
    .gallery-arrow {
        display: none;
    }
}

/* Responsive: stack gallery vertically on small screens */
@media (max-width: 768px) {
    .gallery-grid {
        display: block;
    }
    #gallery-thumbs { margin-top: 12px; }
}

/* More Photos and Videos Masonry */
.media-section {
  margin-top: 3rem;
}
.media-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.media-grid {
  column-count: 3;
  column-gap: 16px;
  perspective: 1000px;
}
.media-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(2,6,23,0.08);
  margin-bottom: 16px;
  break-inside: avoid;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.media-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(2,6,23,0.12);
}
.media-thumb {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}
.media-play-badge {
  position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.65); color: #fff; padding: 10px 16px; border-radius: 999px; font-weight:700; font-size:18px;
  z-index: 2;
}

/* Modal viewer */
.media-modal {
  position: fixed; inset: 0; display:flex; align-items:center; justify-content:center; background: rgba(2,6,23,0.85); z-index: 60;
  backdrop-filter: blur(4px);
}
.media-modal.hidden { display: none; }
.media-modal .content {
  width: min(1100px, 95%);
  max-height: 90vh;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.media-modal img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}
.media-modal video {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}
.media-modal .close {
  position: absolute; right: 18px; top: 18px; background: rgba(255,255,255,0.1); color: #fff; border-radius:8px; padding:8px 10px; cursor:pointer; z-index:70; font-size:20px; font-weight:bold;
  transition: background 0.2s ease;
}
.media-modal .close:hover { background: rgba(255,255,255,0.15); }

/* Modal navigation arrows */
.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  cursor: pointer;
  z-index: 65;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease;
}
.modal-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.1);
}

.modal-arrow-prev {
  left: 20px;
}
.modal-arrow-next {
  right: 20px;
}

/* Hide arrows on mobile */
@media (max-width: 768px) {
  .modal-arrow {
    display: none;
  }
}

@media (max-width: 1024px) {
  .media-grid { column-count: 2; }
}
@media (max-width: 640px) {
  .media-grid { column-count: 1; }
}
