/* ─────────────────────────────────────────────
   CardSwap — landing
   Palette derivata dall'app (constants/theme.ts):
   bg #1a2026 · card #212a33 · accent #4cb2ff
   yellow #f9e027 / #f9ae29 · purple #333574
   ───────────────────────────────────────────── */

@font-face {
  font-family: 'Lilita One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/lilita-one-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: 'Lilita One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/lilita-one-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0;
}

:root {
  --bg: #1a2026;
  --bg-2: #212a33;
  --text: #ffffff;
  --hint: #8794a1;
  --accent: #4cb2ff;
  --yellow: #f9e027;
  --yellow-dark: #f9ae29;
  --purple: #333574;
  --grad: linear-gradient(145deg, #333574 0%, #495fa8 52%, #4fa9de 100%);
  --display: 'Lilita One', 'Arial Black', sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --wrap: 1100px;
}

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

html.js { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

::selection { background: var(--yellow); color: #1a2026; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

/* ── Header ── */
.site-head {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 1.25rem clamp(1.25rem, 4vw, 2.5rem);
}

.site-head .brand img { height: 46px; width: auto; }

.btn {
  display: inline-block;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  color: #1a2026;
  background: var(--yellow);
  border: 3px solid #1a2026;
  border-radius: 999px;
  padding: 0.55em 1.4em;
  text-decoration: none;
  box-shadow: 0 4px 0 #1a2026, 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  background: var(--yellow-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #1a2026, 0 14px 28px rgba(0, 0, 0, 0.4);
}

.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #1a2026; }

/* CTA flottante (compare dopo l'hero) */
.float-cta {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.float-cta.show { opacity: 1; pointer-events: auto; transform: none; }

/* ── Parole giganti sullo sfondo ── */
.word {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font-family: var(--display);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.07);
  font-size: clamp(6rem, 20vw, 22rem);
}

.word > span { display: inline-block; will-change: transform; }

/* ── Hero ── */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 6rem;
  padding-bottom: 4rem;
  background:
    radial-gradient(900px 600px at 85% 20%, rgba(51, 53, 116, 0.55), transparent 65%),
    radial-gradient(700px 500px at 10% 85%, rgba(76, 178, 255, 0.12), transparent 60%),
    var(--bg);
}

.hero .word-1 { top: 8%; left: -4vw; }
.hero .word-2 { bottom: 6%; right: -6vw; }

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: center;
  gap: 2rem;
  width: 100%;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.7rem, 6.5vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.hero h1 .y { color: var(--yellow); }
.hero h1 .b { color: var(--accent); }

.hero-sub {
  margin-top: 1.5rem;
  max-width: 34em;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
}

.hero-sub strong { color: var(--yellow); font-weight: 600; }

.hero .stores { margin-top: 2.25rem; }

.hero-note {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--hint);
}

.hero-kyub { justify-self: center; position: relative; }

.hero-kyub img {
  width: min(340px, 34vw);
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.5));
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-16px) rotate(1deg); }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 1;
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--hint);
  text-decoration: none;
  animation: cue 2.2s ease-in-out infinite;
}

@keyframes cue {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ── Store badges ── */
.stores {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.store-link {
  display: inline-flex;
  align-items: center;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.store-link:hover { transform: translateY(-3px); opacity: 0.88; }

.store-link img { height: 52px; width: auto; display: block; }

html.is-ios .store-android, html.is-android .store-ios { display: none; }

/* ── Titolo sezione "come funziona" ── */
.how-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  color: var(--hint);
  padding: clamp(3rem, 8vw, 6rem) 0 0;
}

.how-title em { font-style: normal; color: var(--text); }

/* ── Step 01–05 ── */
.step {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 9vw, 7.5rem) 0;
}

.step .word { top: 50%; left: 50%; margin-top: -0.5em; }

.step-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.step.flip .step-copy { order: 2; }
.step.flip .tile { order: 1; }

.step h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 5.4vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: 0.01em;
}

.step h2 .num { color: var(--yellow); display: block; }

.step p {
  margin-top: 1.4rem;
  max-width: 30em;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
}

.step p strong { color: var(--text); font-weight: 600; }

/* Tile telefono: lo sfondo viola è già nello screenshot (gradiente brand) */
.tile {
  justify-self: center;
  width: min(400px, 100%);
  border-radius: 28px;
  overflow: hidden;
  background: var(--purple);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 30px 60px rgba(0, 0, 0, 0.45);
  transform: rotate(2deg);
}

.step.flip .tile { transform: rotate(-2deg); }

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

/* ── Marquee feature ── */
.marquee {
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-2);
  padding: 1.1rem 0;
  margin: clamp(2rem, 6vw, 4rem) 0 0;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marq 38s linear infinite;
}

.marquee-set { display: flex; }

.marquee-set > span {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: 0.03em;
  color: var(--hint);
  white-space: nowrap;
}

.marquee-set > span::after {
  content: '✦';
  color: var(--yellow);
  margin: 0 1.4rem;
}

@keyframes marq { to { transform: translateX(-50%); } }

/* ── Download / footer ── */
.download {
  position: relative;
  overflow: hidden;
  background: var(--grad);
  padding: clamp(4rem, 10vw, 7rem) 0 7rem;
  text-align: center;
}

.download::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('bg.webp') center / cover no-repeat;
  opacity: 0.14;
}

.download::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 30, 0.25);
}

.download > * { position: relative; z-index: 1; }

.download h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 1;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.35);
}

.download .sub {
  margin: 1rem auto 2.25rem;
  max-width: 36em;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  line-height: 1.55;
}

.download .stores { justify-content: center; }

.download-kyub {
  position: absolute;
  right: clamp(0.5rem, 6vw, 5rem);
  bottom: -26px;
  width: clamp(110px, 16vw, 190px);
  transform: rotate(-6deg);
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.4));
  z-index: 1;
}

.foot {
  margin-top: clamp(3.5rem, 7vw, 5.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
}

.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.4rem; }

.foot a { color: rgba(255, 255, 255, 0.8); text-decoration: none; }
.foot a:hover { color: #fff; text-decoration: underline; }

.foot .tg { color: rgba(255, 255, 255, 0.6); }
.foot .tg a { color: rgba(255, 255, 255, 0.75); text-decoration: underline; }

/* ── Reveal on scroll (solo con JS attivo: senza JS tutto resta visibile) ── */
html.js .reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
}

html.js .reveal.in-view { opacity: 1; transform: none; }

html.js .tile.reveal { transform: translateY(40px) rotate(5deg); }
html.js .step.flip .tile.reveal { transform: translateY(40px) rotate(-5deg); }
html.js .tile.reveal.in-view { transform: rotate(2deg); }
html.js .step.flip .tile.reveal.in-view { transform: rotate(-2deg); }

/* ── Mobile ── */
@media (max-width: 820px) {
  .site-head .brand img { height: 36px; }

  .hero { padding-top: 7rem; }

  .hero-inner { grid-template-columns: 1fr; position: static; }

  /* Kyub sbuca dall'angolo in basso a destra dell'hero */
  .hero-kyub {
    position: absolute;
    bottom: -30px;
    right: -22px;
    z-index: 0;
    transform: rotate(-9deg);
  }
  .hero-kyub img { width: clamp(110px, 34vw, 150px); animation: none; }
  .hero-copy { position: relative; z-index: 1; }

  .step-grid { grid-template-columns: 1fr; }
  .step.flip .step-copy { order: 0; }
  .step.flip .tile { order: 0; }

  .tile { width: min(340px, 88vw); }

  .download-kyub { display: none; }
}

@media (max-width: 480px) {
  .site-head .cta-head { display: none; }
  .store-link img { height: 46px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html.js { scroll-behavior: auto; }
  .hero-kyub img, .scroll-cue { animation: none; }
  .marquee-track { animation: none; width: auto; }
  .marquee-set { flex-wrap: wrap; justify-content: center; }
  .marquee-set[aria-hidden] { display: none; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  html.js .tile.reveal, html.js .tile.reveal.in-view { transform: rotate(2deg); }
  html.js .step.flip .tile.reveal, html.js .step.flip .tile.reveal.in-view { transform: rotate(-2deg); }
}
