/* Page Transitions */
body {
  background-color: #72561d;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  font-family: 'Atkinson Hyperlegible', sans-serif !important;
  font-size: 18px;
  line-height: 3;
  /* filter: blur(0.5px) brightness(0.7); */
}

body.page-loaded {
  opacity: 1;
}

/* transitions */
#site-title,
#site-title a,
.lead {
  opacity: 1 !important;
  transition: none !important;
}

/* More space in header */
#site-title {
  margin-top: 1.1rem !important;
  margin-bottom: 1.1rem !important;
}

/* Menu molto vicino al titolo */
#content-panel aside {
  margin-top: 0.1rem !important;
  margin-bottom: 0.5rem !important;
}

#menu-main {
  margin-bottom: 0.5rem !important;
}

#content-panel hr {
  margin-top: 1rem !important;
  margin-bottom: 1rem !important;
}

/* Force font on all elements */
* {
  font-family: 'Atkinson Hyperlegible', sans-serif !important;
}

/* Make headings bigger */
h1 { font-size: 2.5em; }
h2 { font-size: 2em; }
h3 { font-size: 1.75em; }
h4 { font-size: 1.5em; }
h5 { font-size: 1.25em; }
h6 { font-size: 1em; }

/* Make paragraph text bigger */
p {
  font-size: 18px;
  line-height: 1.6;
}

/* Video background  */
#video-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(30px) brightness(0.7);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

#video-background.loaded {
  opacity: 1;
}

#gallery-panel {
  position: relative;
}

@media (max-width: 991px) {
  #video-background {
    width: 100%;
  }
}

/* Grain Effect - on html element so it doesn't fade */
@keyframes grain1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-5%, -9%); }
}

@keyframes grain2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10%, -5%); }
}

html::before,
html::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  opacity: 0.17;
  z-index: 100000; /* Increased to stay above everything except lightbox */
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 2000 2000' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='6' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

html::before {
  animation: grain1 4s steps(14) infinite;
}

html::after {
  animation: grain2 6s steps(5) infinite reverse;
}

/* Link Styles - Unified */
a,
a:link,
#menu-main a,
.list-inline a,
#content-panel a,
button.btn {
  color: #000000 !important;
}

a:visited {
  color: #000000 !important;
}

a:hover,
#menu-main a:hover,
.list-inline a:hover,
#content-panel a:hover,
button.btn:hover {
  color: #e6f2ff !important;
}

a:active {
  color: #000000 !important;
}

/* Hide Credit */
.split-credit {
  display: none;
}

/* Hide scrollbar */
#content-panel {
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

#content-panel::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

/* Also hide on body if needed */
body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

#gallery-panel {
  position: relative;
  height: 100vh;
}

#bg-video,
.background-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.background-image-overlay {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.media-copyright {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 10;
  font-size: 0.85rem;
  padding: 5px 10px;
  background: rgba(219, 134, 44, 0.157);
  border-radius: 3px;
  backdrop-filter: blur(5px);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.gallery-grid a {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  /* border: 3px solid #90EE90; */ /* <- Commenta o rimuovi questa riga */
  transition: transform 0.3s ease;
}

.gallery-grid a:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.gallery-grid img {
  width: 100%;
  height: 300px;
  object-fit: contain; /* Mostra l'immagine intera senza tagliare */
  display: block;
  background: #f5f5f500; /* Colore di sfondo per le parti vuote */
}

/* GLightbox Styling - Force lightbox above everything */
.goverlay,
.glightbox-container {
  z-index: 999999 !important;
}

/* Lightbox overlay background */
.goverlay {
  background: rgba(0, 0, 0, 0.85) !important;
}

/* Limit image size in lightbox */
.gslide-image img {
  max-width: 90vw !important;
  max-height: 90vh !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

/* Center image but keep background visible */
.gslide-media {
  max-width: 90vw !important;
  max-height: 90vh !important;
}

/* Lightbox container */
.gcontainer {
  max-width: none !important;
}

/* Back button styling */
.back-link {
  font-size: inherit;
  opacity: 0.8;
  transition: opacity 1s ease;
  color: aliceblue;
}

.back-link:hover {
  opacity: 1;
}

.archive-eroded {
  font-size: 0.92em;
  opacity: 0.55;
}

.archive-eroded a {
  text-decoration: none;
}

.archive-eroded .eroded-word {
  position: relative;
  display: inline-block;
}

.archive-eroded .eroded-word::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  transform: translateY(var(--strike-offset, -50%));
  height: 0.7px;
  background: currentColor;
  pointer-events: none;
  animation: erosion-drift 6s ease-in-out infinite;
}

@keyframes erosion-drift {
  0%   { opacity: 0.25; }
  50%  { opacity: 0.4; }
  100% { opacity: 0.25; }
}

/* Image with credit wrapper */
.image-credit-wrapper {
  position: relative;
  margin: 0;
  width: fit-content;
  max-width: 100%;
  cursor: pointer;
}

.image-credit-wrapper a {
  display: block;
  cursor: zoom-in;
}

.image-credit-wrapper a:hover img {
  opacity: 0.95;
  transition: opacity 0.3s ease;
}

.image-credit-wrapper img {
  display: block;
  max-width: 100%;
  height: auto;
  width: auto;
}

.image-credit {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 0.75rem;
  color: white;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 6px;
  border-radius: 3px;
  line-height: 1.2;
  pointer-events: none; /* Allow clicks to pass through */
}

/* Force GLightbox to be visible and on top */
#glightbox-body,
.glightbox-container {
  z-index: 9999999 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.goverlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.9) !important;
  z-index: 9999998 !important;
}

.gcontainer {
  position: fixed !important;
  z-index: 9999999 !important;
}

/* Mobile fixes for GLightbox */
@media (max-width: 768px) {
  .gslide-image img {
    max-width: 95vw !important;
    max-height: 85vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }
  
  .gslide-media {
    max-width: 95vw !important;
    max-height: 85vh !important;
  }
  
  .gslide-inner-content {
    padding: 20px 10px !important;
  }
  
  /* Make sure container doesn't overflow */
  .gcontainer {
    padding: 0 !important;
  }
}

.audio-player {
  margin: 2rem 0;
}

.audio-player audio {
  width: 100%;
  border-radius: 12px;
}