/* --- Design Tokens ----------------------------------- */
:root {
  --c-olive:  #7a6d4e;
  --c-salmon: #c48b7a;
  --c-gold:   #d8b760;
  --c-white:  #ffffff;
  --c-black:  #000000;
  --nav-h:    48px;
  --pad-x:    clamp(2rem, 5vw, 5rem);
  --pad-y:    clamp(2rem, 4vh, 3.5rem);
}

/* --- Fonts ------------------------------------------- */
@font-face {
  font-family: 'BranGro';
  src: url('img/fonts/BrandonGrotesqueRegular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'BranGroBold';
  src: url('img/fonts/BrandonGrotesqueBold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- Reset & Base ------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'BranGro', 'Open Sans', system-ui, sans-serif;
  background: var(--c-black);
  overflow-x: hidden;
}

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

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

h2 {
  text-transform: uppercase;
}

/* --- Header / Nav ------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-olive);
  height: var(--nav-h);
}

nav {
  height: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 var(--pad-x);
  gap: clamp(1rem, 2.5vw, 2.5rem);
}

nav a {
  color: var(--c-white);
  font-family: 'BranGro', system-ui, sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: opacity 0.2s;
}

nav a:hover {
  opacity: 0.75;
}

/* --- Sections: base comune ---------------------------- */
main > section {
  min-height: 100vh;
  width: 100%;
  scroll-margin-top: var(--nav-h);
}

/* --- Section: HOME ------------------------------------ */
#home {
  display: flex;
  align-items: center;
  justify-content: center;
  background: url('img/fondosedie.jpg') center / cover no-repeat;
  background-color: var(--c-olive);
}

.logo-wrap {
  width: fit-content;
  background: rgba(0, 0, 0, 0.72);
  padding: 1.2rem 3rem;
}

#home .logo {
  width: clamp(400px, 62vw, 900px);
  display: block;
}

/* --- Section: ABOUT (CHi) ----------------------------- */
#about {
  background: var(--c-salmon);
  color: var(--c-olive);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  padding: var(--pad-y) var(--pad-x);
  align-items: center;
}

#about .col-foto {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

#about h2 {
  font-family: 'BranGroBold', system-ui, sans-serif;
  font-size: clamp(4rem, 8vw, 6rem);
  font-weight: 700;
  line-height: 1;
  color: var(--c-olive);
}

#about .col-foto img {
  width: 100%;
  max-height: 55vh;
  object-fit: cover;
  object-position: top;
}

#about .col-testo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

#about .arrow {
  width: 44px;
  margin-bottom: 0.5rem;
}

#about h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

#about p {
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  font-weight: 700;
  line-height: 1.6;
  text-align: justify;
}

/* --- Titoli di sezione grandi ------------------------- */
.section-title {
  font-family: 'BranGroBold', system-ui, sans-serif;
  font-size: clamp(4rem, 8vw, 6.5rem);
  font-weight: 700;
  line-height: 1;
}

.section-desc {
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  font-weight: 700;
  line-height: 1.6;
  text-align: justify;
  max-width: 45ch;
}

/* --- Titolo + freccia inline -------------------------- */
.titolo-blocco {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.titolo-blocco h2 {
  flex: 0 0 auto;
}

/* --- Arrow SVG ---------------------------------------- */
.arrow {
  width: 40px;
  flex-shrink: 0;
  margin-top: 0.75rem;
  transform: rotate(90deg);
}

/* --- Sezioni con gallery (IMPAGLIATURE, GALLERY, RESTAURO, RESTYLING) -- */
/*
 * Layout: flex column
 * - .intestazione / .gallery-text  →  altezza naturale, in cima
 * - .foto-strip                    →  flex:1, cresce e riempie tutto il resto
 */
#impagliature,
#gallery,
#restauro,
#restyling {
  display: flex;
  flex-direction: column;
  padding: var(--pad-y) var(--pad-x) 0;
}

/* --- Intestazione (titolo + testo) nelle sezioni con gallery -- */
.intestazione {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 2rem;
  /* nessun flex-shrink: 0 necessario, è già il comportamento di default */
}

/* --- Griglia foto ------------------------------------- */
.foto-strip {
  flex: 1;          /* occupa tutto lo spazio rimanente nella sezione */
  min-height: 0;    /* necessario per flex children che contengono griglie */
  max-height: 55vh;   /* ← regola questo numero a piacere */
  display: grid;
  gap: 8px;
  align-items: stretch;
}

.foto-strip.quattro {
  grid-template-columns: repeat(4, 1fr);
}

.foto-strip.tre {
  grid-template-columns: repeat(3, 1fr);
}

.foto-strip img {
  width: 100%;
  height: 100%;       /* riempie la cella della griglia */
  min-height: 220px;  /* altezza minima di sicurezza */
  object-fit: cover;
}

/* --- Colori per ciascuna sezione con gallery ---------- */
#impagliature {
  background: var(--c-olive);
  color: var(--c-salmon);
  gap: var(--pad-y);
}

#gallery {
  background: var(--c-olive);
  color: var(--c-salmon);
  gap: var(--pad-y);
}

#gallery .gallery-text {
  max-width: 45%;
  margin-left: auto;
}

#restauro {
  background: var(--c-gold);
  color: var(--c-olive);
  gap: var(--pad-y);
}

#restyling {
  background: var(--c-gold);
  color: var(--c-olive);
  gap: var(--pad-y);
}

/* --- Section: CONTATTI (Dove) ------------------------- */
#contatti {
  display: flex;
  align-items: center;
  justify-content: center;
  background: url('img/fondointreccio.jpg') center / cover no-repeat;
  padding: var(--pad-y) var(--pad-x);
}

.contact-box {
  background: rgba(0, 0, 0, 0.75);
  padding: 2.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto 1fr auto;
  gap: 1.25rem 3rem;
  max-width: 900px;
  width: 100%;
  color: var(--c-gold);
}

.contact-box h2 {
  font-family: 'BranGroBold', system-ui, sans-serif;
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1;
  grid-column: 1;
  grid-row: 1;
}

.contact-box .disponibile {
  font-size: 1.05rem;
  font-weight: 700;
  grid-column: 1;
  grid-row: 2;
}

.contact-box address {
  font-style: normal;
  grid-column: 1;
  grid-row: 3;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-box address p {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
}

.contact-box address img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.contact-box address a {
  color: var(--c-gold);
  transition: opacity 0.2s;
}

.contact-box address a:hover {
  opacity: 0.75;
}

.contact-box .map-wrap {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
}

.contact-box .map-wrap iframe {
  width: 260px;
  height: 260px;
  border: none;
  display: block;
}

.contact-box .piva {
  grid-column: 1 / -1;
  grid-row: 4;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--c-gold);
}

/* --- Responsive --------------------------------------- */
@media (max-width: 768px) {

  /* -- Nav ---------------------------------------------- */
  header {
    height: auto;
  }
  nav {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    height: auto;
    padding: 0.5rem 1rem;
  }

  /* -- Home: logo non più largo della viewport ----------- */
  #home .logo {
    width: min(85vw, 500px);
  }
  .logo-wrap {
    padding: 0.75rem 1.5rem;
  }

  /* -- About --------------------------------------------- */
  #about {
    grid-template-columns: 1fr;
  }

  /* -- Titoli h2: font scalante per evitare overflow ------ */
  /* "IMPAGLIATURE" (12 car.) a 9vw → ~34px su 375px: entra */
  .section-title {
    font-size: clamp(1.8rem, 9vw, 4rem);
  }
  /* "CHI" è breve: può stare più grande */
  #about h2 {
    font-size: clamp(2.5rem, 13vw, 4rem);
  }
  /* "DOVE" nel box contatti */
  .contact-box h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  /* -- Intestazione a colonna singola -------------------- */
  .intestazione {
    grid-template-columns: 1fr;
  }

  /* -- Foto-strip: una foto per riga (sviluppo verticale) - */
  .foto-strip.quattro,
  .foto-strip.tre {
    grid-template-columns: 1fr;
    max-height: none;      /* rimuove il limite di altezza desktop */
  }
  /* Le immagini usano aspect-ratio invece di height: 100%
     perché senza altezza definita sul contenitore height:100% → 0 */
  .foto-strip img {
    height: auto;
    aspect-ratio: 4 / 3;
    min-height: unset;
  }

  /* -- Gallery text -------------------------------------- */
  #gallery .gallery-text {
    max-width: 100%;
    margin-left: 0;
  }

  /* -- Contatti: colonna singola, padding ridotto ------- */
  .contact-box {
    grid-template-columns: 1fr;
    padding: 1.5rem 1.25rem;   /* era 2.5rem 3rem: troppo su mobile */
  }
  .contact-box .map-wrap {
    grid-column: 1;
    grid-row: auto;
  }
  .contact-box .map-wrap iframe {
    width: 100%;
    height: 220px;
  }
}
