/* Epiteto · Cercando un Equilibrio — pre-save
   Palette presa dalla copertina: blu profondo (fondo), ghiaccio del titolo (inchiostro), acqua luminosa (accento). */

/* Variante web del font Epiteto: sottoinsieme condensato del 4%, generato da tools/build-font.py */
@font-face {
  font-family: "EPT Display";
  src: url("../fonts/ept-display.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: "Tenor Sans";
  src: url("../fonts/tenor-sans.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --ground: #0a2533;
  --ground-2: #0f3447;
  --ground-3: #154459;
  --ink: #dce8f4;
  --ink-2: #9cc6da;
  --accent: #7ae2f2;
  --accent-hi: #b0f0fa;
  --paper: #dce8f4;
  --paper-ink: #0a2533;
  --paper-ink-2: #2f5468;

  --display: "EPT Display", "Tenor Sans", sans-serif;

  /* Il glow: la copertina ha un alone bianco-azzurro simmetrico; qui è color acqua,
     a due strati, e il secondo scende verso il basso come luce rifratta sott'acqua.
     È un filtro sul contenitore, così non viene tagliato dalle maschere delle animazioni. */
  --glow: drop-shadow(0 0 7px rgb(122 226 242 / 0.5)) drop-shadow(0 6px 18px rgb(122 226 242 / 0.24)); /* taste-skill-ignore: glow richiesto dal brand, come in copertina */
  --glow-soft: drop-shadow(0 0 6px rgb(122 226 242 / 0.38)) drop-shadow(0 4px 14px rgb(122 226 242 / 0.16)); /* taste-skill-ignore: glow richiesto dal brand, come in copertina */
  --glow-peak: drop-shadow(0 0 12px rgb(176 240 250 / 0.95)) drop-shadow(0 8px 30px rgb(122 226 242 / 0.55)); /* taste-skill-ignore: glow richiesto dal brand, come in copertina */
  --text: "Tenor Sans", "Helvetica Neue", Arial, sans-serif;

  --step-display: clamp(2.4rem, 12.6cqi, 6rem);
  --step-2: clamp(1.6rem, 7.2cqi, 2.5rem);
  --step-body: 1.0625rem;
  --step-small: 0.875rem;

  --m: clamp(20px, 5vw, 56px);
  --bar-h: 64px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ground);
  scrollbar-color: var(--ground-3) var(--ground);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--step-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
@supports (overflow: clip) { body { overflow-x: clip; } }

img, svg { display: block; max-width: 100%; }
h1, h2, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; touch-action: manipulation; }

::selection { background: var(--accent); color: var(--ground); }

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

.icon { width: 22px; height: 22px; fill: currentColor; flex: none; }

/* ---------- La stanza: la copertina sfocata come luce d'ambiente ---------- */

.room {
  position: fixed;
  inset: -10%;
  z-index: -1;
  background: var(--ground) url("../img/room.webp") center / cover no-repeat;
  animation: room-drift 38s ease-in-out infinite alternate;
}
.room::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(10 37 51 / 0.38);
}
@keyframes room-drift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to   { transform: scale(1.14) translate3d(-2%, 1.5%, 0); }
}

/* ---------- Barra ---------- */

.bar {
  display: flex;
  align-items: center;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--m) 0;
}
.bar__logo { display: block; }
.bar__logo img { height: 26px; width: auto; filter: var(--glow-soft); }

/* ---------- Hero: la copertina come oggetto ---------- */

.hero {
  display: grid;
  gap: 32px;
  padding: 0 var(--m);
}

.sleeve {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  isolation: isolate;
}

.half {
  position: absolute;
  inset: 0;
}
.half__in {
  position: absolute;
  inset: 0;
}
.half__in img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* La diagonale della copertina: il cielo in alto a sinistra, il mare in basso a destra.
   Il cielo sborda di 2px oltre la diagonale per non lasciare fessure quando le metà combaciano. */
.half--sky .half__in { clip-path: polygon(0 0, 100% 0, 100% 2px, 2px 100%, 0 100%); }
.half--sea .half__in { clip-path: polygon(100% 0, 100% 100%, 0 100%); }

/* La luce che corre lungo la cucitura quando le due metà si incontrano */
.sleeve::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 141.5%;
  height: 2px;
  background: #f2fbff;
  transform: translate(-50%, -50%) rotate(-45deg) scaleX(0);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.hero__text {
  container-type: inline-size;
  padding-bottom: 8px;
}

.title {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--step-display);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
  filter: var(--glow);
}
.title .line {
  display: block;
  overflow: clip;
  /* spazio per le iniziali grandi sopra e per la coda della Q sotto */
  padding: 0.3em 0 0.16em;
  margin: -0.3em 0 -0.16em;
}
.title .line > span { display: block; }
/* Come in copertina: l'iniziale di riga più alta delle altre lettere */
.title .cap { font-size: 1.3em; line-height: 0; }

.lead {
  margin-top: 20px;
  font-size: 1.125rem;
  color: var(--ink);
}

.date {
  display: block;
  margin-top: 6px;
  font-family: var(--display);
  font-size: var(--step-2);
  line-height: 1.15;
  text-transform: uppercase;
  filter: var(--glow-soft);
}

/* ---------- Countdown ---------- */

.countdown {
  display: flex;
  gap: clamp(18px, 6cqi, 36px);
  margin-top: 24px;
}
.cd__unit { display: grid; gap: 2px; }
.cd__num {
  display: flex;
  font-family: var(--display);
  font-size: var(--step-2);
  line-height: 1;
  filter: var(--glow-soft);
}
.cd__digit {
  position: relative;
  display: inline-block;
  width: 0.622em;
  height: 1.1em;
  overflow: clip;
  text-align: center;
}
.cd__digit > span {
  position: absolute;
  inset: 0;
  line-height: 1.1;
}
.cd__label {
  font-size: var(--step-small);
  color: var(--ink-2);
}

/* ---------- Pulsante ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  margin-top: 28px;
  padding: 0 28px;
  background: var(--accent);
  color: var(--ground);
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.btn:active { transform: scale(0.97); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--accent-hi); }
}

/* ---------- Le altre piattaforme ---------- */

.platforms {
  display: grid;
  gap: 24px;
  padding: 88px var(--m) 0;
}
.platforms__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.35rem, 6.2svw, 2.5rem);
  line-height: 1.15;
  text-transform: uppercase;
  filter: var(--glow-soft);
}
.platforms__list { display: grid; gap: 4px; }
.platforms__list a {
  display: grid;
  grid-template-columns: 24px 1fr 20px;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  padding: 0 20px;
  background: var(--ground-2);
  font-size: 1.125rem;
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.platforms__list .icon { width: 24px; height: 24px; }
.arrow {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.6;
  stroke-linecap: square;
  transition: transform 200ms var(--ease-out), stroke 200ms ease;
}
.platforms__list a:active { transform: scale(0.98); background: var(--ground-3); }

@media (hover: hover) and (pointer: fine) {
  .platforms__list a:hover { background: var(--ground-3); }
  .platforms__list a:hover .arrow { transform: translate(2px, -2px); stroke: var(--accent); }
}

/* ---------- Il retro della copertina ---------- */

.back {
  --cut: clamp(56px, 16vw, 180px);
  margin-top: 112px;
  padding: calc(var(--cut) + 28px) var(--m) calc(28px + env(safe-area-inset-bottom));
  background: var(--paper);
  color: var(--paper-ink);
  clip-path: polygon(0 var(--cut), 100% 0, 100% 100%, 0 100%);
  display: grid;
  gap: 40px;
}

.back__plates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.plate {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.plate--sea { margin-top: 22%; }

.back__name img { width: 100%; height: auto; }

.social {
  display: grid;
  gap: 2px;
  font-size: 1.125rem;
}
@media (min-width: 700px) {
  .social { display: flex; flex-wrap: wrap; gap: 12px 28px; }
}
.social a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 6px;
  text-decoration-thickness: 1.5px;
  transition: text-decoration-color 200ms ease, transform 160ms var(--ease-out);
}
.social a:active { transform: scale(0.97); }
.social a:focus-visible { outline-color: var(--paper-ink); }
@media (hover: hover) and (pointer: fine) {
  .social a:hover { text-decoration-color: currentColor; }
}

.imprint {
  font-size: var(--step-small);
  color: var(--paper-ink-2);
}

/* ---------- Desktop e tablet ---------- */

@media (min-width: 700px) {
  :root { --bar-h: 88px; }
  .bar__logo img { height: 32px; }

  .hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(40px, 6vw, 112px);
    padding-top: 24px;
  }
  .sleeve { width: min(100%, 80svh); justify-self: end; }
  .btn { width: auto; justify-self: start; display: inline-flex; }

  .platforms {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(40px, 6vw, 112px);
    align-items: start;
    padding-top: 120px;
  }
  .platforms__title { justify-self: end; text-align: right; font-size: clamp(2rem, 3.4vw, 3rem); max-width: 9em; }
}

/* Schermi orizzontali: la copertina occupa l'altezza della prima schermata */
@media (min-width: 700px) and (min-aspect-ratio: 5/4) {
  .hero {
    min-height: calc(100svh - var(--bar-h) - 32px);
    padding-top: 0;
  }
  .platforms { padding-top: 160px; }
}

@media (min-width: 700px) {
  .back {
    --cut: clamp(56px, 9vw, 130px);
    margin-top: 120px;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto auto auto 1fr;
    column-gap: clamp(40px, 6vw, 112px);
    row-gap: 40px;
  }
  .back__plates { grid-row: 1 / -1; max-width: 72svh; justify-self: end; width: 100%; }
  .back__name { grid-row: 2; }
  .social { grid-row: 3; }
  .imprint { grid-row: 4; }
}

/* ---------- Intro (solo con JS e movimento consentito) ---------- */

.intro:not(.play) .room { opacity: 0; }
.intro:not(.play) .half { opacity: 0; }
.intro:not(.play) .bar__logo { clip-path: inset(0 100% 0 0); }
.intro:not(.play) .title .line > span { transform: translateY(110%); }
.intro:not(.play) .rise { opacity: 0; transform: translateY(18px); }

.intro.play .room {
  animation:
    room-in 2400ms var(--ease-expo) both,
    room-drift 38s ease-in-out 2400ms infinite alternate;
}
@keyframes room-in {
  from { opacity: 0; transform: scale(1.32); }
  to   { opacity: 1; transform: scale(1.04); }
}

.intro.play .half--sky .half__in { animation: sky-in 1250ms var(--ease-expo) 120ms both; }
.intro.play .half--sea .half__in { animation: sea-in 1250ms var(--ease-expo) 220ms both; }
@keyframes sky-in {
  from { transform: translate3d(-34%, -34%, 0) rotate(-5deg); opacity: 0; }
  35%  { opacity: 1; }
  to   { transform: none; opacity: 1; }
}
@keyframes sea-in {
  from { transform: translate3d(34%, 34%, 0) rotate(-5deg); opacity: 0; }
  35%  { opacity: 1; }
  to   { transform: none; opacity: 1; }
}

.intro.play .sleeve { animation: join 1000ms var(--ease-out) 1080ms both; }
@keyframes join {
  0%   { transform: scale(1);     filter: brightness(1); }
  22%  { transform: scale(1.016); filter: brightness(1.3); }
  100% { transform: scale(1);     filter: brightness(1); }
}
.intro.play .sleeve::after { animation: seam 1100ms var(--ease-out) 1040ms both; }
@keyframes seam {
  0%   { opacity: 1; transform: translate(-50%, -50%) rotate(-45deg) scaleX(0); }
  45%  { opacity: 0.95; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-45deg) scaleX(1); }
}

.intro.play .bar__logo { animation: wipe 1100ms var(--ease-in-out) 500ms both; }
@keyframes wipe {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* Quando le due metà si uniscono il glow del titolo ha un picco e poi si assesta */
.intro.play .title { animation: glow-bloom 1600ms var(--ease-out) 1100ms both; }
@keyframes glow-bloom {
  0%   { filter: var(--glow); }
  18%  { filter: var(--glow-peak); }
  100% { filter: var(--glow); }
}

.intro.play .title .line > span { animation: line-up 1000ms var(--ease-expo) both; }
.intro.play .title .line:nth-child(1) > span { animation-delay: 880ms; }
.intro.play .title .line:nth-child(2) > span { animation-delay: 970ms; }
@keyframes line-up {
  from { transform: translateY(110%); }
  to   { transform: none; }
}

.intro.play .rise { animation: rise 800ms var(--ease-expo) both; animation-delay: calc(1200ms + var(--i, 0) * 80ms); }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Comparsa allo scroll ---------- */

.js .reveal {
  transition:
    opacity 700ms var(--ease-out) calc(var(--i, 0) * 70ms),
    transform 900ms var(--ease-expo) calc(var(--i, 0) * 70ms);
}
.js .reveal:not(.in) { opacity: 0; transform: translateY(24px); }

.js .plate {
  transition:
    clip-path 1300ms var(--ease-expo),
    transform 1600ms var(--ease-expo);
}
.js .plate--sea { transition-delay: 160ms; }
.js .plate--sky:not(.in) { clip-path: inset(0 100% 100% 0); transform: scale(1.08); }
.js .plate--sea:not(.in) { clip-path: inset(100% 0 0 100%); transform: scale(1.08); }

/* ---------- Movimento ridotto: niente spostamenti, solo dissolvenze brevi ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .room { animation: none; transform: scale(1.04); }
  .js .reveal { transition: opacity 300ms ease; }
  .js .reveal:not(.in) { transform: none; }
  .js .plate { transition: opacity 300ms ease; }
  .js .plate--sky:not(.in), .js .plate--sea:not(.in) { clip-path: none; transform: none; opacity: 0; }
  .btn, .platforms__list a, .social a, .arrow { transition: background-color 200ms ease, stroke 200ms ease; }
}
