/* Filo — vetrina. Identità dell'app: fondo notte, lime, stati colorati. */
@font-face { font-family: 'Selawik'; src: url('../assets/fonts/Selawik-Light.ttf') format('truetype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Selawik'; src: url('../assets/fonts/Selawik-Regular.ttf') format('truetype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Selawik'; src: url('../assets/fonts/Selawik-Bold.ttf') format('truetype'); font-weight: 600 900; font-display: swap; }

:root {
  --bg: #0d1218; --surface: #171e27; --surface-2: #1d2631; --border: #2b3542;
  --text: #f4f3ee; --muted: #a8b2c1; --accent: #d4ed98; --ink: #17210f;
  --seen: #69d391; --prog: #f2a65a; --re: #b594f6;
  --font: 'Segoe UI', 'Selawik', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
ol, ul { list-style: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Barra */
.bar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 14px clamp(16px, 4vw, 48px); background: rgba(13, 18, 24, .8); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(43, 53, 66, .6);
}
/* Ritorno al portfolio: lo stesso bottone tondo della campanella di Filo, con l'etichetta accanto */
.back-pill {
  justify-self: start; display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 16px 4px 4px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 700; font-size: 14px; text-decoration: none;
  transition: border-color .2s, background .2s, color .2s;
}
.bar .back-pill { padding: 4px; } /* in alto solo la freccia, senza testo */
.back-ic {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); border: 1.5px solid var(--border); transition: background .2s, border-color .2s;
}
.back-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.back-pill:hover { border-color: var(--accent); color: var(--accent); }
.back-pill:hover .back-ic { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.back-pill:hover .back-ic svg { transform: translateX(-3px); }
.logo { font-weight: 800; font-size: 26px; letter-spacing: -.03em; text-decoration: none; line-height: 1; }
.logo span { color: var(--accent); }
.bar .btn { justify-self: end; }

/* Pulsanti */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 14px 26px; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--ink); font-weight: 700; font-size: 16px; text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(212, 237, 152, .25); }
.btn-small { padding: 9px 18px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--muted); box-shadow: none; }
.btn-big { padding: 20px 40px; font-size: 20px; }

/* Il filo */
.thread-wrap { position: relative; }
.thread { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.thread path { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; }
#thread-path { stroke-width: 2.2; opacity: .85; }
/* Alone morbido intorno al filo */
#thread-glow { stroke-width: 9; opacity: .18; filter: blur(5px); }
/* L'ago luminoso in punta, che avanza scorrendo */
#thread-ago { fill: #fbffe9; opacity: 0; filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 14px rgba(212, 237, 152, .6)); transition: opacity .3s; }
main { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 0 clamp(34px, 7vw, 110px); }

.eyebrow { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px; }
h1, h2 { font-weight: 800; letter-spacing: -.035em; line-height: 1.02; }
h1 { font-size: clamp(44px, 6.1vw, 86px); }
h2 { font-size: clamp(36px, 5vw, 64px); }
h1 span, h2 span { color: var(--muted); font-weight: 300; }
.lead { color: var(--muted); font-size: clamp(17px, 1.6vw, 20px); max-width: 52ch; margin-top: 22px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 40px; align-items: center; min-height: calc(100vh - 60px); padding: 60px 0 80px; }
/* Telefono con le schermate reali dell'app */
.phone {
  justify-self: center; width: 300px; aspect-ratio: 390 / 844; margin: 0;
  border-radius: 40px; padding: 9px; background: #05080b;
  border: 2px solid var(--border); box-shadow: 0 40px 90px rgba(0, 0, 0, .6), 0 0 120px rgba(212, 237, 152, .08);
  transform: rotate(3deg); animation: float 7s ease-in-out infinite;
}
.phone img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 31px; }
@keyframes float { 50% { transform: rotate(3deg) translateY(-12px); } }

/* Galleria "Dentro l'app" */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 44px); align-items: start; }
.shot { margin: 0; display: grid; gap: 24px; justify-items: center; }
.shot:nth-child(2) { margin-top: 56px; }
.phone-sm { width: min(100%, 270px); transform: none; animation: none; border-radius: 36px; padding: 8px; }
.phone-sm img { border-radius: 28px; }
.shot:hover .phone-sm { transform: translateY(-6px); border-color: var(--accent); }
.phone-sm { transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .35s; }
.shot figcaption { text-align: center; color: var(--muted); font-size: 15px; max-width: 30ch; }
.shot figcaption b { display: block; color: var(--text); font-size: 19px; margin-bottom: 4px; }

/* Sezioni */
section { padding: 120px 0; }
.sec-head { max-width: 720px; margin-bottom: 56px; }

/* Funzioni */
.f-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.f { position: relative; padding: 32px; border-radius: 28px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.f-wide { grid-column: span 2; }
.f-n { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .1em; }
.f h3 { font-size: 26px; letter-spacing: -.02em; margin: 10px 0 10px; line-height: 1.15; }
.f p { color: var(--muted); max-width: 54ch; }
.genres { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.genres span { padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; background: rgba(212, 237, 152, calc(var(--s) * .9)); color: var(--ink); }
.genres span:nth-child(n+4) { color: var(--text); }
.notif { margin-top: 22px; display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.notif span { display: grid; line-height: 1.3; }
.notif small { color: var(--muted); font-size: 13px; }
.states { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.states span { padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink); }
.s-seen { background: var(--seen); } .s-prog { background: var(--prog); } .s-re { background: var(--re); } .s-pari { background: var(--accent); }

/* Finale */
.final { text-align: center; padding: 160px 0 140px; display: grid; justify-items: center; }
.final h2 { font-size: clamp(48px, 8vw, 112px); margin-bottom: 40px; }

.foot { border-top: 1px solid var(--border); padding: 40px clamp(16px, 4vw, 48px); display: grid; gap: 10px; justify-items: center; text-align: center; color: var(--muted); font-size: 15px; }
.foot a { color: var(--text); }
.foot .back-pill { margin-top: 10px; justify-self: center; }

/* Comparse */
.rv { opacity: 0; transform: translateY(26px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1); }
.rv.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rv { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 48px; gap: 64px; }
  .phone { transform: none; animation: none; width: 280px; }
  .shots { grid-template-columns: 1fr; gap: 56px; }
  .shot:nth-child(2) { margin-top: 0; }
  .f-grid { grid-template-columns: 1fr; }
  .f-wide { grid-column: auto; }
  section { padding: 90px 0; }
}
@media (max-width: 560px) {
  .cta .btn { flex: 1 1 100%; justify-content: center; }
}

/* ---------- Video dimostrativo: pulsante e popup ---------- */
.btn-play { font: inherit; font-weight: 700; cursor: pointer; }
.btn-play[hidden] { display: none; }
.play-ic { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; margin-left: -8px; }
.play-ic svg { width: 12px; height: 12px; fill: var(--accent); margin-left: 2px; }

.demo-modal {
  border: 0; padding: 0; background: transparent; color: var(--text); overflow: visible;
  max-width: none; max-height: none; width: auto;
  margin: auto; /* il reset globale azzera i margini: senza questo il popup non resta al centro */
}
.demo-modal[open] { display: grid; justify-items: center; gap: 16px; animation: demo-in .35s cubic-bezier(.2, .8, .2, 1); }
.demo-modal::backdrop { background: rgba(5, 8, 11, .82); backdrop-filter: blur(6px); }
@keyframes demo-in { from { opacity: 0; transform: translateY(18px) scale(.97); } }
/* Player panoramico: 16:9 sugli schermi orizzontali, 4:5 su quelli verticali */
.demo-frame {
  width: min(92vw, calc(80vh * 16 / 9), 1280px); aspect-ratio: 16 / 9;
  border-radius: 20px; overflow: hidden; background: var(--bg); border: 1px solid var(--border);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .7), 0 0 140px rgba(212, 237, 152, .1);
}
.demo-frame video { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--bg); }
@media (max-aspect-ratio: 1 / 1) {
  .demo-frame { width: min(92vw, calc(76vh * 4 / 5)); aspect-ratio: 4 / 5; }
}
.demo-close {
  position: fixed; top: 20px; right: 20px; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border); color: var(--text); display: grid; place-items: center;
  transition: border-color .2s, color .2s;
}
.demo-close:hover { border-color: var(--accent); color: var(--accent); }
.demo-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
@media (prefers-reduced-motion: reduce) { .demo-modal[open] { animation: none; } }
