html.in-passaggio { scroll-behavior: auto; overscroll-behavior: none; }

/* A sliding bay masks the change of section. Its scenery and steelwork
   move on separate planes, with the structure settling behind the title. */
.site-passaggio {
  --foto: url("./assets/impalcato.webp");
  --montante: url("./assets/ponteggio-transizione.svg#traverso-montante");
  --elemento: url("./assets/ponteggio-transizione.svg#traverso-elemento");
  --giunto: url("./assets/ponteggio-transizione.svg#traverso-giunto");
  --ingresso-x: -101%;
  --ingresso-y: 0%;
  --uscita-x: 101%;
  --uscita-y: 0%;
  --innesto-x: -37%;
  --innesto-y: 3%;
  --fotogramma: 64% 48%;
  --luce: #ff933f;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 40;
  isolation: isolate;
  pointer-events: none;
  contain: strict;
}

.site-passaggio[hidden] { display: none !important; }
.site-passaggio[data-motivo="cantieri"] {
  --foto: url("./assets/multipiano.webp");
  --montante: url("./assets/ponteggio-transizione.svg#impalcato-montante");
  --elemento: url("./assets/ponteggio-transizione.svg#impalcato-elemento");
  --giunto: url("./assets/ponteggio-transizione.svg#impalcato-giunto");
  --ingresso-x: 0%; --ingresso-y: 101%;
  --uscita-x: 0%; --uscita-y: -101%;
  --innesto-x: 2%; --innesto-y: 36%;
}
.site-passaggio[data-motivo="azienda"], .site-passaggio[data-motivo="home"] {
  --foto: url("./assets/passaggio.webp");
  --montante: url("./assets/ponteggio-transizione.svg#diagonale-montante");
  --elemento: url("./assets/ponteggio-transizione.svg#diagonale-elemento");
  --giunto: url("./assets/ponteggio-transizione.svg#diagonale-giunto");
  --ingresso-x: 101%; --uscita-x: -101%;
  --innesto-x: 30%; --innesto-y: -16%;
  --fotogramma: 50% 56%;
}
.site-passaggio[data-motivo="preventivo"],
.site-passaggio[data-motivo="privacy"], .site-passaggio[data-motivo="cookie"] {
  --foto: url("./assets/facciata-sm.webp");
  --montante: url("./assets/ponteggio-transizione.svg#disegno-montante");
  --elemento: url("./assets/ponteggio-transizione.svg#disegno-elemento");
  --giunto: url("./assets/ponteggio-transizione.svg#disegno-giunto");
  --innesto-x: 16%; --innesto-y: 8%;
  --fotogramma: 45% 65%;
}
.passaggio-pannello {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  color: #faf8ee;
  background: #202422;
}
.passaggio-scena, .passaggio-struttura, .passaggio-luce {
  position: absolute;
  pointer-events: none;
}
.passaggio-scena {
  inset: -3%;
  background: var(--foto) var(--fotogramma) / cover no-repeat;
  filter: grayscale(.9);
  opacity: .58;
}
.passaggio-pannello::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, #191c19 2%, #1b1e1aea 25%, #1c201bc7 44%, #1a201b22 82%),
              linear-gradient(0deg, #13171485, transparent 45%, #18201d2b);
}
.passaggio-struttura {
  z-index: 2;
  inset: -15% -8% -15% 35%;
  background: var(--montante) center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%);
  mask-image: linear-gradient(90deg, transparent, #000 18%);
}
.passaggio-struttura::before, .passaggio-struttura::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--elemento) center / cover no-repeat;
}
.passaggio-struttura::after { background-image: var(--giunto); }
/* The strip of sidelight tightens on the coupling as the bay locks. */
.passaggio-luce {
  z-index: 3;
  top: -25%; bottom: -25%;
  left: 59%; width: 19%;
  opacity: 0;
  transform: skew(-20deg);
  background: linear-gradient(90deg, transparent 8%, #e6b1890e 34%, #ffe6cc28 49%, #de87370f 58%, transparent 86%);
}
.passaggio-nome {
  position: absolute;
  z-index: 4;
  top: 47%;
  left: max(clamp(22px, 7vw, 112px), env(safe-area-inset-left));
  max-width: 75%;
  transform: translateY(-22%);
  color: #faf9f0;
  font-family: Geist, Arial, sans-serif;
  font-size: clamp(2.8rem, 7.6vw, 8.5rem);
  font-weight: 770;
  line-height: .98;
  letter-spacing: -.052em;
  overflow-wrap: break-word;
}
.passaggio-nome::before {
  content: "";
  display: block;
  width: clamp(44px, 6.1vw, 100px);
  height: clamp(3px, .37vw, 6px);
  margin: 0 0 clamp(12px, 2vw, 27px);
  background: var(--luce);
}
.site-passaggio[data-motivo="preventivo"] .passaggio-pannello,
.site-passaggio[data-motivo="privacy"] .passaggio-pannello,
.site-passaggio[data-motivo="cookie"] .passaggio-pannello {
  background-color: #1c292a;
}
.site-passaggio:is([data-motivo="preventivo"], [data-motivo="privacy"], [data-motivo="cookie"]) .passaggio-scena {
  opacity: .23;
}
.site-passaggio:is([data-motivo="preventivo"], [data-motivo="privacy"], [data-motivo="cookie"]) .passaggio-pannello::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0 0 0 35%;
  background-image: linear-gradient(#c1cebd15 1px, transparent 1px),
                    linear-gradient(90deg, #c1cebd15 1px, transparent 1px);
  background-size: clamp(24px, 3.2vw, 55px) clamp(24px, 3.2vw, 55px);
}
.site-passaggio[data-fase="chiude"] .passaggio-pannello {
  animation: passaggio-copri calc(330ms * var(--ritmo, 1)) cubic-bezier(.47,.04,.18,1) both;
}
.site-passaggio[data-fase="chiude"] .passaggio-scena {
  animation: passaggio-fondale calc(350ms * var(--ritmo, 1)) ease-out both;
}
.site-passaggio[data-fase="chiude"] .passaggio-struttura::before {
  animation: passaggio-innesto calc(330ms * var(--ritmo, 1)) cubic-bezier(.26,.42,.25,1) both;
}
.site-passaggio[data-fase="chiude"] .passaggio-struttura::after {
  animation: passaggio-serraggio calc(135ms * var(--ritmo, 1)) calc(205ms * var(--ritmo, 1)) ease-out both;
}
.site-passaggio:is([data-motivo="preventivo"], [data-motivo="privacy"], [data-motivo="cookie"])[data-fase="chiude"] .passaggio-struttura::before {
  animation: passaggio-traccia calc(230ms * var(--ritmo, 1)) calc(55ms * var(--ritmo, 1)) ease-out both;
}
.site-passaggio:is([data-motivo="preventivo"], [data-motivo="privacy"], [data-motivo="cookie"])[data-fase="chiude"] .passaggio-struttura::after {
  animation: passaggio-quota calc(150ms * var(--ritmo, 1)) calc(190ms * var(--ritmo, 1)) ease-out both;
}
.site-passaggio[data-fase="chiude"] .passaggio-luce {
  animation: passaggio-riflesso calc(350ms * var(--ritmo, 1)) ease-out both;
}
.site-passaggio[data-fase="apre"] .passaggio-pannello {
  animation: passaggio-scopri calc(420ms * var(--ritmo, 1)) cubic-bezier(.67,.03,.25,1) forwards;
}
.site-passaggio[data-fase="apre"] .passaggio-struttura::before {
  animation: passaggio-scorri calc(420ms * var(--ritmo, 1)) ease-in forwards;
}
@keyframes passaggio-copri {
  from { transform: translate3d(var(--ingresso-x), var(--ingresso-y), 0); }
  to { transform: none; }
}
@keyframes passaggio-scopri {
  from { transform: none; }
  to { transform: translate3d(var(--uscita-x), var(--uscita-y), 0); }
}
@keyframes passaggio-fondale {
  from { transform: scale(1.05) translateX(2%); }
  to { transform: none; }
}
@keyframes passaggio-innesto {
  from { transform: translate3d(var(--innesto-x), var(--innesto-y), 0); }
  to { transform: none; }
}
@keyframes passaggio-serraggio {
  from { transform: translate3d(0, -7px, 0); }
  to { transform: none; }
}
@keyframes passaggio-traccia {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0); }
}
@keyframes passaggio-quota {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0); }
}
@keyframes passaggio-scorri {
  from { transform: none; }
  to { transform: translate3d(calc(-.44 * var(--innesto-x)), calc(-.44 * var(--innesto-y)), 0); }
}
@keyframes passaggio-riflesso {
  0% { transform: translateX(-145%) skew(-20deg); opacity: 0; }
  63% { opacity: 1; }
  100% { transform: translateX(95%) skew(-20deg); opacity: 0; }
}
@media (max-width: 700px) {
  .passaggio-struttura { inset: -8% -26% -6% 17%; }
  .passaggio-scena { background-position: 54% 50%; }
  .passaggio-nome { top: 58%; max-width: 87%; font-size: clamp(2.5rem, 11.8vw, 4.8rem); }
  .passaggio-pannello::before {
    background: linear-gradient(0deg, #1a1d19ec 4%, #1c1f1bd9 30%, #1a201b24 79%),
                linear-gradient(90deg, #1e231f6e, transparent 88%);
  }
}
@media (prefers-reduced-motion: reduce), print {
  .site-passaggio { display: none !important; }
}
