/* Fullscreen wrapper that covers the entire viewport */
.fullscreen-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh; /* dvh respects iOS browser chrome */
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999999999;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  touch-action: pan-x;
}

/* Image inside the fullscreen wrapper */
.fit-inner img {
  max-width: 94vw;
  max-height: 98vh;
  object-fit: contain;
  box-shadow: 0 0 10px 5px rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
  display: block;
}

/* Zoomed image ? reparented directly into wrapper for scroll to work */
.fullscreen-wrapper > img.zoomed {
  display: block;
  height: 100dvh; /* dvh accounts for iOS browser chrome, unlike vh */
  width: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  box-shadow: 0 0 10px 5px rgba(255, 255, 255, 0.5);
  margin: 0 auto;
}

/* Inner container ? image and caption stack vertically, arrows positioned relative to image */
.fit-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 94vw;
  max-height: 98dvh;
}

/* Navigation arrows ? positioned relative to fit-inner, centred on the image portion */
.fit-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  user-select: none;
  z-index: 10000;
  padding: 6px 8px;
  transition: color 0.2s ease;
  display: none; /* shown via JS */
}

.fit-prev {
  left: 6px;
}

.fit-next {
  right: 6px;
}

.fit-arrow:hover {
  color: #ffcc00;
}

/* Image wrap ? arrows are positioned relative to this */
.fit-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Caption block ? sits directly below the image */
.fit-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 8px;
  pointer-events: none;
}

/* Image counter */
.fit-image-counter {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  white-space: nowrap;
  display: none; /* shown via JS */
}

/* Swipe hint */
.fit-swipe-hint {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  white-space: normal;
  max-width: 90vw;
  text-align: center;
  display: none; /* shown via JS */
}

/* Desktop-only cursor styling */
@media (hover: hover) and (pointer: fine) {
  .fullscreen-image {
    cursor: zoom-in;
  }

  .fullscreen-image.zoomed {
    cursor: zoom-out;
  }

  .desktop-zoomed {
    cursor: zoom-out;
  }
}

/* Subtle hover zoom ONLY for normal Twitter images */
.zoomable-twitter:not(.fullscreen-image):not(.desktop-zoomed) {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: zoom-in;
}

.zoomable-twitter:not(.fullscreen-image):not(.desktop-zoomed):hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}