/* ============================================================
   Shared Lightbox / Expandable Media \u2014 Ivan Tran Portfolio
   Import via: <link rel="stylesheet" href="lightbox.css"> (root)
               <link rel="stylesheet" href="../lightbox.css"> (projects/)
   Mark any <img> as expandable with: class="expandable"
   Optional caption: data-lightbox-caption="..."
   ============================================================ */

img.expandable {
  cursor: zoom-in;
}

html.lightbox-lock {
  overflow: hidden;
}

dialog.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 95vw;
  max-height: 92vh;
  margin: auto;
}

dialog.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 95vw;
  max-height: 92vh;
  padding: 16px;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lightbox-inner.is-visible {
  opacity: 1;
  transform: scale(1);
}

.lightbox-media {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #000000;
  cursor: zoom-out;
}

.lightbox-caption {
  color: #f2f2f2;
  font-size: 0.82em;
  text-align: center;
  margin-top: 12px;
  max-width: 80vw;
}

.lightbox-caption:empty {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  font-size: 1.3em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox-close:hover {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
}

.lightbox-close:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-inner {
    transition: none;
  }
}

@media (max-width: 640px) {
  .lightbox-close {
    width: 44px;
    height: 44px;
  }
}
