/* Heartly · pagina di presentazione (stile "monitor cardiaco", come l'app) */

@font-face {
    font-family: 'Inter';
    src: url('/fonts/inter-latin.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --bg: #12030a;
    --bg-2: #1a0510;
    --accent: #e0336f;
    --accent-hover: #f0437f;
    --glow: #ff4f8b;
    --pink-soft: #ff8fb3;
    --text: #fff;
    --muted: rgb(255 255 255 / 0.66);
    --faint: rgb(255 255 255 / 0.42);
    --line: rgb(255 255 255 / 0.09);
    --card: linear-gradient(160deg, rgb(255 255 255 / 0.065), rgb(255 255 255 / 0.02));
    --radius: 1.25rem;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background:
        radial-gradient(70rem 45rem at 85% -10%, rgb(150 20 70 / 0.35), transparent 60%),
        radial-gradient(60rem 40rem at 0% 40%, rgb(110 15 55 / 0.22), transparent 60%),
        var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; color: var(--pink-soft); background: rgb(224 51 111 / 0.12); padding: 0.1em 0.4em; border-radius: 0.35em; }

.wrap { width: min(1180px, 100% - 3rem); margin-inline: auto; }

/* --- Pulsanti ------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.85rem 1.4rem; border-radius: 0.85rem;
    background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
    box-shadow: 0 14px 34px -14px rgb(224 51 111 / 0.9);
    transition: background-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 18px 40px -14px rgb(224 51 111 / 1); }
.btn-small { padding: 0.55rem 1rem; font-size: 0.9rem; }
.btn-large { padding: 1rem 1.8rem; font-size: 1.05rem; }
.btn-ghost { background: rgb(255 255 255 / 0.06); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: rgb(255 255 255 / 0.1); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18); }

/* --- Navigazione ---------------------------------------------------- */

.nav {
    position: sticky; top: 0; z-index: 10;
    background: rgb(18 3 10 / 0.8);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 2rem; height: 4.5rem; }
.brand img { height: 30px; width: auto; }
.nav-links { display: flex; gap: 1.75rem; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 0.95rem; transition: color 0.2s; }
.nav-links a:hover { color: #fff; }

/* Selettore lingua: sempre visibile, anche su telefono */
.lang { display: flex; gap: 0.15rem; padding: 0.2rem; border-radius: 999px; background: rgb(255 255 255 / 0.05); box-shadow: inset 0 0 0 1px var(--line); }
.lang a { padding: 0.3rem 0.55rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; transition: color 0.2s, background 0.2s; }
.lang a:hover { color: #fff; }
.lang a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / 0.12); }

/* --- Hero ----------------------------------------------------------- */

.hero { position: relative; overflow: hidden; padding: 6.5rem 0 0; }

.grid-bg {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgb(255 255 255 / 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 0.035) 1px, transparent 1px),
        linear-gradient(rgb(255 255 255 / 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 0.015) 1px, transparent 1px);
    background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
    mask-image: radial-gradient(ellipse at 50% 30%, black 25%, transparent 75%);
    pointer-events: none;
}

.ecg {
    position: absolute; left: 0; right: 0; top: 13rem; width: 100%; height: 14rem; pointer-events: none;
    /* Al centro c'è il testo: il tracciato si vede pieno solo ai lati */
    mask-image: linear-gradient(90deg, black 0 18%, rgb(0 0 0 / 0.12) 30% 70%, black 82% 100%);
}
.ecg path { fill: none; stroke-linejoin: round; }
.ecg-base { stroke: rgb(255 90 140 / 0.12); stroke-width: 2; }
.ecg-trace {
    stroke: var(--glow); stroke-width: 2.5; stroke-linecap: round;
    stroke-dasharray: 140 860; stroke-dashoffset: 1000;
    filter: drop-shadow(0 0 6px rgb(255 79 139 / 0.9)) drop-shadow(0 0 18px rgb(255 79 139 / 0.5));
    animation: sweep 4.2s linear infinite;
}
@keyframes sweep { to { stroke-dashoffset: 0; } }

.hero-inner { position: relative; text-align: center; max-width: 860px; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 0.6rem; margin: 0 0 1.75rem;
    padding: 0.4rem 1rem; border-radius: 999px;
    background: rgb(255 255 255 / 0.05); box-shadow: inset 0 0 0 1px var(--line);
    color: var(--muted); font-size: 0.85rem;
}
.pulse { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 0 rgb(255 79 139 / 0.7); animation: pulse 0.833s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(255 79 139 / 0.7); } 100% { box-shadow: 0 0 0 10px rgb(255 79 139 / 0); } }

h1 { margin: 0; font-size: clamp(2.8rem, 7vw, 5.2rem); line-height: 1.02; font-weight: 800; letter-spacing: -0.035em; }
h1 span { color: var(--glow); }
.lead { margin: 1.75rem auto 0; max-width: 640px; font-size: 1.15rem; color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; justify-content: center; margin-top: 2.25rem; }

/* --- Cornici per gli screenshot ------------------------------------- */

.frame {
    margin: 0; border-radius: var(--radius); overflow: hidden;
    background: #1b0712;
    box-shadow: 0 0 0 1px var(--line), 0 40px 100px -40px rgb(0 0 0 / 0.9), 0 30px 120px -60px rgb(224 51 111 / 0.45);
}
.frame img { display: block; width: 100%; height: auto; }
.frame-bar { display: flex; align-items: center; gap: 0.45rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 0.03); }
.frame-bar i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: rgb(255 255 255 / 0.14); }
.frame-bar span { margin-left: 1rem; font-size: 0.78rem; color: var(--faint); }

/* Hero: lo schermo parte inclinato all'indietro e si raddrizza scorrendo */
.stage { perspective: 2200px; perspective-origin: 50% 0; }
.frame-hero { margin-top: 4.5rem; position: relative; transform-origin: 50% 0; transform: rotateX(16deg) scale(0.94); animation: hero-in 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.3s backwards; }
.frame-hero::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / 0.07) 50%, transparent 65%);
    background-size: 250% 100%; animation: glare 7s ease-in-out 1.6s infinite;
}
.stage-hero { position: relative; }
.stage-hero::before {
    content: ''; position: absolute; inset: 0 10% auto; height: 60%; top: -10%;
    background: radial-gradient(closest-side, rgb(224 51 111 / 0.35), transparent);
    filter: blur(40px);
}
@keyframes hero-in { from { opacity: 0; transform: translateY(80px) rotateX(38deg) scale(0.88); } }
@keyframes glare { 0%, 60% { background-position: 120% 0; } 100% { background-position: -120% 0; } }

/* Funzionalità: schermate ruotate verso il testo, si raddrizzano al passaggio del mouse */
.feature .stage { perspective: 1800px; }
.feature .frame { transform: rotateY(-13deg) rotateX(5deg); transform-origin: 0 50%; transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.8s; }
.feature-reverse .frame { transform: rotateY(13deg) rotateX(5deg); transform-origin: 100% 50%; }
.feature .frame:hover { transform: none; }

.phones { display: flex; justify-content: center; gap: 1.5rem; perspective: 1600px; }
.phone {
    margin: 0; width: min(240px, 42%); border-radius: 2.2rem; overflow: hidden;
    box-shadow: 0 0 0 6px #241019, 0 0 0 7px var(--line), 0 40px 80px -30px rgb(0 0 0 / 0.9), 0 30px 90px -50px rgb(224 51 111 / 0.6);
    transform: rotateY(16deg) rotateZ(-2deg); animation: float 7s ease-in-out infinite;
}
.phone img { display: block; width: 100%; height: auto; }
.phone-offset { margin-top: 3.5rem; transform: rotateY(-16deg) rotateZ(2deg); animation-name: float-b; animation-delay: -3.5s; }
@keyframes float { 50% { transform: translateY(-14px) rotateY(10deg) rotateZ(-1deg); } }
@keyframes float-b { 50% { transform: translateY(-14px) rotateY(-10deg) rotateZ(1deg); } }

/* Dove il browser lo supporta, le schermate entrano mentre si scorre (nessuno script) */
@supports (animation-timeline: view()) {
    .frame-hero { animation: hero-scroll linear both; animation-timeline: view(); animation-range: entry 0% cover 45%; }
    @keyframes hero-scroll { from { transform: rotateX(30deg) scale(0.9); } to { transform: rotateX(0deg) scale(1); } }
    .feature .stage { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
    @keyframes reveal { from { opacity: 0; transform: translateY(70px) scale(0.96); } }
    .feature-text { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% cover 30%; }
}

/* --- In breve ------------------------------------------------------- */

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 5rem; border-radius: var(--radius); overflow: hidden; background: var(--line); box-shadow: 0 0 0 1px var(--line); }
.facts div { background: var(--bg-2); padding: 1.6rem 1.5rem; }
.facts strong { display: block; font-size: 1.35rem; letter-spacing: -0.02em; }
.facts span { color: var(--muted); font-size: 0.9rem; }

/* --- Sezioni -------------------------------------------------------- */

.section-head { max-width: 720px; }
.kicker { margin: 0 0 0.75rem; color: var(--pink-soft); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
h2 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -0.03em; font-weight: 800; }
h3 { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.15; letter-spacing: -0.02em; font-weight: 750; }
h4 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.section-head p:not(.kicker) { color: var(--muted); font-size: 1.1rem; margin: 1rem 0 0; }

.features { padding: 8rem 0 4rem; }

.feature { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 4.5rem; align-items: center; margin-top: 7rem; }
.feature-reverse { grid-template-columns: 1.15fr 0.85fr; }
.feature-reverse .feature-text { order: 2; }
.feature-text p { color: var(--muted); margin: 1rem 0 0; }

.checks { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 0.65rem; }
.checks li { position: relative; padding-left: 1.75rem; color: rgb(255 255 255 / 0.82); }
.checks li::before {
    content: ''; position: absolute; left: 0; top: 0.5em; width: 0.9rem; height: 0.55rem;
    border-left: 2px solid var(--glow); border-bottom: 2px solid var(--glow); transform: rotate(-45deg);
}
.checks em { font-style: normal; color: var(--pink-soft); }

.feature-phones { grid-template-columns: 1fr 1fr; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-top: 7rem; }
.tile { padding: 1.6rem; border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.tile p { margin: 0; color: var(--muted); font-size: 0.93rem; }

/* --- Sicurezza ------------------------------------------------------ */

.security { padding: 6rem 0; }
.security-inner {
    padding: 4rem; border-radius: 2rem;
    background: radial-gradient(50rem 30rem at 100% 0%, rgb(224 51 111 / 0.14), transparent 60%), var(--card);
    box-shadow: inset 0 0 0 1px var(--line);
}
.security-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2.5rem 2rem; margin-top: 3rem; }
.security-grid h4 { display: flex; align-items: center; gap: 0.6rem; }
.security-grid h4::before { content: ''; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--glow); box-shadow: 0 0 10px var(--glow); }
.security-grid p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* --- Contatti ------------------------------------------------------- */

.cta { padding: 6rem 0 8rem; }
.cta-inner { text-align: center; max-width: 720px; }
.cta-inner p { color: var(--muted); font-size: 1.15rem; margin: 1rem 0 2.25rem; }
.cta-mail { margin-top: 1.25rem !important; font-size: 0.95rem !important; }
.cta-mail a { color: var(--pink-soft); }

.footer { border-top: 1px solid var(--line); padding: 2.5rem 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer p { margin: 0; color: var(--faint); font-size: 0.85rem; }
.footer a { color: var(--muted); }

/* --- Schermi piccoli ------------------------------------------------ */

@media (max-width: 960px) {
    .feature, .feature-phones, .feature-reverse { grid-template-columns: 1fr; gap: 2.5rem; margin-top: 5rem; }
    .feature-reverse .feature-text { order: 0; }
    .feature .frame, .feature-reverse .frame { transform: rotateX(6deg); transform-origin: 50% 0; }
    .facts, .tiles { grid-template-columns: repeat(2, 1fr); }
    .security-grid { grid-template-columns: repeat(2, 1fr); }
    .security-inner { padding: 2.5rem 1.75rem; }
}

@media (max-width: 640px) {
    .nav-links { display: none; }
    .nav-inner { justify-content: space-between; gap: 1rem; }
    .lang { margin-left: auto; }
    .hero { padding-top: 4rem; }
    .ecg { top: 10rem; height: 10rem; }
    .facts, .tiles, .security-grid { grid-template-columns: 1fr; }
    .frame-hero { margin-top: 3rem; }
    .features { padding-top: 5rem; }
}

/* Sui telefoni stretti il pulsante demo resta nell'hero */
@media (max-width: 480px) {
    .nav-cta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .ecg-trace, .pulse, .frame-hero, .frame-hero::after, .phone, .feature .stage, .feature-text { animation: none !important; }
    .feature .frame { transition: none; }
    .ecg-trace { stroke-dasharray: none; }
}
