/* CONVIA — landing teaser. Nessuna dipendenza: un foglio di stile, un font locale, un SVG. */

@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Token del pacchetto (docs/DESIGN_TOKENS.css) */
  --convia-navy: #05264f;
  --convia-green: #0d433b;
  --convia-mint: #2dc79f;
  --convia-white: #ffffff;
  --convia-text: #08244a;
  --convia-ambient: #dff6f2;
  --font-ui: "Manrope", "Inter", system-ui, sans-serif;
  --radius-pill: 999px;

  /* Valori rilevati dalla grafica approvata */
  --heading-color: #061a36;
  --accent-color: #049986;

  /*
   * Unità di scala: la grafica approvata è 1536 × 1024, quindi 1 unità = 1/100 della sua larghezza (15,36 px).
   * Tutta la composizione desktop è espressa in queste unità e si ridimensiona insieme, senza ritagli.
   */
  --u: min(1vw, 1.5vh);
}
@supports (height: 1svh) {
  :root { --u: min(1vw, 1.5svh); }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--convia-white);
  color: var(--convia-text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ───────── 01_background ───────── */

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden; /* ritaglia il piano e gli archi, che escono dall'SVG di proposito */
  background: linear-gradient(180deg, #ffffff 0%, #fefefe 60%, #fbfcfd 100%);
  isolation: isolate;
}

/* Fasci di luce diagonali, molto leggeri, sulla metà sinistra. */
.stage::before {
  content: "";
  position: absolute;
  inset: -10% -10% -10% -20%;
  z-index: -1;
  background:
    linear-gradient(122deg, transparent 24%, rgba(222, 229, 239, .34) 28%, transparent 33%),
    linear-gradient(122deg, transparent 36%, rgba(224, 231, 240, .30) 41%, transparent 46%),
    linear-gradient(122deg, transparent 49%, rgba(228, 234, 242, .22) 53%, transparent 57%);
  filter: blur(calc(var(--u) * 1.6));
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 45%, transparent 68%);
          mask-image: linear-gradient(90deg, #000 0%, #000 45%, transparent 68%);
  pointer-events: none;
}

/* ───────── Composizione desktop: stessa geometria della grafica, in unità --u ───────── */

.frame {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: calc(var(--u) * 66.6667); /* 1024 px a 1536 di larghezza */
  transform: translateY(-50%);
}

.art-wrap {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  aspect-ratio: 816 / 1024;
  pointer-events: none;
}

.art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible; /* piano e archi proseguono oltre il riquadro */
  z-index: 0;
}

/* Ordine dei piani: illustrazione (0) · testo (1) · sfera (2). */
.art--front { z-index: 2; }

.copy {
  position: absolute;
  left: calc(var(--u) * 10.42);  /* 160 px */
  top: calc(var(--u) * 14.2);    /* 218 px */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  z-index: 1;
}

/* ───────── 05_logo ───────── */

.logo {
  display: block;
  width: calc(var(--u) * 23.05); /* il wordmark misura 349 px nella grafica */
  height: auto;
  margin-left: calc(var(--u) * -0.27);
}

/* ───────── 06_heading ───────── */

.heading {
  margin: calc(var(--u) * 6.3) 0 0 calc(var(--u) * -0.26);
  color: var(--heading-color);
  font-size: calc(var(--u) * 6.25);
  font-weight: 600;
  line-height: .917;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

/* ───────── 07_tagline ───────── */

.tagline {
  margin: calc(var(--u) * 0.95) 0 0 calc(var(--u) * -0.13);
  color: var(--heading-color);
  font-size: calc(var(--u) * 2.93);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}

/* ───────── 08_accent ───────── */

.accent {
  display: block;
  width: calc(var(--u) * 4.82);  /* 74 px */
  height: calc(var(--u) * 0.36); /* 5,5 px */
  margin: calc(var(--u) * 1.67) 0 0 calc(var(--u) * 0.2);
  border-radius: var(--radius-pill);
  background: var(--accent-color);
}

/* ───────── Tablet verticale e mobile: testo sopra, illustrazione sotto ───────── */

@media (max-aspect-ratio: 11/10), (max-width: 700px) {
  :root { --u: clamp(3.4px, 1.72vw, 9.6px); }

  .stage {
    display: flex;
    flex-direction: column;
  }

  .stage::before {
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 40%, transparent 62%);
            mask-image: linear-gradient(180deg, #000 0%, #000 40%, transparent 62%);
  }

  .frame {
    position: relative;
    top: auto;
    height: auto;
    transform: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
  }

  .copy {
    position: relative;
    left: auto;
    top: auto;
    order: 1;
    padding: clamp(40px, 9vh, 96px) clamp(24px, 7.2vw, 72px) 0;
  }

  .logo { width: calc(var(--u) * 25); }
  .heading { margin: calc(var(--u) * 6.4) 0 0 calc(var(--u) * -0.26); font-size: calc(var(--u) * 6.6); }
  .tagline { margin: calc(var(--u) * 1.9) 0 0 calc(var(--u) * -0.13); font-size: calc(var(--u) * 3.02); }
  .accent { width: calc(var(--u) * 5.4); height: max(4px, calc(var(--u) * 0.42)); margin: calc(var(--u) * 2.1) 0 0; }

  /* L'illustrazione occupa lo spazio che resta, intera e ancorata in basso a destra. */
  .art-wrap {
    position: relative;
    right: auto;
    order: 2;
    flex: 1 1 0%;
    width: 100%;
    height: auto;
    min-height: min(92vw, 54vh);
    aspect-ratio: auto;
    margin-top: calc(var(--u) * 1.5);
  }
}

/* ───────── Animazione d'ingresso: la A compie un giro completo su se stessa ───────── */
/*
 * Giro di 360° attorno all'asse verticale, con i piedi fermi sul piano. La sfera non si muove.
 * Durata e ritardo si regolano qui sotto; per toglierla basta eliminare questo blocco.
 */
.hero-a {
  transform-box: view-box;
  transform-origin: 1028px 880px; /* centro della base della A, in coordinate dell'SVG */
  animation: hero-a-giro 1.9s linear .25s both, hero-a-comparsa .45s ease-out .25s both;
}

@keyframes hero-a-comparsa {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes hero-a-giro {
  0% { transform: scaleX(1.0000); }
  1.41% { transform: scaleX(0.9659); }
  2.86% { transform: scaleX(0.8660); }
  4.35% { transform: scaleX(0.7071); }
  5.90% { transform: scaleX(0.5000); }
  7.49% { transform: scaleX(0.2588); }
  9.14% { transform: scaleX(0.0000); }
  10.86% { transform: scaleX(-0.2588); }
  12.64% { transform: scaleX(-0.5000); }
  14.50% { transform: scaleX(-0.7071); }
  16.45% { transform: scaleX(-0.8660); }
  18.48% { transform: scaleX(-0.9659); }
  20.63% { transform: scaleX(-1.0000); }
  22.90% { transform: scaleX(-0.9659); }
  25.31% { transform: scaleX(-0.8660); }
  27.89% { transform: scaleX(-0.7071); }
  30.66% { transform: scaleX(-0.5000); }
  33.68% { transform: scaleX(-0.2588); }
  37.00% { transform: scaleX(-0.0000); }
  40.72% { transform: scaleX(0.2588); }
  44.97% { transform: scaleX(0.5000); }
  50.00% { transform: scaleX(0.7071); }
  56.32% { transform: scaleX(0.8660); }
  65.33% { transform: scaleX(0.9659); }
  100% { transform: scaleX(1.0000); }
}

/* ───────── Animazione d'ingresso: la sfera cade e rimbalza, dopo il giro della A ───────── */
/*
 * Parte quando la A si è fermata (--ball-delay). Tre rimbalzi sempre più bassi; a ogni impatto la sfera si
 * schiaccia e poi si allunga, come gomma. L'ombra sul piano si stringe quando la sfera è in alto.
 */
.hero-ball,
.hero-ball-shadow {
  --ball-delay: 2.05s;
  --ball-duration: 1.7s;
  transform-box: view-box;
}

.hero-ball {
  transform-origin: 1017px 903px; /* punto d'appoggio sul piano: lo schiacciamento parte da lì */
  animation: hero-ball-caduta var(--ball-duration) linear var(--ball-delay) both;
}

.hero-ball-shadow {
  transform-origin: 1030px 903px;
  animation: hero-ball-ombra var(--ball-duration) linear var(--ball-delay) both;
}

@keyframes hero-ball-caduta {
  0%    { opacity: 0; transform: translateY(-1100px) scale(.94, 1.08); animation-timing-function: cubic-bezier(.5, 0, .9, .45); }
  2%    { opacity: 1; }
  26%   { opacity: 1; transform: translateY(0) scale(.94, 1.08); animation-timing-function: ease-out; }
  30%   { transform: translateY(0) scale(1.24, .76); animation-timing-function: ease-in-out; }           /* primo impatto */
  35%   { transform: translateY(-26px) scale(.93, 1.09); animation-timing-function: cubic-bezier(.2, .6, .4, 1); }
  48%   { transform: translateY(-200px) scale(1, 1); animation-timing-function: cubic-bezier(.6, 0, .85, .5); }
  60%   { transform: translateY(0) scale(.97, 1.04); animation-timing-function: ease-out; }
  63%   { transform: translateY(0) scale(1.15, .85); animation-timing-function: ease-in-out; }           /* secondo impatto */
  67%   { transform: translateY(-12px) scale(.96, 1.05); animation-timing-function: cubic-bezier(.2, .6, .4, 1); }
  74.5% { transform: translateY(-78px) scale(1, 1); animation-timing-function: cubic-bezier(.6, 0, .85, .5); }
  82%   { transform: translateY(0) scale(.99, 1.02); animation-timing-function: ease-out; }
  84.5% { transform: translateY(0) scale(1.08, .92); animation-timing-function: ease-in-out; }           /* terzo impatto */
  90%   { transform: translateY(-24px) scale(1, 1); animation-timing-function: cubic-bezier(.6, 0, .85, .5); }
  95%   { transform: translateY(0) scale(1.03, .97); animation-timing-function: ease-out; }
  100%  { opacity: 1; transform: translateY(0) scale(1, 1); }
}

@keyframes hero-ball-ombra {
  0%    { opacity: 0;   transform: scale(.25); animation-timing-function: cubic-bezier(.5, 0, .9, .45); }
  26%   { opacity: 1;   transform: scale(1); }
  30%   { opacity: 1;   transform: scale(1.12); }
  48%   { opacity: .55; transform: scale(.72); }
  60%   { opacity: 1;   transform: scale(1); }
  63%   { opacity: 1;   transform: scale(1.07); }
  74.5% { opacity: .8;  transform: scale(.88); }
  82%   { opacity: 1;   transform: scale(1); }
  90%   { opacity: .93; transform: scale(.96); }
  100%  { opacity: 1;   transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-a, .hero-ball, .hero-ball-shadow { animation: none; }
}
