/* ============================================================
   post-media.css
   Styles for images, videos, and captions inside post content,
   plus the full-size lightbox modal.
   ============================================================ */

/* ── Figure wrapper ─────────────────────────────────────────
   Usage in post HTML:
     <figure class="post-figure">
       <img src="..." alt="..." />
       <figcaption>Caption text here.</figcaption>
     </figure>

     <figure class="post-figure">
       <video src="..." controls></video>
       <figcaption>Caption text here.</figcaption>
     </figure>

   For a video embed (YouTube/Vimeo iframe), wrap the iframe
   in a .post-figure-embed div inside the figure:
     <figure class="post-figure">
       <div class="post-figure-embed">
         <iframe src="..." allowfullscreen></iframe>
       </div>
       <figcaption>Caption text here.</figcaption>
     </figure>
   ──────────────────────────────────────────────────────────── */

.post-figure {
  margin: 1.8rem 0;
  padding: 0;
  text-align: center;
}

/* Image — fills the column, never overflows */
.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  /* Clickable images get a subtle hover cue via JS-added class */
}

.post-figure img.is-zoomable {
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.post-figure img.is-zoomable:hover {
  opacity: 0.92;
}

/* Native video — fills the column */
.post-figure video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  background: #000;
}

/* Responsive embed wrapper (16:9 by default) */
.post-figure-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 4px;
  background: #000;
}
.post-figure-embed iframe,
.post-figure-embed video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 4px;
}

/* Caption */
.post-figure figcaption {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.82rem;
  color: #888;
  line-height: 1.5;
  margin-top: 0.55rem;
  font-style: italic;
}

/* ── Lightbox modal ──────────────────────────────────────────
   Injected into the DOM once by post-media.js             */

#media-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9900;
  background: rgba(10, 10, 10, 0.88);
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
#media-modal.open {
  display: flex;
}

#media-modal-inner {
  position: relative;
  max-width: min(92vw, 1200px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: default;
}

#media-modal-img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 60px);
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6);
  object-fit: contain;
}

#media-modal-caption {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.72);
  font-style: italic;
  text-align: center;
  max-width: 65ch;
  line-height: 1.5;
}
#media-modal-caption:empty {
  display: none;
}

#media-modal-close {
  position: fixed;
  top: 18px;
  right: 22px;
  font-size: 1.8rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.14s;
  z-index: 9910;
}
#media-modal-close:hover {
  color: #fff;
}
