/* ——— Accessibilità: skip link, focus visibile, contrasto, reduced motion ——— */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.skip-link.screen-reader-text {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100000;
    padding: 0.6rem 1rem;
    background: #1a1a1a;
    color: #fff;
    font-size: 1rem;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}
.skip-link.screen-reader-text:focus {
    left: 0;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Focus visibile per tastiera: colore che segue i colori del sito (currentColor) */
:root {
    --focus-ring: 2px solid currentColor;
    --focus-offset: 2px;
}
a:focus-visible,
button:focus-visible,
[tabindex="0"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.wpml-switcher .wpml-ls-item.wpml-ls-current-language:focus-visible,
.nav-link:focus-visible,
.w-nav-link:focus-visible,
.secondary-button:focus-visible,
.footer-links:focus-visible,
.crediits:focus-visible,
.button:focus-visible,
.w-button:focus-visible,
.link-block:focus-visible,
.link-block-4:focus-visible,
.w-input:focus-visible,
.w-select:focus-visible,
.form-field:focus-visible,
.form-field.w-input:focus-visible,
.is-message:focus-visible {
    outline: var(--focus-ring) !important;
    outline-offset: var(--focus-offset);
}

/* Selettore lingua: visibile solo se attivato da Customizer (Aspetto > Personalizza > Selettore lingua WPML) */
body.wpml-switcher-visible .wpml-switcher {
    display: block !important;
}

/* ——— Selettore lingua a tendina (dropdown) ——— */
.wpml-switcher {
    position: relative;
    display: inline-block;
}

.wpml-switcher .wpml-ls-statics-shortcode_actions,
.wpml-switcher .wpml-ls-legacy-dropdown {
    margin: 0;
    padding: 0;
}

.wpml-switcher ul {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
    min-height: 28px;
}

/* Trigger: lingua corrente con freccia a DESTRA della bandiera */
.wpml-switcher .wpml-ls-item.wpml-ls-current-language {
    order: -1;
    padding: 4px 20px 4px 6px;
    border-radius: 4px;
    position: relative;
}

/* Freccia a destra della bandiera (sul li, non sopra) */
.wpml-switcher .wpml-ls-item.wpml-ls-current-language::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 40%;
    transform: translateY(-50%) rotate(45deg);
    border: solid currentColor;
    border-width: 0 1px 1px 0;
    padding: 2.5px;
    opacity: 0.7;
    pointer-events: none;
}

/* Pannello a tendina: posizione assoluta così non sposta nulla al click/hover */
.wpml-switcher .wpml-switcher-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    margin-top: 2px;
    padding: 0;
    list-style: none;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9999;
}

/* Apertura al click (classe aggiunta da JS) */
.wpml-switcher.is-open .wpml-switcher-dropdown {
    opacity: 1;
    visibility: visible;
}

.wpml-switcher .wpml-switcher-dropdown .wpml-ls-item {
    padding: 6px 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.wpml-switcher .wpml-switcher-dropdown .wpml-ls-item:first-child {
    border-top: none;
}

/* Nascondi i testi delle etichette */
.wpml-switcher .wpml-ls-item a span {
    display: none;
}

/* Bandiera lingua */
.wpml-switcher .wpml-ls-item a {
    display: inline-block;
    width: 24px;
    height: 16px;
    background-size: cover;
    background-position: center;
    margin-right: 0;
    cursor: pointer;
    text-indent: -9999px;
}

/* Bandiere specifiche */
.wpml-switcher .wpml-ls-item-en a {
    background-image: url('https://flagcdn.com/w20/gb.png');
}

.wpml-switcher .wpml-ls-item-it a {
    background-image: url('https://flagcdn.com/w20/it.png');
}

/* Lingua corrente piena opacità */
.wpml-switcher .wpml-ls-item.wpml-ls-current-language a {
    opacity: 1;
}

/* Lingue nel dropdown sempre visibili al passaggio */
.wpml-switcher .wpml-ls-item:not(.wpml-ls-current-language) a {
    opacity: 1;
}

@media screen and (max-width: 991px) {
    .wpml-switcher {
        margin-top: 2rem;
    }
    .wpml-switcher .wpml-switcher-dropdown {
        width: auto;
        left: 50%;
        transform: translateX(-50%);
        min-width: unset;
    }
    .wpml-ls-statics-shortcode_actions {
        margin-top: 20px;
    }
}

.iubenda-nostyle,
.iubenda-no_style,
.iubenda-embed,
.iubenda-embed a,
.iubenda-nostyle a,
.iubenda-no_style a {
    color: var(--_color-palette---background-color--primary) !important;
    text-transform: capitalize;
    padding-top: .5em;
    padding-bottom: .5em;
    transition: all .25s cubic-bezier(.77, 0, .175, 1);
}

.iubenda-nostyle:hover,
.iubenda-no_style:hover,
.iubenda-embed:hover,
.iubenda-embed a:hover,
.iubenda-nostyle a:hover,
.iubenda-no_style a:hover {
    opacity: .8;
    transform: translate(0, 2px);
    outline: 0;
}

/* Popup custom Privacy / Cookie Policy (iframe Iubenda) – in wp_footer, copre tutta la finestra */
.iubenda-custom-popup {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.25s, opacity 0.25s;
}
.iubenda-custom-popup.is-open {
    visibility: visible;
    opacity: 1;
}
.iubenda-custom-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
}
.iubenda-custom-popup__box {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 1;
}
.iubenda-custom-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: #333;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.iubenda-custom-popup__close:hover {
    background: rgba(0, 0, 0, 0.15);
}
.iubenda-custom-popup__iframe {
    display: block;
    width: 100%;
    height: 80vh;
    min-height: 400px;
    border: none;
}

/* Card servizi: animazione scritta + underline solo al passaggio sul titolo */
@media screen and (min-width: 992px) {
  .card-text .tertiary-button.card-tertiary {
    width: fit-content;
    max-width: 100%;
    cursor: pointer;
  }

  .card-text .tertiary-button.card-tertiary h3 {
    font-size: 23px;
    margin: 0;
    line-height: 1.2;
  }

  .card-text .tertiary-button.card-tertiary .text-wrapper {
    height: 1.7em;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .card-text .tertiary-button.card-tertiary .text-wrapper-inner {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  .card-text .tertiary-button.card-tertiary .button-underline {
    background-color: #0000001a;
    width: 100%;
    height: 1px;
    overflow: hidden;
  }

  .card-text .tertiary-button.card-tertiary .button-underline_fill {
    background-color: var(--_color-palette---black-primary);
    width: 100%;
    height: 1px;
    transform: translate3d(-100%, 0, 0);
    transition: transform 0.75s cubic-bezier(0.77, 0, 0.175, 1);
  }

  /* Hover su tutta la card: così la linea non si svuota durante lo slide del testo */
  /* Hover solo sull'h3/titolo: slide testo e (via JS) uscita linea */
  .card-text .tertiary-button.card-tertiary:hover .text-wrapper-inner {
    transform: translateY(-50%);
  }

  /* Dopo l'uscita: linea nascosta finché non ripassi sul titolo */
  /* card-underline-done: solo la linea resta nascosta; il testo torna a posto solo uscendo dall'hover */
  .link-block-3.card-underline-done .card-text .tertiary-button.card-tertiary .button-underline_fill,
  .link-block-3.card-underline-done:hover .card-text .tertiary-button.card-tertiary .button-underline_fill {
    transform: translate3d(-100%, 0, 0);
  }

  /* Uscita a destra (mentre sei in hover: dopo un attimo la linea esce e si resetta) */
  .card-text .tertiary-button.card-tertiary .button-underline_fill.card-underline-exiting {
    transition: none;
    animation: card-underline-exit-right 0.65s cubic-bezier(0.77, 0, 0.175, 1) forwards;
  }

  .card-text .tertiary-button.card-tertiary .button-underline_fill.card-underline-reset {
    transform: translate3d(-100%, 0, 0);
    transition: none;
  }

  @keyframes card-underline-exit-right {
    to {
      transform: translate3d(100%, 0, 0);
    }
  }
}

/* Mobile: niente animazione, nessuna modifica a font-size/padding (solo nascondi underline e secondo h3) */
@media screen and (max-width: 991px) {
  .card-text .tertiary-button.card-tertiary {
    padding: 0;
  }

  .card-text .tertiary-button.card-tertiary h3 {
    font-size: 23px;
    line-height: inherit;
  }

  .card-text .tertiary-button.card-tertiary .button-underline {
    display: none;
  }

  .card-text .tertiary-button.card-tertiary .text-wrapper {
    height: auto;
    overflow: visible;
  }

  .card-text .tertiary-button.card-tertiary .text-wrapper-inner h3:last-child {
    display: none;
  }
}

/* Menu mobile: evita che la voce “corrente” sia blu (override Webflow .w-nav-link.w--current) */
@media screen and (max-width: 991px) {
  .nav-menu .w-nav-link.w--current,
  .nav-menu .w-nav-link[aria-current="page"] {
    color: var(--_color-palette---font-color--primary) !important;
  }
}

/* Spazio tra i due indirizzi (Milano / Potenza Picena) in Contatti */
.dove-siamo-section .wrapper-text.text-size-large p + p {
  margin-top: 1.25em;
}

/* Checkbox privacy CF7: allineamento al font del sito (Host Grotesk) */
.form-field_wrapper--privacy,
.form-field_wrapper--privacy .wpcf7-list-item-label,
.form-field_wrapper--privacy .wpcf7-form-control-wrap {
  font-family: var(--_fonts---host-grotesk);
}
.form-field_wrapper--privacy .wpcf7-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
}
.form-field_wrapper--privacy .wpcf7-list-item-label {
  font-size: 15px;
  font-weight: 300;
  line-height: inherit;
}
.form-field_wrapper--privacy .privacy-acceptance-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.25em;
}
.form-field_wrapper--privacy .privacy-acceptance-wrapper p {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25em;
  margin: 0;
}
.form-field_wrapper--privacy .privacy-acceptance-wrapper br {
  display: none;
}
/* Link "privacy policy" dentro la label della checkbox */
.form-field_wrapper--privacy .wpcf7-list-item-label a,
.form-field_wrapper--privacy .wpcf7-list-item-label .privacy-policy-link,
.form-field_wrapper--privacy .wpcf7-list-item-label .iubenda-popup-link {
  font-family: var(--_fonts---host-grotesk);
  font-weight: 300;
  font-size: inherit;
  line-height: inherit;
  color: var(--_color-palette---font-color--primary, #161616) !important;
  text-decoration: underline !important;
  text-underline-offset: 0.15em;
  cursor: pointer;
  text-transform: none !important;
  padding: 0 !important;
  display: inline !important;
  background: none !important;
  transition: opacity 0.2s ease;
}
.form-field_wrapper--privacy .wpcf7-list-item-label a:hover,
.form-field_wrapper--privacy .wpcf7-list-item-label .privacy-policy-link:hover {
  opacity: 0.7;
}

/* Link nel corpo delle news: dimensione del testo + sottolineatura animata all'hover */
.text-rich-text a {
  font-size: inherit;
  line-height: inherit;
  text-decoration: none; /* la sottolineatura nativa non è animabile: la ridisegniamo sotto */

  /* sottolineatura disegnata con un gradiente, così possiamo animarla */
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;   /* in basso, partendo da sinistra */
  background-size: 100% 1px;     /* a riposo: linea piena, così si vede che è un link */
}

.text-rich-text a:hover {
  animation: news-link-underline 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

@keyframes news-link-underline {
  0%   { background-size: 100% 1px; background-position: 100% 100%; } /* linea piena */
  45%  { background-size: 0 1px;    background-position: 100% 100%; } /* esce verso destra */
  46%  { background-size: 0 1px;    background-position: 0 100%; }    /* salta a sinistra (invisibile) */
  100% { background-size: 100% 1px; background-position: 0 100%; }    /* rientra da sinistra */
}
