/*
 * Struttura comune a tutte le pagine (blocco ghiti/app): header, tendina, bruco,
 * menu, pulsante menu, rana "torne sù", footer, loading shade, modali dei form.
 * Valori ripresi dalle classi Tailwind del tema Sage; breakpoint 640/768/1024/1280.
 */

/* ---------- Contenitore ---------- */

/* North dà a .wp-site-blocks il gutter laterale (frontend.css): la struttura Ghiti
   occupa tutta la larghezza e gestisce i margini da sé. */
.wp-site-blocks:has(> .starter) {
  padding-inline: 0;
}

/* Nascosto finché l'intro JS non lo mostra (scripts/partials/intro.js) */
.starter {
  min-height: 100vh;
  overflow: hidden;
  background-color: var(--color-base);
}

#tornasu_track {
  position: relative;
}

/* ---------- Titoli e testi con traduzione al passaggio del mouse ---------- */

.hover-title,
.ghiti-button,
.hover-swap {
  position: relative;
}

.hover-title--centered {
  display: flex;
  justify-content: center;
}

.hover-title__alt,
.hover-title__main,
.hover-swap__alt,
.hover-swap__main {
  line-height: 1;
  cursor: default;
}

.hover-title__alt,
.hover-title__main {
  transition: all 200ms ease-in-out;
}

.hover-title__alt {
  position: absolute;
  overflow: hidden;
  padding: 0 0.5rem 0.25rem 0;
  font-size: .5em;
  font-style: italic;
  opacity: 0;
}

.hover-title--small .hover-title__alt,
.ghiti-button .hover-title__alt {
  font-size: .7em;
}

.hover-title:hover > .hover-title__alt,
.ghiti-button:hover > .hover-title__alt {
  opacity: 1;
  transform: translateY(-0.6em);
}

.hover-title--small:hover > .hover-title__alt,
.ghiti-button:hover > .hover-title__alt {
  transform: translateY(-0.5rem);
}

.hover-title:hover > .hover-title__main,
.ghiti-button:hover > .hover-title__main {
  transform: translateY(0.5rem);
}

.hover-swap__alt,
.hover-swap__main {
  transition: opacity 300ms ease-in-out;
}

.hover-swap__alt {
  position: absolute;
  overflow: hidden;
  font-style: italic;
  opacity: 0;
}

.hover-swap:hover > .hover-swap__alt { opacity: 1; }
.hover-swap:hover > .hover-swap__main { opacity: 0; }

/* ---------- Pulsante ---------- */

.ghiti-button {
  display: flex;
  align-items: center;
  padding: 1.25rem 2rem 1rem;
  border-radius: 9999px;
  background-color: var(--color-salmone-500);
  color: var(--color-white);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-decoration: none;
}

.ghiti-button .hover-title__alt,
.ghiti-button .hover-title__main {
  cursor: pointer;
}

.ghiti-button--blu { background-color: var(--color-primary-500); }
.ghiti-button--verde { background-color: var(--color-secondary-500); }
.ghiti-button--giallo { background-color: var(--color-giallo-500); }
.ghiti-button--rosa { background-color: var(--color-rosa-500); }
.ghiti-button--salmone { background-color: var(--color-salmone-500); }

@media (min-width: 640px) {
  .ghiti-button {
    font-size: 1.5rem;
    line-height: 2rem;
  }
}

/* ---------- Switch (lingua, lettura facilitata) ---------- */

.switch-svg { width: 9rem; height: auto; }
.switch-svg--lang { width: 7rem; }

@media (min-width: 640px) {
  .switch-svg--lang { width: 9rem; }
}

/* ---------- Header ---------- */

.site-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 80rem;
  margin-inline: auto;
  padding-top: 4.5rem;
}

.site-header__lang {
  position: absolute;
  top: 0.5rem;
  left: 0.75rem;
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.site-header__lang-label {
  display: none;
  margin-bottom: 0.5rem;
  color: var(--color-primary-500);
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 700;
}

.site-header__lang-switch {
  cursor: pointer;
}

.site-header__brand {
  margin-block: 1rem;
}

.site-header__logo {
  width: 11rem;
  height: auto;
  max-width: 100%;
}

@media (min-width: 640px) {
  .site-header { padding: 0 2rem; }
  .site-header__lang { left: 1rem; }
  .site-header__lang-label { display: block; }
  .site-header__brand { margin-block: 1.5rem; }
  .site-header__logo { width: 14rem; }
}

@media (min-width: 768px) {
  .site-header__logo { width: 20rem; }
}

@media (min-width: 1024px) {
  .site-header__lang-label {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
}

/* ---------- Tendina "pai grancj" ---------- */

.tendina {
  position: fixed;
  top: -100%;
  z-index: 30;
  width: 100%;
  height: 100%;
  background-color: var(--color-secondary-500);
  transform: translateZ(0);
}

.tendina__content {
  max-width: 1344px;
  height: 100%;
  margin-inline: auto;
  padding: 2rem 2rem 5rem;
  overflow: auto;
  color: var(--color-white);
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.tendina__fade {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 5rem;
  background-image: linear-gradient(to top, var(--color-secondary-500), transparent);
}

.tendina__handle-row {
  position: absolute;
  bottom: 1px;
  left: 0;
  width: 100%;
  transform: translateY(100%);
}

.tendina__handle-wrap {
  position: relative;
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 1344px;
  margin-inline: auto;
  padding-inline: 1rem;
}

.tendina__grabber {
  position: absolute;
  transform: translateZ(0);
}

.tendina__label {
  position: absolute;
  top: 0;
  width: 100%;
  padding-top: 13px;
  padding-right: .35rem;
  color: var(--color-white);
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 700;
  text-align: center;
}

.tendina__toggle {
  cursor: pointer;
}

/* Testo della tendina (contenuto editoriale) */
.tendina_content h2 { margin-bottom: 1.25rem; font-size: 2.25rem; line-height: 2.5rem; }
.tendina_content h3 { margin-bottom: 1rem; font-size: 1.875rem; line-height: 2.25rem; }
.tendina_content :is(p, ul, ol) { margin-bottom: 0.75rem; font-size: 1.5rem; line-height: 2rem; }
.tendina_content ul { padding-left: 1.5rem; list-style: disc; }
.tendina_content ul ul { list-style: circle; }

@media (min-width: 640px) {
  .tendina__handle-wrap { padding-inline: 2rem; }
  .tendina__label { padding-right: 0.75rem; font-size: 1.25rem; }
}

@media (min-width: 768px) {
  .tendina__content { padding: 6rem 3rem; }
  .tendina__label { padding-top: 26px; }
  .tendina_content h2 { font-size: 3rem; line-height: 1; }
  .tendina_content h3 { font-size: 2.25rem; line-height: 2.5rem; }
  .tendina_content :is(p, ul, ol) { font-size: 1.875rem; line-height: 2.25rem; }
}

/* ---------- Bruco ---------- */

.bruco-rail {
  position: relative;
}

.bruco {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-width: 870px;
  margin-bottom: 1rem;
}

.bruco__box {
  position: relative;
  display: flex;
  gap: 0.25rem;
  width: max-content;
}

.bruco__testa,
.bruco__corpo {
  position: relative;
  flex-shrink: 1;
  width: 100%;
}

.bruco__testa { max-width: 87px; }
.bruco__corpo { max-width: 68px; }
.bruco__corpo--fortunato { max-width: 60px; }

@media (min-width: 1024px) {
  .bruco { margin-bottom: 1.5rem; }
  .bruco__testa { max-width: 115px; }
  .bruco__corpo { max-width: 90px; }
  .bruco__corpo--fortunato { max-width: 79px; }
}

#bruco .gambetta-1 { transform-origin: 21px 60px; }
#bruco .gambetta-2 { transform-origin: 55px 60px; }

#bruco.sgambetta .gambetta-1,
#bruco.sgambetta .gambetta-2 {
  animation: anim-sgambetta 0.1s ease-in-out infinite alternate both;
}

#bruco.sgambetta .gambetta-2 { animation-delay: 0.1s; }

#bruco.sgambetta #pupilla_dx,
#bruco.sgambetta #pupilla_sx {
  transform: none !important;
}

@keyframes anim-sgambetta {
  from { transform: rotate(-7deg); }
  to { transform: rotate(7deg); }
}

#bruco #antenna_sx {
  transform-origin: 44px 80px;
  transform: rotate(-5deg) translate(0, 7px);
}

#bruco #antenna_dx {
  transform-origin: 60px 80px;
  transform: translate(13px, 7px) rotate(5deg);
}

#bruco.scuoti #antenna_sx { animation: anim-scuoti-antenne-sx 5s ease-in-out 3s infinite alternate both; }
#bruco.scuoti #antenna_dx { animation: anim-scuoti-antenne-dx 5s ease-in-out 3s infinite alternate both; }
#bruco.scuoti #nasetto { animation: anim-scuoti-nasetto 6s ease-in-out 5s infinite; }

@keyframes anim-scuoti-antenne-sx {
  0%, 4%, 8%, 100% { transform: rotate(-5deg) translate(0, 7px); }
  2%, 6% { transform: rotate(20deg) translate(0, 7px); }
}

@keyframes anim-scuoti-antenne-dx {
  0%, 4%, 8%, 100% { transform: rotate(5deg) translate(13px, 7px); }
  2%, 6% { transform: rotate(-25deg) translate(13px, 7px); }
}

@keyframes anim-scuoti-nasetto {
  0%, 4.4%, 100% { transform: translate(0, 0); }
  3.3% { transform: translate(0, -5px); }
}

/* ---------- Menu ---------- */

.menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 100%;
  height: calc(100vh + 40px);
  overflow: auto;
}

.menu__inner {
  width: 100%;
  padding-top: 5rem;
  background-color: var(--color-base);
}

.menu__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.menu__logo {
  width: 12rem;
  height: auto;
  max-width: 100%;
  margin-bottom: 3rem;
}

.menu__claim {
  max-width: 48rem;
  padding-inline: 2rem;
  color: var(--color-primary-500);
  font-size: 1.25rem;
  line-height: 1.75rem;
  text-align: center;
}

.menu__featured {
  display: flex;
  gap: 1.5rem;
  max-width: 64rem;
  margin: 2rem auto;
  padding-inline: 2rem;
  overflow-x: auto;
}

.menu__featured-card {
  min-width: 15rem;
}

.menu__sections {
  position: relative;
  overflow: hidden;
  padding: 3rem 0 9rem;
}

.menu__sections-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-secondary-600);
}

.menu__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: center;
  gap: 1rem;
  max-width: 83rem;
  margin-inline: auto;
  padding-inline: 2rem;
}

.menu-card {
  position: relative;
}

.menu-card__mask {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: var(--color-primary-500);
  transition: transform 200ms ease-in-out;
}

.menu-card__img {
  position: relative;
  display: block;
  width: 15rem;
  height: auto;
  margin-inline: auto;
  transform-origin: center;
  transition: transform 200ms ease-in-out;
}

.menu-card__label {
  position: absolute;
  bottom: 0.25rem;
  width: 100%;
  color: var(--color-white);
  font-weight: 700;
  text-align: center;
  transition: all 200ms ease-in-out;
}

.menu-card:hover .menu-card__mask { transform: scale(.95); }
.menu-card:hover .menu-card__wobble { animation: slowRotation 8s ease-in-out infinite; }
.menu-card:hover .menu-card__img { transform: translateY(-2rem) scale(1.25); }
.menu-card:hover .menu-card__label { transform: translateY(-1.5rem) scale(1.25); }

.menu__cta {
  display: flex;
  justify-content: center;
  margin-top: 4rem;
}

@media (min-width: 768px) {
  .menu__inner { padding-top: 6rem; }
  .menu__logo { margin-bottom: 4rem; }
  .menu__claim { padding-inline: 2.5rem; font-size: 1.875rem; line-height: 2.25rem; }
  .menu__featured { justify-content: center; gap: 3rem; margin-block: 4rem; overflow: hidden; }
  .menu__sections { min-height: 45rem; padding-top: 6rem; }
  .menu__cards { display: flex; flex-wrap: wrap; }
  .menu-card__label { bottom: 1rem; font-size: 1.125rem; line-height: 1.75rem; }
  .menu__cta { margin-top: 5rem; }
}

/* ---------- Pulsante menu ---------- */

.menu-button {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem;
}

.menu-button__icon {
  width: 3.5rem;
  height: auto;
}

.menu-button__label {
  color: var(--color-white);
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 700;
}

@media (min-width: 640px) {
  .menu-button__icon { width: 5rem; }
}

@media (min-width: 1024px) {
  .menu-button__icon { width: 6rem; }
}

/* ---------- Rana "torne sù" ---------- */

.tornasu {
  position: absolute;
  top: calc(100vh - 216px);
  z-index: 30;
  cursor: pointer;
}

.tornasu__offsetter {
  transform: translateY(6rem);
  transition: transform 300ms ease-in-out;
}

.tornasu__offsetter.offset_none {
  transform: translateY(0);
}

.tornasu__label {
  margin-top: 0.5rem;
  color: var(--color-secondary-500);
  font-weight: 700;
  text-align: center;
}

@media (min-width: 768px) {
  .tornasu__offsetter { transform: translateY(8rem); }
}

#tornasu_track .pin-spacer { pointer-events: none; }
#tornasu_track .pin-spacer #tornasu { pointer-events: auto; }

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: -3rem;
  padding-top: 4rem;
  overflow: hidden;
  background-color: var(--color-rosa-600);
}

.site-footer__content {
  width: 100%;
  padding: 0 2rem 4rem;
}

.site-footer__arlef {
  display: block;
  margin-bottom: 0.75rem;
}

.site-footer__columns {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.site-footer__col--narrow { max-width: 300px; }
.site-footer__title { margin-bottom: 1.5rem; }
.site-footer__text { margin-bottom: 1.5rem; }

.site-footer__legal {
  font-size: 1rem;
  line-height: 1.5rem;
  border-color: var(--color-black);
}

.site-footer__legal:hover,
.site-footer__legal:focus {
  border-bottom: 1px solid var(--color-black);
}

.site-footer__credits {
  margin-bottom: 3rem;
  line-height: 1;
}

.site-footer__er-label {
  margin-bottom: 0.5rem;
  color: var(--color-primary-500);
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 700;
}

.site-footer__er-switch { cursor: pointer; }

.site-footer__graphic {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-top: -44vw;
  padding-left: 2rem;
  pointer-events: none;
}

@media (min-width: 575px) {
  .site-footer__graphic { margin-top: -22vw; }
}

@media (min-width: 600px) {
  .site-footer__text { margin-bottom: 6rem; }
  .site-footer__credits { margin-bottom: 4.5rem; }
}

@media (min-width: 1024px) {
  .site-footer__content { padding-inline: 4rem; }
  .site-footer__er-label { font-size: 1.25rem; }
}

@media (min-width: 1280px) {
  .site-footer__content,
  .site-footer__graphic { width: auto; }
  .site-footer__graphic { margin-top: 0; }
}

/* ---------- Loading shade ---------- */

.shade {
  position: fixed;
  top: 0;
  z-index: 1002;
  display: flex;
  justify-content: center;
  align-items: center;
  width: calc(100% + 21px);
  height: 100%;
  overflow: hidden;
  transform: translateX(100%);
}

.shade__ondina,
.shade__sfondo {
  position: absolute;
  top: 0;
  height: 100%;
  background-color: var(--color-secondary-500);
}

.shade__ondina { left: 0; width: 2.5rem; }
.shade__sfondo { left: 2.25rem; width: 100%; }

.shade__aligner {
  position: relative;
  display: flex;
}

.shade__babyriccio {
  position: relative;
  z-index: 2;
}

.shade-bruco {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 100%;
  height: 100%;
}

.shade-bruco__shifter {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---------- Modali dei form ---------- */

.form-modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background-color: rgb(0 0 0 / 0.2);
  animation: fade-in .8s ease-out;
}

.form-modal__box {
  position: relative;
  width: 600px;
  padding: 2rem;
  border-radius: 0.375rem;
  background-color: var(--color-rosa-600);
}

.form-modal__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem;
  border-radius: 0.375rem;
  background-color: var(--color-primary-600);
  cursor: pointer;
}

.form-modal .gform_footer input[type=submit].gform_button.button {
  padding: 0.9em 1.7em;
  border: none;
  border-radius: 50px;
  background-color: var(--color-primary-500);
  color: var(--color-white);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .21px;
  cursor: pointer;
}

.form-modal .gfield_consent_label a {
  text-decoration: underline;
}

@media (min-width: 768px) {
  .form-modal__box { padding: 3rem; }
}

.site-footer__graphic-svg {
  width: 35rem;
  max-width: 100%;
  height: auto;
}

/* SVG della rana "torne sù" e della maniglia della tendina */
.rana-svg { width: 4rem; height: auto; }
.tendina-opener-svg { position: relative; width: 7rem; height: auto; }
.tendina-opener__flip { transform: none; }
/* Su Sage questo path ha due attributi class e il browser usa solo il primo: la regola resta senza effetto come nell'originale. */
.tendina-opener__shade { fill: var(--color-primary-600); opacity: 0.3; }

@media (min-width: 768px) {
  .rana-svg { width: 6rem; }
  .tendina-opener-svg { width: 12rem; }
}
