﻿@font-face {
  font-family: "Castoro Titling";
  src: url("fonts/CastoroTitling.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Helvetica";
  src: url("fonts/Helvetica.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Helvetica";
  src: url("fonts/Helvetica-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fff;
  --fg: #000;
  --font-title: "Castoro Titling", serif;
  --font-body: "Helvetica", Arial, sans-serif;
  --gutter: 12px;
  --pad: 24px;
  --fs: .75rem;
  --bar-h: 56px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (min-width: 768px) { :root { --pad: 48px; --fs: .875rem; } }

* { box-sizing: border-box; margin: 0; padding: 0; border-radius: 0; }

html { scrollbar-gutter: stable; }
html.lb-lock { overflow: hidden; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs);
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
img {
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}
a, button, img { -webkit-tap-highlight-color: transparent; }
:focus, :focus-visible { outline: none; }
::selection { background: var(--fg); color: var(--bg); }

/* ---------- Hero ---------- */

.hero {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 var(--pad);
  text-align: left;
  z-index: 0;
  background: var(--bg) url("img/hero/bg.webp") 50% center / cover no-repeat;
  /* layer composito dedicato: l'opacità non ridisegna le ombre sfocate del testo */
  will-change: opacity;
  transform: translateZ(0);
  contain: strict;
}
.hero-text {
  max-width: 100%;
  text-shadow:
    0 0 20px #fff,
    0 0 40px #fff,
    0 0 70px #fff,
    0 0 110px #fff,
    0 0 160px #fff;
}
.hero h1 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(2.25rem, 11vw, 7.5rem);
  line-height: .85;
  text-transform: uppercase;
}
.subtitle {
  margin-top: 1rem;
  font-size: var(--fs);
  text-transform: uppercase;
}
.subtitle em { font-style: normal; font-weight: 700; }
.hero-spacer { height: 85vh; height: 85svh; }

@media (min-width: 768px) {
  .hero { padding: 0 var(--pad); }
  .hero h1 { font-size: clamp(3rem, 5.5vw, 6rem); }
}

/* ---------- Griglia ---------- */

main { position: relative; z-index: 1; }

.grid {
  column-count: 2;
  column-gap: var(--gutter);
  padding: 0 var(--pad) 96px;
}
@media (min-width: 768px)  { .grid { column-count: 3; column-gap: 20px; padding: 0 var(--pad) 120px; } }
@media (min-width: 1400px) { .grid { column-count: 4; } }

.item {
  display: block;
  break-inside: avoid;
  margin-bottom: var(--gutter);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
@media (min-width: 768px) { .item { margin-bottom: 20px; } }
.item.in { opacity: 1; transform: none; }
.item.is-hidden { display: none; }
.item.is-source { visibility: hidden; }
.item img { width: 100%; height: auto; background: #f2f2f2; }

/* ---------- Filtri ---------- */

.filters {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px var(--pad);
  background: var(--bg);
  transform: translateY(100%);
  transition: transform .5s var(--ease);
}
.filters.show { transform: none; }
/* con il lightbox aperto i filtri escono come sono entrati, e rientrano alla chiusura */
html.lb-open .filters { transform: translateY(100%); }
.filters button {
  font-size: var(--fs);
  padding: 2px 0;
  opacity: .45;
  background: linear-gradient(var(--fg), var(--fg)) 0 100% / 0 1px no-repeat;
  transition: opacity .3s var(--ease), background-size .45s var(--ease), transform .2s var(--ease);
}
.filters button { white-space: nowrap; flex: none; }
/* mobile: filtri su una riga, allineati a sinistra, scorrimento orizzontale, testi mai troncati */
@media (max-width: 767px) {
  .filters {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
}
.filters button:hover { opacity: 1; background-size: 100% 1px; }
.filters button:active { transform: scale(.94); }
.filters button[aria-pressed="true"] { opacity: 1; background-size: 100% 1px; }

/* ---------- Biografia / Credits ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  padding: 20px var(--pad);
  pointer-events: none;
  mix-blend-mode: difference;
}
.topbar button {
  pointer-events: auto;
  font-size: var(--fs);
  padding: 2px 0;
  color: #fff;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .45s var(--ease), transform .2s var(--ease);
}
.topbar button:hover { background-size: 100% 1px; }
.topbar button:active { transform: scale(.94); }

.panel {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s var(--ease), visibility 0s .45s;
}
.panel.open { opacity: 1; visibility: visible; transition-delay: 0s; }
.panel-close {
  position: fixed;
  top: 12px; right: calc(var(--pad) - 8px);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.panel-close svg {
  width: 20px; height: 20px;
  fill: none; stroke: var(--fg); stroke-width: 1.25;
}
.panel-body { padding: calc(var(--bar-h) + 8px) var(--pad) 120px; max-width: 64rem; }
.panel-body h2 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(1.75rem, 6vw, 3.75rem);
  line-height: .85;
  text-transform: uppercase;
  margin-bottom: 40px;
}
.credits { display: grid; gap: 24px; }
.credit { display: flex; align-items: center; gap: 16px; text-transform: uppercase; line-height: 1.2; }
.credit img { height: 40px; width: auto; max-width: 50%; object-fit: contain; }
@media (min-width: 768px) {
  .credits { gap: 32px; }
  .credit { gap: 24px; }
  .credit img { height: 44px; }
}
.credit img[hidden] { display: none; }
.credits-note { margin-top: 16px; font-size: .7rem; line-height: 1.4; opacity: .55; max-width: 32rem; }
.credit a { color: inherit; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; }

.panel-wide { overflow-x: hidden; }
.panel-wide .panel-body { max-width: none; padding-bottom: 48px; }

/* testo e box immagine alternati; la parallasse avviene dentro il box, ad altezza fissa */
.bio { display: grid; gap: 40px; }
.bio-row { display: grid; gap: 40px; }
.bio-row p { line-height: 1.5; max-width: 38rem; }
.bio-fig { position: relative; overflow: hidden; height: 40vh; background: #f2f2f2; }
.bio-fig img {
  position: absolute;
  left: 0; top: -30%;
  width: 100%; height: 160%;
  object-fit: cover;
  will-change: transform;
}
@media (min-width: 768px) {
  .bio { gap: 120px; }
  .bio-row { grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
  .bio-row p { max-width: none; padding-right: 8%; }
  .bio-fig { height: 70vh; }
  .bio-row:nth-child(even) p { order: 2; padding: 0 0 0 8%; }
  .bio-row:nth-child(even) .bio-fig { order: 1; }
}

/* ---------- Testimonianze ---------- */

.voci { list-style: none; border-top: 1px solid var(--fg); }
.voci li { border-bottom: 1px solid rgba(0, 0, 0, .2); }
.voci button {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 20px 0;
  text-align: left;
  transition: opacity .3s var(--ease);
}
.voci button:hover { opacity: .55; }
.voce-data { font-variant-numeric: tabular-nums; opacity: .55; }
.voce-nome { font-weight: 700; text-transform: uppercase; }
.voce-sub { line-height: 1.4; }
@media (min-width: 768px) {
  .voci button { grid-template-columns: 10rem 1fr 1fr; gap: 24px; align-items: baseline; }
}

#voci-indice[hidden], #voci-lettura[hidden] { display: none !important; }
.voci-back { margin-bottom: 40px; padding: 2px 0; opacity: .55; transition: opacity .3s var(--ease); }
.voci-back:hover { opacity: 1; }
#voci-lettura h2 { margin-bottom: 16px; }
.voce-firma { text-transform: uppercase; margin-bottom: 40px; line-height: 1.4; }
.voce-firma strong { font-weight: 700; }
.voce-testo { max-width: 38rem; display: grid; gap: 1.1em; line-height: 1.5; }
/* desktop: titolo e firma a sinistra, testo a destra, come nella biografia */
@media (min-width: 768px) {
  #voci-lettura {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "back back" "titolo testo" "firma testo" ". testo";
    grid-template-rows: auto auto auto 1fr;
    column-gap: 48px;
  }
  .voci-back { grid-area: back; justify-self: start; }
  #voci-lettura h2 { grid-area: titolo; align-self: start; padding-right: 8%; }
  .voce-firma { grid-area: firma; margin-bottom: 0; }
  .voce-testo { grid-area: testo; max-width: 42rem; }
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden;
}
.lightbox.open { visibility: visible; }

.lb-bg {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  transition: opacity .5s var(--ease);
}
.lightbox.open .lb-bg { opacity: 1; }

.lb-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bar-h);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  background: var(--bg);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.lightbox.open .lb-bar { opacity: 1; }
.lb-nav { margin-left: -8px; display: flex; align-items: center; gap: 4px; font-size: var(--fs); line-height: 1; }
#lb-count { min-width: 4.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.lb-bar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}
.lb-bar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.25;
  stroke-linecap: butt;
  stroke-linejoin: miter;
}
#lb-close { margin-right: -8px; }
@media (min-width: 768px) { .lb-bar { padding: 0 var(--pad); } }

.lb-stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--bar-h) + 8px) var(--pad) 0;
}
@media (min-width: 768px) { .lb-stage { padding-left: var(--pad); padding-right: var(--pad); } }
.lb-img { flex: none; will-change: transform; }

.lb-info {
  position: relative;
  padding: 24px var(--pad) 120px;
  opacity: 0;
  transition: opacity .5s var(--ease) .15s;
}
.lightbox.open .lb-info { opacity: 1; }
.lb-info h2 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(1.75rem, 6vw, 3.75rem);
  line-height: .85;
  text-transform: uppercase;
  margin-bottom: 32px;
}
.lb-details { display: grid; gap: 24px; }
.lb-details dl { display: grid; gap: 6px; }
.lb-info h2:empty { display: none; }
.lb-details dl div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 12px; }
.lb-details dt { font-weight: 700; }
.lb-details p { max-width: 38rem; }
.lb-details p:empty, .lb-details dl:empty { display: none; }
@media (min-width: 768px) {
  .lb-info { padding: 24px var(--pad) 160px; }
  .lb-details { grid-template-columns: 1fr 1fr; gap: 48px; }
}

.lb-stage { transition: opacity .45s var(--ease); }
.lightbox.swap .lb-stage,
.lightbox.swap .lb-info { opacity: 0; transition: opacity .2s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .item, .filters, .filters button, .lb-bg, .lb-bar, .lb-info { transition-duration: .01s; }
  .item { transform: none; }
}

