/* =============================================================
   Primopiano Costruzioni — sistema visivo
   Palette derivata dal logo: navy #002A56, accento #00608E.
   Tipografia: Helvetica Now Display (locale, resources/font).
   ============================================================= */

/* ------------------------------------------------------------ font --- */
@font-face {
  font-family: 'Helvetica Now Display';
  src: url('../../resources/font/HelveticaNowDisplay-Light.woff2') format('woff2'),
       url('../../resources/font/HelveticaNowDisplay-Light.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Now Display';
  src: url('../../resources/font/HelveticaNowDisplay-Regular.woff2') format('woff2'),
       url('../../resources/font/HelveticaNowDisplay-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Now Display';
  src: url('../../resources/font/HelveticaNowDisplay-Medium.woff2') format('woff2'),
       url('../../resources/font/HelveticaNowDisplay-Medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Now Display';
  src: url('../../resources/font/HelveticaNowDisplay-Bold.woff2') format('woff2'),
       url('../../resources/font/HelveticaNowDisplay-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------- tokens --- */
:root {
  --navy: #002a56;
  --navy-deep: #001b38;
  --blue: #00608e;

  --ink: #0e1115;
  --ink-soft: #3d4349;
  --muted: #63696f;

  --paper: #ffffff;
  --paper-warm: #f5f4f1;
  --paper-cool: #eef0f1;
  --line: #e3e1dc;
  --line-strong: #cfcdc7;

  --gutter: clamp(1.25rem, 5vw, 5.5rem);
  --measure: 62ch;
  --gap: clamp(1.25rem, 2.4vw, 2.5rem);
  --section-y: clamp(5rem, 11vw, 11rem);
  --radius: 0px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.6s;

  --header-h: 76px;
}

@media (max-width: 720px) {
  :root { --header-h: 64px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Helvetica Now Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.62;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

button,
input,
textarea,
select { font: inherit; color: inherit; }

::selection { background: var(--navy); color: #fff; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 1.25rem;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------ tipografia --- */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

.display {
  font-size: clamp(2.9rem, 8.6vw, 8.75rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.h1 {
  font-size: clamp(2.5rem, 6.6vw, 6rem);
  line-height: 0.94;
  letter-spacing: -0.045em;
}

.h2 {
  font-size: clamp(2rem, 4.6vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.h3 {
  font-size: clamp(1.35rem, 2.1vw, 1.9rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.h4 {
  font-size: clamp(1.05rem, 1.35vw, 1.25rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 500;
}

.lead {
  font-weight: 300;
  font-size: clamp(1.15rem, 1.9vw, 1.6rem);
  line-height: 1.42;
  letter-spacing: -0.022em;
  color: var(--ink-soft);
}

.body-lg {
  font-size: clamp(1.0625rem, 1.15vw, 1.2rem);
  line-height: 1.6;
}

.eyebrow {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow--rule {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.eyebrow--rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.muted { color: var(--muted); }
.measure { max-width: var(--measure); }
.measure-sm { max-width: 46ch; }

/* --------------------------------------------------------- layout --- */
.container {
  width: 100%;
  max-width: 1680px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: 1160px; }

.section { padding-block: var(--section-y); }
/* le sezioni raggiungibili da un'ancora non finiscono sotto l'header fisso */
[id].section,
[id].hero { scroll-margin-top: calc(var(--header-h) + 0.5rem); }
.section--tight { padding-block: clamp(3.5rem, 7vw, 7rem); }
.section--top-0 { padding-top: 0; }
.section--bottom-0 { padding-bottom: 0; }

.section--warm { background: var(--paper-warm); }
.section--dark {
  background: var(--navy-deep);
  color: #fff;
}
.section--dark .lead,
.section--dark .muted { color: rgba(255, 255, 255, 0.66); }
.section--dark .eyebrow { color: rgba(255, 255, 255, 0.55); }
.section--dark .eyebrow--rule::after { background: rgba(255, 255, 255, 0.22); }

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* --------------------------------------------------------- header --- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: transform 0.45s var(--ease), background-color 0.4s var(--ease),
    border-color 0.4s var(--ease), color 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(6, 14, 24, 0.55), rgba(6, 14, 24, 0));
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

/* sopra un hero scuro/immagine */
.site-header[data-mode='over'] { color: #fff; }
.site-header[data-mode='over']::before { opacity: 1; }

.site-header.is-solid {
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom-color: var(--line);
  color: var(--ink);
}
.site-header.is-solid::before { opacity: 0; }

.site-header.is-hidden { transform: translateY(-102%); }

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

/* ---------------------------------------------------------- brand --- */
/* Il marchio è il logo originale (resources/images/logos), ritagliato dalla
   versione fornita: griglia + "primo piano" + "costruzioni", senza la cornice
   e senza la riga con l'indirizzo del sito. Due file sovrapposti — navy e
   bianco — che si scambiano in dissolvenza quando l'header passa sopra una
   hero scura. */
.brand {
  display: inline-flex;
  align-items: center;
  color: inherit;
}

.brand-logo {
  position: relative;
  display: block;
  flex: none;
  height: calc(var(--header-h) - 16px); /* 60px sopra i 720px, 48px sotto */
  aspect-ratio: 1168 / 1183;
}
.brand-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.4s var(--ease);
}
.brand-logo .logo-light { opacity: 0; }

/* sopra una hero scura, e nel piè di pagina, serve la versione bianca */
.site-header[data-mode='over'] .brand-logo .logo-navy,
.site-footer .brand-logo .logo-navy { opacity: 0; }
.site-header[data-mode='over'] .brand-logo .logo-light,
.site-footer .brand-logo .logo-light { opacity: 1; }

/* ------------------------------------------------------------ nav --- */
.nav {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 2.4vw, 2.6rem);
}

.nav a {
  position: relative;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  padding-block: 0.35rem;
}

.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}
.nav a:hover::after,
.nav a[aria-current='page']::after { transform: scaleX(1); }
.nav a[aria-current='page'] { opacity: 1; }

.nav-cta {
  border: 1px solid currentColor;
  padding: 0.55rem 1.1rem !important;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}
.nav-cta::after { display: none; }
.nav-cta:hover { background: currentColor; }
.nav-cta:hover span { color: var(--paper); }
.site-header[data-mode='over'] .nav-cta:hover span { color: var(--navy-deep); }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: 0;
  padding: 0.5rem 0;
  cursor: pointer;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav-toggle-bars {
  position: relative;
  width: 22px;
  height: 10px;
}
.nav-toggle-bars span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.4s var(--ease-out), opacity 0.3s;
}
.nav-toggle-bars span:first-child { top: 0; }
.nav-toggle-bars span:last-child { bottom: 0; }

@media (max-width: 900px) {
  .js .nav { display: none; }
  .nav { flex-wrap: wrap; gap: 0.75rem 1.25rem; font-size: 0.85rem; }
  .nav .nav-cta { display: none; }
  .js .nav-toggle { display: inline-flex; }
}

/* ------------------------------------------------- menu overlay --- */
.menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--navy-deep);
  color: #fff;
  padding: calc(var(--header-h) + 2rem) var(--gutter) 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 0.72s var(--ease-out), visibility 0.72s;
  overflow-y: auto;
}
.menu.is-open {
  transform: translateY(0);
  visibility: visible;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.menu-list li { overflow: hidden; }
.menu-list a {
  display: block;
  padding: 0.18em 0;
  font-size: clamp(2.3rem, 11vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.06;
  transform: translateY(105%);
  transition: transform 0.7s var(--ease-out);
}
.menu.is-open .menu-list a { transform: translateY(0); }
.menu.is-open .menu-list li:nth-child(1) a { transition-delay: 0.08s; }
.menu.is-open .menu-list li:nth-child(2) a { transition-delay: 0.14s; }
.menu.is-open .menu-list li:nth-child(3) a { transition-delay: 0.2s; }
.menu.is-open .menu-list li:nth-child(4) a { transition-delay: 0.26s; }
.menu.is-open .menu-list li:nth-child(5) a { transition-delay: 0.32s; }

.menu-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  opacity: 0;
  transition: opacity 0.5s var(--ease) 0.35s;
}
.menu.is-open .menu-foot { opacity: 1; }

body.menu-open { overflow: hidden; }

/* Con il menu aperto l'header resta sopra il pannello navy: sulle pagine
   chiare serve comunque la versione chiara di marchio e comandi. */
body.menu-open .site-header { color: #fff; }
body.menu-open .site-header .brand-logo .logo-navy { opacity: 0; }
body.menu-open .site-header .brand-logo .logo-light { opacity: 1; }

/* -------------------------------------------------------- bottoni --- */
.btn {
  --btn-fg: var(--paper);
  --btn-bg: var(--navy);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.05rem 1.75rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.4s var(--ease);
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.5s var(--ease-out);
  z-index: -1;
}
.btn:hover::before { transform: scaleY(1); }
.btn .arrow { transition: transform 0.5s var(--ease-out); }
.btn:hover .arrow { transform: translateX(5px); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: currentColor;
  --btn-fill: var(--ink);
  border: 1px solid currentColor;
}
.btn--ghost::before { background: var(--btn-fill); }
.btn--ghost:hover { color: var(--paper); }
.section--dark .btn--ghost,
.hero .btn--ghost { --btn-fill: var(--paper); }
.section--dark .btn--ghost:hover,
.hero .btn--ghost:hover { color: var(--navy-deep); }

.btn--light {
  --btn-bg: #fff;
  --btn-fg: var(--navy-deep);
}
.btn--light::before { background: var(--paper-warm); }
.btn--light:hover { color: var(--navy-deep); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.95rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid currentColor;
  transition: gap 0.4s var(--ease-out), opacity 0.3s;
}
.link-arrow:hover { gap: 1.1rem; }

.arrow {
  display: inline-block;
  width: 0.85em;
  flex: none;
}

/* ----------------------------------------------------------- hero --- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  color: #fff;
  overflow: hidden;
}

.hero--page {
  min-height: min(78svh, 760px);
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.hero-media img,
.hero-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.js .hero-media img,
.js .hero-media video {
  transform: scale(1.08);
  transition: transform 2.4s var(--ease-out);
}
.is-ready .hero-media img,
.is-ready .hero-media video { transform: scale(1); }

.hero-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(4, 12, 22, 0.42) 0%, rgba(4, 12, 22, 0.1) 38%, rgba(4, 12, 22, 0.62) 100%);
}

.hero-inner {
  width: 100%;
  padding-bottom: clamp(2rem, 4vw, 3.5rem);
  padding-top: calc(var(--header-h) + 2rem);
}

.hero .display { font-size: min(16vw, clamp(3.75rem, 7.4vw, 7.6rem)); }

.hero-claim {
  max-width: 18ch;
  margin-bottom: clamp(1.5rem, 3vw, 2.4rem);
}

.hero-sub {
  max-width: 46ch;
  color: rgba(255, 255, 255, 0.82);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: clamp(1.6rem, 2.8vw, 2.5rem);
}

.hero-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  margin-top: clamp(2rem, 4.5vw, 3.5rem);
  padding-top: 1.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.78);
}

.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.scroll-hint i {
  display: block;
  width: 1px;
  height: 34px;
  background: currentColor;
  opacity: 0.5;
  animation: scrollHint 2.6s var(--ease) infinite;
  transform-origin: top;
}
@keyframes scrollHint {
  0% { transform: scaleY(0); opacity: 0; }
  35% { transform: scaleY(1); opacity: 0.6; }
  70% { transform: scaleY(1); opacity: 0.6; }
  100% { transform: scaleY(0) translateY(34px); opacity: 0; }
}

/* hero delle pagine interne */
.page-hero {
  padding-top: calc(var(--header-h) + clamp(4.5rem, 11vw, 9rem));
  padding-bottom: clamp(2.5rem, 5vw, 4.5rem);
}
.page-hero .h1 { margin-bottom: clamp(1.2rem, 2.2vw, 2rem); }

/* su mobile il testo si sovrappone alle zone chiare dell'immagine:
   velatura un filo piu' marcata e ombra morbida sotto il testo */
@media (max-width: 720px) {
  .hero-media::after {
    background: linear-gradient(to bottom, rgba(4, 12, 22, 0.52) 0%, rgba(4, 12, 22, 0.24) 36%, rgba(4, 12, 22, 0.74) 100%);
  }
  .hero-claim,
  .hero-sub,
  .hero-foot {
    text-shadow: 0 1px 16px rgba(4, 12, 22, 0.55);
  }
}

/* ---------------------------------------------------------- media --- */
.media {
  position: relative;
  overflow: hidden;
  background: var(--paper-cool);
}
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 0.75s var(--ease-out);
}

.media > [data-parallax] {
  position: absolute;
  inset: -8% 0;
  width: 100%;
  height: 116%;
  object-fit: cover;
}

.ratio-4x5 { aspect-ratio: 4 / 5; }
.ratio-3x2 { aspect-ratio: 3 / 2; }
.ratio-16x9 { aspect-ratio: 16 / 9; }
.ratio-1x1 { aspect-ratio: 1 / 1; }
.ratio-21x9 { aspect-ratio: 21 / 9; }
.ratio-4x3 { aspect-ratio: 4 / 3; }

.media-caption {
  margin-top: 0.9rem;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: -0.005em;
}

/* rivelazione immagini */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out), transform 1s var(--ease-out);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
[data-reveal-delay='1'] { transition-delay: 0.09s; }
[data-reveal-delay='2'] { transition-delay: 0.18s; }
[data-reveal-delay='3'] { transition-delay: 0.27s; }
[data-reveal-delay='4'] { transition-delay: 0.36s; }

.js .media[data-reveal-media] img {
  transform: scale(1.09);
  transition: transform 1.6s var(--ease-out), scale 0.75s var(--ease-out);
}
.media[data-reveal-media].is-visible img { transform: scale(1); }
.js .media[data-reveal-media]::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--paper);
  transform-origin: bottom;
  transition: transform 1.05s var(--ease-out);
  z-index: 2;
}
.media[data-reveal-media].is-visible::before { transform: scaleY(0); }
.section--dark .media[data-reveal-media]::before { background: var(--navy-deep); }

/* titoli a comparsa per righe.
   Il ritaglio (overflow) mangerebbe la coda delle lettere discendenti (g, p, q,
   y) perche' con interlinee sotto 1 la riga e' piu' bassa dei glifi: lo spazio
   in basso serve a lasciarle intere, il margine negativo lo riassorbe cosi' la
   spaziatura fra le righe non cambia. Il testo nascosto parte piu' in basso
   (120%) proprio per restare fuori anche da quello spazio in piu'. */
.split-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
}
.js .split-line > span {
  display: block;
  transform: translateY(120%);
  transition: transform 1s var(--ease-out);
}
.is-visible .split-line > span,
.split-ready.is-visible > .split-line > span { transform: translateY(0); }
.split-line:nth-child(2) > span { transition-delay: 0.07s; }
.split-line:nth-child(3) > span { transition-delay: 0.14s; }
.split-line:nth-child(4) > span { transition-delay: 0.21s; }

/* -------------------------------------------------------- progetti --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: clamp(2.5rem, 4vw, 4.5rem) var(--gap);
}

.project-card { display: block; }

.project-card .media {
  aspect-ratio: 4 / 5;
}
.project-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.project-name {
  font-size: clamp(1.15rem, 1.6vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.project-place {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.project-year {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--line-strong);
}
.tag--wip { color: var(--blue); }
.tag--wip::before { background: var(--blue); }

/* ------------------------------------------------- certificazioni --- */
.certs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.cert {
  border-top: 1px solid var(--line-strong);
  padding-top: 1.5rem;
}
.cert-code {
  display: block;
  margin-bottom: 1rem;
  font-size: clamp(1.6rem, 2.6vw, 2.3rem);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--blue);
}
.cert .h4 { margin: 0 0 0.5rem; }
.cert p { margin: 0; max-width: 40ch; line-height: 1.55; }

@media (max-width: 820px) {
  .certs { grid-template-columns: 1fr; gap: 2rem; }
}

/* Cantieri in corso: sono quelli con appartamenti in vendita, e la griglia
   deve dirlo prima di ogni altra cosa. Etichetta piena sull'immagine, filetto
   navy sotto e consegna in accento; il resto della card resta identico.
   Sta sotto la tendina di rivelazione (z-index 2), cosi' compare insieme
   alla foto invece di galleggiarci sopra. */
.project-flag {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--navy);
  color: var(--paper);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.75rem 1.1rem;
  /* contiene la passata di luce dentro la fascia */
  overflow: hidden;
}

/* E' l'unica informazione commerciale della griglia, quindi deve farsi
   notare: un battito lento sul quadratino e una passata di luce sulla
   fascia, sulla stessa cadenza cosi' leggono come un gesto solo. Niente si
   sposta e niente cambia dimensione: il layout resta fermo. */
.project-flag::before {
  content: '';
  width: 6px;
  height: 6px;
  background: currentColor;
  /* l'alone e' quadrato come il punto: box-shadow senza raggio */
  animation: flagPulse 3.8s var(--ease) infinite;
}
.project-flag::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0) 38%,
    rgba(255, 255, 255, 0.26) 50%,
    rgba(255, 255, 255, 0) 62%
  );
  /* a riposo sta fuori dalla fascia: se l'animazione non parte non si vede */
  transform: translateX(-140%);
  pointer-events: none;
  animation: flagSheen 3.8s var(--ease) infinite;
}

@keyframes flagPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
  24% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@keyframes flagSheen {
  0% { transform: translateX(-140%); }
  34% { transform: translateX(140%); }
  100% { transform: translateX(140%); }
}

/* Cantiere gia' tutto venduto: stessa fascia ma ferma e in inchiostro.
   Non c'e' piu' niente da vendere, quindi niente battito ne' passata di luce. */
.project-flag--sold { background: var(--ink); }
.project-flag--sold::before { animation: none; }
.project-flag--sold::after { content: none; }

.project-card[data-stato='in-costruzione'] .project-meta {
  border-top-color: var(--navy);
}
.project-card[data-stato='in-costruzione'] .project-year {
  color: var(--blue);
}

/* progetti in evidenza (home) */
.featured {
  display: grid;
  gap: clamp(3rem, 6vw, 6rem);
}
.featured-item {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
  align-items: center;
}
.featured-item .media { grid-column: span 7; aspect-ratio: 16 / 10; }
.featured-item .featured-body { grid-column: 9 / span 4; }
.featured-item:nth-child(even) .media { grid-column: 6 / span 7; order: 2; }
.featured-item:nth-child(even) .featured-body { grid-column: 1 / span 4; order: 1; }
.featured-body .h2 {
  margin-bottom: 0.8rem;
  /* i nomi stanno su una riga quando ci entrano; se non ci entrano
     (es. "Via della Repubblica") il capo va bilanciato, non forzato */
  text-wrap: balance;
}
.featured-body .project-place { margin-bottom: 0; font-size: 0.95rem; }

@media (max-width: 900px) {
  .featured-item,
  .featured-item:nth-child(even) {
    grid-template-columns: 1fr;
  }
  .featured-item .media,
  .featured-item:nth-child(even) .media {
    grid-column: 1 / -1;
    order: 1;
    aspect-ratio: 4 / 3;
  }
  .featured-item .featured-body,
  .featured-item:nth-child(even) .featured-body {
    grid-column: 1 / -1;
    order: 2;
  }
}

/* nuove costruzioni (home): fascia navy sopra il carosello. E' l'unico
   intervento in vendita, quindi si stacca dal resto per colore e peso. */
.nc-band {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background: var(--navy);
  color: var(--paper);
  margin-bottom: clamp(3.5rem, 7vw, 6rem);
}
.nc-band-media {
  min-height: clamp(260px, 30vw, 440px);
  cursor: pointer;
}
.nc-band-media img {
  position: absolute;
  inset: 0;
}
.nc-band-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.1rem;
  padding: clamp(1.75rem, 4.5vw, 4rem);
}
.nc-band .eyebrow { color: #7fb4d0; }
.nc-band-title {
  font-size: clamp(2.2rem, 4.4vw, 3.8rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.nc-band-body > p { max-width: 46ch; color: rgba(255, 255, 255, 0.72); }
.nc-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  margin: 0.4rem 0 0.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.nc-facts dt { font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); order: 2; }
.nc-facts dd { margin: 0; font-size: 1.15rem; font-weight: 500; letter-spacing: -0.02em; }
.nc-facts div { display: flex; flex-direction: column; }

/* nella griglia di Progetti la fascia prende tutta la riga */
.nc-band--grid { grid-column: 1 / -1; margin-bottom: 0; }
.nc-band.is-filtered { display: none; }

@media (max-width: 800px) {
  .nc-band { grid-template-columns: 1fr; }
  .nc-band-media { min-height: 0; aspect-ratio: 4 / 3; }
}

/* le foto che aprono la scheda di approfondimento */
.media[data-dettaglio] { cursor: pointer; }
.project-more { margin-top: 1rem; font-size: 0.85rem; }

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

/* carosello dei realizzati (home). Senza JS le slide si scorrono in
   orizzontale; con JS stanno impilate nella stessa cella e si alternano. */
.pc {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  column-gap: var(--gap);
}
.pc-slides {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.pc-slide {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  column-gap: var(--gap);
  scroll-snap-align: start;
}
.pc-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper-cool);
  cursor: pointer;
}
.pc-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pc-body { padding-top: clamp(4.5rem, 7vw, 6.5rem); }
.pc-title {
  font-size: clamp(1.9rem, 3.2vw, 3rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  text-wrap: balance;
  margin: 0.9rem 0 0.5rem;
}
.pc-body .project-place { font-size: 0.95rem; margin-bottom: 1.6rem; }

.link-more {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0 0.25rem;
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.link-more .arrow { transition: transform 0.5s var(--ease-out); }
.link-more:hover .arrow { transform: translateX(5px); }

.pc-ctrl {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.pc-ctrl > * { pointer-events: auto; }
.pc-count {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.pc-count b {
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-right: 0.15rem;
}
.pc-nav { display: flex; align-items: center; gap: 0.5rem; }
.pc-arrow {
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.pc-arrow:hover { background: var(--navy); border-color: var(--navy); color: var(--paper); }
.pc-bar {
  position: relative;
  flex: 1;
  height: 1px;
  margin-left: 1rem;
  background: var(--line-strong);
}
.pc-bar i {
  position: absolute;
  left: 0;
  top: -1px;
  height: 3px;
  width: 0;
  background: var(--navy);
  transition: width 0.6s var(--ease-out);
}
.pc-thumbs {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.6rem;
  margin-top: 1.25rem;
  padding-bottom: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.pc-thumbs::-webkit-scrollbar { display: none; }
.pc-thumb {
  position: relative;
  flex: 0 0 clamp(78px, 8.5vw, 120px);
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: var(--paper-cool);
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.3s var(--ease);
}
.pc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pc-thumb:hover,
.pc-thumb[aria-current='true'] { opacity: 1; }
.pc-thumb::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.4rem;
  height: 2px;
  background: var(--navy);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}
.pc-thumb[aria-current='true']::after { transform: scaleX(1); }

/* senza JS i comandi non servono: si scorre col dito */
.pc-ctrl,
.pc-thumbs { display: none; }

.js .pc-ctrl { display: flex; }
.js .pc-thumbs { display: flex; }
.js .pc-slides { grid-auto-flow: row; overflow: visible; }
.js .pc-slide {
  grid-area: 1 / 1;
  visibility: hidden;
  transition: visibility 0s 0.8s;
}
.js .pc-slide.is-on { visibility: visible; transition: none; }
.js .pc-media img {
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 0.8s var(--ease), transform 1.4s var(--ease-out);
}
.js .pc-slide.is-on .pc-media img { opacity: 1; transform: none; }
.js .pc-body {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.js .pc-slide.is-on .pc-body {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s var(--ease) 0.25s, transform 0.6s var(--ease-out) 0.25s;
}

@media (max-width: 860px) {
  .pc,
  .pc-slide { grid-template-columns: 1fr; }
  .pc-body { padding-top: 1.4rem; }
  .pc-ctrl {
    grid-column: 1;
    grid-row: 2;
    flex-direction: row-reverse;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.75rem;
  }
  .pc-nav { flex: 1; }
  .pc-bar { order: -1; margin: 0 1rem 0 0; }
}

/* scheda di approfondimento */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 250;
}
.drawer[hidden] { display: none; }
.drawer-veil {
  position: absolute;
  inset: 0;
  background: rgba(0, 27, 56, 0.55);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(720px, 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  transform: translateX(100%);
  transition: transform 0.7s var(--ease-out);
}
.drawer.is-open .drawer-veil { opacity: 1; }
.drawer.is-open .drawer-panel { transform: none; }
.drawer-close {
  /* sticky con margine negativo: resta in vista scorrendo, ma sopra la foto
     invece di spingerla in basso */
  position: sticky;
  top: 1rem;
  z-index: 3;
  display: block;
  height: 2.75rem;
  margin: 1rem 1rem -3.75rem auto;
  padding: 0 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.drawer-close:hover { border-color: var(--ink); }
.drawer-hero {
  position: relative;
  aspect-ratio: 16 / 11;
  background: var(--paper-cool);
}
.drawer-hero img { width: 100%; height: 100%; object-fit: cover; }
.drawer-body { padding: clamp(1.5rem, 4.5vw, 3.25rem); }
.drawer-title {
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 0.9rem 0 0.5rem;
}
.drawer-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
  padding: 1.1rem 0;
  border-block: 1px solid var(--line);
}
.drawer-facts div { display: flex; flex-direction: column; }
.drawer-facts dt { order: 2; font-size: 0.8rem; color: var(--muted); }
.drawer-facts dd { margin: 0; font-size: 1.05rem; font-weight: 500; }
.drawer-text {
  max-width: var(--measure);
  color: var(--ink-soft);
  margin-bottom: 2rem;
}
.drawer-text p + p { margin-top: 1em; }
/* dati tecnici: etichetta a sinistra, valore a destra, una riga ciascuno */
.drawer-data {
  display: grid;
  margin: 0 0 2.5rem;
  font-size: 0.9rem;
}
.drawer-data div {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}
.drawer-data div:last-child { border-bottom: 1px solid var(--line); }
.drawer-data dt { color: var(--muted); }
.drawer-data dd { margin: 0; }

/* filtri */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.1rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.filter {
  background: none;
  border: 0;
  padding: 0.35rem 0;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--muted);
  position: relative;
  transition: color 0.35s var(--ease);
}
.filter::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1.15rem;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}
.filter[aria-pressed='true'] { color: var(--ink); }
.filter[aria-pressed='true']::after { transform: scaleX(1); }
.filter-count {
  font-size: 0.7rem;
  vertical-align: super;
  opacity: 0.6;
  margin-left: 0.15rem;
}

.project-card.is-filtered {
  display: none;
}

/* zoom leggero al passaggio del mouse */
@media (hover: hover) and (pointer: fine) {
  .project-card:hover .media img,
  .featured-item:hover .media img {
    scale: 1.04;
  }
}

/* ---------------------------------------------------------- ragioni --- */
/* Cinque card: numero, titolo e un "+". Col mouse il testo resta chiuso e
   sale al passaggio, mentre la card si colora di blu; da tastiera si apre
   col focus. Col dito e senza puntatore il testo resta sempre aperto. */
.reasons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.2vw, 1.25rem);
}
.reason {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  min-height: 25rem;
  padding: clamp(1.5rem, 2vw, 2rem);
  isolation: isolate;
}
/* il fondo sta su uno pseudo-elemento: la transizione dell'articolo e'
   gia' occupata dalla rivelazione allo scroll ([data-reveal]) */
.reason::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.04);
  transition: background-color 0.5s var(--ease);
}
.reason:focus-visible { outline: 1px solid #7fb4d0; outline-offset: 3px; }
.reason-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.reason-num {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: #7fb4d0;
  transition: color 0.5s var(--ease);
}
.reason-plus {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease);
}
.reason-plus::before {
  content: '+';
  font-size: 1.1rem;
  line-height: 1;
  color: #fff;
  transition: transform 0.6s var(--ease-out), color 0.4s var(--ease);
}
.reason h3 {
  font-size: clamp(1.35rem, 1.7vw, 1.6rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: #fff;
}
/* da 0fr a 1fr: il testo si apre senza altezze fisse da indovinare */
.reason-body {
  display: grid;
  grid-template-rows: auto 1fr;
  transition: grid-template-rows 0.6s var(--ease-out);
}
.reason-text { overflow: hidden; }
.reason p {
  margin: 0;
  padding-top: 1rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.8);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .reason-body { grid-template-rows: auto 0fr; }
  .reason p { opacity: 0; transform: translateY(12px); }

  .reason:hover::before,
  .reason:focus-within::before { background-color: var(--blue); }
  .reason:hover .reason-body,
  .reason:focus-within .reason-body { grid-template-rows: auto 1fr; }
  .reason:hover p,
  .reason:focus-within p {
    opacity: 1;
    transform: none;
    color: rgba(255, 255, 255, 0.92);
    transition-delay: 0.12s;
  }
  .reason:hover .reason-num,
  .reason:focus-within .reason-num { color: #fff; }
  .reason:hover .reason-plus,
  .reason:focus-within .reason-plus { background-color: #fff; border-color: #fff; }
  .reason:hover .reason-plus::before,
  .reason:focus-within .reason-plus::before { color: var(--blue); transform: rotate(45deg); }
}
/* senza mouse il "+" non apre niente: meglio toglierlo */
@media not ((hover: hover) and (pointer: fine)) {
  .reason-plus { display: none; }
  .reason { min-height: 0; }
}

@media (max-width: 1180px) {
  .reasons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* la quinta resterebbe sola: prende tutta la riga */
  .reason:last-child { grid-column: 1 / -1; }
  .reason { min-height: 17rem; }
}
@media (max-width: 640px) {
  .reasons { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------- studio --- */
/* "Venite a trovarci": testo e indirizzo accanto alla sala riunioni,
   sotto una fila di tre foto sfalsate */
/* testo e indirizzo partono dal bordo alto della foto */
.studio-intro { align-items: start; }
.studio-strip { margin-top: clamp(3rem, 6vw, 6rem); }
.studio-strip > :nth-child(2) { margin-top: clamp(2rem, 5vw, 5rem); }
.studio-strip > :nth-child(3) { margin-top: clamp(1rem, 2.5vw, 2.5rem); }

.visit {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-strong);
}
.visit-facts dt {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.visit-addr {
  margin: 0 0 0.7rem;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--navy);
}
.visit .link-arrow { color: var(--navy); }
.visit-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 3rem;
  margin: 1.6rem 0 0;
}
.visit-facts dd {
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.visit-facts a:hover { color: var(--navy); text-decoration: underline; }

@media (max-width: 900px) {
  /* la sala riunioni sale sopra il testo */
  .studio-intro > .col-7 { order: -1; }
  /* le tre foto restano affiancate, piccole e allineate */
  .studio-strip { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  .studio-strip.grid > [class*='col-'] { grid-column: auto; margin-top: 0; }
}

/* ---------------------------------------------------------- stats --- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--gap);
  border-top: 1px solid var(--line);
  padding-top: clamp(1.5rem, 3vw, 2.5rem);
}
.stat-value {
  font-size: clamp(2.2rem, 4.4vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}
.stat-label {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 22ch;
}
.section--dark .stats { border-color: rgba(255, 255, 255, 0.2); }

/* ------------------------------------------------------- manifesto --- */
.manifesto {
  font-size: clamp(1.6rem, 3.4vw, 3rem);
  font-weight: 300;
  line-height: 1.16;
  letter-spacing: -0.038em;
  max-width: 24ch;
}
.manifesto em {
  font-style: normal;
  color: var(--blue);
}
.section--dark .manifesto em { color: #7fb4d0; }

.chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.1rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.chain span:not(:last-child)::after {
  content: '→';
  margin-left: 1.1rem;
  opacity: 0.55;
}

/* -------------------------------------------------------- timeline --- */
.timeline {
  border-top: 1px solid var(--line);
}
.timeline-item {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: var(--gap);
  padding-block: clamp(1.8rem, 3vw, 2.6rem);
  border-bottom: 1px solid var(--line);
}
.timeline-year {
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}
.timeline-body { max-width: 62ch; }
.timeline-body h3 { margin-bottom: 0.5rem; }
.timeline-body p { color: var(--ink-soft); }

@media (max-width: 720px) {
  .timeline-item { grid-template-columns: 1fr; gap: 0.8rem; }
}

/* --------------------------------------------------- scheda progetto --- */
.project-hero {
  position: relative;
  min-height: min(88svh, 900px);
  display: flex;
  align-items: flex-end;
  color: #fff;
  overflow: hidden;
}

.spec {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--gap);
  border-top: 1px solid var(--line);
  padding-top: clamp(1.5rem, 3vw, 2.2rem);
}
.spec dt {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.spec dd {
  margin: 0;
  font-size: clamp(1.02rem, 1.3vw, 1.2rem);
  letter-spacing: -0.02em;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap) var(--gap);
  row-gap: clamp(2rem, 4vw, 4rem);
}
.gallery .g-wide { grid-column: 1 / -1; }
.gallery .g-half { grid-column: span 6; }
.gallery .g-left { grid-column: 1 / span 7; }
.gallery .g-right { grid-column: 8 / span 5; align-self: end; }
.gallery .g-center { grid-column: 3 / span 8; }
.gallery .g-narrow { grid-column: 4 / span 6; }

@media (max-width: 820px) {
  .gallery .g-half,
  .gallery .g-left,
  .gallery .g-right,
  .gallery .g-center,
  .gallery .g-narrow { grid-column: 1 / -1; }
}

/* Foto che si aprono nel popup. Nella griglia progetti e' sensibile al clic
   tutta la scheda, non solo l'immagine. */
.zoomable { cursor: zoom-in; }
.project-card:has(.zoomable) { cursor: zoom-in; }
.zoomable:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* segnale discreto che la foto si ingrandisce: un piu' nell'angolo, tenuto
   sotto la tendina di rivelazione (z-index 2) come l'etichetta dei cantieri,
   cosi' arriva insieme alla foto invece di galleggiarci sopra */
.media.zoomable::after {
  content: '+';
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: clamp(2.4rem, 3.4vw, 3rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--navy);
  font-size: 1.15rem;
  line-height: 1;
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease-out);
}
/* col mouse compare al passaggio, col dito resta li' */
@media (hover: hover) and (pointer: fine) {
  .media.zoomable::after {
    opacity: 0;
    transform: translateY(35%);
  }
  .project-card:hover .media.zoomable::after,
  .featured-item:hover .media.zoomable::after,
  .media.zoomable:hover::after,
  .media.zoomable:focus-visible::after {
    opacity: 1;
    transform: none;
  }
}

.features {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: var(--gap);
}
.features li {
  break-inside: avoid;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
}
@media (max-width: 640px) { .features { columns: 1; } }

.next-project {
  position: relative;
  display: block;
  color: #fff;
  overflow: hidden;
  min-height: min(60svh, 560px);
  display: flex;
  align-items: center;
}
.next-project .hero-media img { transform: scale(1.04); }
.next-project:hover .hero-media img { transform: scale(1); }

/* --------------------------------------------------------- lightbox --- */
/* Il popup della foto: fondo scuro, immagine al centro, nome e luogo del
   progetto sotto. Frecce e contatore restano fuori se la foto e' una sola. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 12, 20, 0.985);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(3.5rem, 7vw, 4.5rem) clamp(1rem, 6vw, 5rem);
  opacity: 0;
  visibility: hidden;
  /* in chiusura la visibilita' aspetta la fine della dissolvenza; in
     apertura cambia subito, altrimenti il fuoco non entra nel popup */
  transition: opacity 0.45s var(--ease), visibility 0s linear 0.45s;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s var(--ease), visibility 0s;
}

/* col popup aperto l'intestazione si toglie di mezzo */
body.foto-open .site-header { transform: translateY(-102%); }

/* la figura prende tutta l'altezza utile: cosi' la foto sa di quanto puo'
   rimpicciolirsi per lasciare spazio alla didascalia, invece di uscire fuori */
.lightbox-figure {
  margin: 0;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.9rem, 2vw, 1.4rem);
}
.lightbox img {
  flex: 0 1 auto;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.985);
  transition: opacity 0.5s var(--ease-out), transform 0.8s var(--ease-out);
}
.lightbox img.is-loaded { opacity: 1; transform: none; }

.lightbox-caption {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: center;
  color: #fff;
}
.lightbox-caption[hidden] { display: none; }
.lightbox-title {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}
.lightbox-place {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.62);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 1rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
  transition: opacity 0.3s;
}
.lightbox-close:hover,
.lightbox-nav:hover { opacity: 1; }
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  opacity: 1;
  outline: 1px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}
.lightbox-nav[hidden] { display: none; }
.lightbox-close { top: clamp(0.5rem, 2vw, 1.5rem); right: clamp(0.5rem, 2vw, 1.5rem); }
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
}
.lightbox-nav.prev { left: clamp(0.25rem, 2vw, 1.5rem); }
.lightbox-nav.next { right: clamp(0.25rem, 2vw, 1.5rem); }
.lightbox-counter {
  position: absolute;
  bottom: clamp(0.75rem, 2vw, 1.75rem);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

/* col dito le frecce laterali rubano spazio alla foto: si scorre */
@media (max-width: 640px) {
  .lightbox-nav { top: auto; bottom: 0.25rem; transform: none; }
  .lightbox-counter { bottom: 1.35rem; }
}

/* ----------------------------------------------------------- form --- */
.form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.6rem var(--gap);
}
.field { display: flex; flex-direction: column; }
.field--full { grid-column: 1 / -1; }
.field label {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.field input,
.field textarea,
.field select {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  padding: 0.7rem 0;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  transition: border-color 0.35s var(--ease);
  border-radius: 0;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-bottom-color: var(--navy);
}
.field textarea { resize: vertical; min-height: 7.5rem; }
.field .error {
  font-size: 0.8rem;
  color: #a3372c;
  margin-top: 0.5rem;
  min-height: 1.2em;
}
.field.is-invalid input,
.field.is-invalid textarea { border-bottom-color: #a3372c; }

.form-consent {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  font-size: 0.86rem;
  color: var(--muted);
}
.form-consent input { width: 1.05rem; height: 1.05rem; margin-top: 0.22rem; flex: none; }

.form-note {
  grid-column: 1 / -1;
  font-size: 0.9rem;
  padding: 1rem 1.2rem;
  border-left: 2px solid var(--blue);
  background: var(--paper-warm);
}
.form-note[hidden] { display: none; }

@media (max-width: 720px) {
  .form { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------- contatti --- */
.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.contact-list li {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: var(--gap);
  padding-block: 1.3rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.contact-list dt,
.contact-list .c-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-list .c-value {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  letter-spacing: -0.025em;
}
.contact-list .c-note {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  letter-spacing: 0;
  color: var(--muted);
}
.contact-list a:hover { color: var(--blue); }

@media (max-width: 640px) {
  .contact-list li { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* --------------------------------------------------------- footer --- */
.site-footer {
  background: var(--navy-deep);
  color: rgba(255, 255, 255, 0.72);
  padding-top: clamp(4rem, 8vw, 7rem);
  padding-bottom: 2.25rem;
  font-size: 0.92rem;
}
.site-footer a { transition: color 0.35s var(--ease); }
.site-footer a:hover { color: #fff; }

/* Due blocchi soltanto: identita' a sinistra, recapiti a destra.
   Con poche voci una colonna "Naviga" resterebbe vuota, quindi i
   link vivono nella barra bassa. */
.footer-top {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(2.5rem, 5vw, 4rem) var(--gap);
  align-items: start;
  padding-bottom: clamp(2.75rem, 5vw, 4.5rem);
}

.footer-brand {
  grid-column: 1 / span 4;
  padding-top: 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.footer-brand .brand { color: #fff; margin-bottom: 1.35rem; }
.footer-brand .brand-logo { height: 88px; }
.footer-claim {
  margin: 0;
  max-width: 34ch;
  color: rgba(255, 255, 255, 0.58);
  line-height: 1.65;
}

.footer-reach {
  grid-column: 6 / -1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.footer-reach li {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  padding-top: 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.f-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}
.f-value {
  color: #fff;
  font-size: clamp(0.98rem, 1.1vw, 1.12rem);
  letter-spacing: -0.02em;
  line-height: 1.45;
}
a.f-value:hover { color: #7fb4d0; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.5);
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem clamp(1.25rem, 2.4vw, 2.25rem);
}
.footer-nav a {
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.02em;
}
.footer-nav a[aria-current='page'] { color: #fff; }
.footer-legal { margin: 0; }

@media (max-width: 1000px) {
  .footer-brand { grid-column: 1 / -1; }
  .footer-reach { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .footer-reach { grid-template-columns: 1fr; gap: 0; }
  .footer-reach li { padding-block: 1.1rem; }
  .footer-top { padding-bottom: 1.75rem; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 0.9rem; }
}

/* ------------------------------------------------------ modello 3D --- */
/* Il canvas e' decorativo: senza WebGL il blocco resta vuoto e non
   occupa spazio, il testo accanto non cambia. */
.model3d {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
  margin-top: clamp(1.75rem, 3vw, 2.75rem);
}

.model3d canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s var(--ease-out);
}

.model3d.is-loaded canvas { opacity: 1; }
.model3d.is-failed { display: none; }

@media (max-width: 900px) {
  .model3d {
    aspect-ratio: 5 / 4;
    max-width: 32rem;
    margin-inline: auto;
  }
}

/* --------------------------------------------------- utility grid --- */
/* col-* imposta solo la fine: cosi' si combina con start-* */
.col-1 { grid-column-end: span 1; }
.col-2 { grid-column-end: span 2; }
.col-3 { grid-column-end: span 3; }
.col-4 { grid-column-end: span 4; }
.col-5 { grid-column-end: span 5; }
.col-6 { grid-column-end: span 6; }
.col-7 { grid-column-end: span 7; }
.col-8 { grid-column-end: span 8; }
.col-9 { grid-column-end: span 9; }
.col-10 { grid-column-end: span 10; }
.col-12 { grid-column: 1 / -1; }
.start-2 { grid-column-start: 2; }
.start-3 { grid-column-start: 3; }
.start-4 { grid-column-start: 4; }
.start-5 { grid-column-start: 5; }
.start-6 { grid-column-start: 6; }
.start-7 { grid-column-start: 7; }
.start-8 { grid-column-start: 8; }

@media (max-width: 900px) {
  .grid > [class*='col-'] { grid-column: 1 / -1; }
  .grid > [class*='start-'] { grid-column-start: 1; }
  .md-col-6 { grid-column: auto / span 6; }
}

.stack-sm > * + * { margin-top: 1rem; }
.stack > * + * { margin-top: clamp(1.5rem, 2.5vw, 2.2rem); }
.stack-lg > * + * { margin-top: clamp(2.5rem, 5vw, 4rem); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.75rem; }
.mt-2 { margin-top: clamp(1.2rem, 2vw, 1.8rem); }
.mt-3 { margin-top: clamp(2rem, 3.4vw, 3rem); }
.mt-4 { margin-top: clamp(3rem, 5vw, 4.5rem); }
.mb-2 { margin-bottom: clamp(1.2rem, 2vw, 1.8rem); }
.mb-3 { margin-bottom: clamp(2rem, 3.4vw, 3rem); }
.mb-4 { margin-bottom: clamp(3rem, 5vw, 4.5rem); }

.full-bleed {
  width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
}

.text-right { text-align: right; }

/* ------------------------------------------------------ transizione --- */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--paper);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}
.js .page-veil { opacity: 1; }
.is-ready .page-veil { opacity: 0; }

/* ------------------------------------------- scorrimento morbido --- */
/* Con smooth-scrollbar attivo la finestra non scorre piu': scorre solo
   .scroll-root, alto quanto lo schermo (vedi main.js). */
html.has-smooth-scroll,
html.has-smooth-scroll body {
  height: 100%;
  overflow: hidden;
  scroll-behavior: auto;
}
.scroll-root {
  height: 100vh;
  outline: none;
}
.scroll-root .scrollbar-track { background: none; z-index: 150; }
.scroll-root .scrollbar-track-y { width: 5px; }
.scroll-root .scrollbar-thumb-y {
  width: 5px;
  border-radius: 0;
  background: #424242;
}
.scroll-root .scrollbar-track-x { display: none !important; }

/* --------------------------------------------------------- cursore --- */
/* Il pallino misura 76px ma a riposo e' scalato a 0.3: cosi' quando si
   allarga resta nitido. La posizione arriva da JS tramite `translate`,
   la transizione tocca solo `scale`. */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: #fff;
  mix-blend-mode: exclusion;
  pointer-events: none;
  scale: 0;
  transition: scale 0.35s var(--ease-out);
}
.cursor-dot.is-active { scale: 0.3; }
.cursor-dot.is-active.is-link { scale: 1.2; }
.cursor-dot.is-active.is-view { scale: 1; }

.cursor-dot-label {
  display: block;
  line-height: 76px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #000;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.cursor-dot.is-view .cursor-dot-label {
  opacity: 1;
  transition: opacity 0.35s var(--ease) 0.2s;
}

@media (max-width: 991px) {
  .cursor-dot { display: none; }
}

/* -------------------------------------------------- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .split-line > span { transform: none; }
  .media[data-reveal-media]::before { display: none; }
  .media[data-reveal-media] img { transform: none; }
  .hero-media img { transform: none; }
  .project-card:hover .media img,
  .featured-item:hover .media img { scale: 1; }
  .project-flag::before { box-shadow: none; }
  .project-flag::after { display: none; }
  .js .pc-media img,
  .js .pc-body { transform: none; }
}
