/* VARS */
:root {
  --scrollbar-width: 16px;
  --text-color: #333;
  --max-page-width: 1800px;
  --project-gutter: 64px;
}

/* Reset base */
body {
  margin: 0;
  font-family: "Helvetica", sans-serif;
  letter-spacing: 0px;
}

img {
  max-width: 100%;
  height: auto;
}

body.page-template-tpl-works main#primary {
  margin-top: 200px;
}

/* -------- TRANSIZIONI DI PAGINA PER BROWSERS MODERNI  --------------*/
@view-transition {
  navigation: auto;
}

/* 2. Definizione delle animazioni personalizzate */
@keyframes scivola-fuori {
  from {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1);
  }
  to {
    opacity: 0;
    filter: blur(10px);
    transform: scale(0.95);
  }
}

@keyframes scivola-dentro {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    filter: blur(0px);
    transform: translateY(0);
  }
}

/* 3. Applicazione del passaggio "Lento ed Evidente" */
::view-transition-old(root) {
  /* La vecchia pagina svanisce rimpicciolendosi leggermente */
  animation: 0.8s cubic-bezier(0.4, 0, 0.2, 1) both scivola-fuori;
}

::view-transition-new(root) {
  /* La nuova pagina appare dal basso con un leggero blur che si pulisce */
  animation: 0.8s cubic-bezier(0.4, 0, 0.2, 1) both scivola-dentro;
}
/* --------------- FINE TRANSIZIONI ------------------------ */

/* --------------- MENU ------------------------ */
/* Navbar fissa in alto */
.navbar {
  position: fixed;
  bottom: 0;
  top: initial;
  width: 100%;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
  z-index: 10;
  background-color: rgb(245, 245, 245);
}

header.navbar .menu-toggle {
  border: 1px solid #222;
  padding: 0.25em 0.75em;
}

@media (width >= 768px) {
  .navbar {
    top: 0;
    bottom: initial;
    background-color: transparent;
  }

  header.navbar .menu-toggle {
    border: 0;
    padding: 0;
  }
}

.logo {
  width: 400px;
}

.menu-toggle {
  cursor: pointer;
  font-size: 2rem;
  scale: 1;
  transition: scale 400ms ease-in-out;
}

.menu-toggle:hover {
  scale: 1.1;
  transition: scale 400ms ease-in-out;
}

@media (width <= 768px) {
  .logo {
    width: 200px;
  }
  .menu-toggle {
    font-size: 1.125rem;
  }
}

/* Overlay Menu a tutto schermo */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  z-index: 100;
  display: flex;
  flex-direction: column;

  /* Stato iniziale nascosto */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
}

/* Quando il menu è attivo */
.overlay.active {
  opacity: 1;
  visibility: visible;
}

.overlay-header {
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
}

.close-btn {
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
}

/* Link centrati */
.nav-links {
  list-style: none;
  padding: 0;
  margin: auto; /* Centra verticalmente e orizzontalmente nel flex container */
  text-align: center;
}

.nav-links li {
  margin: 20px 0;
}

.nav-links a {
  display: inline-block;
  text-decoration: none;
  color: black;
  font-size: 2rem;
  font-weight: 500;
  scale: 1;
  transition: scale 400ms ease-in-out;
}

.nav-links a:hover {
  color: black !important;
  font-weight: 500 !important;
  scale: 1.1;
  transition: scale 400ms ease-in-out;
}

/* ---------- GRIGLIA DEI PROGETTI ------------- */
/* Il contenitore */
section.articles {
  z-index: 1;
  position: relative;
  padding: 180px var(--project-gutter) 0;
}

section.articles figure {
  text-align: center;
  /* width: -moz-fit-content;
  width: fit-content; */
  /*width: calc (0.5 * (100vw - var(--scrollbar-width)) - 160px) !important;*/
  margin: 0 auto;
  position: relative;
  margin-bottom: 120px !important;
}

section.articles figure:nth-of-type(2n + 1) {
  float: left;
  clear: left;
}

section.articles figure:nth-of-type(2n) {
  float: right;
  clear: right;
}

section.articles figure:nth-of-type(4n + 3) {
  position: relative;
  left: -30px;
}

.articles figcaption {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.articles figure:hover figcaption {
  opacity: 1;
  transition: opacity 300ms linear;
  -webkit-transition: opacity 300ms linear;
  -moz-transition: opacity 300ms linear;
  -ms-transition: opacity 300ms linear;
  -o-transition: opacity 300ms linear;
}
.articles > figure figcaption a.default {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  font-style: normal !important;
  text-align: center !important;
  text-transform: none !important;
  text-decoration: none;
  color: var(--text-color) !important;
  font-weight: 400 !important;
  font-size: 24px;
  line-height: 30px;
  letter-spacing: 0.5px !important;
}

.articles > figure figcaption a.default.label_inv {
  color: #ffffff !important;
}

/* ------------------------------ */
/* 1. Reset e Contenitore */
figure.effect-zoom {
  position: relative;
  overflow: hidden; /* Fondamentale per non far uscire l'immagine dai bordi quando si ingrandisce */
  margin: 0;
  cursor: pointer;
}

/* 2. Gestione Immagine */
figure.effect-zoom a img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 1s cubic-bezier(0.21, 1, 0.4, 0.98);
}

/* Effetto Zoom al passaggio sul PADRE */
figure.effect-zoom:hover a img {
  transform: scale(1.05); /* Ingrandimento del 5% */
}

/* 3. Gestione Figcaption (Overlay) */
figure.effect-zoom figcaption {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Stato iniziale: invisibile */
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none; /* Permette al mouse di "attraversare" la caption se necessario */
}

/* Mostra la caption al passaggio sul PADRE */
figure.effect-zoom:hover figcaption {
  opacity: 1;
  pointer-events: auto; /* Riattiva i click sul link della caption quando visibile */
}

/* Stile del link interno alla caption */
figure.effect-zoom figcaption a.default {
  color: white;
  text-decoration: none;
  font-weight: bold;
  padding: 10px 20px;
  border: 1px solid white;
}
/* ------------------------------ */

/* Responsive */
@media (width >= 1024px) {
  section.articles {
    width: calc(100vw - var(--scrollbar-width));
    max-width: calc(var(--max-page-width) - var(--scrollbar-width) - (2 * var(--project-gutter)));
    /* padding-left: calc(max(var(--project-gutter), 0.5 * (100vw - var(--max-page-width) - var(--scrollbar-width))));
    padding-right: calc(max(var(--project-gutter), 0.5 * (100vw - var(--max-page-width) - var(--scrollbar-width)))); */
  }

  section.articles figure {
    margin-bottom: calc((100vw - var(--scrollbar-width)) / 6) !important;
    max-width: calc(50% - var(--project-gutter));
  }

  section.articles figure:nth-child(2) {
    margin-top: calc((100vw - var(--scrollbar-width)) / 8) !important;
  }

  section.articles figure figcaption a.default {
    font-size: 24px;
    line-height: 1.5em;
  }

  section.articles figure:nth-of-type(2n) {
    margin-top: calc((100vw - var(--scrollbar-width)) / 16);
  }
}

/* @media (max-width: 900px) {
  .articles figure {
    width: calc(50% - var(--project-gutter));
  }
} */

@media (max-width: 600px) {
  .articles figure {
    width: 100%;
  }
}

/* ------------------------------------------------------------ */
/* FILTRI ISOTOPE */
/* .filters-button-group {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: var(--project-gutter);
}

.filters-button-group button {
  border: none;
  background: none;
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
}

.filters-button-group button:hover {
  scale: 1.05;
  transition: scale 300ms ease;
}

.filters-button-group button.is-checked {
  text-decoration: underline;
} */

section.articles div.clearboth {
  clear: both;
}

.top-align p {
  margin-top: 0;
}

/* FOOTER */
footer#footer {
  margin: 3rem 0 7rem;
  border-top: 1px solid #555;
  padding: 1rem;
}

footer#footer .footer-content {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col {
  text-align: center;
}

section#media_image-2 img {
  width: 180px;
}

#footer-mail {
  text-decoration: none;
  font-size: 1.25rem;
}

@media (width >= 768px) {
  footer#footer {
    margin: 3rem 0 1rem;
  }
}

@media (width >= 1024px) {
  footer#footer .footer-content {
    flex-direction: row;
    justify-content: space-between;
    width: calc(16 * (100vw - var(--scrollbar-width)) / 16);
    margin-left: calc(50% - min(8 * (100vw - var(--scrollbar-width)) / 16, 900px));
    max-width: 1800px;
    padding: 2rem;
  }

  .footer-col {
    text-align: left;
  }

  section#media_image-2 img {
    width: auto;
  }

  #footer-mail {
    text-decoration: none;
    font-size: 1.8rem;
  }
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}
