/* ---- Variables ---- */
:root {
  --bg-dark: #0d0d0d;
  --card-bg: rgba(18, 18, 18, 0.88);
  --card-border: rgba(255, 255, 255, 0.06);
  --accent: #c44d4d;
  --accent-hover: #d65c5c;
  --text: #f2f2f2;
  --text-muted: #b0b0b0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.25s ease;
  /* Fluid desktop: content width scales with viewport */
  --content-max: min(1280px, 88vw);
  --section-gap: clamp(1.5rem, 3vw, 2.5rem);
  --section-pad: clamp(1.25rem, 2.5vw, 2rem);
  --side-gap: clamp(1rem, 2vw, 2rem);
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: clamp(15px, 1.1vw + 14px, 17px);
  background: var(--bg-dark) url('foto studio/sfondo studio.webp') no-repeat center center fixed;
  background-size: cover;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
header {
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: clamp(0.6rem, 1.2vw, 0.875rem) var(--side-gap);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--card-border);
}
header a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
header a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}

/* ---- Sections common ---- */
.intro, .attrezzatura, .contatti, .lavori {
  max-width: var(--content-max);
  margin: var(--section-gap) auto;
  padding: var(--section-pad) var(--side-gap);
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.intro { display: flex; flex-wrap: wrap; gap: clamp(1.25rem, 2.5vw, 2rem); }
.text { flex: 2; min-width: min(100%, 280px); }
.text h2, .attrezzatura h2, .contatti h2, .lavori h2, .contatti-info h3 { color: var(--accent); }
.text h2, .contatti h2 { text-align: center; }
.attrezzatura h2, .lavori h2 { cursor: pointer; text-align: center; }

/* ---- Toggle sections ---- */
.toggle-container {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.45s ease-out;
}
.toggle-container.open { max-height: 3200px; }

/* ---- Two galleries side by side (one image at a time, click to next) ---- */
.galleries-row {
  max-width: var(--content-max);
  margin: var(--section-gap) auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  padding: 0 var(--side-gap);
}
.gallery-single {
  position: relative;
  aspect-ratio: 4/3;
  max-height: min(420px, 38vh);
  border-radius: var(--radius);
  overflow: hidden;
  background: #111;
  cursor: pointer;
  border: 1px solid var(--card-border);
}
.gallery-single:focus { outline: none; }
.gallery-single img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.gallery-single img.gallery-fade {
  opacity: 0;
}

/* Sovraimpressione titolo galleria: in alto a sinistra, stile editoriale; scompare al passaggio del mouse */
.gallery-label {
  position: absolute;
  top: clamp(1rem, 2.2vw, 1.5rem);
  left: clamp(1rem, 2.2vw, 1.5rem);
  right: auto;
  bottom: auto;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.65em;
  font-size: clamp(1.6rem, 3.8vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 1px rgba(0,0,0,0.8);
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
/* Barra verticale accent a sinistra del testo */
.gallery-label::before {
  content: '';
  width: 4px;
  height: 1.15em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
/* Velatura leggera solo in angolo per leggibilità */
.gallery-label::after {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: -0.5rem;
  right: -0.5rem;
  bottom: -0.5rem;
  z-index: -1;
  opacity: 1;
  background: linear-gradient(135deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.2) 45%, transparent 70%);
  border-radius: var(--radius-sm);
  transition: opacity 0.4s ease;
}
.gallery-single:hover .gallery-label,
.gallery-single:focus .gallery-label {
  opacity: 0;
  transform: translateY(-10px);
}
.gallery-single:hover .gallery-label::after,
.gallery-single:focus .gallery-label::after {
  opacity: 0;
}

.gallery-single::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0,0,0,0);
  transition: background 0.25s ease;
  pointer-events: none;
}
.gallery-single:hover::after {
  background: rgba(0,0,0,0.08);
}

/* ---- Lavori / Media ---- */
.lavori .media-container { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(1.25rem, 2.5vw, 2rem); margin-top: 1.5rem; }
.lavori .media-block { flex: 1 1 min(100%, 320px); }
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
  border-radius: var(--radius-sm);
  background: #111;
}
.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: var(--radius-sm);
}
.lavori .media-block h3 { color: var(--accent); margin-top: 0; }
.spotify-wrap { min-height: clamp(280px, 28vh, 352px); }

/* ---- Attrezzatura ---- */
.columns {
  column-count: 2;
  column-gap: 2.5rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.columns strong { color: var(--text); }

/* ---- Contatti ---- */
.contatti-layout { display: flex; flex-wrap: wrap; gap: clamp(1.25rem, 2.5vw, 2rem); }
.contatti-info, .form-contatti { flex: 1 1 min(100%, 320px); }
.contatti-info iframe { border-radius: var(--radius-sm); }
.form-contatti label { display: block; margin-bottom: 0.35rem; font-weight: 500; color: var(--text-muted); }
.form-contatti input,
.form-contatti textarea,
.form-contatti select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-contatti input:focus,
.form-contatti textarea:focus,
.form-contatti select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 77, 77, 0.2);
}
.form-contatti button {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-top: 0.25rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.15s ease;
}
.form-contatti button:hover { background: var(--accent-hover); }
.form-contatti button:active { transform: scale(0.98); }
.form-success {
  text-align: center;
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(196, 77, 77, 0.15);
  color: #e8b86d;
  border-radius: var(--radius-sm);
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive: tablet / mobile ---- */
@media (max-width: 768px) {
  :root { --content-max: 100%; --side-gap: 1rem; }
  .galleries-row { grid-template-columns: 1fr; margin: 1rem auto; padding: 0 1rem; }
  .gallery-single { max-height: 260px; }
  .intro, .attrezzatura, .contatti, .lavori { margin: 1rem; padding: 1.25rem; }
  .columns { column-count: 1; }
  .text h2 { font-size: 1.2rem; }
  .attrezzatura h2, .contatti h2, .lavori h2 { font-size: 1.3rem; }
}

/* ---- Large desktop: use more of the screen ---- */
@media (min-width: 1400px) {
  :root {
    --content-max: min(1440px, 82vw);
    --section-gap: clamp(2rem, 2.2vw, 3rem);
  }
  .gallery-single { max-height: min(480px, 42vh); }
}
