:root {
  --gh: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z'/></svg>");
  --bg: #070b16;
  --bg-2: #0d1426;
  --card: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef2ff;
  --muted: #9aa6c4;
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --grad: linear-gradient(110deg, var(--cyan), var(--blue) 45%, var(--violet));
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; touch-action: pan-x pan-y; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before, body::after { content: ''; position: fixed; pointer-events: none; z-index: -1; }
body::before {
  inset: -25%;
  background:
    radial-gradient(34rem 26rem at 78% 12%, rgba(59, 130, 246, 0.30), transparent 62%),
    radial-gradient(30rem 24rem at 12% 30%, rgba(139, 92, 246, 0.24), transparent 62%),
    radial-gradient(28rem 22rem at 55% 85%, rgba(34, 211, 238, 0.16), transparent 62%);
  animation: aurora 26s ease-in-out infinite alternate;
}
body::after {
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1.4px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000 20%, transparent 75%);
  animation: grid-drift 40s linear infinite;
}
h1, h2, h3 { font-family: 'Space Grotesk', 'Inter', sans-serif; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
a { color: inherit; }
img { max-width: 100%; }

.wrap { width: min(1120px, 100% - 3rem); margin-inline: auto; }
.grad { background: linear-gradient(100deg, var(--cyan), var(--blue), var(--violet), var(--blue), var(--cyan)); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: flow 7s linear infinite; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(7, 11, 22, 0.7);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: 0.9rem; gap: 1rem; }
.brand { font-family: 'Space Grotesk', sans-serif; font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 0.6rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 0.95rem; }
.nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 0.5rem 0.85rem; border-radius: 99px; font-size: 0.95rem; transition: color .2s, background .2s; }
.nav a:hover, .nav .active a { color: var(--text); background: var(--card); }
.nav a.nav-cta { color: #fff; background: var(--grad); background-origin: border-box; font-weight: 600; margin-left: 0.4rem; }

/* Buttons */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.9rem 1.5rem; border-radius: 99px; font-weight: 600; text-decoration: none; transition: transform .2s, box-shadow .2s, background .2s; border: 1px solid transparent; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--grad); background-origin: border-box; background-clip: border-box; border-color: transparent; color: #fff; box-shadow: 0 10px 40px -10px rgba(59, 130, 246, 0.8); }
.btn-primary::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%); transform: translateX(-120%); animation: shine 4.5s ease-in-out infinite 1.5s; pointer-events: none; }
.btn-primary:hover::after { animation-duration: 1.2s; }
.btn-ghost { border-color: var(--line); background: var(--card); color: var(--text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); }

/* Hero */
.hero { padding-block: clamp(3rem, 8vw, 6.5rem); }
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0.9rem; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--muted); font-size: 0.85rem; margin-bottom: 1.5rem; }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); animation: pulse 2s infinite; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
.hero .lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 34rem; margin: 1.5rem 0 2rem; }
.hero .actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.platforms { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 2.5rem; color: var(--muted); font-size: 0.85rem; }
.platforms span { padding: 0.3rem 0.8rem; border: 1px solid var(--line); border-radius: 99px; }

/* Phone mockup */
.stage { position: relative; display: grid; place-items: center; min-height: 480px; }
.stage::before { content: ''; position: absolute; width: 380px; height: 380px; border-radius: 50%; background: var(--grad); filter: blur(90px); opacity: 0.35; }
.phone { position: relative; width: 250px; height: 500px; border-radius: 40px; padding: 10px; background: linear-gradient(160deg, #26304f, #0c1226); border: 1px solid rgba(255, 255, 255, 0.18); box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.7); animation: float 6s ease-in-out infinite; transform: rotate(-4deg); }
.screen { height: 100%; border-radius: 31px; background: linear-gradient(180deg, #111a33, #0a0f20); overflow: hidden; padding: 1.1rem; display: flex; flex-direction: column; gap: 0.8rem; position: relative; }
.screen::before { content: ''; position: absolute; top: 8px; left: 50%; width: 70px; height: 18px; border-radius: 12px; background: #000; transform: translateX(-50%); }
.s-title { margin-top: 1.4rem; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.15rem; }
.s-sub { font-size: 0.72rem; color: var(--muted); margin-top: -0.5rem; }
.s-hero { height: 110px; border-radius: 18px; background: var(--grad); display: flex; align-items: flex-end; padding: 0.8rem; font-weight: 700; font-size: 0.85rem; }
.s-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-size: 0.75rem; }
.s-row i { width: 30px; height: 30px; border-radius: 10px; flex: none; }
.s-row:nth-of-type(1) i { background: #3b82f6; }
.s-row:nth-of-type(2) i { background: #8b5cf6; }
.s-row:nth-of-type(3) i { background: #22d3ee; }
.s-row small { display: block; color: var(--muted); font-size: 0.65rem; }
.chip { position: absolute; padding: 0.6rem 0.9rem; border-radius: 14px; background: rgba(13, 20, 38, 0.85); border: 1px solid var(--line); backdrop-filter: blur(10px); font-size: 0.8rem; font-weight: 600; box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6); }
.chip.a { top: 14%; left: -2%; animation: float 5s ease-in-out infinite reverse; }
.chip.b { bottom: 16%; right: -2%; animation: float 7s ease-in-out infinite; }

/* Sections */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section-head { max-width: 40rem; margin-bottom: 2.5rem; }
.kicker { color: var(--cyan); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.8rem; }
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
.section-head p { color: var(--muted); font-size: 1.1rem; margin: 1rem 0 0; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; transition: transform .25s, border-color .25s, background .25s; }
.card:hover { transform: translateY(-5px); border-color: rgba(96, 165, 250, 0.5); background: rgba(255, 255, 255, 0.06); }
.icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.35); margin-bottom: 1.1rem; }
.card h3 { font-size: 1.3rem; margin-bottom: 0.6rem; }
.card p { color: var(--muted); margin: 0; }

/* Case study cards */
.case { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-decoration: none; }
.case-link { display: flex; flex-direction: column; flex: 1; text-decoration: none; color: inherit; }
.case-actions { padding: 0 1.5rem 1.5rem; }
.btn-sm { padding: 0.55rem 1.1rem; font-size: 0.9rem; }
.btn-lg { padding: 1.05rem 2rem; font-size: 1.1rem; }
.btn-demo { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55), 0 12px 36px -10px rgba(59, 130, 246, 0.9); animation: demo-glow 2.4s ease-out infinite; }
.case-actions .btn-demo { display: flex; justify-content: center; width: 100%; padding: 0.95rem 1.2rem; font-size: 1.02rem; }
.play { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: rgba(255, 255, 255, 0.95); color: #1d4ed8; font-size: 0.6rem; padding-left: 2px; }
.btn-github { background: #000; color: #fff; border-color: rgba(255, 255, 255, 0.28); }
.btn-github:hover { background: #161b22; border-color: rgba(255, 255, 255, 0.55); }
.gh-icon { width: 1.15em; height: 1.15em; flex: none; background: currentColor; -webkit-mask: var(--gh) center / contain no-repeat; mask: var(--gh) center / contain no-repeat; }
.site-footer a.btn { color: #fff; }
.case-thumb { height: 190px; display: grid; place-items: center; position: relative; font-family: 'Space Grotesk', sans-serif; font-size: 4.5rem; font-weight: 700; color: rgba(255, 255, 255, 0.92); }
.case-thumb.g0 { background: linear-gradient(135deg, #2563eb, #22d3ee); }
.case-thumb.g1 { background: linear-gradient(135deg, #7c3aed, #ec4899); }
.case-thumb.g2 { background: linear-gradient(135deg, #059669, #22d3ee); }
.case-thumb.g3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.case-thumb .live { position: absolute; top: 12px; right: 12px; font-family: 'Inter', sans-serif; font-size: 0.72rem; font-weight: 600; padding: 0.25rem 0.65rem; border-radius: 99px; background: rgba(0, 0, 0, 0.35); }
.case-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.case-body h3 { font-size: 1.3rem; }
.case-body p { color: var(--muted); margin: 0; }
.more { margin-top: auto; padding-top: 0.6rem; color: var(--cyan); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0.3rem 0 0; list-style: none; }
.tags li { font-size: 0.75rem; padding: 0.2rem 0.65rem; border-radius: 99px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); color: var(--muted); }

.case-thumb .live.status-sviluppata { background: rgba(5, 150, 105, 0.85); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; color: var(--muted); font-size: 1.05rem; }
.checks li { position: relative; padding-left: 1.9rem; }
.checks li::before { content: '✓'; position: absolute; left: 0; top: 0.1rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: #fff; background: var(--grad); }
.checks.todo li::before { content: '→'; background: var(--card); border: 1px solid var(--line); color: var(--cyan); }

/* Process */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; counter-reset: step; }
.step { position: relative; padding: 1.6rem; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.step::before { counter-increment: step; content: '0' counter(step); display: block; font-family: 'Space Grotesk', sans-serif; font-size: 2.4rem; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 0.6rem; }
.step h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.step p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* CTA */
.cta { text-align: center; padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem; border-radius: 28px; border: 1px solid var(--line); background: radial-gradient(40rem 20rem at 50% 0%, rgba(59, 130, 246, 0.3), transparent 70%), var(--bg-2); }
.cta h2 { font-size: clamp(2rem, 5vw, 3.2rem); max-width: 40rem; margin: 0 auto 1rem; }
.cta p { color: var(--muted); max-width: 32rem; margin: 0 auto 2rem; font-size: 1.1rem; }

/* Inner pages */
.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) 1rem; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.page-head .lead { color: var(--muted); font-size: 1.2rem; max-width: 40rem; margin-top: 1rem; }
.prose { max-width: 42rem; }
.prose h2 { font-size: 1.6rem; margin: 2.2rem 0 0.6rem; }
.prose p { color: var(--muted); font-size: 1.08rem; }
.back { display: inline-block; margin-top: 2.5rem; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }
.hero-case { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 2rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding-block: 2rem; color: var(--muted); font-size: 0.9rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer a { text-decoration: none; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.site-footer a:hover { color: var(--text); }

.stage { perspective: 1100px; }
.phone { transform: rotate(-4deg) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .25s ease-out; }
.ring { position: absolute; border-radius: 50%; border: 1px dashed rgba(148, 163, 184, 0.28); pointer-events: none; animation: spin 40s linear infinite; }
.ring.r1 { width: 380px; height: 380px; }
.ring.r2 { width: 520px; height: 520px; animation-duration: 70s; animation-direction: reverse; border-style: solid; border-color: rgba(148, 163, 184, 0.12); }
.ring i { position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }
.s-hero { background: linear-gradient(120deg, var(--cyan), var(--blue), var(--violet), var(--cyan)); background-size: 250% 100%; animation: flow 6s linear infinite; }
.s-row { animation: slide-in .7s both; }
.s-row:nth-of-type(1) { animation-delay: .6s; }
.s-row:nth-of-type(2) { animation-delay: .8s; }
.s-row:nth-of-type(3) { animation-delay: 1s; }
.chip.b { animation: float 7s ease-in-out infinite, pop .6s 1.2s both; }
.chip.a { animation: float 5s ease-in-out infinite reverse, pop .6s 1.5s both; }

/* Spotlight che segue il mouse */
.card { position: relative; }
.card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s; background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(96, 165, 250, 0.18), transparent 60%); }
.card:hover::after { opacity: 1; }
.case:hover .case-thumb { filter: saturate(1.25); }
.case-thumb { transition: filter .3s; animation: flow-diag 9s ease-in-out infinite alternate; }
.case-thumb.g0, .case-thumb.g1, .case-thumb.g2, .case-thumb.g3 { background-size: 160% 160%; }

/* Comparsa allo scroll (solo se JS attivo) */
.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity .4s ease-out, transform .4s ease-out; transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

@keyframes aurora { 0% { transform: translate3d(-3%, -2%, 0) rotate(0deg) scale(1); } 100% { transform: translate3d(4%, 3%, 0) rotate(8deg) scale(1.12); } }
@keyframes grid-drift { to { background-position: 34px 34px; } }
@keyframes flow { to { background-position: -220% 0; } }
@keyframes flow-diag { 0% { background-position: 0% 0%; } 100% { background-position: 100% 100%; } }
@keyframes shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; scale: .7; } to { opacity: 1; scale: 1; } }
@keyframes demo-glow { 0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.6), 0 12px 36px -10px rgba(59, 130, 246, 0.9); } 70%, 100% { box-shadow: 0 0 0 14px rgba(96, 165, 250, 0), 0 12px 36px -10px rgba(59, 130, 246, 0.9); } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -14px; } }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hero .wrap > div:first-child > * { animation: rise .4s ease-out both; }
.hero .wrap > div:first-child > :nth-child(2) { animation-delay: .04s; }
.hero .wrap > div:first-child > :nth-child(3) { animation-delay: .08s; }
.hero .wrap > div:first-child > :nth-child(4) { animation-delay: .12s; }
.hero .wrap > div:first-child > :nth-child(5) { animation-delay: .16s; }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .stage { min-height: 440px; }
  .grid-3 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .nav a { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
  .brand span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1 !important; transform: none !important; }
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
