/* ============================================================
   LAYOUT — Navbar, Footer, Mega-menu
   ============================================================ */

/* ============================================================
   PAGE TRANSITIONS (View Transitions API)
   ============================================================ */
@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: vt-fade-out 0.18s ease forwards;
}
::view-transition-new(root) {
  animation: vt-fade-in 0.22s ease forwards;
}
@keyframes vt-fade-out {
  to { opacity: 0; transform: translateY(6px); }
}
@keyframes vt-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
}

/* ============================================================
   LOGO MARQUEE
   ============================================================ */
.hero-marquee {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 28px 0 36px;
  margin-top: 0;
  width: 100%;
  overflow: hidden;
}
.hero-marquee__label {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 36px;
}
.logo-marquee-wrap {
  overflow: hidden;
  width: 100%;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
}
.logo-marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  animation: marquee-scroll 32s linear infinite;
}
.logo-marquee-track .logo-slot {
  width: 140px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 72px;
}
.logo-marquee-track .logo-slot img {
  max-width: 140px;
  max-height: 40px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.65;
  transition: opacity .2s;
}
.logo-marquee-track .logo-slot img:hover {
  opacity: 1;
}
@keyframes marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-33.333%); }
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--white);
  border-bottom: 1px solid var(--neutral--gray-200);
  transition: box-shadow .2s;
}
.navbar.is-scrolled {
  box-shadow: 0 2px 16px rgba(10,10,46,.08);
}
.navbar__inner {
  display: flex;
  align-items: center;
  height: 68px;
  gap: 8px;
  position: relative;
}
.navbar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  color: var(--g900);
  flex-shrink: 0;
  margin-right: 16px;
  cursor: pointer;
}
.navbar__nav {
  display: flex;
  align-items: center;
  gap: 2px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.navbar__link {
  font-size: 14px;
  font-weight: 600;
  color: var(--g700);
  padding: 8px 14px;
  border-radius: 99px;
  transition: all .15s;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
  white-space: nowrap;
  line-height: 1;
}
.navbar__link:hover { color: var(--g900); background: var(--g50); }
.navbar__link.active { color: var(--g900); background: var(--neutral--gray-100); }
.navbar__cta { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.navbar__hamburger { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.navbar__hamburger span { display: block; width: 24px; height: 2px; background: var(--g900); margin: 5px 0; border-radius: 2px; transition: all .2s; }
.mobile-acc { display: none; }

/* ============================================================
   MEGA MENU
   ============================================================ */
.nav-item { position: relative; display: flex; align-items: center; }
.nav-item > .navbar__link { display: flex; align-items: center; gap: 5px; }
.nav-item > .navbar__link::after { content: '▾'; font-size: 10px; opacity: .6; transition: transform .2s; }
.mega-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(10,10,46,.14), 0 0 0 1px var(--neutral--gray-200);
  width: 600px;
  padding: 24px;
  z-index: 1010;
  color: var(--g900);
}
.mega-menu.is-open { opacity: 1; pointer-events: all; transform: translateX(-50%) translateY(0); }
.nav-item > .navbar__link.is-open { color: var(--g900); background: var(--neutral--gray-100); }
.nav-item > .navbar__link.is-open::after { transform: rotate(180deg); }
.mega-menu__inner { display: grid; grid-template-columns: 1fr 1fr; }
.mega-col { padding: 0 12px; }
.mega-col:first-child { border-right: 1px solid var(--neutral--gray-200); padding-left: 0; }
.mega-col:last-child { padding-right: 0; }
.mega-col__header { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--neutral--gray-200); }
.mega-col__label { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--orange); margin-bottom: 4px; }
.mega-col__sub { font-size: 12px; color: var(--g600); line-height: 1.4; }
.mega-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
  transition: background .12s;
  cursor: pointer;
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font);
  text-align: left;
  margin-bottom: 2px;
}
.mega-item:hover { background: var(--g50); }
.mega-col__header--link { cursor: pointer; transition: opacity .15s; }
.mega-col__header--link:hover { opacity: .75; }
.mega-item__icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
  background: var(--neutral--gray-100);
}
.mega-item__icon--b2c { background: rgba(232,98,10,.08); }
.mega-item__icon--b2b { background: var(--blue-surface); }
.mega-item__title { font-size: 13px; font-weight: 700; color: var(--g900); line-height: 1.3; }
.mega-item__desc { font-size: 12px; color: var(--g600); margin-top: 3px; line-height: 1.4; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--blue-800);
  color: var(--white);
  padding: 80px 0 0;
  margin-top: 0;
}
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 60px;
}
.footer__brand { max-width: 340px; }
.footer__brand p { font-size: 14px; color: rgba(255,255,255,.6); margin-top: 16px; line-height: 1.7; }
.footer__contacts { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.footer__contacts a {
  font-size: 14px;
  color: rgba(255,255,255,.75);
  font-weight: 500;
  transition: color .2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer__contacts a:hover { color: var(--white); }
.footer__col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  margin-bottom: 20px;
}
.footer__col-links { display: flex; flex-direction: column; gap: 12px; }
.footer__col-links a {
  font-size: 14px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  transition: color .2s;
}
.footer__col-links a:hover { color: var(--white); }

/* Large logo at the bottom */
.footer__logo-large {
  font-size: 48px;
  font-weight: 900;
  color: rgba(255,255,255,.12);
  letter-spacing: -0.03em;
  padding: 40px 0 0;
  display: block;
}

.footer__cert { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.footer__cert-bar { display: flex; align-items: center; justify-content: space-between; padding: 24px 0; border-top: 1px solid rgba(255,255,255,.1); }
.footer__cert-logos { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer__cert-pill { background: rgba(255,255,255,.9); border-radius: 8px; padding: 6px 14px; display: flex; align-items: center; }
.cert-badge {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,.08);
  border-radius: 6px;
  padding: 5px 10px;
  color: rgba(255,255,255,.6);
}
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 20px 0;
  margin-top: 0;
}
.footer__copy { font-size: 12px; color: rgba(255,255,255,.35); }
.footer__social { display: flex; gap: 8px; }
.footer__social a {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.7);
  transition: all .2s;
}
.footer__social a:hover { background: var(--orange); color: var(--white); transform: translateY(-2px); }

/* ============================================================
   RESPONSIVE — Layout
   ============================================================ */
@media (max-width: 900px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 640px) {
  .footer__cert-bar { flex-direction: column; align-items: flex-start; gap: 20px; }
  .ann-bar { display: none; }
  .navbar__nav { display: none; }
  .navbar__hamburger { display: block; }
  .navbar__cta .btn { display: none; }
  .footer__grid { grid-template-columns: 1fr; gap: 32px; }
  .footer__logo-large { font-size: 32px; }

  /* Mobile nav panel */
  .nav-open .navbar__nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    top: 68px;
    left: 0; right: 0; bottom: 0;
    background: var(--white);
    padding: 12px 16px 40px;
    gap: 2px;
    overflow-y: auto;
    z-index: 999;
    border-top: 1px solid var(--neutral--gray-100);
    animation: mobile-nav-in .18s ease forwards;
  }
  @keyframes mobile-nav-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .nav-open .navbar__link {
    font-size: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    width: 100%;
    text-align: left;
  }

  /* Nascondi voce Formazione desktop nel pannello mobile */
  .nav-open .nav-item { display: none; }

  /* Mobile accordion items (costruiti via JS) */
  .mobile-acc { display: none; flex-direction: column; }
  .nav-open .mobile-acc { display: flex; }

  .mobile-acc__btn {
    font-size: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }
  .mobile-acc__arrow {
    flex-shrink: 0;
    transition: transform .22s ease;
  }
  .mobile-acc.is-open .mobile-acc__arrow { transform: rotate(180deg); }

  .mobile-acc__sub {
    display: none;
    flex-direction: column;
    background: var(--blue-surface);
    border-radius: 12px;
    padding: 8px;
    margin: 0 8px 4px;
    width: calc(100% - 16px);
    box-sizing: border-box;
    gap: 2px;
  }
  .mobile-acc.is-open .mobile-acc__sub { display: flex; }

  .mobile-acc__all {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue-primary);
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
  }
  .mobile-acc__sub .mega-item { padding: 8px 12px; border-radius: 8px; }
  .mobile-acc__sub .mega-item:hover { background: rgba(26,86,219,.06); }

  /* Hamburger → X */
  .nav-open .navbar__hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-open .navbar__hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .nav-open .navbar__hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}
