.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  isolation: isolate;
  overflow: visible;
  background: transparent;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}

.lang {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang a,
.lang button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.lang a.is-active,
.lang a:hover,
.lang button.is-active,
.lang button:hover {
  color: var(--gold);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-img {
  height: 56px;
  width: auto;
  max-width: none;
  display: block;
}

.site-header .logo {
  position: relative;
  align-self: stretch;
  z-index: 2;
  /* SVG 278×233: riserva la larghezza con img fuori flusso. */
  width: 120px;
}

.site-header .logo-img {
  position: absolute;
  left: 0;
  bottom: -30px;
  height: 100px;
  overflow: visible;
}

.logo-img--on-dark {
  display: none;
}

.site-footer .logo-img--on-light {
  display: block;
  height: 72px;
}

.site-footer .logo-img--on-dark {
  display: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav a,
.nav .has-sub > span {
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.nav a:hover,
.nav a.is-active,
.nav .has-sub:hover > span {
  color: var(--gold);
}

.has-sub {
  position: relative;
}

.submenu {
  position: absolute;
  top: calc(100% + 14px);
  left: -16px;
  min-width: 210px;
  background: var(--navy);
  color: var(--color-paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 10px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: 0.2s var(--ease);
}

.has-sub:hover .submenu,
.has-sub:focus-within .submenu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.submenu a {
  display: block;
  padding: 8px 18px;
  color: var(--color-paper);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-cta .lang a,
.nav-cta .lang button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink);
  margin: 0 auto;
  position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-toggle span::before {
  top: -6px;
}

.menu-toggle span::after {
  top: 6px;
}

.site-footer {
  flex-shrink: 0;
  background: var(--navy);
  color: var(--white);
  padding: 0 0 env(safe-area-inset-bottom);
  box-shadow: inset 0 2px 0 var(--color-blue);
}

.site-footer .container {
  padding-top: 56px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px 48px;
  padding-bottom: 48px;
  align-items: start;
}

.footer-grid br {
  display: none;
}

.footer-grid > div:first-child p {
  margin-top: 18px;
  max-width: 46ch;
  font-size: 0.9rem;
  line-height: 1.75;
  color: color-mix(in srgb, var(--white) 64%, transparent);
}

.footer-address br {
  display: revert;
}

.footer-title {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--white) 12%, transparent);
}

.site-footer a {
  display: block;
  width: fit-content;
  color: color-mix(in srgb, var(--white) 78%, transparent);
  margin-bottom: 0;
  padding: 6px 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.site-footer a:hover {
  color: var(--gold-soft);
}

.site-footer .logo {
  display: flex;
  width: fit-content;
  margin-bottom: 4px;
}

.footer-copy {
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid color-mix(in srgb, var(--white) 12%, transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--white) 48%, transparent);
}

.footer-copy a {
  display: inline;
  padding: 0;
  font-size: inherit;
}

.nav-mobile-only {
  display: none;
}

@media (max-width: 980px) {
  .menu-toggle {
    display: grid;
    place-items: center;
  }

  .logo-img {
    height: 48px;
  }

  .nav-cta .btn {
    min-height: 42px;
    padding: 0 14px;
  }

  .nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    background: var(--navy);
    color: var(--color-paper);
    padding: 36px 24px calc(24px + env(safe-area-inset-bottom));
    border-bottom: 1px solid var(--line);
    gap: 0;
    max-height: min(80svh, calc(100svh - 5rem));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 1;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition:
      opacity 0.28s var(--ease),
      transform 0.28s var(--ease),
      visibility 0s linear 0.28s;
  }

  .nav > * {
    min-width: 0;
    max-width: 100%;
  }

  .nav > a,
  .has-sub > span,
  .submenu a {
    padding: 8px 0;
    min-height: 40px;
    display: flex;
    align-items: center;
    color: var(--color-paper);
  }

  .nav a:hover,
  .nav a.is-active,
  .has-sub > span {
    color: var(--gold-soft);
  }

  /*
    Lock su html, non su body: overflow:hidden sul body spezza sticky.
    Su pointer fine, scrollbar-gutter evita il salto di larghezza.
    Su touch overflow:hidden sul root fa ricalcolare la viewport iOS
    (pagina che allarga/stringe + pan orizzontale): li basta touch-action.
  */
  html:has(body.nav-open) {
    overscroll-behavior: none;
  }

  @media (hover: hover) and (pointer: fine) {
    html:has(body.nav-open) {
      overflow: hidden;
      scrollbar-gutter: stable;
    }

    @supports not (scrollbar-gutter: stable) {
      html:has(body.nav-open) {
        padding-inline-end: var(--nav-scrollbar, 0px);
      }
    }
  }

  body.nav-open {
    touch-action: none;
  }

  body.nav-open .site-header {
    touch-action: manipulation;
  }

  body.nav-open .site-header .logo,
  body.nav-open .site-header .nav-cta {
    z-index: 2;
  }

  body.nav-open .nav {
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    touch-action: pan-y;
    transition:
      opacity 0.28s var(--ease),
      transform 0.28s var(--ease),
      visibility 0s;
  }

  @media (prefers-reduced-motion: reduce) {
    .nav,
    body.nav-open .nav {
      transform: none;
      transition: none;
    }
  }

  .nav-mobile-only {
    display: none;
  }

  .submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: 0 0 4px 12px;
  }

  .footer-grid,
  .footer-copy {
    grid-template-columns: 1fr 1fr;
    flex-direction: column;
  }

  .site-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .site-footer .container {
    padding-top: 44px;
  }
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 16px;
  }

  .footer-grid > div:first-child {
    grid-column: 1 / -1;
  }

  .site-footer .logo-img--on-light {
    height: 56px;
  }
}

@media (max-width: 480px) {
  .logo-img {
    height: 40px;
  }

  .site-header .logo {
    width: 102px;
  }

  .site-header .logo-img {
    bottom: -25px;
    height: 85px;
  }

  .nav-cta .btn {
    display: none;
  }

  .nav-bar {
    min-height: 64px;
    gap: 12px;
  }

  .nav-mobile-only {
    display: flex;
    margin-top: 8px;
    font-weight: 500;
    color: var(--gold);
  }
}

