/* ══════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --white:  #ffffff;
  --light:  #f0efed;
  --mid:    #999894;
  --dark:   #333330;
  --black:  #111110;
  --font:   'Barlow', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

html, body {
  width: 100%; height: 100%;
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
address { font-style: normal; }

/* ══════════════════════════════════════════
   INTRO
══════════════════════════════════════════ */
#intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.7s ease;
}
#intro.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Stage di scrittura: testo poi barra (barra = cursore a destra) */
#intro-stage {
  display: flex;
  align-items: center;
  gap: 0.14em;
  font-size: clamp(28px, 4.5vw, 64px);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  transition: opacity 0.35s ease;
}
#intro-stage.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Testo digitato — nero nella fase 1, grigio nella fase PROGINT */
#typed-text {
  display: inline;
  color: var(--dark);
  transition: color 0.3s ease;
}
#typed-text.grey { color: #888; }

/* La barra \ da Logo-01 — è il cursore che si muove */
#slash-bar {
  height: 1.15em;
  width: auto;
  display: block;
  flex-shrink: 0;
  animation: blink 0.53s step-end infinite;
}
#slash-bar.solid { animation: none; opacity: 1; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Logo-02 finale: parte piccolo (stessa scala del testo) e cresce */
#final-logo {
  position: absolute;
  width: min(90vw, 1200px);
  height: auto;
  opacity: 0;
  /* parte da scala ridotta — corrisponde visivamente alla dimensione del testo */
  transform: scale(0.28);
  transform-origin: center center;
  transition: opacity 0.4s ease,
              transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
#final-logo.visible {
  opacity: 1;
  transform: scale(1);
}

/* ══════════════════════════════════════════
   BACKGROUND LOGO
══════════════════════════════════════════ */
#bg-logo {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#bg-logo.visible { opacity: 1; }
#bg-logo img {
  width: min(95vw, 1400px);
  height: auto;
  opacity: 0.07;
  filter: grayscale(1);
}

/* ══════════════════════════════════════════
   SCROLL CONTAINER
══════════════════════════════════════════ */
#scroll-container {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
#scroll-container::-webkit-scrollbar { display: none; }
#scroll-container.visible { opacity: 1; pointer-events: all; }

/* ══════════════════════════════════════════
   SLIDE PROGETTO
══════════════════════════════════════════ */
.project-slide {
  width: 100%; height: 100vh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-photo {
  position: relative;
  cursor: pointer;
  max-width: min(82vw, 1100px);
  max-height: 78vh;
  display: flex;
}

.photo-inner {
  position: relative;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 12px 60px rgba(0,0,0,0.10), 0 2px 12px rgba(0,0,0,0.05);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.slide-photo:hover .photo-inner {
  transform: scale(1.015);
  box-shadow: 0 20px 80px rgba(0,0,0,0.15), 0 4px 20px rgba(0,0,0,0.07);
}
.photo-inner img {
  display: block;
  max-width: min(82vw, 1100px);
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
}
.photo-fallback { position: absolute; inset: 0; }
.photo-fallback svg { width: 100%; height: 100%; }

.photo-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 48px 28px 24px;
  background: linear-gradient(to top, rgba(255,255,255,0.95) 0%, transparent 100%);
  display: flex; align-items: flex-end; gap: 14px;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.slide-photo:hover .photo-caption { opacity: 1; transform: translateY(0); }

.caption-num   { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--mid); flex-shrink: 0; }
.caption-title { font-size: 13px; font-weight: 400; color: var(--dark); flex: 1; letter-spacing: 0.02em; }
.caption-hint  { font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mid); flex-shrink: 0; }

/* ══════════════════════════════════════════
   CONTACT SLIDE (pagina finale bianca)
══════════════════════════════════════════ */
.contact-slide {
  width: 100%; height: 100vh;
  scroll-snap-align: start;
  background: var(--white);
  position: relative;
}

/* I tre item in colonna centrata */
.contact-slide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 180px;
}
.contact-item {
  position: relative;
  text-align: center;
  cursor: default;
}
.contact-top, .contact-mid, .contact-bot { /* nessun posizionamento assoluto */ }

/* Testi: label e value sovrapposti, fade incrociato su hover */
.c-label,
.c-value {
  display: block;
  font-family: var(--font);
  font-size: clamp(26px, 3.2vw, 48px);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #aaa;
  line-height: 1.5;
  transition: opacity 0.35s ease;
  white-space: nowrap;
}
/* label visibile, value sovrapposto e invisibile */
.c-label { position: relative; }
.c-value  {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  white-space: nowrap;
}
.contact-item:hover .c-label { opacity: 0; }
.contact-item:hover .c-value { opacity: 1; }

/* ══════════════════════════════════════════
   DOTS
══════════════════════════════════════════ */
#project-dots {
  position: fixed; right: 32px; top: 50%; transform: translateY(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
}
#project-dots.visible { opacity: 1; pointer-events: all; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: #ccc; cursor: pointer; transition: background 0.3s, transform 0.3s; }
.dot.active { background: var(--black); transform: scale(1.6); }

/* ══════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════ */
#lightbox {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(255,255,255,0.97);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.4s ease;
}
#lightbox.open { opacity: 1; pointer-events: all; }
#lb-close { position: absolute; top: 28px; right: 36px; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--mid); transition: color 0.2s; z-index: 10; }
#lb-close:hover { color: var(--black); }
#lb-prev, #lb-next { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 28px; cursor: pointer; color: var(--mid); transition: color 0.2s; padding: 20px; z-index: 10; }
#lb-prev { left: 24px; } #lb-next { right: 24px; }
#lb-prev:hover, #lb-next:hover { color: var(--black); }
#lb-stage { width: min(80vw, 1100px); aspect-ratio: 4/3; }
#lb-img-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--light); }
#lb-img-wrap img, #lb-img-wrap svg { width: 100%; height: 100%; object-fit: contain; display: block; }
#lb-meta { margin-top: 20px; display: flex; justify-content: space-between; width: min(80vw, 1100px); }
#lb-title { font-size: 14px; font-weight: 400; color: var(--dark); }
#lb-counter { font-size: 11px; color: var(--mid); }
#lightbox::after { content: 'ESC · ← →'; position: absolute; bottom: 24px; font-size: 10px; letter-spacing: 0.1em; color: #ddd; }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 768px) {
  #nav { padding: 20px 24px; }
  .slide-photo { width: 88vw; }
  #project-dots { right: 12px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  footer { padding: 60px 24px 32px; }
  #lb-stage { width: 92vw; } #lb-meta { width: 92vw; }
  #lb-prev { left: 4px; } #lb-next { right: 4px; }
  .caption-hint { display: none; }
  #intro-stage { font-size: clamp(18px, 5.5vw, 36px); }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
