/* ==========================================================================
   PROGETTO FUOCO 2026 — foglio di stile
   Palette: bianco, elegante, minimal
   ========================================================================== */

:root {
  --bg: #ffffff;
  --fg: #242f3a;          /* antracite del logo nobis */
  --navy: #242f3a;
  --accent: #eb6209;      /* arancione della fiammella */
  --accent-dark: #cf5606;
  --muted: #8a8a8a;
  --grey: #808080;        /* grigio 50% (barra titolo galleria) */
  --line: #ececec;
  --radius: 14px;
  --maxw: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.10);
  --font: "Jost", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* --------------------------------------------------------------------------
   HEADER FISSO (uguale in ogni pagina)
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;    /* logo sopra, titolo sotto */
  align-items: flex-start;
  gap: 14px;                 /* distanza logo <-> titolo */
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.site-header a { display: inline-flex; }
.site-header__logo {
  height: 30px;
  width: auto;
  display: block;
}
.site-header__title {
  font-family: var(--font);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: 0.01em;    /* spaziatura ridotta */
  color: var(--navy);
  line-height: 1;
}
.site-header__title em {
  font-style: italic;
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   GRIGLIA HOME 2x2
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding-bottom: 40px;
}

.tile {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 4 / 3;
  cursor: pointer;
  background: #f4f4f4;
  box-shadow: var(--shadow);
  transform: translateZ(0);
}

.tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.1s var(--ease);   /* solo dissolvenza, nessuno zoom */
}

.tile__img.is-visible {
  opacity: 1;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0) 45%);
  z-index: 1;
  pointer-events: none;
}

.tile__label {
  position: absolute;
  left: 22px;
  bottom: 18px;
  z-index: 2;
  color: #fff;
  font-weight: 700;
  font-size: clamp(16px, 2.4vw, 24px);
  letter-spacing: 0.05em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.tile__count {
  display: block;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.85;
  margin-top: 4px;
}


/* --------------------------------------------------------------------------
   ANIMAZIONE DI INGRESSO (composizione della home)
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
/* ritardi progressivi */
.d1 { transition-delay: 0.05s; }
.d2 { transition-delay: 0.20s; }
.d3 { transition-delay: 0.35s; }
.d4 { transition-delay: 0.50s; }
.d5 { transition-delay: 0.65s; }
.d6 { transition-delay: 0.80s; }

/* --------------------------------------------------------------------------
   PAGINA GALLERIA
   -------------------------------------------------------------------------- */
/* link "torna alla home": in fondo, allineato a destra */
.back-row {
  text-align: right;
  padding: 6px 0 46px;
}
.back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: color 0.3s var(--ease);
}
.back-link:hover { color: var(--fg); }
.back-link::before { content: "\2190\00a0"; }

.masonry {
  columns: 3;
  column-gap: 16px;
  padding-bottom: 50px;
}
.masonry__item {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: #f4f4f4;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.07);
  opacity: 0;
  transform: translateY(18px);
}
.masonry__item.in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.masonry__item img {
  width: 100%;
  transition: transform 0.6s var(--ease);
}
.masonry__item:hover img { transform: scale(1.04); }

/* --------------------------------------------------------------------------
   LIGHTBOX
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
  padding: 24px;
}
.lightbox.open { opacity: 1; visibility: visible; }

.lightbox__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}
.lightbox__img {
  max-width: min(92vw, 1100px);
  max-height: 74vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  object-fit: contain;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}
.lightbox__img.loaded { opacity: 1; transform: scale(1); }

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(92vw, 1100px);
  margin-top: 22px;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 13px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn__hint { display: block; font-size: 10px; opacity: 0.6; letter-spacing: 0.06em; margin-top: 2px; }

.lightbox__close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.lightbox__close:hover { transform: rotate(90deg); box-shadow: var(--shadow); }

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  z-index: 2;
}
.lightbox__nav:hover { box-shadow: var(--shadow); }
.lightbox__nav--prev { left: 18px; }
.lightbox__nav--next { right: 18px; }
.lightbox__nav--prev:hover { transform: translateY(-50%) translateX(-3px); }
.lightbox__nav--next:hover { transform: translateY(-50%) translateX(3px); }

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
.footer {
  display: flex;
  flex-direction: column;    /* logo sopra, testo sotto */
  align-items: flex-start;
  gap: 8px;
  padding: 20px 28px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: #fff;
  border-top: 1px solid var(--line);
}
.footer__logo { height: 24px; width: auto; display: block; }
.footer strong { color: var(--navy); font-weight: 600; }

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .masonry { columns: 2; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .masonry { columns: 1; }
  .lightbox__bar { flex-direction: row; gap: 10px; }
  .btn { padding: 12px 16px; font-size: 12px; }
  .hero { padding: 48px 20px 24px; }
}

/* accessibilità: rispetta chi disattiva le animazioni */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal, .masonry__item { opacity: 1; transform: none; }
}
