/* Prova 5 — il magazine di presentazione si sfoglia scorrendo; sotto, il manifesto.
   Carta bianca su un fondo color pietra calda, serif editoriale come nel magazine, corsivo vinaccia. */

:root {
  --stone: #ebe6de;
  --stone-2: #e2dcd2;
  --paper: #fbfaf7;
  --ink: #2a2725;
  --soft: #6f6a64;
  --wine: #5e3035;
  --wine-hi: #7a3d43;
  --serif: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 2.6vw, 36px);
  --ease: cubic-bezier(.16, .84, .24, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--stone); color: var(--ink); font: 400 16px/1.6 var(--serif); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; }
.mono { font-family: var(--mono); font-size: .7rem; line-height: 1.7; letter-spacing: .14em; text-transform: uppercase; }

/* testata */
.top {
  position: fixed; inset: 0 0 auto; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) var(--gutter) 16px; color: var(--ink);
  background: linear-gradient(rgba(235,230,222,.95), rgba(235,230,222,.7) 70%, rgba(235,230,222,0));
}
.brand img { width: clamp(80px, 7.5vw, 108px); height: auto; }
.nav { display: flex; gap: clamp(14px, 2.2vw, 30px); font: 500 .68rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.nav a { position: relative; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 1px; background: var(--wine); transform: scaleX(0); transition: transform .4s var(--ease); }
.nav a:hover { color: var(--wine); }
.nav a:hover::after { transform: scaleX(1); }
.globe { justify-self: end; display: inline-flex; align-items: center; gap: 8px; font: 500 .7rem/1 var(--mono); letter-spacing: .1em; }
.globe svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.menu-btn { display: none; background: none; border: 0; color: inherit; font: 500 .7rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; padding: 6px 0; }
@media (max-width: 860px) {
  .top { grid-template-columns: 1fr auto auto; gap: 18px; }
  .menu-btn { display: inline-block; }
  .nav { position: fixed; inset: 0; z-index: -1; display: grid; place-content: center; justify-items: center; gap: 26px; background: var(--stone); font: 400 1.9rem/1 var(--serif); letter-spacing: 0; text-transform: none; opacity: 0; visibility: hidden; transition: opacity .4s, visibility .4s; }
  .top.open .nav { opacity: 1; visibility: visible; }
}

/* ——— il magazine ———
   Senza JS: le pagine una sotto l'altra. Con JS (.is-book): sezione lunga, palco fisso, rivista che si sfoglia. */
.mag { position: relative; background: radial-gradient(120% 80% at 50% 45%, #f2eee8 0, var(--stone) 55%, var(--stone-2) 100%); }
.mag-stage { position: relative; padding: 110px var(--gutter) 60px; }
.mag-pages { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: 28px; width: min(560px, 100%); }
.mag-pages img { width: 100%; height: auto; box-shadow: 0 30px 50px -30px rgba(40,30,20,.5); }
.book, .mag-count, .mag-cue, .mag-bar { display: none; }

.mag.is-book .mag-stage { position: sticky; top: 0; height: 100vh; height: 100svh; padding: 0; overflow: hidden; perspective: 2600px; perspective-origin: 50% 40%; }
.mag.is-book .mag-pages { display: none; }
.mag.is-book .book {
  display: block; position: absolute; left: 50%; top: calc(50% + 22px);
  width: calc(var(--pw) * 2); height: var(--ph); margin: calc(var(--ph) / -2) 0 0 calc(var(--pw) * -1);
  transform-style: preserve-3d; will-change: transform;
}
/* i due blocchi di pagine sotto ai fogli: spessore e ombra a terra */
.side { position: absolute; top: 0; width: var(--pw); height: 100%; background: var(--paper); }
.side.l { left: 0; box-shadow: -1px 1px 0 #e9e5df, -2px 2px 0 #f6f4f0, -3px 3px 0 #e4e0d9, -4px 4px 0 #f3f1ec, 0 40px 60px -28px rgba(40,28,18,.55), 0 10px 18px -8px rgba(40,28,18,.25); }
.side.r { right: 0; box-shadow: 1px 1px 0 #e9e5df, 2px 2px 0 #f6f4f0, 3px 3px 0 #e4e0d9, 4px 4px 0 #f3f1ec, 0 40px 60px -28px rgba(40,28,18,.55), 0 10px 18px -8px rgba(40,28,18,.25); }
/* un foglio = una pagina davanti e una dietro, divisa in strisce per poterla curvare */
.leaf { position: absolute; left: 50%; top: 0; width: var(--pw); height: 100%; transform-style: preserve-3d; pointer-events: none; }
.seg { position: absolute; top: 0; left: 0; height: 100%; transform-style: preserve-3d; transform-origin: 0 50%; }
.seg .seg { left: 100%; }
.face { position: absolute; top: 0; bottom: 0; left: 0; width: calc(100% + 2px); backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.face.back { transform: rotateY(180deg); left: -2px; }
.face i { position: absolute; inset: 0; background: #1c140e; opacity: 0; }
.face.back i { background: linear-gradient(90deg, #1c140e, #3a2a20); }
/* piega centrale: ombra vicino al dorso */
.leaf > .seg > .face::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.leaf > .seg > .face.front::after { background: linear-gradient(90deg, rgba(30,20,12,.26), rgba(30,20,12,.08) 35%, rgba(30,20,12,0) 90%); }
.leaf > .seg > .face.back::after { background: linear-gradient(270deg, rgba(30,20,12,.26), rgba(30,20,12,.08) 35%, rgba(30,20,12,0) 90%); }

.mag.is-book .mag-count { display: block; position: absolute; left: var(--gutter); bottom: 22px; margin: 0; color: var(--soft); }
.mag-count span { color: var(--wine); }
.mag.is-book .mag-cue { display: inline-flex; align-items: center; gap: 12px; position: absolute; right: var(--gutter); bottom: 18px; margin: 0; color: var(--soft); transition: opacity .6s; }
.mag-cue i { width: 1px; height: 30px; background: linear-gradient(var(--wine), transparent); animation: cue 2.4s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0%, 100% { transform: scaleY(.3); opacity: .4; } 50% { transform: scaleY(1); opacity: 1; } }
.mag.is-book .mag-bar { display: block; position: absolute; left: 50%; bottom: 30px; width: min(220px, 34vw); height: 1px; translate: -50% 0; background: rgba(42,39,37,.14); }
.mag-bar i { display: block; height: 100%; background: var(--wine); transform-origin: left; transform: scaleX(0); }
.mag.is-book .book { cursor: pointer; }

/* ——— il manifesto ——— */
.manifesto { background: var(--paper); text-align: center; }
.chapter { display: grid; justify-items: center; gap: 22px; padding: clamp(90px, 13vw, 170px) var(--gutter); max-width: 900px; margin: 0 auto; }
.chapter + .chapter { border-top: 1px solid #e6e0d7; max-width: none; }
.chapter > * { max-width: 760px; }
.big { margin: 0 0 10px; font: 400 clamp(2.3rem, 6.4vw, 5.4rem)/1 var(--serif); text-transform: uppercase; letter-spacing: -.01em; text-wrap: balance; }
.mid { margin: 0 0 4px; font: 400 clamp(1.9rem, 4.4vw, 3.6rem)/1.04 var(--serif); text-transform: uppercase; letter-spacing: -.005em; text-wrap: balance; }
.big em, .mid em { font-style: italic; text-transform: none; color: var(--wine); }
.lead { margin: 0; font: italic 400 clamp(1.25rem, 2.2vw, 1.7rem)/1.35 var(--serif); color: var(--wine); text-wrap: balance; }
.body { margin: 0; max-width: 54ch !important; font-size: clamp(1rem, 1.25vw, 1.12rem); color: var(--soft); text-wrap: pretty; }
.accent { margin: 6px 0; font: 700 clamp(1.05rem, 1.5vw, 1.25rem)/1.4 var(--serif); color: var(--ink); }
.kicker { margin: 0 0 -6px; color: var(--wine); }
.kicker::before, .kicker::after { content: ""; display: inline-block; width: 28px; height: 1px; background: currentColor; vertical-align: middle; margin: 0 12px; opacity: .5; }
.link { display: inline-flex; align-items: center; gap: 12px; margin-top: 12px; padding: 14px 4px 10px; border-bottom: 1px solid currentColor; font: 500 .74rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--wine); }
.link span { transition: transform .5s var(--ease); }
.link:hover span { transform: translateX(6px); }
.link.solid { border: 0; padding: 18px 26px; background: var(--paper); color: var(--wine); transition: background .4s, color .4s; }
.link.solid:hover { background: #fff; }

.covers { display: flex; justify-content: center; gap: clamp(10px, 2vw, 26px); margin: 26px 0 8px; max-width: none !important; }
.covers a { width: clamp(78px, 13vw, 170px); transition: transform .8s var(--ease); }
.covers a:nth-child(1) { transform: rotate(-5deg) translateY(8px); }
.covers a:nth-child(2) { transform: rotate(-1.5deg); }
.covers a:nth-child(3) { transform: rotate(2deg) translateY(4px); }
.covers a:nth-child(4) { transform: rotate(6deg) translateY(10px); }
.covers a:hover { transform: translateY(-10px) rotate(0); }
.covers img { width: 100%; box-shadow: 0 26px 36px -20px rgba(40,28,18,.5), 0 3px 8px rgba(40,28,18,.12); }

.finale { background: var(--wine); color: #f6efe8; max-width: none; border: 0 !important; }
.finale .big { font-size: clamp(2rem, 5.2vw, 4.4rem); }
.finale .big em { color: #e8cdbf; }
.finale .body { color: #e5d7cf; }

/* piè di pagina */
.foot { padding: 34px var(--gutter) calc(28px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 20px; color: var(--soft); }
.f-links, .f-addr { display: grid; font-size: .62rem; }
.f-addr { text-align: right; justify-items: end; }
.f-links a:hover, .f-addr a:hover { color: var(--wine); }
.f-sign { margin: 0; display: grid; justify-items: center; font: 400 1.6rem/1 var(--serif); text-transform: uppercase; color: var(--ink); }
.f-sign em { font: italic 400 .95rem/1.6 var(--serif); text-transform: none; color: var(--wine); }
@media (max-width: 640px) { .foot { grid-template-columns: 1fr; justify-items: center; text-align: center; } .f-addr { text-align: center; justify-items: center; } .f-sign { order: -1; } }

/* comparse leggere */
.js .rise { opacity: 0; transform: translateY(24px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.js .rise.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .rise { opacity: 1; transform: none; transition: none; }
  .mag-cue i { animation: none; }
}

.leaf.far { display: none; }

/* le pagine sono immagini: intere da ferme, a strisce mentre girano */
.face img { position: absolute; top: 0; left: 0; height: 100%; width: var(--pw); max-width: none; user-select: none; -webkit-user-select: none; }

/* salta il magazine */
.mag-skip { display: none; }
.mag.is-book .mag-skip {
  display: inline-flex; align-items: center; gap: 10px; position: absolute; z-index: 5; right: var(--gutter); bottom: 16px;
  padding: 11px 16px 10px; border-radius: 999px; background: rgba(251,250,247,.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px -10px rgba(40,28,18,.35); color: var(--wine);
  font: 500 .66rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; transition: background .35s, color .35s, opacity .5s;
}
.mag-skip:hover { background: var(--wine); color: #f6efe8; }
.mag-skip span { transition: transform .4s var(--ease); }
.mag-skip:hover span { transform: translateY(3px); }
.mag.is-book .mag-cue { right: auto; left: 50%; translate: -50% 0; bottom: 44px; }
.mag-skip.gone { opacity: 0; pointer-events: none; }
@media (max-width: 760px) { .mag.is-book .mag-bar { display: none; } .mag.is-book .mag-cue { bottom: 70px; } }

/* icona della Sala */
.sala-badge { position: fixed; z-index: 25; left: var(--gutter); bottom: calc(58px + env(safe-area-inset-bottom, 0px)); width: 84px; height: 84px; display: grid; place-items: center;
  border-radius: 50%; background: var(--wine); color: #f6efe8; box-shadow: 0 14px 30px -12px rgba(40, 20, 15, .55);
  transition: background .4s, transform .5s var(--ease); animation: sb-in 1s var(--ease) 1.2s backwards; }
.sala-badge:hover { transform: scale(1.06); }
@keyframes sb-in { from { opacity: 0; transform: scale(.5) rotate(-30deg); } to { opacity: 1; transform: none; } }
.sala-badge:hover { background: var(--wine-hi); }
.sb-ring { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); animation: sb-spin 16s linear infinite; }
.sb-ring text { font: 500 9.6px/1 var(--mono); letter-spacing: .1em; fill: currentColor; }
.sb-ico { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sb-glow { fill: #ffb45a; stroke: none; animation: sb-glow 2.4s ease-in-out infinite; }
@keyframes sb-spin { to { transform: rotate(360deg); } }
@keyframes sb-glow { 50% { opacity: .3; } }
@media (max-width: 760px) { .sala-badge { width: 70px; height: 70px; bottom: calc(52px + env(safe-area-inset-bottom, 0px)); } .sb-ring text { font-size: 10.4px; } .sb-ico { width: 28px; height: 28px; } }
@media (prefers-reduced-motion: reduce) { .sb-ring, .sb-glow { animation: none; } }

/* quinta copertina (The Little Pig) e cinque copertine anche sul telefono */
.covers a:nth-child(5) { transform: rotate(-3deg) translateY(6px); }
@media (max-width: 560px) { .covers { gap: 8px; } .covers a { width: 16vw; } }

/* The Little Pig inclinata come le altre copertine */
.covers a:nth-child(5) { transform: rotate(-6deg) translateY(10px); }

/* telefono: "Salta il magazine" sopra la rivista, al centro */
@media (max-width: 760px) {
  .mag.is-book .mag-skip { right: auto; left: 50%; translate: -50% 0; bottom: auto; top: calc(78px + env(safe-area-inset-top, 0px)); }
}
