/* ==========================================================================
   Edilizia Fani — foglio di stile unico
   Palette, tipografia e spaziature dal documento di handoff.
   Mobile-first: base < 720px, poi 720px e 1024px.
   ========================================================================== */

:root {
  --bg: #F3EFE8;
  --ink: #1F1C18;
  --ink-2: #4A443C;
  --muted: #6B645A;
  --muted-dark: #A39A8C;
  --line: #D9D2C5;
  --line-strong: #C9C0B1;
  --line-dark: #3A352F;
  --dark: #2A2622;
  --dark-2: #1F1C18;
  --on-dark: #F3EFE8;
  --on-dark-2: #CFC7BA;
  --accent: #B4532A;
  --accent-hover: #8A3D1E;
  --accent-dark: #D98A63;
  --placeholder: #D9D2C5;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;

  --container: 1240px;
  --gutter: 20px;
  --header-h: 72px;
  --hero-overhang: 48px;
}

/* --------------------------------------------------------------------------
   Reset minimo
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img { display: block; max-width: 100%; height: auto; }
/* <picture> come blocco normale: con display:contents il <source> diventava
   un elemento di griglia vuoto e spostava la foto nella colonna sbagliata. */
picture { display: block; }
picture > source { display: none; }

/* L'attributo hidden deve vincere sui display espliciti (es. .card) */
[hidden] { display: none !important; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}
a:hover { color: var(--accent-hover); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  background: var(--dark-2);
  color: var(--on-dark);
  padding: 10px 16px;
  font-weight: 600;
}
.skip-link:focus { top: 16px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Contenitore e tipografia condivisa
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.eyebrow--muted { color: var(--muted); }
.eyebrow--on-dark { color: var(--accent-dark); }

.h2 {
  font-size: clamp(32px, 4.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
}

.note {
  font-size: 13px;
  color: var(--muted);
}

.link-inline { border-bottom: 1px solid var(--accent); }

.link-underline {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}
.link-underline:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Bottoni
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 22px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-dark { background: var(--dark-2); color: var(--on-dark); }
.btn-dark:hover { background: var(--accent); color: #fff; }

.btn-outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--ink); color: var(--on-dark); }

.btn-outline-light { border-color: var(--on-dark); color: var(--on-dark); background: transparent; }
.btn-outline-light:hover { background: var(--on-dark); color: var(--ink); }

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 239, 232, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  min-width: 0;
}
.brand:hover { color: var(--ink); }
.brand__mark {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  flex: 0 0 auto;
  background: #fff;
}
.brand__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1;
}
.brand__name {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand__place {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Hamburger: visibile solo sotto i 1024px, e solo con JS attivo */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 4px 8px 12px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.nav-toggle__bars {
  position: relative;
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  transition: background-color 150ms ease;
}
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: currentColor;
  transition: transform 150ms ease;
}
.nav-toggle__bars::before { top: -7px; }
.nav-toggle__bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-7px) rotate(-45deg); }

.nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 26px;
}
.nav__list a {
  display: inline-block;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 2px solid transparent;
}
.nav__list a:hover { color: var(--accent); }
.nav__list a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Layout mobile del menu: pannello sotto l'header */
@media (max-width: 1023.98px) {
  .js .nav-toggle { display: inline-flex; }

  .js .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 40px -24px rgba(31, 28, 24, 0.35);
  }
  .js .nav:not(.is-open) { display: none; }

  .js .nav__list {
    flex-direction: column;
    gap: 0;
    padding: 8px var(--gutter) 16px;
  }
  .js .nav__list li + li { border-top: 1px solid var(--line); }
  .js .nav__list a {
    display: block;
    padding: 14px 0;
    font-size: 16px;
    border-bottom: 0;
  }
  .js .nav__list a[aria-current="page"] {
    border-bottom: 0;
    box-shadow: inset 3px 0 0 var(--accent);
    padding-left: 14px;
  }

  /* Senza JS: voci su più righe, sempre visibili */
  .no-js .site-header__inner { flex-wrap: wrap; }
  .no-js .nav { width: 100%; }
  .no-js .nav__list { gap: 0 20px; }
}

/* --------------------------------------------------------------------------
   Hero (home)
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  background: var(--dark);
  color: var(--on-dark);
  isolation: isolate;
}
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  opacity: 0.35;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(42, 38, 34, 0.25) 0%, rgba(42, 38, 34, 0.92) 100%);
}

.hero__grid {
  display: grid;
  gap: 32px;
  padding-top: 72px;
  padding-bottom: 56px;
  align-items: end;
}
.hero .eyebrow { color: var(--accent-dark); margin-bottom: 20px; }
.hero__title {
  font-size: clamp(44px, 9vw, 104px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.hero__aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 440px;
}
.hero__aside p {
  font-size: 18px;
  line-height: 1.6;
  color: var(--on-dark-2);
}

/* La foto sporge oltre il bordo inferiore della sezione scura.
   Nessun overflow hidden sulla sezione, come richiesto. */
.hero__photo {
  transform: translateY(var(--hero-overhang));
  margin-top: calc(-1 * var(--hero-overhang));
  width: 100%;
  aspect-ratio: 1000 / 408;
  object-fit: cover;
  background: var(--line-dark);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

/* --------------------------------------------------------------------------
   Home: servizi
   -------------------------------------------------------------------------- */
.intro {
  padding-top: calc(var(--hero-overhang) + 56px);
  padding-bottom: 64px;
  display: grid;
  gap: 28px;
}
.intro__text {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 60ch;
}

/* Due colonne con bordi sopra/sotto e divisore */
.pillars {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.pillars__grid {
  display: grid;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.pillar {
  padding: 40px 0;
}
.pillar + .pillar { border-top: 1px solid var(--line); }
.pillar h3 {
  font-size: clamp(28px, 3.5vw, 34px);
  line-height: 1.15;
  margin-bottom: 16px;
}
.pillar p {
  color: var(--ink-2);
  line-height: 1.7;
  max-width: 60ch;
}
.pillar p + p { margin-top: 14px; }

/* --------------------------------------------------------------------------
   Home: lavori in evidenza
   -------------------------------------------------------------------------- */
.featured {
  padding-top: 64px;
  padding-bottom: 64px;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px 24px;
  margin-bottom: 32px;
}

/* --------------------------------------------------------------------------
   Schede (lavori, progetti, immobili)
   -------------------------------------------------------------------------- */
.cards {
  display: grid;
  gap: 40px 32px;
  grid-template-columns: 1fr;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--ink);
}
.card__media {
  width: 100%;
  aspect-ratio: 1000 / 704;
  object-fit: cover;
  background: var(--placeholder);
}
.card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card__cat {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.card h3 {
  font-size: 26px;
  line-height: 1.15;
  transition: color 150ms ease;
}
.card__desc {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
}
.card__credit {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

a.card:hover { color: var(--ink); }
a.card:hover h3 { color: var(--accent); }

/* --------------------------------------------------------------------------
   CTA scura
   -------------------------------------------------------------------------- */
.cta {
  background: var(--dark-2);
  color: var(--on-dark);
}
.cta__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 28px 32px;
  padding-top: 64px;
  padding-bottom: 64px;
}
.cta h2 {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.1;
  max-width: 640px;
}

/* --------------------------------------------------------------------------
   Intestazione pagine interne
   -------------------------------------------------------------------------- */
.page-head {
  border-bottom: 1px solid var(--line);
}
.page-head__inner {
  padding-top: 56px;
  padding-bottom: 40px;
}
.page-head h1 {
  font-size: clamp(44px, 6vw, 80px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.page-head p {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 640px;
}

/* --------------------------------------------------------------------------
   Chi siamo
   -------------------------------------------------------------------------- */
.about {
  display: grid;
  gap: 40px;
  padding-top: 56px;
  padding-bottom: 72px;
  align-items: start;
}
.about__photo {
  width: 100%;
  aspect-ratio: 1000 / 704;
  object-fit: cover;
  background: var(--placeholder);
}
.about__text h2 {
  font-size: clamp(30px, 3.8vw, 38px);
  line-height: 1.15;
  margin-bottom: 24px;
}
.about__text p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
  max-width: 60ch;
  margin-bottom: 32px;
}

/* --------------------------------------------------------------------------
   Griglie di pagina (lavori / progetti / immobili)
   -------------------------------------------------------------------------- */
.gallery {
  padding-top: 40px;
  padding-bottom: 72px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.filter {
  min-height: 44px;
  padding: 10px 18px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.filter:hover { border-color: var(--ink); }
.filter[aria-pressed="true"] {
  background: var(--dark-2);
  color: var(--on-dark);
  border-color: var(--dark-2);
}
.filters__count {
  width: 100%;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.no-js .filters { display: none; }

.cards__empty {
  grid-column: 1 / -1;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink-2);
  padding: 24px 0;
}

.gallery__foot {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px 24px;
}
.gallery__foot p {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.3;
}
.gallery__foot a:not(.btn) { color: var(--accent); border-bottom: 1px solid var(--accent); }

/* --------------------------------------------------------------------------
   Contatti
   -------------------------------------------------------------------------- */
.contact {
  display: grid;
  gap: 40px;
  padding-top: 48px;
  padding-bottom: 72px;
}
.contact__list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.contact__item .eyebrow { margin-bottom: 10px; }
.contact__value {
  font-family: var(--serif);
  font-size: clamp(24px, 3.2vw, 30px);
  line-height: 1.2;
  color: var(--ink);
}
.contact__phones {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.contact__phones a,
a.contact__value {
  color: var(--ink);
  overflow-wrap: anywhere;
}
.contact__phones a:hover,
a.contact__value:hover { color: var(--accent); }
.contact__item .link-underline { margin-top: 12px; color: var(--accent); }
.contact__item .link-underline:hover { color: var(--accent-hover); }

.contact__panel {
  background: var(--dark);
  color: var(--on-dark);
  padding: 32px 28px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}
.contact__panel p {
  font-family: var(--serif);
  font-size: clamp(24px, 3.2vw, 30px);
  line-height: 1.2;
}
.contact__panel .note { color: var(--on-dark-2); font-size: 14px; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--dark-2);
  color: var(--on-dark-2);
}
.site-footer__inner {
  padding-top: 48px;
  padding-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 16px;
}
.site-footer__brand img {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
}
.site-footer__name {
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 32px);
  color: var(--on-dark);
  line-height: 1.1;
  margin-bottom: 6px;
}
.site-footer__tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.3;
}
.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  font-size: 15px;
}
.site-footer__links a { color: var(--on-dark); padding: 4px 0; }
.site-footer__links a:hover { color: var(--accent-dark); }
.site-footer__legal {
  border-top: 1px solid var(--line-dark);
  padding-top: 20px;
  font-size: 13px;
  color: var(--muted-dark);
  line-height: 1.6;
}

/* ==========================================================================
   Tablet: ≥ 720px
   ========================================================================== */
@media (min-width: 720px) {
  :root {
    --gutter: 32px;
    --header-h: 84px;
    --hero-overhang: 72px;
  }

  .brand__mark { width: 48px; height: 48px; }
  .brand__name { font-size: 26px; }

  .hero__grid {
    padding-top: 96px;
    padding-bottom: 80px;
    gap: 40px;
  }

  .intro {
    padding-top: calc(var(--hero-overhang) + 72px);
    padding-bottom: 80px;
  }

  .cards { grid-template-columns: repeat(2, 1fr); gap: 48px 32px; }

  .pillars__grid { grid-template-columns: 1fr 1fr; }
  .pillar { padding: 64px 0; }
  .pillar + .pillar { border-top: 0; }
  .pillar:first-child { padding-right: 40px; border-right: 1px solid var(--line); }
  .pillar:last-child { padding-left: 40px; }

  .featured { padding-top: 80px; padding-bottom: 80px; }
  .cta__inner { padding-top: 80px; padding-bottom: 80px; }

  .page-head__inner { padding-top: 80px; padding-bottom: 56px; }

  .about { grid-template-columns: 1fr 1fr; gap: 48px; padding-top: 72px; padding-bottom: 96px; }

  .gallery { padding-top: 48px; padding-bottom: 96px; }

  .contact { grid-template-columns: 1fr 1fr; gap: 48px; padding-top: 64px; padding-bottom: 96px; }
  .contact__panel { padding: 40px; min-height: 360px; }

  .site-footer__inner { padding-top: 56px; padding-bottom: 40px; }
  .site-footer__brand img { width: 64px; height: 64px; }
}

/* ==========================================================================
   Desktop: ≥ 1024px
   ========================================================================== */
@media (min-width: 1024px) {
  :root { --hero-overhang: 96px; }

  .hero__grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 48px 80px;
    padding-top: 112px;
    padding-bottom: 96px;
  }
  .hero__aside { justify-self: end; }

  .intro {
    grid-template-columns: 1fr 1fr;
    gap: 48px 80px;
    padding-top: calc(var(--hero-overhang) + 64px);
    padding-bottom: 96px;
  }

  .pillar { padding: 72px 0; }
  .pillar:first-child { padding-right: 48px; }
  .pillar:last-child { padding-left: 48px; }

  .featured { padding-top: 96px; padding-bottom: 96px; }
  .section-head { margin-bottom: 40px; }

  .cards { grid-template-columns: repeat(3, 1fr); }
  .cards--wide { grid-template-columns: repeat(2, 1fr); }

  .about { gap: 64px; }
}

/* Griglia a 3 colonne solo oltre i 1024px; evita schede troppo strette
   quando la pagina ha un solo elemento (immobili in vendita). */
@media (min-width: 1024px) {
  .cards--single { grid-template-columns: repeat(3, 1fr); }
}
