/* Satoshi in grassetto; nero del catalogo e arancione #ff7a00 come unico accento.
   La pagina passa da chiaro a scuro e torna chiara: il tema lo decide la sezione visibile (data-theme). */
/* Satoshi ospitato sul sito: la politica di sicurezza del CMS accetta solo font da qui */
@font-face { font-family: "Satoshi"; src: url("fonts/satoshi-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url("fonts/satoshi-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
:root {
  --light-bg: #f4f3f0;
  --light-ink: #161414;
  --dark-bg: #0f0f0f;
  --dark-ink: #f2f0ed;
  --bg: var(--light-bg);
  --ink: var(--light-ink);
  --muted: color-mix(in srgb, var(--ink) 55%, var(--bg));
  --line: color-mix(in srgb, var(--ink) 12%, transparent);
  --accent: #ff7a00;
  --btn-hover: #FA7700;
  --font: "Satoshi", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
html[data-theme="dark"] { --bg: var(--dark-bg); --ink: var(--dark-ink); }

* { box-sizing: border-box; margin: 0; }
/* niente scorrimento orizzontale: le foto ingrandite dalle animazioni non devono allargare la pagina
   (hidden come riserva per i browser che non supportano clip, es. Safari iOS meno recente) */
html, body { overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
html { scroll-padding-top: 72px; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 500 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color .8s var(--ease), color .8s var(--ease);
}
img { display: block; width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
em { font-style: italic; }
h1, h2 { font-weight: 700; letter-spacing: -0.04em; line-height: 1; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* Loader */
.loader {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; align-content: center; gap: 28px;
  background: var(--dark-bg); color: var(--dark-ink);
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
}
.loader-title { font-weight: 700; font-size: clamp(20px, 2.4vw, 32px); letter-spacing: -0.03em; }
/* Data nel loader: ogni cifra è un rullo che gira e si ferma sul numero giusto */
.loader-date {
  display: flex; font-weight: 500; letter-spacing: -0.04em; line-height: 1;
  font-size: clamp(56px, 12vw, 200px); font-variant-numeric: tabular-nums;
}
.reel { display: block; height: 1em; overflow: hidden; }
.reel-in { display: block; }
.reel-in span { display: block; height: 1em; text-align: center; }
/* punto separatore: un piccolo cerchio arancione sulla linea di base */
.loader-date .sep { width: .07em; height: .07em; border-radius: 50%; background: var(--accent); align-self: flex-end; margin: 0 .07em .11em; }
.no-motion .loader { display: none; }
/* Schermata di attesa (Impostazioni · Messa online): testo libero, che va a capo tra le parole e non esce mai dallo schermo */
.loader-attesa { padding: 0 var(--gutter); text-align: center; }
.loader-attesa .loader-date {
  flex-wrap: wrap; justify-content: center; column-gap: .28em; row-gap: .12em;
  font-size: min(clamp(56px, 12vw, 200px), calc(146vw / var(--misura, 10)), 22vh);
}
.loader-attesa .parola { display: flex; }
.loader-attesa .testo { white-space: pre; }

/* Lettere che compaiono dietro un blocco colorato */
.wrd { display: inline-block; white-space: nowrap; }
.ch { display: inline-block; }

/* Nav: sempre leggibile sopra qualsiasi sfondo */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  height: 76px; padding: 12px var(--gutter) 0;
  /* colori pieni: nero sulle parti chiare, bianco su quelle scure (tema della pagina o foto a tutto schermo) */
  --nav-ink: var(--ink); --nav-bg: var(--bg);
  color: var(--nav-ink); transition: color .4s;
  font-size: 14px; font-weight: 700;
}
.nav-title { font-size: clamp(20px, 1.8vw, 26px); letter-spacing: -0.03em; line-height: 1; }

.label, .tag { color: var(--muted); font-size: 13px; font-weight: 500; }
.tag { display: inline-block; margin-right: 1.5em; vertical-align: .35em; color: inherit; opacity: .7; }

/* Hero */
.hero-stage, .join-stage {
  position: relative; height: 100dvh; overflow: hidden;
  display: grid; place-items: center;
}
.hero-card, .join-card {
  position: absolute; inset: 0;
  clip-path: polygon(41% 30%, 59% 30%, 59% 70%, 41% 70%);
}
.hero-card img, .join-card img { width: 100%; height: 100%; object-fit: cover; }
.hero-card::after, .join-card::after {
  content: ""; position: absolute; inset: 0; background: #0f0f0f; opacity: var(--dim, 0);
}
.hero-words, .join-words {
  position: relative; z-index: 1; width: 100%;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 var(--gutter);
  font-weight: 700; letter-spacing: -0.04em; line-height: 1;
  font-size: clamp(30px, 4.6vw, 76px);
}
.hero-words .w-r, .join-words .w-r { text-align: right; }
.hero-words { display: grid; grid-template-columns: 1fr 21vw 1fr; font-size: clamp(28px, 4vw, 64px); }
.hero-words .w-l { text-align: right; }
.hero-words .w-r { grid-column: 3; text-align: left; }
@media (max-width: 768px) { .hero-words { display: flex; } .hero-words .w-l { text-align: center; } }
.hero-intro {
  position: absolute; z-index: 2; left: 50%; top: 100%;
  width: min(620px, calc(100% - 2 * var(--gutter)));
  color: var(--dark-ink);
  font-size: clamp(20px, 1.9vw, 28px); line-height: 1.25; font-weight: 700; letter-spacing: -0.02em;
}
.intro-p + .intro-p { margin-top: 1.4em; }

/* Neruda */
.join-card { clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%); }
/* fondo scuro: su telefono la foto non riempie tutto lo schermo e sotto non deve vedersi la hero */
.join { background: var(--dark-bg); }
.join-words { color: var(--dark-ink); justify-content: center; gap: 24vw; }
.poem { padding: clamp(80px, 12vw, 160px) var(--gutter); max-width: 1100px; margin-left: 12vw; }
blockquote { margin-top: 24px; font-weight: 700; font-size: clamp(30px, 4.4vw, 68px); line-height: 1.05; letter-spacing: -0.04em; }
blockquote p + p { margin-top: .25em; }
.accent { color: var(--accent); }
.poem-note { margin-top: 64px; max-width: 30ch; font-size: clamp(20px, 1.9vw, 28px); line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
details { margin-top: 56px; max-width: 560px; }
summary { cursor: pointer; color: var(--muted); font-size: 15px; list-style: none; }
summary::before { content: "+ "; }
details[open] summary::before { content: "− "; }
summary:hover { color: var(--accent); }
.poem-full { padding-top: 32px; font-weight: 500; }
.poem-full p + p { margin-top: 1.2em; }

/* Capitoli: schede a sinistra, fotografie del capitolo scelto a destra */
/* sempre scura, anche mentre la chiusura chiara le sale sopra */
.index { background: var(--dark-bg); color: var(--dark-ink); --bg: var(--dark-bg); --ink: var(--dark-ink); }
.index-stage {
  min-height: 100dvh; display: grid; grid-template-columns: 0.9fr 1.1fr; align-items: center;
  gap: var(--gutter); padding: 120px var(--gutter) var(--gutter); position: relative;
}
.index-list { list-style: none; padding: 0; }
.index-list button {
  font: 700 clamp(26px, 3.4vw, 60px)/1.1 var(--font); letter-spacing: -0.04em; text-align: left; white-space: nowrap;
  color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer;
  opacity: .2; transition: opacity 1.1s ease, color .3s;
}
/* !important: con lo scroll attivo GSAP scrive l'opacità inline */
.index-list button:hover { opacity: 1 !important; color: var(--btn-hover); }
.index-list button[aria-selected="true"] { opacity: 1; }
.index-list button[aria-selected="true"]::after { content: "."; color: var(--accent); }

/* con lo scroll attivo la dissolvenza la guida GSAP: niente transizioni CSS che la rallenterebbero */
.scrubbed .panel, .scrubbed .panel.on, .scrubbed .index-list button { transition: none; }
/* i tre capitoli stanno uno sopra l'altro nella stessa cella: si passa dall'uno all'altro in dissolvenza incrociata */
.panel {
  grid-column: 2; grid-row: 1; display: grid; gap: 20px;
  opacity: 0; visibility: hidden; transform: scale(1.02);
  transition: opacity 1.2s ease, transform 1.6s var(--ease), visibility 0s 1.2s;
}
.panel.on { opacity: 1; visibility: visible; transform: none; transition: opacity 1.2s ease, transform 1.6s var(--ease); }
.panel-main { position: relative; width: 100%; max-width: calc(60dvh * 3 / 2); aspect-ratio: 3 / 2; }
.panel-main .ph {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden; transition: opacity 1.4s ease, visibility 0s 1.4s;
}
.panel-main .ph.on { opacity: 1; visibility: visible; z-index: 1; transition: opacity 1.4s ease; }
.panel-main img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 768px) {
  .index-stage { grid-template-columns: 1fr; align-items: start; align-content: start; row-gap: 24px; padding-top: 72px; }
  .panel { grid-column: 1; grid-row: 2; }
  .index-list button { font-size: clamp(24px, 7.8vw, 36px); }
}
@media (prefers-reduced-motion: reduce) {
  .panel, .panel.on, .panel-main .ph, .index-list button { transition: none; }
}

/* Sovrapposizioni come nel catalogo */
.ov { position: relative; overflow: hidden; }
.ov-stage { height: 100dvh; display: grid; place-items: center; }
.ov-base, .ov-top { grid-area: 1 / 1; display: flex; }
.ov-base { width: 100%; height: 46dvh; }
.ov-base img { flex: 1; min-width: 0; height: 100%; object-fit: cover; }
.ov-top { height: 62dvh; z-index: 1; box-shadow: 0 12px 32px rgba(0, 0, 0, .12); }
.ov-top img { height: 100%; width: auto; }
@media (max-width: 768px) {
  .ov-stage { height: 56dvh; }
  .ov-base { height: 30dvh; }
  .ov-top { height: auto; width: 82vw; }
  .ov-top img { width: 50%; height: auto; }
}

/* Foto cliccabili */
.ph { cursor: zoom-in; overflow: hidden; }

/* Chiusura */
.outro {
  position: relative; z-index: 2; padding: clamp(120px, 16vw, 220px) 0 8px;
  /* sempre chiara: sale sopra i capitoli scuri senza cambiare colore a metà */
  background: var(--light-bg); color: var(--light-ink); --bg: var(--light-bg); --ink: var(--light-ink);
}
/* la chiusura parte sovrapposta all'ultimo schermo dei capitoli e li copre salendo */
.motion .outro { margin-top: -100vh; }
/* la sezione di Neruda parte sovrapposta all'ultimo schermo della hero e la copre salendo */
.motion .join { position: relative; z-index: 2; margin-top: -100vh; }
.outro-p {
  padding: 0 var(--gutter); max-width: 24ch; margin-left: 12vw;
  font-size: clamp(26px, 3.2vw, 48px); line-height: 1.1; font-weight: 700; letter-spacing: -0.03em;
}
.fill { display: grid; gap: 8px; padding: 0 8px; margin-top: clamp(160px, 20vw, 300px); }
.fill .ph { overflow: hidden; }
.fill img { width: 100%; height: 100%; object-fit: cover; }
.fill-wide { height: 64vh; }
.fill-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fill-pair .ph { height: 56vh; }

/* Footer scuro: il contenuto sale da sotto la sezione precedente (vedi main.js) */
.foot {
  position: relative; overflow: hidden; background: var(--dark-bg); color: var(--dark-ink);
  /* il modulo nel footer usa sempre i colori scuri, qualunque sia il tema della pagina */
  --bg: var(--dark-bg); --ink: var(--dark-ink); --muted: color-mix(in srgb, var(--dark-ink) 55%, var(--dark-bg));
}
.foot-top {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); align-items: start;
  padding: 0 var(--gutter);
}
.foot-book { padding-top: .4em; }
.foot-name { font-weight: 700; font-size: clamp(40px, 4.6vw, 76px); letter-spacing: -0.04em; line-height: 1; }
.foot-inner { padding: clamp(96px, 11vw, 160px) 0 32px; }
.marquee { display: block; overflow: hidden; margin-top: clamp(40px, 5vw, 72px); }
.marquee-track {
  display: flex; width: max-content; white-space: nowrap;
  font-weight: 700; letter-spacing: -0.045em; line-height: 1.3; padding-bottom: .05em;
  font-size: clamp(64px, 10vw, 156px);
  animation: marquee 40s linear infinite;
}
.marquee-track span { padding: 0 .25em; }
.marquee-track span { transition: color .4s var(--ease); }
.marquee:hover .marquee-track span, .marquee:focus-visible .marquee-track span { color: var(--accent); }
.marquee-track i { font-style: normal; color: var(--accent); padding: 0 .25em; }
@keyframes marquee { to { transform: translateX(-50%); } }
.foot-bottom {
  display: flex; justify-content: space-between; gap: 24px; margin-top: 48px;
  padding: 24px var(--gutter) 0; border-top: 1px solid rgba(242, 240, 237, .12); font-size: 13px;
  color: color-mix(in srgb, var(--dark-ink) 60%, var(--dark-bg));
}
.foot-bottom a:hover { color: var(--accent); }
@media (max-width: 768px) { .foot-top { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } }

@media (max-width: 768px) {
  .hero-words, .join-words { flex-direction: column; justify-content: center; gap: 30dvh; text-align: center; }
  .hero-words .w-r, .join-words .w-r { text-align: center; }
  .hero-card { clip-path: polygon(8% 38%, 92% 38%, 92% 62%, 8% 62%); }
  /* Neruda: foto iniziale più bassa (72% dello schermo) e parole più vicine */
  .join-card { clip-path: polygon(0% 14%, 100% 14%, 100% 86%, 0% 86%); }
  .join-words { gap: 26dvh; }
  .fill-wide { height: 44vh; }
  .fill-pair .ph { height: 38vh; }
  .poem, .outro-p { margin-left: 0; }
  /* distanze più strette su telefono */
  /* la poesia risale nello spazio vuoto sotto "con il giorno." */
  :root { --gutter: 24px; }
  .poem { padding: 72px var(--gutter) 8px; margin-top: -24dvh; position: relative; z-index: 3; }
  .poem-note { margin-top: 40px; }
  details { margin-top: 28px; }
  .outro { padding-top: 96px; }
  .fill { margin-top: 56px; }
}

/* Campi del modulo di prenotazione (nella modale) */
.signup-intro { max-width: 30ch; font-size: clamp(20px, 1.9vw, 28px); line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; color: var(--muted); }
.field input {
  font: 700 20px/1.3 var(--font); color: var(--ink);
  background: none; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 70%, transparent);
  padding: 8px 0; border-radius: 0;
}
.field input:focus { outline: none; border-bottom-color: var(--accent); }
.field input:user-invalid { border-bottom-color: #ff6b5a; }
.check { display: flex; gap: 12px; align-items: baseline; cursor: pointer; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; transform: translateY(3px); }
.check.small { font-size: 14px; color: var(--muted); }
.book-form button[type=submit] {
  justify-self: start; font: 700 16px var(--font); color: var(--bg); background: var(--ink);
  border: 0; padding: 16px 40px; cursor: pointer; transition: background-color .3s, transform .15s;
}
.book-form button[type=submit]:hover { background: var(--btn-hover); color: var(--dark-bg); }
.book-form button[type=submit]:active { transform: scale(.98); }
.book-form button[type=submit]:disabled { opacity: .5; cursor: wait; }
.form-msg { min-height: 1.5em; font-weight: 700; }
.form-msg.error { color: #ff6b5a; }
.signup-done { font-size: clamp(22px, 2.2vw, 32px); line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; max-width: 26ch; }

/* Pulsanti "Prenota il catalogo" (menu e footer) e modale di prenotazione */
.foot-cta {
  margin-top: 32px; font: 700 16px var(--font); color: var(--dark-ink); background: none; cursor: pointer;
  border: 1px solid currentColor; padding: 16px 32px;
  transition: background-color .3s, color .3s, border-color .3s;
}
.foot-cta:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--dark-bg); }
.foot-cta:active { transform: scale(.98); }
.nav-cta {
  font: inherit; color: var(--nav-bg); background: var(--nav-ink); cursor: pointer;
  border: 1px solid var(--nav-ink); padding: 8px 16px;
  transition: background-color .4s, color .4s, border-color .4s, opacity .3s;
}
.nav-cta:hover { background: var(--btn-hover); border-color: var(--btn-hover); color: var(--dark-bg); }
.nav-light .nav, .nav-foot .nav { --nav-ink: var(--dark-ink); --nav-bg: var(--dark-bg); }
.book {
  border: 0; padding: 0; margin: auto; width: min(600px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  background: var(--dark-bg); color: var(--dark-ink);
  --bg: var(--dark-bg); --ink: var(--dark-ink); --muted: color-mix(in srgb, var(--dark-ink) 55%, var(--dark-bg));
}
.book.light {
  background: var(--light-bg); color: var(--light-ink);
  --bg: var(--light-bg); --ink: var(--light-ink); --muted: color-mix(in srgb, var(--light-ink) 55%, var(--light-bg));
}
.book.light .form-msg.error { color: #c0392b; }
.book.light .field input:user-invalid { border-bottom-color: #c0392b; }
.book::backdrop { background: rgba(15, 15, 15, .6); backdrop-filter: blur(6px); }
.book[open] { animation: book-in .6s var(--ease); }
@keyframes book-in { from { opacity: 0; transform: translateY(24px); } }
.book-box { position: relative; padding: clamp(28px, 4vw, 48px); }
.book h2 { font-size: clamp(24px, 3vw, 40px); white-space: nowrap; padding-right: 40px; }
.book-intro { margin: 12px 0 32px; color: var(--muted); }
.book-form { display: grid; gap: 24px; }
.book-close {
  position: absolute; top: 12px; right: 12px; width: 48px; height: 48px;
  display: grid; place-items: center; font: 500 36px/1 var(--font);
  color: var(--ink); background: none; border: 0; cursor: pointer;
  transition: color .3s, transform .4s var(--ease);
}
.book-close:hover { color: var(--btn-hover); transform: rotate(90deg); }
@media (max-width: 768px) { .nav-cta { padding: 6px 10px; } }
@media (prefers-reduced-motion: reduce) { .book[open] { animation: none; } }

/* Lightbox */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  border: 0; padding: 24px; background: var(--dark-bg); color: var(--dark-ink);
}
.lightbox[open] { display: flex; flex-direction: column; animation: fade .5s var(--ease); }
.lightbox::backdrop { background: var(--dark-bg); }
.lightbox img { flex: 1; min-height: 0; object-fit: contain; }
.lb-bar { display: flex; gap: 24px; justify-content: center; align-items: center; padding-top: 16px; font-size: 14px; font-weight: 700; }
.lb-bar button { font: inherit; color: inherit; opacity: .6; background: none; border: 0; cursor: pointer; padding: 8px 4px; }
.lb-bar button:hover { opacity: 1; color: var(--btn-hover); }
.lb-count { opacity: .6; min-width: 5ch; text-align: center; }
[data-lb="close"] { margin-left: 24px; }
@keyframes fade { from { opacity: 0; } }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Senza animazioni (riduzione movimento o script non caricati): tutto visibile e statico */
.no-motion .hero-card { clip-path: none; }
.no-motion .hero-card::after { opacity: .5; }
.no-motion .hero-words { color: var(--dark-ink); }
.no-motion .hero-intro { position: relative; top: auto; left: auto; margin: 0 auto; padding: 0 0 15vh; }
.no-motion .hero-stage { height: auto; min-height: 100dvh; align-content: center; gap: 15vh; padding-top: 30vh; }
.no-motion .hero-stage .hero-card { position: absolute; }

/* Pagine semplici del CMS (informativa privacy, pagina non trovata): stessa carta, stesso inchiostro */
body.plain main { max-width: 68ch; margin: 0 auto; padding: 120px var(--gutter) 96px; }
body.plain h1 { font-size: clamp(36px, 5vw, 64px); margin-bottom: 32px; }
body.plain p { margin-bottom: 1em; }
body.plain a { text-decoration: underline; text-underline-offset: 3px; }
body.plain a:hover { color: var(--accent); }

/* Cursore a pallino, solo con il mouse. !important: i bottoni dichiarano il proprio cursor */
@media (hover: hover) and (pointer: fine) {
  html, html *, ::backdrop {
    cursor: url("cursor.png") 6 6, auto !important;
    cursor: -webkit-image-set(url("cursor.png") 1x, url("cursor@2x.png") 2x) 6 6, auto !important;
  }
  input:not([type=checkbox]), textarea { cursor: text !important; }
}
/* Il segno arancione lasciato dal cursore */
.ink-trail { position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; pointer-events: none; }
