/* --- IMPORTAZIONE FONT --- */
@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=Inter:wght@400&display=swap");

/* --- RESET E REGOLE BASE --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", sans-serif;
  background-color: rgb(250, 249, 247);
  color: rgb(31, 31, 31);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

::selection {
  background-color: #1f1f1f;
  color: #faf9f7;
}

/* --- MENU DI NAVIGAZIONE --- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px;
  background-color: rgba(250, 249, 247, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.brand {
  font-family: "Cormorant Garamond", serif;
  font-size: 3.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.nav-desktop {
  display: flex;
  gap: 40px;
  align-items: center;
}

.nav-link {
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0%;
  height: 1px;
  background-color: rgb(31, 31, 31);
  transition: width 250ms ease-in-out;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 8px;
  margin-right: -8px;
  position: relative;
  z-index: 110;
}

/* Le linee dell'hamburger (alcune pagine usano <span>, altre <div>) */
.nav-mobile-toggle > * {
  display: block;
  width: 26px;
  height: 1.5px;
  background-color: rgb(31, 31, 31);
  transition: transform 350ms ease, opacity 250ms ease;
}

.nav-mobile-toggle > *:not(:first-child) {
  margin-top: 7px;
}

/* Hamburger -> X quando il menu è aperto */
.navbar.menu-open .nav-mobile-toggle > :nth-child(1) {
  transform: translateY(8.5px) rotate(45deg);
}
.navbar.menu-open .nav-mobile-toggle > :nth-child(2) {
  opacity: 0;
}
.navbar.menu-open .nav-mobile-toggle > :nth-child(3) {
  transform: translateY(-8.5px) rotate(-45deg);
}

body.menu-open {
  overflow: hidden;
}

/* --- SEZIONE HERO (FOTO PRINCIPALE - HOME) --- */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 80px 60px;
}

.hero-image-wrapper {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 700ms ease-out forwards;
}

.hero-img {
  max-height: 80vh;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

/* --- ELEMENTI GLOBALI PAGINA PORTFOLIO --- */
/* Actors non ha padding sopra: senza margine il titolo finirebbe sotto la navbar */
#actors {
  scroll-margin-top: 140px;
}

.section-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 400;
  color: rgb(31, 31, 31);
  letter-spacing: -0.01em;
  padding: 0 5vw;
  max-width: 1400px;
  margin: 0 auto 60px;
}

.fade-in-element {
  opacity: 0;
  transform: translateY(40px); /* Spostamento morbido verso il basso */
  transition: opacity 800ms cubic-bezier(0.16, 1, 0.3, 1), transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--delay, 0ms);
}

.fade-in-element.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- GRIGLIA FOTO --- */
.gallery-section {
  padding-top: 120px;
  padding-bottom: 60px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 5vw;
}

.gallery-col-1 { padding-top: 0; } 
.gallery-col-2 { padding-top: 160px; } 
.gallery-col-3 { padding-top: 80px; }


.gallery-item {
  display: block;
  margin-bottom: 60px; 
  cursor: pointer;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 800ms cubic-bezier(0.16, 1, 0.3, 1), transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--delay, 0ms);
}

.gallery-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  margin-bottom: 16px; 
  transition: transform 400ms ease, opacity 400ms ease;
}

.gallery-item:hover img {
  transform: scale(1.02);
  opacity: 0.9;
}

/* Proporzioni originali delle foto */
.ar-3-4 { aspect-ratio: 3 / 4; }
.ar-3-2 { aspect-ratio: 3 / 2; }


.actor-name {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
}

/* --- FOOTER --- */
.footer {
  padding: 120px 40px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.footer p {
  font-size: 0.8rem;
  color: rgb(107, 107, 107);
  letter-spacing: 0.03em;
}


/* --- SEZIONE PUBLICATIONS & EXHIBITIONS --- */
.content-container {
  padding: 160px 5vw 0px;
  max-width: 1200px;
  margin: 0 auto;
}

.pub-heading {
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 400;
  color: rgb(31, 31, 31);
  margin-bottom: 80px;
  letter-spacing: -0.01em;
}


.publications-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;
}


.publication-item img {
  width: 100%;
  object-fit: cover;
  display: block;
  margin-bottom: 40px; /* Aumentato da 24px a 40px */
}

.pub-card img {
  width: 100%;
  object-fit: cover;
  display: block;
  margin-bottom: 24px;
}

.publication-text {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  color: rgb(107, 107, 107);
  line-height: 1.7;
  letter-spacing: 0.01em;
}

/* Classi di utilità per i margini inferiori */
.mb-40 { margin-bottom: 40px !important; }
.mb-60 { margin-bottom: 60px !important; }
.mb-140 { margin-bottom: 140px !important; }

/* --- SEZIONE ABOUT --- */
.about-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 80px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 160px 40px 0;
    align-items: start;
}

/* Immagine del ritratto */
.about-grid img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* Testo biografico */
.about-text {
    max-width: 600px;
    line-height: 1.8;
}

.about-text p {
    margin-bottom: 24px;
}

/* --- SEZIONE CONTACT --- */
.contact-container {
  padding: 160px 5vw 0;
  max-width: 600px;
  margin: 0 auto;
}

.contact-intro {
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 48px;
  letter-spacing: 0.01em;
}

.contact-block {
  margin-bottom: 48px;
}

.contact-label {
  font-size: 0.85rem;
  color: rgb(107, 107, 107);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

.contact-link {
  font-size: 0.95rem;
  color: rgb(31, 31, 31);
  border-bottom: 1px solid rgb(212, 212, 212);
  padding-bottom: 2px;
  transition: border-color 250ms ease;
}

.contact-link:hover {
  border-color: rgb(31, 31, 31);
}

.form-input {
  width: 100%;
  padding: 14px 0;
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  color: rgb(31, 31, 31);
  background-color: transparent;
  border: none;
  border-bottom: 1px solid rgb(212, 212, 212);
  outline: none;
  letter-spacing: 0.02em;
  transition: border-color 250ms ease;
  margin-bottom: 32px;
}

.form-input:focus {
  border-color: rgb(31, 31, 31);
}

.textarea-input {
  resize: none;
  margin-bottom: 40px;
}

.form-btn {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  color: rgb(31, 31, 31);
  background: transparent;
  border: 1px solid rgb(31, 31, 31);
  padding: 14px 40px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background-color 250ms ease, color 250ms ease;
}

.form-btn:hover {
  background-color: rgb(31, 31, 31);
  color: rgb(250, 249, 247);
}

/* --- ANIMAZIONI AL CARICAMENTO --- */
@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* --- RESPONSIVE (TABLET & MOBILE) --- */

/* Desktop stretto: menu più compatto per non andare a capo */
@media (max-width: 1100px) {
  .navbar {
    padding: 24px 32px;
  }
  .brand {
    font-size: 3rem;
  }
  .nav-desktop {
    gap: 28px;
  }
}

/* Tablet */
@media (max-width: 1024px) {
  .gallery-grid {
    gap: 16px;
  }
  .gallery-col-2 { padding-top: 120px; }
  .gallery-col-3 { padding-top: 60px; }
  .about-grid {
    grid-template-columns: 240px 1fr;
    gap: 48px;
  }
}

/* Da qui in giù il menu diventa un pannello a schermo intero (hamburger) */
@media (max-width: 900px) {
  .navbar {
    padding: 18px 24px;
  }
  .brand {
    font-size: 2.4rem;
    position: relative;
    z-index: 110;
  }
  .nav-mobile-toggle {
    display: block;
  }

  /* top/left/width/height espliciti: la navbar (con backdrop-filter)
     fa da contenitore per gli elementi fixed al suo interno */
  .nav-desktop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 22px;
    padding: 110px 24px 60px;
    background-color: rgb(250, 249, 247);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 350ms ease, visibility 350ms ease;
  }
  .navbar.menu-open .nav-desktop {
    opacity: 1;
    visibility: visible;
  }

  .nav-desktop > a,
  .nav-desktop > .nav-dropdown {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 450ms ease, transform 450ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .navbar.menu-open .nav-desktop > * {
    opacity: 1;
    transform: translateY(0);
  }
  .navbar.menu-open .nav-desktop > :nth-child(2) { transition-delay: 60ms; }
  .navbar.menu-open .nav-desktop > :nth-child(3) { transition-delay: 120ms; }
  .navbar.menu-open .nav-desktop > :nth-child(4) { transition-delay: 180ms; }

  .nav-desktop .nav-link {
    font-family: "Cormorant Garamond", serif;
    font-size: 2.1rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
  }
  .nav-link::after {
    bottom: 0;
  }

  .hero-section {
    padding: 100px 24px 40px;
  }
  .content-container,
  .contact-container {
    padding-top: 120px;
  }
  .about-grid {
    padding-top: 120px;
  }
}

/* Smartphone e tablet in verticale */
@media (max-width: 768px) {
  .hero-section {
    min-height: 0;
    padding: 96px 16px 24px;
  }
  .hero-img {
    max-height: 75vh;
    margin: 0 auto;
  }

  /* Galleria a 2 colonne (le foto vengono ridistribuite da js/main.js) */
  .gallery-section {
    padding-top: 40px;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 0 16px;
  }
  .gallery-col-1,
  .gallery-col-2,
  .gallery-col-3 {
    padding-top: 0;
  }
  .gallery-item {
    margin-bottom: 22px;
  }
  .gallery-item img {
    margin-bottom: 10px;
  }
  .actor-name {
    display: block;
    font-size: 1rem;
    line-height: 1.25;
  }
  .section-title {
    font-size: 1.75rem;
    padding: 0 16px;
    margin-bottom: 28px;
  }
  /* Spaziatura uniforme tra le sezioni (sovrascrive gli stili inline) */
  .portfolio-section {
    padding-top: 64px !important;
  }
  .portfolio-section:first-of-type {
    padding-top: 100px !important;
  }
  /* Le ancore portano il titolo appena sotto la navbar */
  .portfolio-section,
  #actors {
    scroll-margin-top: 32px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 110px 24px 0;
  }
  .about-grid img {
    max-width: 360px;
  }

  .content-container {
    padding: 110px 20px 0;
  }
  .pub-heading {
    font-size: 1.75rem;
    margin-bottom: 40px;
  }
  .publications-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 20px;
  }
  .pub-card p {
    font-size: 0.85rem;
    line-height: 1.6;
  }
  .mb-140 {
    margin-bottom: 80px !important;
  }

  .contact-container {
    padding: 110px 24px 0;
  }
  /* 16px evita lo zoom automatico di iOS sui campi del form */
  .form-input {
    font-size: 1rem;
  }

  .footer {
    padding: 72px 20px 32px;
  }
}

@media (max-width: 600px) {
  .navbar {
    padding: 16px 20px;
  }
  .brand {
    font-size: 2.1rem;
  }
  .nav-desktop {
    padding-left: 20px;
    padding-right: 20px;
  }
  .publications-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}
/* Make gallery images clickable */
.gallery-item img {
    cursor: zoom-in;
}


/* Fullscreen lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.96);

    opacity: 0;
    visibility: hidden;

    transition: opacity 0.35s ease, visibility 0.35s ease;

    padding: 40px;
}


/* Visible state */
.lightbox.active {
    opacity: 1;
    visibility: visible;
}


/* Enlarged photograph */
.lightbox-image {
    max-width: 95vw;
    max-height: 92vh;

    width: auto;
    height: auto;

    object-fit: contain;

    cursor: default;

    transform: scale(0.96);
    transition: transform 0.4s ease;
}


.lightbox.active .lightbox-image {
    transform: scale(1);
}


/* Close button */
.lightbox-close {
    position: absolute;
    top: 24px;
    right: 30px;

    border: none;
    background: none;

    color: white;

    font-family: Arial, sans-serif;
    font-size: 42px;
    font-weight: 200;

    line-height: 1;

    cursor: pointer;

    z-index: 10000;

    opacity: 0.8;

    transition: opacity 0.2s ease, transform 0.2s ease;
}


.lightbox-close:hover {
    opacity: 1;
    transform: scale(1.08);
}


/* Prevent scrolling while lightbox is open */
body.lightbox-open {
    overflow: hidden;
}


/* Mobile */
@media (max-width: 768px) {

    .lightbox {
        padding: 20px;
    }

    .lightbox-image {
        max-width: 94vw;
        max-height: 88vh;
    }

    .lightbox-close {
        top: 15px;
        right: 20px;
        font-size: 36px;
    }
}
/* =========================
   PORTFOLIO DROPDOWN
   ========================= */

.nav-dropdown {
    position: relative;
}

.portfolio-toggle {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 18px);
    left: 0;

    display: flex;
    flex-direction: column;
    gap: 10px;

    min-width: 130px;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);

    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease;
}

/* Desktop: appare passando col mouse */
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    color: inherit;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;

    transition: opacity 0.2s ease;
}

.dropdown-menu a:hover {
    opacity: 0.55;
}


/* Mobile: nel pannello a schermo intero le sottosezioni sono sempre visibili */
@media (max-width: 900px) {

    .navbar .nav-dropdown .dropdown-menu {
        position: static;

        padding-top: 12px;
        padding-left: 2px;

        gap: 10px;

        /* eredita la visibilità dal pannello del menu */
        opacity: 1;
        visibility: inherit;
        transform: none;
    }

    .navbar .dropdown-menu a {
        font-size: 0.85rem;
        letter-spacing: 0.04em;
        color: rgb(107, 107, 107);
    }
}