/* ============================================
   INSTAGRAM PREVIEW & SITE CREDIT (ig.css)
   ============================================ */

.site-credit-wrapper {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1vh;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Scritta trigger di default */
.site-credit {
  display: inline-block;
  font-size: 1.6vh;
  font-weight: 300; /* Spessore leggero fisso */
  letter-spacing: -0.01em;
  color: var(--text-dim);
  opacity: 0.75;
  text-decoration: none;
  white-space: nowrap;
  text-align: center;
  user-select: none;
  cursor: pointer;
  transition: color 0.25s ease,
              font-size 0.25s ease,
              opacity 0.25s ease;
}

.site-credit::before,
.ig-card-link::before {
  content: none !important;
  display: none !important;
}

/* Finestra di anteprima: senza ombra, larga */
.instagram-preview-card {
  position: absolute;
  bottom: calc(100% + 1vh);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: var(--bg-dark);
  border: 1px solid var(--text-main);
  border-radius: 8px;
  box-shadow: none !important;
  width: 380px;
  max-width: 90vw;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 999999;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

/* Ponte trasparente tra scritta e finestra */
.instagram-preview-card::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 2.5vh; /* Copre completamente il tragitto tra testo e immagine */
  background: transparent;
  pointer-events: auto;
}

.ig-card-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  line-height: 0;
  cursor: pointer;
}

.ig-screenshot {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  opacity: 1 !important;
  pointer-events: auto;
}

/* ============================================
   HOVER DESKTOP (min-width: 769px)
   ============================================ */
@media (min-width: 769px) {
  /* Sia che il mouse sia sulla scritta, sia che vada sull'immagine */
  .site-credit-wrapper:hover .site-credit {
    color: var(--accent-lime) !important;
    font-size: 1.7vh !important; /* Dimensione ridotta e calibrata */
    font-weight: 300 !important; /* Nessun aumento di spessore */
    opacity: 1 !important;
  }

  .site-credit-wrapper:hover .instagram-preview-card {
    opacity: 1;
    visibility: visible;
    pointer-events: auto !important; /* Consente interazione e hover diretto sull'immagine */
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================
   MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
  .site-credit-wrapper {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    bottom: auto !important;
    /* La galleria parte da 24vh ed è alta ~55vh; questo valore lo posiziona esattamente sotto */
    top: calc(24vh + 55vh + 30vh) !important;
    width: 100%;
    margin: 0 !important;
    padding-bottom: calc(env(safe-area-inset-bottom) + 3vh);
    box-sizing: border-box;
    text-align: center;
    z-index: 999999;
  }

  .site-credit {
    font-size: 1.3vh;
    font-weight: 300;
  }

  .instagram-preview-card {
    display: none !important;
  }

}
/* Scomparsa se la griglia a tutto schermo è attiva */
body.grid-active .site-credit-wrapper {
  display: none !important;
}