*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0a07;
  --bg-2: #131210;
  --bg-3: #1a1916;
  --text: #ddd5c4;
  --text-muted: #6e6858;
  --text-dim: #9a9080;
  --accent: #b8886a;
  --accent-2: #8da08f;
  --border: rgba(221, 213, 196, 0.07);
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Syne', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

/* GRAIN OVERLAY */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* TYPOGRAPHY */
h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(3.8rem, 10vw, 9.5rem);
  line-height: 0.93;
  letter-spacing: -0.02em;
}
h2 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2rem, 4.5vw, 4rem);
  line-height: 1.1;
}
h3 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  line-height: 1.1;
}

.label {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

p {
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  font-weight: 300;
  line-height: 1.85;
  color: var(--text-dim);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.3s ease, color 0.3s ease;
}
a:hover { opacity: 0.65; }

strong { font-weight: 500; color: var(--text); }

/* NAVIGATION */
nav.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1.4rem 4vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.6s ease, border-color 0.6s ease;
  border-bottom: 1px solid transparent;
}

nav.site-nav.scrolled {
  background: rgba(11, 10, 7, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--border);
}

.nav-name {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.3s;
}
.nav-name:hover { opacity: 1; }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}

.nav-links li {
  display: flex;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease;
}
.nav-links a:hover { color: var(--text); opacity: 1; }
.nav-links a.active { color: var(--accent); }

/* SECTIONS / PAGE */
section, .page {
  padding: 10rem 4vw 8rem;
}

.section-inner, .page-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.section-header, .page-header {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  margin-bottom: 5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* BREADCRUMB */
.breadcrumb {
  font-family: var(--font-sans);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3rem;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--accent);
  opacity: 1;
}

.breadcrumb .sep {
  margin: 0 0.6rem;
  opacity: 0.4;
}

/* HOME */
#home, .home-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 8rem;
  padding-top: 8rem;
  position: relative;
}

.home-inner {
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

.home-title-wrap { margin-bottom: 5rem; }

.home-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5rem;
  align-items: start;
}

.home-bio p {
  font-size: clamp(1rem, 1.5vw, 1.08rem);
  color: var(--text-dim);
  max-width: 58ch;
}

.home-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  color: var(--text-muted);
  font-weight: 300;
  max-width: 26ch;
  line-height: 1.7;
  text-align: right;
  padding-top: 0.2rem;
}

/* HOME — link macro sezioni */
.home-sections {
  margin-top: 6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
}

.home-section-link {
  display: block;
  padding: 2.5rem 1.5rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.4s ease;
  position: relative;
}

.home-section-link:last-child { border-right: none; }
.home-section-link:hover {
  background: var(--bg-2);
  opacity: 1;
}

.hsl-number {
  font-family: var(--font-sans);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.hsl-title {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  color: var(--text);
  line-height: 1.1;
  transition: color 0.3s;
}

.home-section-link:hover .hsl-title {
  color: var(--accent);
}

.hsl-arrow {
  font-family: var(--font-serif);
  margin-left: 0.3rem;
  display: inline-block;
  transition: transform 0.3s;
  color: var(--accent);
}

.home-section-link:hover .hsl-arrow {
  transform: translateX(4px);
}

.scroll-indicator {
  position: absolute;
  bottom: 3rem;
  right: 4vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  opacity: 0.25;
}

.scroll-indicator .si-label {
  font-family: var(--font-sans);
  font-size: 0.5rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  color: var(--text);
}

/* LIST DI INDICE (pagine sezione) */
.index-list { list-style: none; display: flex; flex-direction: column; }

.index-item {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  gap: 2rem;
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
  transition: opacity 0.3s;
  text-decoration: none;
}

.index-item:hover {
  opacity: 1;
}

.index-item:hover .index-title {
  color: var(--accent);
}

.index-item:first-child { padding-top: 1rem; }

.index-number {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

.index-title {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--text);
  transition: color 0.4s ease;
}

.index-meta {
  font-family: var(--font-sans);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.index-meta .im-type { color: var(--accent-2); }

/* SINGOLA PAGINA PROGETTO / LAB */
.project-hero {
  margin-bottom: 4rem;
}

.project-hero .label {
  display: block;
  margin-bottom: 1rem;
}

.project-hero h1 {
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 0.95;
  margin-bottom: 1.5rem;
}

.project-hero .subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  color: var(--text-dim);
  font-weight: 300;
  max-width: 60ch;
}

.project-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem 3rem;
  margin: 3rem 0 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.meta-item .meta-key {
  font-family: var(--font-sans);
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.meta-item .meta-value {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
}

.project-body {
  max-width: 68ch;
  margin: 0 auto 5rem;
}

.project-body p {
  margin-bottom: 1.4rem;
  font-size: clamp(1.05rem, 1.6vw, 1.15rem);
  line-height: 1.95;
}

.project-body p.lead {
  font-size: clamp(1.15rem, 1.9vw, 1.35rem);
  font-style: italic;
  color: var(--text);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.project-body h3 {
  font-size: 1.8rem;
  color: var(--text);
  margin: 3rem 0 1rem;
}

.project-body blockquote {
  margin: 2.5rem 0;
  padding-left: 2rem;
  border-left: 1px solid var(--accent);
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 2;
  max-width: 50ch;
}

/* SUBPROJECT (per Frottage) */
.subproject-block {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.subproject-block h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin-bottom: 0.5rem;
}

.subproject-block .sub-meta {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 2rem;
}

/* IMAGE GALLERY (griglia) */
.project-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
  margin-top: 3rem;
}

.project-gallery.layout-wide {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

@media (max-width: 480px) {
  .project-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

.gallery-img {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--bg-3);
  cursor: zoom-in;
}

.gallery-img.wide {
  aspect-ratio: 4 / 3;
}

.gallery-img img,
.gallery-img video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(15%) brightness(0.8);
  transition: filter 0.6s ease, transform 0.7s ease;
  display: block;
}

.gallery-img:hover img,
.gallery-img:hover video {
  filter: grayscale(0%) brightness(0.95);
  transform: scale(1.04);
}

.gallery-img.is-video::after {
  content: '▶';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(11, 10, 7, 0.75);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: background 0.3s, transform 0.3s;
}

.gallery-img.is-video:hover::after {
  background: var(--accent);
  transform: translate(-50%, -50%) scale(1.1);
}

/* PHOTO CREDITS */
.photo-credits {
  margin-top: 1.2rem;
  font-family: var(--font-sans);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.8;
}

.photo-credits .pc-label {
  color: var(--accent);
  margin-right: 0.6rem;
  font-weight: 500;
}

/* LIGHTBOX */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  cursor: zoom-out;
}

.lightbox.open { display: flex; }

.lightbox-content {
  max-width: 100%;
  max-height: 100%;
  position: relative;
  cursor: default;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, border-color 0.3s;
  z-index: 9999;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--accent);
  color: var(--accent);
}

.lightbox-close { top: 2vh; right: 2vw; font-size: 1.4rem; }
.lightbox-nav.prev { left: 2vw; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 2vw; top: 50%; transform: translateY(-50%); }
.lightbox-counter {
  position: fixed;
  bottom: 2vh;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.6);
  z-index: 9999;
}

body.lb-open { overflow: hidden; }

/* VIDEO BLOCK (per Carne Espansa) */
.lab-video {
  margin: 3rem 0;
  width: 100%;
  background: #000;
  border: 1px solid var(--border);
}

.lab-video video {
  width: 100%;
  height: auto;
  display: block;
}

/* CONTATTI */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 3rem;
}

.contact-label {
  display: block;
  margin-bottom: 0.8rem;
}

.contact-value {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 300;
  color: var(--text);
  transition: color 0.3s;
}

.contact-value:hover { color: var(--accent); opacity: 1; }

/* PLACEHOLDER */
.placeholder-block {
  display: inline-flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 2.5rem 3rem;
  border: 1px solid var(--border);
}

.placeholder-block .ph-text {
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* PUBBLICAZIONI ACCADEMIA */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 2.5rem 0;
}

.pub-item {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.pub-item:last-child {
  border-bottom: 1px solid var(--border);
}

.pub-status {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.pub-title {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  font-weight: 400;
  color: var(--text);
  line-height: 1.4;
  max-width: 72ch;
  margin-bottom: 0.6rem;
}

.pub-keywords {
  font-family: var(--font-sans);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  max-width: 72ch;
  margin-bottom: 1.2rem;
}

.pub-abstract {
  font-size: clamp(0.85rem, 1.3vw, 0.95rem);
  font-weight: 300;
  line-height: 1.8;
  color: var(--text-dim);
  max-width: 72ch;
  margin-bottom: 1rem;
}

.pub-doi {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--accent);
}

/* FOOTER */
.footer-bottom {
  margin-top: 7rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
}

/* BACK LINK (in fondo alle pagine) */
.back-link {
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: inline-block;
}

.back-link a {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link a:hover { color: var(--accent); opacity: 1; }

/* REVEAL ANIMATIONS */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.22s; }
.reveal-d3 { transition-delay: 0.38s; }

/* HOME ENTRANCE */
.entrance {
  opacity: 0;
  transform: translateY(28px);
  animation: fadeUp 1.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.ed1 { animation-delay: 0.2s; }
.ed2 { animation-delay: 0.55s; }
.ed3 { animation-delay: 0.85s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ——— HAMBURGER MENU ——— */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 200;
}
.nav-hamburger span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--text);
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(11, 10, 7, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
}
.nav-mobile-overlay.open { display: flex; }
.nav-mobile-overlay a {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s ease;
}
.nav-mobile-overlay a:hover { color: var(--text); }
.nav-mobile-overlay a.active { color: var(--accent); }
.nav-mobile-overlay .mobile-lang {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
}

/* MOBILE */
@media (max-width: 768px) {
  .nav-hamburger { display: flex; }
  .nav-links { display: none; }
  .project-meta-grid { grid-template-columns: repeat(2, 1fr) !important; }
  section, .page { padding: 7rem 6vw 5rem; }
  .home-meta {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .home-tagline { text-align: left; }
  .home-sections {
    grid-template-columns: 1fr 1fr;
  }
  .home-section-link {
    border-right: 1px solid var(--border);
  }
  .home-section-link:nth-child(2n) { border-right: none; }
  .index-item {
    grid-template-columns: 2.5rem 1fr;
    gap: 1rem;
  }
  .index-meta {
    grid-column: 2;
    text-align: left;
    margin-top: 0.6rem;
  }
}

@media (max-width: 480px) {
  .nav-links li:nth-child(3), .nav-links li:nth-child(4) { display: none; }
  .project-meta-grid { grid-template-columns: 1fr !important; }
  section, .page { padding: 6rem 5vw 4rem; }
  .home-sections { grid-template-columns: 1fr; }
  .home-section-link, .home-section-link:nth-child(2n) {
    border-right: none;
  }
}

/* ——— LANGUAGE SWITCHER ——— */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.lang-sep {
  color: var(--text-muted);
  font-size: 0.55rem;
  opacity: 0.5;
  user-select: none;
}
.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  transition: color 0.3s ease;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { color: var(--text); }
