/* === SFONDO ALTRI PROGETTI === */
body {
  margin: 0;
  padding: 0;
  font-family: monospace;
  color: #fff;
  background: linear-gradient(180deg, #00bcd4, #0047ff, #6a00ff);
  background-size: 200% 200%;
  animation: bgShift 12s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

/* Scanlines */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.15) 0px,
    rgba(0,0,0,0.15) 2px,
    transparent 2px,
    transparent 4px
  );
  animation: scanlines 1s steps(20) infinite;
  pointer-events: none;
  z-index: 1;
}

/* Blocchi glitch */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,0,0,0.15) 25%, transparent 25% 50%, rgba(0,255,255,0.15) 50% 75%, transparent 75%),
    linear-gradient(0deg, rgba(0,255,0,0.1) 50%, transparent 50%);
  background-size: 4px 100%, 100% 4px;
  animation: glitchBlocks 3s infinite;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 2;
}

/* Flash casuali */
.flash {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  animation: randomFlash 8s infinite;
}

/* Menu */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 6;
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.95rem;
}
.site-nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.2rem 0.4rem;
}
.site-nav a:hover { opacity: 0.8; }
.site-nav a.active { text-decoration: underline; }

/* Contenitore */
.container {
  width: 90vw;
  max-width: 1000px;
  margin: 4.75rem auto 3rem;
  padding: 2rem;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  position: relative;
  z-index: 3;
}

/* Blocchi opere */
.opera {
  margin-bottom: 3rem;
}
.opera h2 {
  margin-bottom: 0.4rem;
}
.anno {
  font-size: 0.9rem;
  color: #ccc;
  font-weight: normal;
}
.descrizione {
  font-size: 1rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.opera img {
  max-width: 100%;
  border: 1px solid #444;
  margin-bottom: 0.5rem;
}

/* Animazioni */
@keyframes bgShift {
  0% { background-position: 50% 0%; }
  50% { background-position: 50% 100%; }
  100% { background-position: 50% 0%; }
}
@keyframes scanlines {
  to { transform: translateY(2px); }
}
@keyframes glitchBlocks {
  0%   { transform: translate(0,0); }
  20%  { transform: translate(-5px, 3px); }
  40%  { transform: translate(3px, -2px); }
  60%  { transform: translate(-2px, -4px); }
  80%  { transform: translate(4px, 2px); }
  100% { transform: translate(0,0); }
}
@keyframes randomFlash {
  0%, 98%, 100% { opacity: 0; }
  1% { opacity: 0.9; }
  3% { opacity: 0; }
  20% { opacity: 0.6; }
  22% { opacity: 0; }
  50% { opacity: 0.7; }
  52% { opacity: 0; }
  75% { opacity: 0.5; }
  77% { opacity: 0; }
}
/* Pulsante link esterno */
.btn {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  color: #ffcc00;
  border: 1px solid #ffcc00;
  text-decoration: none;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
  z-index: 1;
}

/* Hover: inverti i colori */
.btn:hover {
  background: #ffcc00;
  color: #000;
  border-color: #ffcc00;
}

/* Micro glitch luminoso */
.btn::before, 
.btn::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0; left: 0;
  background: #ffcc00;
  z-index: -1;
  opacity: 0;
  mix-blend-mode: difference;
  transition: opacity 0.2s ease;
}

.btn:hover::before {
  opacity: 0.15;
  animation: btnGlitch 0.4s steps(2, end) infinite;
}

/* Animazione glitch */
@keyframes btnGlitch {
  0% { clip-path: inset(25% 0 55% 0); }
  50% { clip-path: inset(55% 0 25% 0); }
  100% { clip-path: inset(25% 0 55% 0); }
}

html, body {
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.container, .works, .content {
  min-height: 100vh;   /* occupa almeno lo schermo intero */
  height: auto;        /* ma si allunga se c’è più testo */
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 2rem;
}

.gallery img {
  width: 100%;
  max-height: 400px;   /* altezza massima */
  object-fit: cover;   /* ritaglia se troppo alta */
  border-radius: 6px;
  transition: transform 0.3s ease;
}
