/* =========================
   VD · Drawer overlay menu
   Dark palette coerente con vd-chi-siamo / vd-branding / vd-showcase-page.
   ========================= */

/* L'animazione del toggle hamburger vive in `assets/css/vd-header.css`
   (selettori `.vd-header__toggle` e `.vd-header__bar`). Il bottone è
   renderizzato dal nostro `header.php` custom; il vecchio CSS che pilotava
   l'hamburger Kadence (`.drawer-toggle .menu-toggle-icon span`, rotate 90°
   sul wrapper, ecc.) è stato rimosso perché puntava a markup che non
   esiste più nel nostro header. */

.vd-drawer {
  --vd-drawer-bg: #0c2931;
  --vd-drawer-bg-deep: #081c22;
  --vd-drawer-ink: #ededed;
  --vd-drawer-ink-soft: rgba(237, 237, 237, 0.7);
  --vd-drawer-muted: rgba(237, 237, 237, 0.4);
  --vd-drawer-line: rgba(237, 237, 237, 0.16);
  --vd-drawer-accent: #ff810a;
  --vd-drawer-accent-soft: rgba(255, 129, 10, 0.12);

  --vd-drawer-font-ui: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --vd-drawer-font-body: 'Libre Baskerville', Georgia, 'Times New Roman', serif;

  --vd-drawer-pad: clamp(20px, 4vw, 56px);
  --vd-drawer-pad-y: clamp(20px, 3.5vw, 40px);
  --vd-drawer-radius: 20px;
  --vd-drawer-duration: 0.55s;
  --vd-drawer-duration-fast: 0.32s;
  --vd-drawer-ease: cubic-bezier(0.16, 0.84, 0.32, 1);
  --vd-drawer-ease-toggle: cubic-bezier(0.4, 0, 0.2, 1);

  position: fixed;
  inset: 0;
  z-index: 9998; /* sopra header, sotto wpadminbar (z 99999) */
  background: var(--vd-drawer-bg);
  color: var(--vd-drawer-ink);
  font-family: var(--vd-drawer-font-ui);
  overflow-y: auto;
  overflow-x: hidden;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
  transition: opacity var(--vd-drawer-duration) var(--vd-drawer-ease),
              visibility 0s linear var(--vd-drawer-duration);
}

.vd-drawer.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity var(--vd-drawer-duration) var(--vd-drawer-ease),
              visibility 0s;
}

/* Body lock quando il drawer VD è aperto */
body.vd-drawer-open {
  overflow: hidden;
}

/* Drawer Kadence disattivato in modo permanente: il drawer VD lo sostituisce
   completamente. L'output HTML viene già rimosso lato PHP (vd_disable_kadence_mobile_drawer
   in functions.php), questa è una rete di sicurezza per coprire il caso in cui
   una versione di Kadence stampi comunque qualcosa via altri hook. */
.popup-drawer,
.drawer-content-wrap,
.drawer-overlay,
.popup-mobile-active {
  display: none !important;
}

/* Accessibility: screen-reader only */
.vd-drawer__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.vd-drawer__inner {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--vd-drawer-pad-y) var(--vd-drawer-pad);
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* ═══ Topbar: il logo è posizionato dal JS; la X è il toggle header ═══ */

.vd-drawer__topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-bottom: clamp(24px, 5vw, 64px);
  min-height: 56px;
}

/* Default (fallback se il JS non riesce a sincronizzare con l'header):
   logo a sinistra, dimensioni clamp standard. Quando il JS aggancia il
   logo dell'header, applica position: absolute + top/left/height/width
   inline al .vd-drawer__logo, sovrascrivendo questi default. */
.vd-drawer__logo {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
  color: var(--vd-drawer-ink);
  max-width: 60%;
  transition: opacity var(--vd-drawer-duration) var(--vd-drawer-ease);
}

.vd-drawer__logo:hover {
  opacity: 0.72;
}

.vd-drawer__logo img,
.vd-drawer__logo .custom-logo,
.vd-drawer__logo-img {
  max-height: clamp(36px, 4.5vw, 56px);
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

.vd-drawer__logo-text {
  font-family: var(--vd-drawer-font-body);
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--vd-drawer-ink);
  white-space: nowrap;
}

/* ═══ Grid layout (split sx menu / dx CTA) ═══ */

.vd-drawer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(40px, 6vw, 72px);
  flex: 1;
  align-items: stretch;
}

@media (min-width: 960px) {
  .vd-drawer__grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: clamp(48px, 5vw, 96px);
  }
}

.vd-drawer__col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vd-drawer__col--main {
  justify-content: space-between;
  gap: clamp(40px, 6vw, 72px);
}

.vd-drawer__col--cta {
  justify-content: center;
  align-items: flex-start;
}

/* ═══ Menu (uppercase XL) ═══ */

.vd-drawer__nav {
  width: 100%;
}

.vd-drawer__menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.4vw, 6px);
}

.vd-drawer__menu .menu-item {
  position: relative;
  list-style: none;
}

.vd-drawer__menu .menu-item > a {
  display: inline-block;
  padding: 4px 0;
  font-family: var(--vd-drawer-font-ui);
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--vd-drawer-ink);
  transition: color var(--vd-drawer-duration) var(--vd-drawer-ease),
              transform var(--vd-drawer-duration) var(--vd-drawer-ease);
  transform-origin: left center;
}

.vd-drawer__menu .menu-item > a:hover,
.vd-drawer__menu .menu-item.is-current > a,
.vd-drawer__menu .menu-item.is-current-ancestor > a,
.vd-drawer__menu .menu-item.current-menu-item > a {
  color: var(--vd-drawer-accent);
}

.vd-drawer__menu .menu-item > a:focus-visible {
  outline: 2px solid var(--vd-drawer-accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Submenu (livello 2) */

.vd-drawer__menu .sub-menu {
  list-style: none;
  margin: 6px 0 12px;
  padding-left: clamp(14px, 2vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vd-drawer__menu .sub-menu .menu-item > a {
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--vd-drawer-ink);
  letter-spacing: 0.02em;
}

.vd-drawer__menu .sub-menu .menu-item > a:hover,
.vd-drawer__menu .sub-menu .menu-item.is-current > a {
  color: var(--vd-drawer-accent);
}

/* ═══ Meta (social + contatti) ═══ */

.vd-drawer__meta {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 32px);
  padding-top: clamp(20px, 3vw, 36px);
  border-top: 1px solid var(--vd-drawer-line);
}

.vd-drawer__social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Link inline meta (social + contatti): pattern hover identico al footer —
   underline ::after che scorre da sinistra (scaleX 0 → 1). */

.vd-drawer__social a,
.vd-drawer__contact dd a {
  position: relative;
  display: inline-block;
  width: fit-content;
  font-family: var(--vd-drawer-font-ui);
  text-decoration: none;
  color: var(--vd-drawer-ink-soft);
  transition: color var(--vd-drawer-duration-fast) var(--vd-drawer-ease);
}

.vd-drawer__social a::after,
.vd-drawer__contact dd a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1.5px;
  background: var(--vd-drawer-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.32s cubic-bezier(0.16, 0.84, 0.32, 1);
}

.vd-drawer__social a:hover,
.vd-drawer__social a:focus-visible,
.vd-drawer__contact dd a:hover,
.vd-drawer__contact dd a:focus-visible {
  color: var(--vd-drawer-ink);
}

.vd-drawer__social a:hover::after,
.vd-drawer__social a:focus-visible::after,
.vd-drawer__contact dd a:hover::after,
.vd-drawer__contact dd a:focus-visible::after {
  transform: scaleX(1);
}

.vd-drawer__social a {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.vd-drawer__contact {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.vd-drawer__contact-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.vd-drawer__contact-row--links {
  grid-template-columns: 1fr;
}

.vd-drawer__contact dt {
  font-family: var(--vd-drawer-font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--vd-drawer-ink);
  margin: 0;
}

.vd-drawer__contact dd {
  margin: 0;
}

.vd-drawer__contact-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.vd-drawer__contact dd a {
  font-family: var(--vd-drawer-font-ui);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.vd-drawer__contact dd a.vd-drawer__contact-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.vd-drawer__contact dd a.vd-drawer__contact-action svg {
  width: 1em;
  height: 1em;
  flex: 0 0 1em;
  fill: currentColor;
}

/* ═══ CTA (right column) ═══ */

.vd-drawer__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: clamp(20px, 3vw, 32px);
  padding: clamp(16px, 2vw, 24px) clamp(20px, 3vw, 36px) clamp(16px, 2vw, 24px) 0;
  text-decoration: none;
  color: var(--vd-drawer-ink);
  transition: transform var(--vd-drawer-duration) var(--vd-drawer-ease),
              color var(--vd-drawer-duration) var(--vd-drawer-ease);
}

.vd-drawer__cta:hover {
  transform: translateX(-4px);
}

.vd-drawer__cta:hover .vd-drawer__cta-arrow {
  background: var(--vd-drawer-accent);
  border-color: var(--vd-drawer-accent);
  transform: translateX(6px);
}

.vd-drawer__cta:hover .vd-drawer__cta-text strong {
  color: var(--vd-drawer-accent);
}

.vd-drawer__cta-text {
  font-family: var(--vd-drawer-font-ui);
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--vd-drawer-ink);
}

.vd-drawer__cta-text strong {
  font-weight: 800;
  color: var(--vd-drawer-ink);
  transition: color var(--vd-drawer-duration) var(--vd-drawer-ease);
}

.vd-drawer__cta-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: clamp(48px, 5vw, 72px);
  height: clamp(48px, 5vw, 72px);
  border-radius: 50%;
  background: var(--vd-drawer-bg-deep);
  border: 1px solid var(--vd-drawer-line);
  color: var(--vd-drawer-ink);
  transition: background var(--vd-drawer-duration) var(--vd-drawer-ease),
              border-color var(--vd-drawer-duration) var(--vd-drawer-ease),
              transform var(--vd-drawer-duration) var(--vd-drawer-ease),
              color var(--vd-drawer-duration) var(--vd-drawer-ease);
}

.vd-drawer__cta-arrow svg {
  width: 40%;
  height: 40%;
}

.vd-drawer__cta:focus-visible {
  outline: 2px solid var(--vd-drawer-accent);
  outline-offset: 6px;
  border-radius: 8px;
}

.vd-drawer__desktop-contact-note {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: var(--vd-drawer-pad);
  background: rgba(8, 28, 34, 0.58);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--vd-drawer-duration-fast) var(--vd-drawer-ease),
              visibility 0s linear var(--vd-drawer-duration-fast);
}

.vd-drawer__desktop-contact-note.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity var(--vd-drawer-duration-fast) var(--vd-drawer-ease),
              visibility 0s;
}

.vd-drawer__desktop-contact-note-card {
  max-width: min(460px, 100%);
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--vd-drawer-line);
  background: var(--vd-drawer-bg-deep);
  color: var(--vd-drawer-ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.vd-drawer__desktop-contact-note-card p {
  margin: 0;
  color: var(--vd-drawer-ink);
  font-family: var(--vd-drawer-font-ui);
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0.005em;
}

/* ═══ GSAP reveal initial state ═══ */

.vd-drawer[data-gsap-ready="true"] .vd-drawer__menu .menu-item,
.vd-drawer[data-gsap-ready="true"] .vd-drawer__meta > *,
.vd-drawer[data-gsap-ready="true"] .vd-drawer__cta {
  opacity: 0;
  transform: translateY(20px);
  will-change: opacity, transform;
}

/* ═══ Reduced motion =====
   `!important` qui è l'unica eccezione: serve a battere gli inline-style
   applicati da GSAP via gsap.set/gsap.to. Pattern WCAG standard. */

@media (prefers-reduced-motion: reduce) {
  .vd-drawer,
  .vd-drawer * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .vd-drawer[data-gsap-ready="true"] .vd-drawer__menu .menu-item,
  .vd-drawer[data-gsap-ready="true"] .vd-drawer__meta > *,
  .vd-drawer[data-gsap-ready="true"] .vd-drawer__cta {
    opacity: 1;
    transform: none;
  }
}

/* ═══ Mobile: riordino blocchi (CTA prima dei contatti) ═══ */

@media (max-width: 959.98px) {
  .vd-drawer__col--main {
    display: contents;
  }
  .vd-drawer__nav { order: 1; }
  .vd-drawer__col--cta { order: 2; }
  .vd-drawer__meta { order: 3; }
}

/* ═══ Mobile fine-tuning ═══ */

@media (max-width: 640px) {
  .vd-drawer__topbar {
    padding-bottom: 28px;
  }
  .vd-drawer__menu .menu-item > a {
    font-size: clamp(2rem, 9vw, 3rem);
  }
  .vd-drawer__cta {
    flex-wrap: wrap;
  }
  .vd-drawer__cta-text {
    font-size: clamp(1.4rem, 6vw, 2rem);
  }
  .vd-drawer__contact-row {
    grid-template-columns: 60px 1fr;
  }
}
