/* Cucitura fra le pagine progetto e il resto del sito.
   Le pagine progetto restano com'erano: qui ci sono solo il logo-menu nella barra,
   il pannello laterale (lo stesso della home) e la striscia finale con il prossimo progetto.
   Tutto e' sotto classi .sx-* per non toccare lo stile dei progetti. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../../assets/inter-light.woff2") format("woff2");
}

:root {
  --sx-carbon: #222725;
  --sx-snow: #fffbfe;
  --sx-lemon: #fff133;
  --sx-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html.is-open {
  overflow: hidden;
}

/* ---------- barra: logo-menu + nome ---------- */

header.portfolio-bar .sx-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-self: start;
}

header.portfolio-bar .sx-logo {
  position: relative;
  display: block;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  overflow: hidden;
  cursor: pointer;
}

header.portfolio-bar .sx-logo img {
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 420ms var(--sx-ease), opacity 220ms var(--sx-ease);
}

header.portfolio-bar .sx-logo:focus-visible {
  outline: 2px solid var(--sx-snow);
  outline-offset: 4px;
}

header.portfolio-bar .sx-bars {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 5px;
  opacity: 0;
  transform: rotate(-90deg);
  transition: transform 420ms var(--sx-ease), opacity 220ms var(--sx-ease);
}

header.portfolio-bar .sx-bars i {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--sx-lemon);
  transition: transform 420ms var(--sx-ease), opacity 220ms var(--sx-ease);
}

@media (hover: hover) {
  header.portfolio-bar .sx-logo:hover img,
  header.portfolio-bar .sx-logo:focus-visible img {
    transform: rotate(90deg);
    opacity: 0;
  }

  header.portfolio-bar .sx-logo:hover .sx-bars,
  header.portfolio-bar .sx-logo:focus-visible .sx-bars {
    opacity: 1;
    transform: none;
  }
}

@media (hover: none) {
  header.portfolio-bar .sx-logo img {
    animation: sx-logo-hint 3.2s var(--sx-ease) 2.5s 1 both;
  }

  header.portfolio-bar .sx-bars {
    animation: sx-bars-hint 3.2s var(--sx-ease) 2.5s 1 both;
  }
}

@keyframes sx-logo-hint {
  0%, 100% { transform: none; opacity: 1; }
  25%, 70% { transform: rotate(90deg); opacity: 0; }
}

@keyframes sx-bars-hint {
  0%, 100% { transform: rotate(-90deg); opacity: 0; }
  25%, 70% { transform: none; opacity: 1; }
}

html.is-open header.portfolio-bar .sx-logo img {
  animation: none;
  transform: rotate(90deg);
  opacity: 0;
}

html.is-open header.portfolio-bar .sx-bars {
  animation: none;
  opacity: 1;
  transform: none;
}

html.is-open header.portfolio-bar .sx-bars i:nth-child(1) { transform: translateY(7px) rotate(45deg); }
html.is-open header.portfolio-bar .sx-bars i:nth-child(2) { opacity: 0; }
html.is-open header.portfolio-bar .sx-bars i:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

header.portfolio-bar a.sx-name {
  font-family: "Inter", "DM Sans", Arial, sans-serif;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--sx-snow);
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms var(--sx-ease);
}

header.portfolio-bar a.sx-name:hover {
  color: var(--sx-lemon);
}

@media (max-width: 700px) {
  header.portfolio-bar .sx-logo {
    width: 36px;
    height: 36px;
  }

  header.portfolio-bar .sx-brand {
    gap: 10px;
  }
}

/* ---------- pannello laterale, uguale a quello della home ---------- */

.sx-veil {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(0 0 0 / 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 420ms var(--sx-ease), visibility 0s linear 420ms;
}

.sx-menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 45;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: 130px 32px 32px;
  background: var(--sx-carbon);
  color: var(--sx-snow);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 420ms var(--sx-ease), visibility 0s linear 420ms;
}

@media (max-width: 700px) {
  .sx-menu {
    padding: 150px 20px 24px;
  }
}

html.is-open .sx-veil {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

html.is-open .sx-menu {
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}

.sx-menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sx-menu li + li {
  border-top: 1px solid rgb(255 251 254 / 0.16);
}

.sx-menu li {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 300ms var(--sx-ease), transform 420ms var(--sx-ease);
}

html.is-open .sx-menu li {
  opacity: 1;
  transform: none;
  transition-delay: calc(120ms + var(--i) * 40ms);
}

.sx-menu li a {
  display: block;
  padding: 28px 0;
  font-size: clamp(36px, 3.2vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--sx-snow);
  text-decoration: none;
  transition: color 160ms var(--sx-ease), transform 300ms var(--sx-ease);
}

.sx-menu li a:hover {
  color: var(--sx-lemon);
  transform: translateX(6px);
}

.sx-menu-foot {
  font-size: 13px;
}

.sx-menu-foot a {
  color: var(--sx-snow);
  text-decoration: none;
}

.sx-menu-foot a:hover {
  color: var(--sx-lemon);
}

.sx-menu :focus-visible,
.sx-end :focus-visible {
  outline: 2px solid var(--sx-snow);
  outline-offset: 4px;
}

/* ---------- striscia finale: prossimo progetto e contatti ---------- */

.sx-end {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  padding: 72px 4% calc(56px + env(safe-area-inset-bottom));
  background: var(--sx-carbon);
  color: var(--sx-snow);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
  text-align: left;
}

.sx-next {
  display: grid;
  gap: 18px;
  color: inherit;
  text-decoration: none;
}

.sx-label {
  font-size: 13px;
  opacity: 0.7;
}

.sx-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.sx-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: none;
}

.sx-icon img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.sx-icon--wide {
  width: auto;
}

.sx-icon--wide img {
  width: auto;
  height: 28px;
}

.sx-title {
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.02em;
  transition: color 160ms var(--sx-ease);
}

.sx-arrow {
  display: block;
  width: 36px;
  height: 36px;
  flex: none;
  transition: transform 300ms var(--sx-ease);
}

.sx-next:hover .sx-title,
.sx-next:focus-visible .sx-title {
  color: var(--sx-lemon);
}

.sx-next:hover .sx-arrow,
.sx-next:focus-visible .sx-arrow {
  transform: translateX(8px);
}

.sx-contact {
  display: grid;
  gap: 6px;
  justify-items: end;
  font-size: 14px;
}

.sx-contact a {
  padding: 6px 0;
  color: inherit;
  text-decoration: none;
  transition: color 160ms var(--sx-ease);
}

.sx-contact a:hover {
  color: var(--sx-lemon);
}

@media (max-width: 700px) {
  .sx-end {
    flex-direction: column;
    align-items: flex-start;
  }

  .sx-contact {
    justify-items: start;
  }

  .sx-row {
    gap: 16px;
  }

  .sx-icon {
    width: 48px;
    height: 48px;
  }

  /* la scritta Mico e' larga: sul telefono resta alla sua proporzione, non nel quadrato da 48 px */
  .sx-icon--wide {
    width: auto;
  }

  .sx-icon--wide img {
    height: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  header.portfolio-bar .sx-logo img,
  header.portfolio-bar .sx-bars {
    animation: none;
  }

  .sx-veil,
  .sx-menu,
  .sx-menu li,
  .sx-menu li a,
  .sx-arrow,
  header.portfolio-bar .sx-logo img,
  header.portfolio-bar .sx-bars,
  header.portfolio-bar .sx-bars i {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* ---------- Barra del progetto con il pannello aperto ----------
   Il pannello deve stare SOPRA la barra del progetto, come nella home: la barra diventa trasparente,
   cosi' si vede il pannello scuro che arriva fino in cima, con il logo-X e il nome sopra.
   Le voci della barra (Progetto, Processo, lingua...) spariscono finche' il pannello e' aperto. */
header.portfolio-bar {
  transition: background-color 300ms var(--sx-ease), border-color 300ms var(--sx-ease);
}

header.portfolio-bar nav,
header.portfolio-bar .portfolio-project {
  transition: opacity 220ms var(--sx-ease), visibility 0s linear 0s;
}

html.is-open header.portfolio-bar {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom-color: transparent;
}

html.is-open header.portfolio-bar nav,
html.is-open header.portfolio-bar .portfolio-project {
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms var(--sx-ease), visibility 0s linear 220ms;
}
