/* =========================================================
   Three's Company Yacht — threes-company-yacht-gallery.css
   Gallery-only styles (grid, modal/lightbox, gallery hero)
========================================================= */

/* -------------------------
   Gallery hero overrides (from styles.css)
------------------------- */
.hero.hero--gallery{
  min-height: 420px;
}

.hero.hero--gallery .hero-overlay{
  padding: 54px 16px;
}

@media (max-width: 768px){
  .hero.hero--gallery{
    min-height: 360px;
  }

  .hero.hero--gallery .hero-overlay{
    padding: 44px 14px;
  }
}

/* -------------------------
   Page layout
------------------------- */
.gallery-page-container{
  margin-top: 8px;
  max-width: 1320px;
  padding: 0 1rem 3rem;
  margin-left: auto;
  margin-right: auto;
}

/* When there are no images */
.no-images-message{
  text-align: center;
  padding: 2rem 1rem;
  font-size: 1rem;
  color: #555;
}

/* -------------------------
   Gallery grid
------------------------- */
.gallery-container{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

/* Card shell */
.gallery-item{
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
  box-sizing: border-box;
}

.gallery-item:hover{
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* Reserve caption space to reduce CLS */
.gallery-item > span{
  flex: 0 0 auto;
  text-align: center;
  padding: 10px 8px 14px;
  font-size: 1rem;
  font-weight: 600;
  color: #0f4c75;
  letter-spacing: 0.02em;
  text-transform: none;
  min-height: 2.6em;
}

.gallery-item:hover > span{
  color: #1f6faf;
}

/* -------------------------
   Media wrapper (unified aspect ratio)
------------------------- */
.gallery-media{
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: #000;
}

/* Image thumbnails */
.gallery-media img{
  width: 100%;
  height: 100%;
  display: block;
  max-width: 100%;
  object-fit: cover;
}

/* Video thumbnails */
.video-thumb-wrapper{
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Thumb video fills the 4:3 frame */
.video-thumb-wrapper video{
  width: 100%;
  height: 100%;
  max-width: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

.video-thumb-wrapper .play-overlay{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* -------------------------
   Modal overlay + card
------------------------- */
.modal{
  /* KEEP display:none so JS open/close works */
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1050;
  background-color: rgba(0, 0, 0, 0.85);
  overflow: auto;
}

/* White “card” that holds the media */
.modal-content{
  position: relative;
  box-sizing: border-box;
  background-color: #ffffff;

  margin: 70px auto 40px;
  max-width: 1100px;
  width: 90%;
  padding: 10px;
  border-radius: 10px;

  text-align: center; /* caption alignment; media centers via container */
}

/* Container around image/video + caption */
.modal-image-container{
  position: relative;
  display: inline-flex;          /* shrink-wrap to content, not full width/height */
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;   /* media + caption start at top */
  max-width: 100%;
}

/* Media in modal */
.modal-image-container img,
.modal-image-container video{
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  display: block;
  background-color: #000;
  border-radius: 10px;
}

/* Filename / caption (under media) */
.modal-filename{
  margin-top: 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #222222;
}

/* Optional emphasis inside caption */
.modal strong{
  font-variant: small-caps;
  margin-right: 6px;
}

/* Fullscreen button pinned to media corner */
.fullscreen{
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 6px 10px;
  font-size: 0.8rem;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  cursor: pointer;
}

/* -------------------------
   Modal controls (close / prev / next)
------------------------- */
.close,
.prev,
.next{
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  color: #ffffff;
  font-size: 2.2rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 0 12px;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.7);
  z-index: 1100;
}

.close{
  top: 12px;
  right: 20px;
  transform: none;
  font-size: 2.4rem;
}

.prev{ left: 10px; }
.next{ right: 10px; }

/* -------------------------
   Fullscreen mode
------------------------- */
.modal.is-fullscreen{
  background-color: #000;
}

.modal.is-fullscreen .modal-content{
  margin: 0;
  max-width: none;
  width: 100%;
  height: 100%;
  border-radius: 0;
  padding: 0;
  background-color: #000; /* remove white card */
}

.modal.is-fullscreen .modal-image-container{
  width: 100%;
  height: 100%;
  display: flex;            /* override inline-flex */
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal.is-fullscreen .modal-image-container img,
.modal.is-fullscreen .modal-image-container video{
  max-width: 100%;
  max-height: 100vh;
  border-radius: 0;
}

.modal.is-fullscreen .fullscreen{
  right: 20px;
  bottom: 20px;
}

/* -------------------------
   Responsive tweaks
------------------------- */
@media (max-width: 767px){
  .modal-content{
    margin: 40px auto 20px;
    padding-bottom: 1.5rem;
  }

  .close{
    right: 12px;
    top: 8px;
  }
}

@media (max-width: 575px){
  .gallery-container{
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}
