/* Header and scroll-controlled video aperture. */
:root { --compact-nav-height: 48px; }
html { scroll-padding-top: calc(var(--compact-nav-height) + 8px); }
nav { position: fixed; inset: 0 0 auto; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 32px; transition: background-color .2s, padding .25s; }
.nav-logo-wrap { flex: 0 0 145px; }
.nav-logo-wrap img { width: 145px; height: 52px; object-fit: contain; }
.nav-links { list-style: none; padding: 0; display: flex; align-items: center; gap: 5px; }
.nav-links a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 17px; background: rgba(250,247,241,.13); color: var(--paper); font-size: 12px; font-weight: 550; text-transform: uppercase; transition: background .2s; backdrop-filter: blur(16px); }
.nav-links a { border-radius: 999px; }
.nav-links .nav-cta { color: var(--paper); background: var(--orange-ink); border-radius: 50px; gap: 14px; padding-inline: 22px; }
.nav-links a:hover { background: rgba(250,247,241,.3); }
.nav-links .nav-cta:hover { background: #aa350d; }
.menu-toggle { display: none; }
/* Pagina attuale nel menu */
.nav-links a[aria-current="page"]:not(.nav-cta) { background: rgba(250,247,241,.3); }
.nav-scrolled .nav-links a[aria-current="page"]:not(.nav-cta), .nav-compact .nav-links a[aria-current="page"]:not(.nav-cta) { color: var(--orange-ink); }
/* Tendina per "Servizi": oggi non usata, pronta per quando ci saranno più pagine di servizio (markup: li.nav-has-sub > button.nav-sub-toggle + ul.nav-sub) */
.nav-has-sub { position: relative; }
.nav-sub-toggle { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 12px 15px 12px 17px; border: 0; border-radius: 999px; background: rgba(250,247,241,.13); color: var(--paper); font: inherit; font-size: 12px; font-weight: 550; text-transform: uppercase; cursor: pointer; transition: background .2s; backdrop-filter: blur(16px); }
.nav-sub-toggle:hover, .nav-has-sub.is-open .nav-sub-toggle { background: rgba(250,247,241,.3); }
.nav-sub-toggle:focus-visible { outline: 3px solid #ed8b5c; outline-offset: 2px; }
.nav-sub-caret { display: grid; transition: transform .2s; }
.nav-has-sub.is-open .nav-sub-caret { transform: rotate(180deg); }
.nav-sub { display: none; position: absolute; top: calc(100% + 10px); left: 50%; min-width: 220px; margin: 0; padding: 8px; list-style: none; border-radius: 18px; background: var(--paper); box-shadow: 0 16px 40px rgba(12,27,51,.22); transform: translateX(-50%); }
/* Ponte invisibile: il mouse passa dal pulsante alla tendina senza chiuderla */
.nav-sub::before { content: ''; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.nav-has-sub.is-open .nav-sub { display: grid; gap: 2px; }
.nav-links .nav-sub .nav-sub-link:not(.nav-cta) { justify-content: flex-start; min-height: 44px; padding: 10px 14px; border-radius: 12px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; text-transform: none; white-space: nowrap; backdrop-filter: none; }
.nav-links .nav-sub .nav-sub-link:not(.nav-cta):hover { background: rgba(20,45,83,.07); }
.nav-links .nav-sub .nav-sub-link[aria-current="page"] { color: var(--orange-ink); }
nav.nav-scrolled { background: rgba(250,247,241,.94); backdrop-filter: blur(16px); }
.nav-scrolled .nav-logo-wrap img { filter: brightness(0) saturate(100%) invert(16%) sepia(26%) saturate(1585%) hue-rotate(177deg) brightness(93%); }
.nav-scrolled .nav-links a:not(.nav-cta) { color: var(--ink); background: rgba(20,45,83,.055); }
.nav-scrolled .nav-links a:not(.nav-cta):hover { background: rgba(20,45,83,.13); }
.nav-scrolled .nav-sub-toggle { color: var(--ink); background: rgba(20,45,83,.055); }
.nav-scrolled .nav-sub-toggle:hover, .nav-scrolled .nav-has-sub.is-open .nav-sub-toggle { background: rgba(20,45,83,.13); }
nav.nav-compact { height: var(--compact-nav-height); padding: 0 32px; align-items: center; background: rgba(255,255,255,.96); }
.nav-compact .nav-logo-wrap { flex-basis: 110px; }
.nav-compact .nav-logo-wrap img { width: 110px; height: 34px; }
.nav-compact .nav-links a:not(.nav-cta) { min-height: 40px; padding: 8px 13px; background: transparent; font-size: 11px; }
.nav-compact .nav-sub-toggle { min-height: 40px; padding: 8px 11px 8px 13px; background: transparent; font-size: 11px; }
.nav-compact .nav-links .contact-cta.contact-cta { min-height: 40px; padding: 4px 5px 4px 16px; gap: 12px; font-size: 11px; }
.nav-compact .nav-links .contact-cta .cta-arrow { width: 32px; height: 32px; flex-basis: 32px; font-size: 22px; }

.hero { --hero-stage-height: max(690px,100svh); position: relative; height: var(--hero-stage-height); background: var(--paper); }
.motion-ready .hero { height: calc(var(--hero-stage-height) + 65svh); }
.hero-stage { position: sticky; top: 0; height: var(--hero-stage-height); display: flex; flex-direction: column; justify-content: flex-end; padding: 160px 40px 64px; overflow: clip; isolation: isolate; }
.hero-media { position: absolute; z-index: -1; left: 50%; top: 50%; width: 100%; height: 100%; transform: translate(-50%,-50%); overflow: hidden; background: var(--navy) url('img/hero-poster-20260930.jpg') center / cover no-repeat; }
.hero-clip-defs { position: absolute; width: 0; height: 0; pointer-events: none; }
.hero-video, .hero-video-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-video { object-fit: cover; object-position: center; }
.hero-media:not(.is-playing) .hero-video { opacity: 0; }
.hero-video-overlay { background: linear-gradient(180deg,rgba(12,27,51,.25) 5%,rgba(12,27,51,.13) 25%,rgba(12,27,51,.62) 62%,rgba(12,27,51,.95)); }
.hero-topline { position: absolute; top: 125px; left: 40px; right: 40px; text-align: right; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--paper); }
.hero-content { position: relative; width: min(1200px,100%); margin-inline: auto; display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px 70px; color: var(--paper); align-items: end; }
.hero-title { grid-column: 1; grid-row: 1 / 3; font-size: clamp(42px,5.4vw,76px); line-height: 1.01; letter-spacing: -.055em; }
.hero-title span { color: #ff6600; }
.hero-sub { grid-column: 2; grid-row: 1; font-size: 17px; line-height: 1.55; color: rgba(250,247,241,.9); max-width: 420px; }
.hero-cta-row { grid-column: 2; grid-row: 2; align-self: start; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }

@media (min-width: 1600px) { .hero-stage { padding-inline: 5vw; } .hero-topline { left: 5vw; right: 5vw; } }
@media (max-width: 1050px) {
  nav { padding-inline: 24px; }
  .nav-links a { padding-inline: 13px; font-size: 11px; }
  .nav-sub-toggle { padding-inline: 13px 11px; font-size: 11px; }
  .hero-stage { padding-inline: 32px; }
  .hero-topline { left: 32px; right: 32px; }
  .hero-content { column-gap: 35px; grid-template-columns: 1.2fr 1fr; }
  .hero-title { font-size: 48px; }
  .hero-sub { font-size: 16px; }
}
/* Tablet orizzontale e schermi stretti: sei voci su una riga senza andare a capo */
@media (max-width: 920px) and (min-width: 761px) {
  nav, nav.nav-compact { padding-inline: 18px; gap: 12px; }
  .nav-links { gap: 2px; }
  .nav-links a, .nav-compact .nav-links a:not(.nav-cta) { padding-inline: 9px; white-space: nowrap; }
  .nav-links .nav-cta, .nav-compact .nav-links .contact-cta.contact-cta { padding-left: 12px; gap: 8px; white-space: nowrap; }
}
@media (max-width: 760px) {
  :root { --compact-nav-height: 38px; }
  nav { padding: 17px 20px; align-items: start; }
  .nav-logo-wrap { flex-basis: 118px; }
  .nav-logo-wrap img { width: 118px; height: 42px; }
  .menu-toggle { display: flex; align-items: center; gap: 26px; color: var(--ink); background: var(--paper); border: 0; border-radius: 40px; padding: 10px 16px; min-height: 44px; font-size: 12px; text-transform: uppercase; }
  .menu-toggle span { font-size: 22px; line-height: 1; }
  .nav-scrolled .menu-toggle { background: var(--navy); color: var(--paper); }
  .nav-links { display: none; position: absolute; top: 77px; left: 20px; right: 20px; padding: 12px; background: var(--paper); border-radius: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
  nav.menu-open .nav-links { display: grid; }
  .nav-links a[aria-current="page"]:not(.nav-cta) { color: var(--orange-ink); }
  .nav-has-sub { position: static; }
  .nav-sub-toggle, .nav-scrolled .nav-sub-toggle, .nav-compact .nav-sub-toggle { width: 100%; min-height: 48px; padding: 12px 17px; border-radius: 10px; background: transparent; color: var(--ink); font-size: 14px; backdrop-filter: none; }
  .nav-sub-toggle:hover, .nav-has-sub.is-open .nav-sub-toggle, .nav-scrolled .nav-has-sub.is-open .nav-sub-toggle { background: rgba(20,45,83,.06); }
  .nav-sub { position: static; min-width: 0; padding: 2px 0 6px; border-radius: 0; background: transparent; box-shadow: none; transform: none; }
  .nav-sub::before { display: none; }
  .nav-links .nav-sub .nav-sub-link:not(.nav-cta) { justify-content: center; min-height: 44px; font-size: 14px; color: #526176; }
  .nav-links a { clip-path: none !important; background: transparent; color: var(--ink); border-radius: 10px !important; font-size: 14px; min-height: 48px; }
  .nav-links .nav-cta { color: white; border-radius: 40px !important; }
  nav.nav-compact { padding: 3px 20px; }
  .nav-compact .nav-logo-wrap { position: relative; flex-basis: 88px; }
  .nav-compact .nav-logo-wrap img { width: 88px; height: 32px; }
  .nav-compact .menu-toggle { position: relative; min-height: 32px; height: 32px; padding: 4px 13px; gap: 18px; font-size: 11px; }
  .nav-compact .menu-toggle span { font-size: 19px; }
  /* Keep a 44px touch area around the visually slim mobile controls. */
  .nav-compact .menu-toggle::after, .nav-compact .nav-logo-wrap::after { content: ''; position: absolute; inset: -6px 0; }
  .nav-compact .nav-links { top: calc(var(--compact-nav-height) + 8px); }
  .nav-compact .nav-links a:not(.nav-cta) { min-height: 48px; font-size: 14px; }
  .nav-compact .nav-links .contact-cta.contact-cta { min-height: 48px; font-size: 13px; }
  .hero { --hero-stage-height: max(740px,100svh); }
  .motion-ready .hero { height: calc(var(--hero-stage-height) + 50svh); }
  .hero-stage { padding: 150px 20px 42px; }
  /* Keep the subject in the portrait crop, including the poster fallback. */
  .hero-media { background-position: 78% center; }
  .hero-video { object-position: 78% center; }
  .hero-topline { top: 104px; left: 20px; right: 20px; font-size: 9px; }
  .hero-topline span:last-child { display: none; }
  .hero-content { display: block; }
  .hero-title { font-size: clamp(35px,9.2vw,57px); max-width: 600px; }
  .hero-sub { font-size: 14px; margin-top: 22px; max-width: 480px; }
  .hero-cta-row { margin-top: 24px; }
}
/* Telefono in verticale: ritaglio del poster con la stessa inquadratura (78%), circa 6 volte più leggero. */
@media (max-width: 760px) and (max-aspect-ratio: 3/4) {
  .hero-media { background-image: url('img/hero-poster-mobile-20261008.jpg'); }
}
@media (prefers-reduced-motion: reduce) {
  nav { transition: none; }
  .motion-ready .hero { height: var(--hero-stage-height); }
  .hero-stage { position: relative; }
}
