:root {
    --navy: #0b1b34;
    --navy-2: #12294d;
    --blue: #1f6feb;
    --cyan: #19c3d6;
    --orange: #ff9a1f;
    --ink: #1c2738;
    --muted: #5d6b82;
    --soft: #f4f7fb;
    --line: #e2e8f0;
    --grad: linear-gradient(135deg, var(--blue), var(--cyan));
    --bs-primary: var(--blue);
    --bs-primary-rgb: 31, 111, 235;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -.02em; color: var(--navy); }
a { color: var(--blue); }
.text-grad { background: linear-gradient(90deg, #4da3ff, var(--cyan) 60%, #7ef0e0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.text-grad-dark { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Header */
.site-header {
    background: rgba(11, 27, 52, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 14px rgba(0, 0, 0, .18); border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.site-header .nav-link { color: rgba(255, 255, 255, .75); font-weight: 500; padding: .6rem .9rem; }
.site-header .nav-link:hover,
.site-header .nav-link.active { color: #fff; }
.site-header .nav-link.active { box-shadow: inset 0 -2px 0 var(--cyan); }

.brand { display: inline-flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-logo { display: block; height: 44px; width: auto; background: #fff; border-radius: .5rem; padding: 3px 8px; }
.brand-text { font-weight: 800; font-size: 1.35rem; letter-spacing: .08em; line-height: 1; }
.brand-text small { font-weight: 500; font-size: .75em; letter-spacing: .05em; color: var(--cyan); text-transform: lowercase; margin-left: .1rem; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem;
    background: var(--grad); border-radius: .45rem; font-size: 1.1rem;
}

.btn-accent { background: var(--grad); color: #fff; border: 0; font-weight: 600; box-shadow: 0 8px 22px rgba(31, 111, 235, .35); transition: transform .2s, filter .2s, box-shadow .2s; }
.btn-accent:hover { color: #fff; filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(25, 195, 214, .4); }
.btn-outline-light-soft { border: 1px solid rgba(255, 255, 255, .4); color: #fff; font-weight: 600; }
.btn-outline-light-soft:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* Hero con sfondo animato */
.hero {
    position: relative; overflow: hidden; color: #fff; isolation: isolate;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
    padding: 6.5rem 0 7rem;
}
.hero::before {
    content: ''; position: absolute; inset: -25%; z-index: -2; pointer-events: none;
    background:
        radial-gradient(38% 38% at 80% 25%, rgba(25, 195, 214, .38), transparent 70%),
        radial-gradient(42% 42% at 15% 80%, rgba(31, 111, 235, .5), transparent 70%),
        radial-gradient(30% 30% at 55% 60%, rgba(255, 154, 31, .14), transparent 70%);
    animation: aurora 18s ease-in-out infinite alternate;
}
.hero::after {
    content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .06;
    background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
@keyframes aurora {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
    50%  { transform: translate3d(4%, -3%, 0) rotate(6deg) scale(1.08); }
    100% { transform: translate3d(-4%, 3%, 0) rotate(-5deg) scale(1.04); }
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hero > .container { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: clamp(2.1rem, 4.6vw, 3.5rem); font-weight: 800; line-height: 1.12; }
.hero .lead { color: rgba(255, 255, 255, .8); max-width: 40rem; }
.hero-sm { padding: 5rem 0 4.5rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--cyan); }
.hero .eyebrow::before { content: ''; display: inline-block; width: 2rem; height: 2px; background: var(--cyan); vertical-align: middle; margin-right: .7rem; }

.hero-wave { position: absolute; left: 0; right: 0; bottom: -1px; line-height: 0; z-index: 0; }
.hero-wave svg { display: block; width: 100%; height: 70px; }

.stat { border-left: 3px solid var(--cyan); padding-left: 1rem; }
.stat strong { display: block; font-size: 1.7rem; color: #fff; line-height: 1.1; }
.stat span { font-size: .85rem; color: rgba(255, 255, 255, .7); }

/* Immagini a rotazione nella hero: riquadro 16:9 uniforme anche per le immagini con sfondo trasparente */
.hero-art {
    max-width: 36rem; margin: 0 auto; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 1.25rem;
    background: linear-gradient(160deg, #16335f, #0b1b34);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .14), 0 0 60px rgba(25, 195, 214, .18);
    animation: art-float 6s ease-in-out infinite;
}
.hero-art .carousel-inner, .hero-art .carousel-item { height: 100%; }
.hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-art .carousel-item { transition-duration: 1s; }
@keyframes art-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Sezioni */
.section { padding: 5.5rem 0; }
.section-soft { background: var(--soft); }
.section-dark { position: relative; background: linear-gradient(160deg, var(--navy), var(--navy-2)); color: rgba(255, 255, 255, .8); overflow: hidden; }
.section-dark::before {
    content: ''; position: absolute; width: 38rem; height: 38rem; right: -12rem; top: -14rem; border-radius: 50%;
    background: radial-gradient(circle, rgba(25, 195, 214, .25), transparent 65%); pointer-events: none;
}
.section-dark h2, .section-dark h3, .section-dark h4 { color: #fff; }
.section-dark .container { position: relative; }
.section-title { max-width: 44rem; margin-bottom: 3rem; }
.section-title h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.section-title p { color: var(--muted); font-size: 1.05rem; }
.section-dark .section-title p { color: rgba(255, 255, 255, .7); }

.card-feature, .card-portal {
    position: relative; height: 100%; background: #fff; border: 1px solid var(--line); border-radius: 1.1rem; padding: 1.9rem;
    transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card-feature:hover, .card-portal:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(11, 27, 52, .12); border-color: transparent; }
.card-feature::after {
    content: ''; position: absolute; left: 1.9rem; right: 1.9rem; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
    background: var(--grad); transform: scaleX(0); transform-origin: left; transition: transform .35s;
}
.card-feature:hover::after { transform: scaleX(1); }
.icon-box {
    width: 3.2rem; height: 3.2rem; border-radius: .9rem; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #fff; margin-bottom: 1.1rem; background: var(--grad);
    box-shadow: 0 10px 22px rgba(31, 111, 235, .3);
}
.icon-box.orange { background: linear-gradient(135deg, #ff7a18, #ffbd2e); box-shadow: 0 10px 22px rgba(255, 154, 31, .35); }
.icon-box.green { background: linear-gradient(135deg, #3fa535, #9be02f); box-shadow: 0 10px 22px rgba(94, 190, 50, .3); }
.card-portal { padding: 2.25rem; border-top: 4px solid var(--blue); }
.card-portal.alt { border-top-color: var(--cyan); }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { position: relative; padding-left: 1.9rem; margin-bottom: .7rem; }
.check-list li::before { content: '\F26A'; font-family: 'bootstrap-icons'; position: absolute; left: 0; top: 0; color: var(--blue); }

/* Passaggi numerati */
.steps { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); counter-reset: step; }
.step { position: relative; padding: 1.6rem 1.4rem; border-radius: 1.1rem; background: #fff; border: 1px solid var(--line); counter-increment: step; }
.step::before {
    content: counter(step); display: flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; margin-bottom: 1rem;
    border-radius: 50%; background: var(--grad); color: #fff; font-weight: 800; box-shadow: 0 8px 18px rgba(31, 111, 235, .3);
}
.step h3 { font-size: 1.1rem; }
.step p { margin: 0; color: var(--muted); font-size: .95rem; }
.section-dark .step { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); backdrop-filter: blur(4px); }
.section-dark .step p { color: rgba(255, 255, 255, .7); }

.pill {
    display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .95rem; border-radius: 50rem; background: #fff;
    border: 1px solid var(--line); font-size: .9rem; font-weight: 500; color: var(--navy);
}
.pill i { color: var(--blue); }

.cta-band {
    position: relative; overflow: hidden; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff;
    border-radius: 1.4rem; padding: 3.2rem; box-shadow: 0 24px 50px rgba(11, 27, 52, .25);
}
.cta-band::before {
    content: ''; position: absolute; width: 22rem; height: 22rem; right: -6rem; top: -10rem; border-radius: 50%;
    background: radial-gradient(circle, rgba(25, 195, 214, .35), transparent 65%);
}
.cta-band > * { position: relative; }
.cta-band h2 { color: #fff; }

/* Contatti */
.contact-card { background: var(--soft); border-radius: 1rem; padding: 2rem; height: 100%; }
.contact-card i { color: var(--blue); font-size: 1.2rem; margin-right: .6rem; }
.form-control, .form-select { border-radius: .6rem; padding: .7rem .9rem; border-color: #cfd8e4; }
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 .2rem rgba(31, 111, 235, .15); }
.hp-field { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* Footer */
.site-footer { background: var(--navy); color: rgba(255, 255, 255, .7); }
.site-footer h6 { color: #fff; text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; margin-bottom: 1rem; }
.site-footer a { color: rgba(255, 255, 255, .7); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer li { margin-bottom: .4rem; }
.site-footer hr { border-color: rgba(255, 255, 255, .15); opacity: 1; }
.site-footer address { font-style: normal; line-height: 1.8; }
.site-footer .brand-text { font-size: 1.5rem; }

/* Comparsa allo scroll (attiva solo se JavaScript è disponibile) */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

@media (max-width: 575.98px) {
    .hero { padding: 4.2rem 0 5rem; }
    .section { padding: 3.5rem 0; }
    .cta-band { padding: 2rem 1.5rem; }
    .brand-text { font-size: 1.1rem; }
    .brand-logo { height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
    .hero::before, .hero-art { animation: none; }
    .js .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
}
