/* Uses the CSS variables and header/footer rules already defined in style.css */

.lavori-page { padding-top: 0; }

/* ---------- HERO ---------- */
.lavori-hero {
  padding: 150px 24px 50px;
  background: linear-gradient(to bottom, var(--black-2), var(--black));
  text-align: center;
}
.lavori-hero .eyebrow {
  display: inline-block;
  color: var(--orange);
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 13px;
  margin-bottom: 16px;
  text-transform: uppercase;
}
.lavori-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1.1;
  text-transform: uppercase;
}
.lavori-hero .accent { color: var(--orange); }
.lavori-hero p {
  color: var(--grey);
  max-width: 640px;
  margin: 18px auto 0;
  font-size: 1.05rem;
}

/* ---------- FILTERS ----------
   Non sticky di proposito: un secondo elemento agganciato in cima, sopra
   l'header fisso del sito, creava sovrapposizioni imprevedibili su mobile
   (la barra "restava" sopra la galleria invece di lasciarle spazio). */
.lavori-filters {
  background: var(--black-2);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 22px 0;
}

.service-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -24px 16px;
  padding: 0 24px 4px;
  scrollbar-width: none;
}
.service-tabs::-webkit-scrollbar { display: none; }
.service-tab {
  flex-shrink: 0;
  background: var(--black-3);
  border: 1.5px solid rgba(255,255,255,0.12);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  min-height: 44px;
}
.service-tab .count { color: var(--grey); font-weight: 600; margin-left: 4px; }
.service-tab.active { border-color: var(--orange); color: var(--orange); background: #241c14; }
.service-tab.active .count { color: var(--orange); opacity: 0.75; }

.filters-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.brand-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--black-3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px 16px;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}
.brand-search .search-icon { width: 18px; height: 18px; fill: none; stroke: var(--grey); stroke-width: 1.8; flex-shrink: 0; }
.brand-search input {
  flex: 1;
  background: none; border: none; color: var(--white);
  font-family: var(--font-body); font-size: 0.9rem;
}
.brand-search input:focus { outline: none; }
.results-count { color: var(--grey); font-size: 0.85rem; white-space: nowrap; }

/* Griglia marche con logo — selezione "cattivante" al posto dei semplici chip testuali.
   Volutamente corta (11 marche + "tutte"): il resto sta dietro "mostra altre marche"
   per non trasformare la pagina in uno scroll infinito prima ancora dei risultati. */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
  padding: 4px 4px 4px;
}
.brand-empty { color: var(--grey); font-size: 0.85rem; grid-column: 1 / -1; }

.brands-more-wrap { text-align: center; margin-top: 12px; }
.brands-more-btn {
  background: none;
  border: 1px dashed rgba(255,255,255,0.2);
  color: var(--grey);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.brands-more-btn:hover { border-color: var(--orange); color: var(--orange); }

.brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--black-3);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 8px 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.brand-card:hover { transform: translateY(-2px); border-color: rgba(245,126,29,0.4); }
.brand-card.active { border-color: var(--orange); background: #241c14; }

.brand-logo {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
  flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo--all { background: var(--orange); }
.brand-logo--all svg { width: 26px; height: 26px; fill: none; stroke: var(--black); stroke-width: 2.2; stroke-linecap: round; }
.brand-fallback-icon { width: 30px; height: 30px; fill: none; stroke: #1c1c1c; stroke-width: 1.6; }

.brand-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  color: var(--white);
}
.brand-card.active .brand-name { color: var(--orange); }
.brand-count {
  font-size: 0.68rem;
  color: var(--grey);
  background: rgba(255,255,255,0.06);
  padding: 1px 8px;
  border-radius: 999px;
}
.brand-card.active .brand-count { color: var(--orange); background: rgba(245,126,29,0.14); }

/* ---------- GALLERY GRID ---------- */
.lavori-gallery {
  padding: 34px 0 90px;
  background: var(--black);
  min-height: 160px;
  /* Compensa l'header fisso quando si scrolla qui via JS dopo una scelta */
  scroll-margin-top: 100px;
}

/* Placeholder mostrato finché l'utente non sceglie un servizio o una marca:
   evita di scaricare/mostrare tutte le 150+ foto appena si apre la pagina. */
.gallery-intro[hidden] { display: none; }
.gallery-intro {
  text-align: center;
  padding: 50px 20px;
  border: 1.5px dashed rgba(255,255,255,0.12);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.gallery-intro-icon { width: 30px; height: 30px; fill: none; stroke: var(--orange); stroke-width: 2; transform: rotate(90deg); opacity: 0.8; }
.gallery-intro p { color: var(--grey); font-size: 0.95rem; max-width: 420px; }

.gallery-results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.active-filter { font-family: var(--font-display); text-transform: uppercase; font-size: 1.1rem; letter-spacing: 0.02em; }

.load-more-wrap { text-align: center; margin-top: 28px; }

.lavori-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.lavoro-card {
  background: var(--black-3);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.lavoro-card:hover { transform: translateY(-3px); border-color: rgba(245,126,29,0.35); }

.lavoro-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #0c0c0c;
}
.lavoro-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.lavoro-card:hover .lavoro-media img { transform: scale(1.06); }

.lavoro-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(9,9,9,0.75);
  backdrop-filter: blur(4px);
  color: var(--orange);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 999px;
}

.lavoro-card figcaption {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lavoro-card figcaption strong { font-size: 0.9rem; }
.lavoro-card figcaption span { font-size: 0.76rem; color: var(--grey); }

.empty-state {
  text-align: center;
  color: var(--grey);
  padding: 60px 0;
  font-size: 0.95rem;
}

/* ---------- BOTTOM CTA ---------- */
.lavori-cta {
  padding: 70px 0 90px;
  background: linear-gradient(to bottom, var(--black), var(--black-2));
  text-align: center;
}
.lavori-cta h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  margin-bottom: 12px;
}
.lavori-cta p { color: var(--grey); margin-bottom: 26px; }
.lavori-cta-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- LIGHTBOX ---------- */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: rgba(9,9,9,0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lightbox-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--white);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.lightbox-close:hover { background: rgba(255,255,255,0.16); }

.lightbox-figure {
  max-width: min(92vw, 1100px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0;
  transform: scale(0.85);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.28s ease;
}
.lightbox.is-open .lightbox-figure {
  transform: scale(1);
  opacity: 1;
}
.lightbox-figure img {
  max-width: 100%;
  max-height: 74vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-figure figcaption {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lightbox-figure figcaption strong { font-size: 1rem; }
.lightbox-figure figcaption span { font-size: 0.82rem; color: var(--grey); }

/* Le card della galleria sono cliccabili */
.lavoro-media { cursor: zoom-in; }

@media (max-width: 600px) {
  .lightbox { padding: 20px 16px; }
  .lightbox-close { top: 10px; right: 10px; width: 38px; height: 38px; font-size: 1.4rem; }
  .lightbox-figure img { max-height: 68vh; }
}

@media (max-width: 900px) {
  .lavori-hero { padding: 130px 24px 40px; }
  .lavori-filters { padding: 16px 0; }
  .brand-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .brand-logo { width: 44px; height: 44px; }
}

@media (max-width: 600px) {
  .lavori-hero { padding: 104px 18px 34px; }
  .lavori-page .lavori-hero p { font-size: 0.92rem; }
  .lavori-filters { padding: 14px 0; }
  .filters-row { flex-direction: column; align-items: stretch; }
  .brand-search { max-width: none; }
  /* 3 per riga: schede più grandi e comode da toccare, meno affollamento visivo */
  .brand-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .brand-card { padding: 10px 4px 8px; }
  .brand-logo { width: 40px; height: 40px; border-radius: 8px; }
  .brand-name { font-size: 0.66rem; }
  .gallery-results-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .lavori-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .lavoro-card figcaption { padding: 8px 10px 10px; }
  .lavoro-card figcaption strong { font-size: 0.78rem; }
  .lavoro-card figcaption span { font-size: 0.68rem; }
  .lavoro-badge { font-size: 0.6rem; padding: 4px 8px; top: 6px; left: 6px; }
  .lavori-cta-buttons { flex-direction: column; align-items: stretch; }
}

/* Foto multiple per lavoro + frecce nello zoom */
.lavoro-count {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(9,9,9,0.75); color: var(--white);
  font-size: 0.68rem; font-weight: 700; padding: 4px 9px; border-radius: 999px;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.1); color: var(--white);
  font-size: 2rem; line-height: 1; cursor: pointer; z-index: 2;
}
.lightbox-nav[hidden] { display: none; }
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }
.lightbox-counter { display: block; font-style: normal; font-size: 0.78rem; color: var(--orange); margin-top: 2px; }
@media (max-width: 600px) {
  .lightbox-nav { width: 40px; height: 40px; font-size: 1.7rem; }
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
}

/* Marche in una sola riga scorrevole: i lavori restano subito visibili sotto */
.brand-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 2px 6px;
  max-height: none;
}
.brand-grid::-webkit-scrollbar { display: none; }
.brand-grid .brand-card { flex: 0 0 88px; padding: 10px 4px 8px; }
.brand-grid .brand-logo { width: 40px; height: 40px; }
.brands-more-wrap { display: none; }
.lavori-hero { padding-bottom: 28px; }
.lavori-filters { padding: 14px 0; }
.lavori-gallery { padding-top: 24px; }

.lavori-cta-buttons { align-items: center; }
.lavori-cta-buttons .btn { margin-top: 0; }
