/* ==========================================================================
   il tempo di un amore — Claudia Rota
   Una sola linea: clessidra → infinito → mensola del libro.
   La linea crema del libro, nel giorno dell'autrice, diventa bruna: bordo
   della copertina e contorno delle lettere adesive.
   ========================================================================== */

.lp {
  --viola: #71557b;        /* il viola piatto della copertina */
  --notte: #21172a;        /* lo stesso viola, di notte */
  --carta: #EFDCC6;        /* il beige del sito: il giorno */
  --sabbia: #ecd3a2;
  --lilla: #D8CAEC;
  --lilla-sito: #B79FD8;
  --bianco: #FFF6E6;       /* crema */
  --inchiostro: #2A1A13;   /* bruno */

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --testo: "Newsreader", Georgia, serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --g: clamp(22px, 5.8vw, 92px);              /* margine laterale */
  --capo: clamp(84px, 13svh, 132px);          /* quota delle etichette alte (sotto la barra del sito) */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-sito: cubic-bezier(.7, 0, .2, 1);
}

.lp *,
.lp *::before,
.lp *::after { box-sizing: border-box; }

.lp { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

.lp { margin: 0; }

/* --------------------------------------------------------------------------
   Contenitore e palco
   -------------------------------------------------------------------------- */

.lp .tda {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  background: var(--viola);
  color: var(--bianco);
  font-family: var(--serif);
  font-weight: 300;
  font-variation-settings: "SOFT" 100;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.lp .tda__svh {
  position: absolute;
  top: 0; left: 0;
  width: 0;
  height: 100vh;
  height: 100svh;
  visibility: hidden;
  pointer-events: none;
}

.lp .tda__stage {
  position: sticky;
  top: 0;
  z-index: 0;
  height: 100vh;
  height: 100lvh;
  margin-bottom: -100vh;
  margin-bottom: -100lvh;
  overflow: hidden;
  pointer-events: none;
}

.lp .tda__canvas {
  display: block;
  width: 100%;
  height: 100%;
  font-variation-settings: "SOFT" 100;
}

/* "il tempo" passa, enorme, scritto con la sola linea */
.lp .tda__parola {
  position: absolute;
  left: 0;
  top: 50%;
  white-space: nowrap;
  font-style: italic;
  font-weight: 300;
  font-size: 44svh;
  line-height: 1;
  letter-spacing: -.02em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(216, 202, 236, .34);
  opacity: 0;
  transform: translate3d(100vw, -52%, 0);
}

.lp .solo-voce {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.lp .etichetta {
  margin: 0;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* le pillole del sito */
.lp .pillola {
  display: inline-block;
  padding: 9px 16px 8px;
  border: 1.5px solid #2A1A13;
  border-radius: 999px;
  background: #FFF6E6;
  color: #2A1A13;
  white-space: nowrap;
}

.lp .punto { display: inline-block; margin: 0 .5em; }

.lp .riga { display: block; white-space: nowrap; }
.lp .riga__in { display: inline-block; will-change: transform; }
.lp .sonda { display: inline-block; width: 0; height: 0; vertical-align: baseline; }

/* --------------------------------------------------------------------------
   0 · Hero — la copertina, distesa
   -------------------------------------------------------------------------- */

.lp .hero {
  --sotto: clamp(128px, 22svh, 220px);
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100svh;
  min-height: 540px;
}

.lp .hero__angolo {
  position: absolute;
  top: var(--capo);
  left: var(--g);
}

.lp .hero__titolo {
  position: absolute;
  left: var(--g);
  top: calc(var(--capo) + 38px + clamp(14px, 2.6svh, 26px));
  margin: 0;
  font-weight: 300;
  font-size: clamp(44px, 15vw, 84px);
  line-height: .9;
  letter-spacing: -.035em;
  opacity: calc(1 - var(--out, 0) * 1.25);
  transform: translate3d(0, calc(var(--shift, 0px) - var(--out, 0) * 5svh), 0);
}

.lp .hero__clessidra {
  position: absolute;
  left: 50%;
  bottom: var(--sotto);
  height: min(37svh, 82vw);
  aspect-ratio: 1 / 2;
  transform: translateX(-50%);
}

.lp .hero__terra {
  position: absolute;
  left: 0; right: 0;
  bottom: var(--sotto);
  height: 0;
}

.lp .hero__sotto {
  position: absolute;
  left: var(--g); right: var(--g);
  bottom: 0;
  height: var(--sotto);
  padding-top: clamp(16px, 3svh, 32px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto 1fr;
  column-gap: 16px;
  row-gap: 8px;
  align-items: start;
  justify-items: start;
  opacity: calc(1 - var(--out, 0) * 2);
}
.lp .hero__dati { grid-column: 1; grid-row: 1; }
.lp .hero__amazon { grid-column: 1; grid-row: 2; }
.lp .hero__ora { grid-column: 1; grid-row: 3; font-variant-numeric: tabular-nums; }
.lp .hero__ora-voce { display: inline-block; margin-right: 1.1em; opacity: .85; }
.lp .hero__sotto .scorri { grid-column: 2; grid-row: 1 / span 4; justify-self: end; }

.lp .hero__amazon {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  -webkit-tap-highlight-color: transparent;
  transition: color .3s ease;
}
@media (hover: hover) {
  .lp .hero__amazon:hover { color: var(--lilla); }
}
.lp .hero__amazon:focus-visible { outline: 1.5px solid var(--bianco); outline-offset: 6px; }

.lp .scorri {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.lp .scorri__filo {
  position: relative;
  width: 1px;
  height: clamp(36px, 7svh, 64px);
  margin-right: .1em;
  background: linear-gradient(rgba(255, 246, 230, .6), rgba(255, 246, 230, .1));
}
.lp .scorri__filo::after {
  content: "";
  position: absolute;
  left: -2px; top: 0;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--sabbia);
  animation: granello 2.4s cubic-bezier(.55, 0, .9, .55) infinite;
}
@keyframes granello {
  0%   { transform: translateY(-6px); opacity: 0; }
  18%  { opacity: 1; }
  82%  { opacity: 1; }
  100% { transform: translateY(clamp(36px, 7svh, 64px)); opacity: 0; }
}
.lp .scorri .etichetta { transition: letter-spacing .6s var(--ease); }
@media (hover: hover) {
  .lp .scorri:hover .etichetta { letter-spacing: .26em; }
}
.lp .scorri:focus-visible { outline: 1.5px solid var(--bianco); outline-offset: 8px; }

/* ingresso (≤ 2 s, non blocca lo scroll) */
html.js .lp .hero__titolo { clip-path: inset(-40% -20% var(--clip, 0px) -20%); }
html.js .lp .hero .riga__in { transform: translate3d(0, 245%, 0); }
html.js .lp .hero .riga + .riga .riga__in { transform: translate3d(0, 128%, 0); }
html.js .lp .hero .etichetta,
html.js .lp .hero .scorri__filo { opacity: 0; }

html.js .lp .tda.is-pronto .hero .riga .riga__in {
  transform: none;
  transition: transform 1.3s var(--ease) .1s;
}
html.js .lp .tda.is-pronto .hero .riga + .riga .riga__in { transition-delay: .2s; }
html.js .lp .tda.is-pronto .hero .etichetta,
html.js .lp .tda.is-pronto .hero .scorri__filo {
  opacity: 1;
  transition: opacity 1s ease .95s, color .3s ease, letter-spacing .6s var(--ease);
}
html.js .lp .tda.is-finito .hero__titolo { clip-path: none; }

/* --------------------------------------------------------------------------
   I e II · gli atti (il palco fa il resto)
   -------------------------------------------------------------------------- */

.lp .atto,
.lp .dedica,
.lp .fine { position: relative; z-index: 1; }

.lp .tda { --h-amore: 145svh; }
.lp .atto--tempo { height: 270svh; }
.lp .atto--amore { height: 100vh; height: 100svh; }   /* il viola dell'atto II finisce dove comincia il giorno */

.lp .atto__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

.lp .atto__capo {
  position: absolute;
  top: var(--capo);
  left: var(--g);
  opacity: var(--vis, 1);
}

.lp .conta {
  position: absolute;
  left: var(--g);
  bottom: clamp(26px, 6svh, 64px);
  display: flex;
  align-items: baseline;
  gap: 12px;
  opacity: var(--vis, 1);
}
.lp .conta__num {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(44px, 5.2vw, 84px);
  line-height: .78;
  letter-spacing: -.02em;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  min-width: 2.9ch;
}

.lp .atto__nota {
  position: absolute;
  left: var(--g);
  right: var(--g);
  top: var(--nota-y, 78svh);
  margin: 0;
  text-align: center;
  font-family: var(--testo);
  font-style: italic;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.45;
  font-variation-settings: normal;
  opacity: var(--vis, 1);
}

/* --------------------------------------------------------------------------
   La dedica
   -------------------------------------------------------------------------- */

.lp .dedica {
  height: 480svh;
  margin-top: -100vh;
  margin-top: -100svh;          /* si aggancia nell'istante in cui l'atto I si sgancia */
}

.lp .dedica__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  padding: 50svh var(--g) 0;
}

.lp .dedica__blocco { opacity: calc(var(--vis, 1) * (1 - var(--esce, 0))); }

.lp .dedica__capo { margin-bottom: clamp(16px, 3svh, 32px); }

.lp .dedica__testo {
  margin: 0;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(24px, 8vw, 40px);
  line-height: 1.2;
  letter-spacing: -.012em;
}

.lp .verso {
  display: block;
  white-space: nowrap;
  transition: opacity .8s ease;
}
.lp .verso.is-passato { opacity: .66; }
.lp .verso .p { display: inline-block; white-space: nowrap; }
.lp .verso .c { display: inline-block; }
html.js .lp .verso .c { opacity: 0; }

/* --------------------------------------------------------------------------
   Chiusura — il libro sulla linea, nel giorno dell'autrice
   -------------------------------------------------------------------------- */

.lp .fine {
  height: calc(var(--h-amore) + 100svh);
  margin-top: -100vh;
  margin-top: -100svh;          /* già agganciata sotto l'atto II: il libro sale appena la linea si distende */
}
html.js .lp .fine__pin:not(.is-vivo) { pointer-events: none; }
html.js .lp .fine__pin:not(.is-vivo) > :not(.fine__atto) { opacity: 0; }

/* Senza script non c'è la tela: resta una pagina ferma ma intera (titolo, dedica, libro) */
html:not(.js) .lp .tda__stage,
html:not(.js) .lp .atto,
html:not(.js) .lp .fine__atto,
html:not(.js) .lp .hero__ora,
html:not(.js) .lp .scorri,
html:not(.js) .lp .dato--allora { display: none; }
html:not(.js) .lp .dedica,
html:not(.js) .lp .fine { height: auto; margin-top: 0; }
html:not(.js) .lp .dedica__pin,
html:not(.js) .lp .fine__pin { position: relative; }
html:not(.js) .lp .fine__pin { background: var(--carta); }
html:not(.js) .lp .libro__img { border-bottom-width: 2px; }

.lp .fine__pin {
  --t1: 1; --t2: 1; --l: 1; --d: 1; --b: 1; --giro: 1; --va: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  color: var(--inchiostro);
  padding: clamp(84px, 11.5svh, 116px) var(--g) clamp(20px, 3.2svh, 34px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "testa   testa"
    "dati    libro"
    "bottone bottone";
  column-gap: 14px;
}

/* l'etichetta dell'atto II vive qui, finché si è ancora nel viola */
.lp .fine__atto {
  position: absolute;
  top: var(--capo);
  left: var(--g);
  opacity: var(--va);
}

.lp .fine__testa { grid-area: testa; align-self: end; padding-bottom: clamp(14px, 2.4svh, 24px); }

.lp .fine__capo {
  margin-bottom: clamp(12px, 2svh, 20px);
  opacity: var(--d);
}

/* le lettere adesive dell'autrice */
.lp .fine__titolo {
  margin: 0;
  font-weight: 800;
  font-size: clamp(40px, 13.2vw, 64px);
  line-height: .98;
  letter-spacing: -.005em;
  color: #FFF6E6;
  -webkit-text-stroke: .05em #2A1A13;
  paint-order: stroke fill;
  text-shadow: 0 .05em 0 #2A1A13;
  transform: translate3d(0, var(--shift, 0px), 0);
  clip-path: inset(-40% -20% var(--clip, 0px) -20%);
}
.lp .fine__titolo .riga:nth-of-type(2) .riga__in { transform: translate3d(0, calc((1 - var(--t1)) * 245%), 0); }
.lp .fine__titolo .riga:nth-of-type(3) .riga__in { transform: translate3d(0, calc((1 - var(--t2)) * 135%), 0); }

/* la copertina: piatta, col bordo e l'ombra piena, appoggiata sul suo spigolo */
.lp .libro {
  grid-area: libro;
  align-self: end;
  justify-self: end;
  margin: 0 6px 0 0;
  height: min(40svh, 92vw);
  aspect-ratio: 938 / 1500;
}
.lp .libro__maschera {
  display: block;
  height: 100%;
  clip-path: inset(-30% -50% -9px -50%);
}
.lp .libro__sale {
  display: block;
  height: 100%;
  transform: translate3d(0, calc((1 - var(--l)) * 112%), 0);
}
.lp .libro__oggetto {
  display: block;
  height: 100%;
  transform-origin: 0 100%;
  transform: rotate(calc(-5deg + var(--giro) * 2.5deg));
  transition: transform .5s var(--ease-sito);
}
@media (hover: hover) {
  .lp .libro:hover .libro__oggetto { transform: rotate(0deg) translateY(-6px); }
}
.lp .libro__img {
  display: block;
  height: 100%;
  width: auto;
  aspect-ratio: 938 / 1500;
  object-fit: cover;
  background: var(--viola);
  border: 2px solid #2A1A13;
  border-radius: 6px;
  box-shadow: 0 7px 0 #2A1A13;
}

/* le cifre, alla maniera del sito: numero sopra, didascalia sotto */
.lp .dati {
  grid-area: dati;
  align-self: end;
  margin: 0;
  padding-bottom: clamp(14px, 2.4svh, 22px);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2svh, 20px);
  opacity: var(--d);
  transform: translate3d(0, calc((1 - var(--d)) * 14px), 0);
}
.lp .dato { margin: 0; display: flex; flex-direction: column; align-items: flex-start; }
.lp .dato dt { order: 2; margin-top: 6px; }
.lp .dato dd { margin: 0; }
.lp .dato__n {
  order: 1;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 6.8vw, 44px);
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}
.lp .dato__n span { display: inline-block; white-space: nowrap; }
.lp .daallora {
  order: 3;
  margin-top: 2px;
  color: rgba(42, 26, 19, .72);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* il pulsante del sito */
.lp .bottone {
  grid-area: bottone;
  justify-self: start;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: clamp(24px, 3.6svh, 36px);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 22px 34px;
  border-radius: 999px;
  background: #B79FD8;
  color: #2A1A13;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  opacity: var(--b);
  transform: translate3d(0, calc((1 - var(--b)) * 16px), 0);
  transition: color .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.lp .bottone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #2A1A13;
  transform: translateY(101%);
  transition: transform .55s var(--ease-sito);
}
.lp .bottone__freccia { flex: none; display: block; transition: transform .45s var(--ease-sito); }
@media (hover: hover) {
  .lp .bottone:hover { color: #FFF6E6; }
  .lp .bottone:hover::before { transform: none; }
  .lp .bottone:hover .bottone__freccia { transform: translate(4px, -4px); }
}
.lp .bottone:focus-visible { color: #FFF6E6; outline: 2px solid #2A1A13; outline-offset: 4px; }
.lp .bottone:focus-visible::before { transform: none; }
.lp .bottone:active .bottone__freccia { transform: translate(5px, -5px); }

/* --------------------------------------------------------------------------
   Tablet in verticale
   -------------------------------------------------------------------------- */

/* telefono: la chiusura riempie la larghezza e i dati respirano accanto al libro */
@media (max-width: 599px) {
  .lp .fine__pin { column-gap: 20px; }
  .lp .fine__titolo { font-size: clamp(44px, 14.6vw, 72px); }
  .lp .libro { height: min(36svh, 80vw); }
  .lp .dato dt { white-space: nowrap; letter-spacing: .08em; }
  .lp .dati { padding-bottom: clamp(24px, 4svh, 32px); }
}

@media (min-width: 600px) {
  .lp .hero__titolo { font-size: clamp(84px, 15vw, 120px); }
  .lp .dedica__testo { font-size: clamp(40px, 8vw, 60px); }
  .lp .fine__titolo { font-size: clamp(64px, 13.2vw, 96px); }
  .lp .libro { height: min(46svh, 92vw); }
}

/* --------------------------------------------------------------------------
   Computer (orizzontale largo)
   -------------------------------------------------------------------------- */

@media (min-width: 900px) and (min-aspect-ratio: 1/1) {

  .lp .hero { --sotto: clamp(140px, 24svh, 236px); }

  .lp .hero__titolo {
    top: auto;
    bottom: var(--sotto);
    font-size: clamp(80px, 10.4vw, 190px);
    line-height: .9;
  }

  .lp .hero__clessidra {
    left: auto;
    right: 13.5vw;
    height: 54svh;
    transform: none;
  }

  .lp .hero__sotto { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .lp .hero__ora { grid-column: 2; grid-row: 1; }
  .lp .hero__sotto .scorri { grid-column: 3; }

  .lp .tda__parola { font-size: 62svh; }

  .lp .atto__nota {
    left: auto;
    top: auto;
    bottom: clamp(26px, 6svh, 64px);
    text-align: right;
  }

  .lp .dedica__pin {
    align-items: center;
    padding-top: 0;
  }
  .lp .dedica__testo {
    font-size: clamp(30px, 4.2vw, 76px);
    line-height: 1.16;
  }

  .lp .fine__pin {
    padding-top: var(--capo);
    padding-bottom: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) clamp(120px, 18svh, 170px);
    grid-template-areas:
      "testa  libro"
      "sotto  sotto";
    column-gap: clamp(32px, 5vw, 96px);
  }

  .lp .fine__testa { padding-bottom: 0; }
  .lp .fine__capo { margin-bottom: clamp(16px, 3svh, 32px); }
  .lp .fine__titolo { font-size: clamp(72px, min(9.6vw, 16svh), 156px); }

  .lp .libro {
    height: min(100% - 12px, 62svh, 46vw);
    margin-right: clamp(40px, 7.5vw, 130px);
  }

  .lp .dati,
  .lp .bottone {
    grid-area: sotto;
    align-self: start;
    margin-top: clamp(16px, 3.2svh, 34px);
  }

  .lp .dati {
    justify-self: start;
    flex-direction: row;
    gap: clamp(28px, 3.8vw, 72px);
    padding-bottom: 0;
  }
  .lp .dato__n { font-size: clamp(34px, 4vw, 68px); white-space: nowrap; }
  .lp .dato dt { margin-top: 8px; }

  .lp .bottone { justify-self: end; }
}

/* schermi bassi: la fascia della barra del sito resta libera */
@media (max-height: 640px) {
  .lp { --capo: 84px; }
  .lp .hero__clessidra { height: min(33svh, 82vw); }
  .lp .hero__titolo { top: calc(var(--capo) + 38px + 10px); }
  .lp .libro { height: min(36svh, 92vw); }
}
@media (max-height: 640px) and (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .lp .hero__clessidra { height: 50svh; }
  .lp .hero__titolo { top: auto; }
  .lp .libro { height: min(100% - 12px, 56svh, 46vw); }
}

/* --------------------------------------------------------------------------
   Movimento ridotto: tutto presente, niente animazioni autonome
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html.js .lp .hero .riga__in,
  html.js .lp .tda.is-pronto .hero .riga__in { transform: none; transition: none; }
  html.js .lp .hero__titolo { clip-path: none; }
  html.js .lp .hero .etichetta,
  html.js .lp .hero .scorri__filo,
  html.js .lp .tda.is-pronto .hero .etichetta,
  html.js .lp .tda.is-pronto .hero .scorri__filo { opacity: 1; transition: none; }
  .lp .scorri__filo::after { animation: none; opacity: 1; top: 50%; }
  html.js .lp .verso .c { opacity: 1; }
  .lp .verso { transition: none; }
  .lp .libro__oggetto,
  .lp .bottone,
  .lp .bottone::before,
  .lp .bottone__freccia { transition: none; }
  .lp .atto--tempo { height: 200svh; }
  .lp .dedica { height: 300svh; }
}
