/* ==========================================================
   CM AUTOMATED SOLUTION — Home
   Tema scuro navy, coerente con la NEXT Software Suite
   ========================================================== */

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

:root {
    --bg-primary: #050B17;
    --bg-secondary: #0A1428;
    --bg-card: #0E1B34;
    --bg-card-hover: #132443;
    --paper: #F4F7FB;
    --ink: #0B1B33;
    --ink-muted: #56677F;
    --ink-stroke: #DCE3EC;

    --accent-cyan: #00CB9A;
    --accent-blue: #2F7BFF;
    --accent-blue-2: #1F6BFF;
    --accent-purple: #7B4BEA;
    --accent-orange: #FFB640;

    --text-primary: #FFFFFF;
    --text-secondary: rgba(226, 235, 248, 0.74);
    --text-muted: rgba(226, 235, 248, 0.52);

    --border-color: rgba(148, 178, 230, 0.12);
    --border-light: rgba(148, 178, 230, 0.2);

    --gradient-main: linear-gradient(120deg, #00CB9A 0%, #2F7BFF 60%, #5C8DFF 100%);
    --gradient-accent: linear-gradient(135deg, #00CB9A, #7B4BEA);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-head: 'Manrope', 'Inter', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    --header-h: 76px;
    --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
    --ease: cubic-bezier(.2, .7, .2, 1);
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }

body {
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: -0.02em; line-height: 1.12; }
:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 3px; border-radius: 4px; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 2rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.gradient-text {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------- Skip link ---------- */
.skip-to-content {
    position: absolute; left: 1rem; top: -100px; z-index: 10002;
    background: var(--accent-blue); color: #fff; padding: .75rem 1.25rem;
    border-radius: var(--radius-md); font-weight: 600; text-decoration: none;
}
.skip-to-content:focus { top: 1rem; }

/* ==========================================================
   HEADER
   ========================================================== */
.header {
    position: fixed; inset: 0 0 auto 0; z-index: 1000;
    height: var(--header-h);
    transition: background-color .3s, border-color .3s, backdrop-filter .3s;
    border-bottom: 1px solid transparent;
}
.header.scrolled {
    background: rgba(5, 11, 23, 0.9);
    backdrop-filter: saturate(150%) blur(16px);
    -webkit-backdrop-filter: saturate(150%) blur(16px);
    border-bottom-color: var(--border-color);
}
.header-container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.logo { display: flex; align-items: center; gap: .7rem; text-decoration: none; flex-shrink: 0; }
.logo img { width: 40px; height: 40px; border-radius: 50%; }
.logo-text { font-family: var(--font-head); font-size: 1rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.logo-text strong { color: #fff; font-weight: 800; margin-right: .15rem; }

.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav-menu { display: flex; align-items: center; gap: .15rem; }
.nav-menu a {
    display: block; padding: .5rem .75rem; border-radius: var(--radius-full);
    color: var(--text-secondary); text-decoration: none; font-size: .92rem; font-weight: 500;
    transition: color .2s, background-color .2s;
}
.nav-menu a:hover, .nav-menu a.is-current { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav-menu .nav-next { color: #fff; position: relative; padding-left: 1.55rem; }
.nav-menu .nav-next::before {
    content: ""; position: absolute; left: .7rem; top: 50%; width: 7px; height: 7px; margin-top: -3.5px;
    border-radius: 2px; background: var(--accent-blue); box-shadow: 0 0 0 3px rgba(47, 123, 255, .25);
}
.header-buttons { display: flex; gap: .6rem; }

.mobile-toggle { display: none; width: 44px; height: 44px; position: relative; }
.mobile-toggle span { position: absolute; left: 11px; right: 11px; height: 2px; background: #fff; border-radius: 2px; transition: transform .3s, opacity .3s; }
.mobile-toggle span:nth-child(1) { top: 15px; }
.mobile-toggle span:nth-child(2) { top: 21px; }
.mobile-toggle span:nth-child(3) { top: 27px; }
.mobile-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mobile-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================
   BOTTONI
   ========================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    padding: .8rem 1.4rem; border-radius: var(--radius-full);
    font-family: var(--font-sans); font-size: .95rem; font-weight: 600; text-decoration: none;
    border: 1px solid transparent; cursor: pointer; white-space: nowrap;
    transition: transform .25s var(--ease), box-shadow .25s, background-color .25s, border-color .25s, color .25s;
}
.btn-sm { padding: .55rem 1.05rem; font-size: .88rem; }
.btn-lg { padding: 1rem 1.75rem; font-size: 1rem; }
.btn-gradient { background: var(--gradient-main); color: #fff; box-shadow: 0 10px 30px -10px rgba(47, 123, 255, .6); }
.btn-gradient:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -12px rgba(47, 123, 255, .75); }
.btn-outline { color: #fff; border-color: var(--border-light); background: rgba(255, 255, 255, 0.02); }
.btn-outline:hover { border-color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .06); }

/* ==========================================================
   STAGE 3D: hero + storia guidata dallo scroll
   ========================================================== */
.stage { position: relative; background: radial-gradient(1200px 700px at 72% 30%, #0f2550 0%, rgba(5, 11, 23, 0) 65%), var(--bg-primary); }
.stage-sticky {
    position: sticky; top: 0; height: 100vh; height: 100svh; margin-bottom: -100vh; margin-bottom: -100svh;
    overflow: hidden; z-index: 0;
}
#robot-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s ease; }
.stage.is-ready #robot-canvas { opacity: 1; }
.stage-fallback { position: absolute; inset: 0; background: url('../images/factory/factory-hero.jpg') center / cover no-repeat; opacity: 0; transition: opacity .6s; }
.stage.no-webgl .stage-fallback { opacity: .9; }
.stage-vignette {
    position: absolute; inset: 0; pointer-events: none;
    background:
        linear-gradient(90deg, rgba(5, 11, 23, .92) 0%, rgba(5, 11, 23, .55) 32%, rgba(5, 11, 23, 0) 58%),
        linear-gradient(0deg, rgba(5, 11, 23, .9) 0%, rgba(5, 11, 23, 0) 22%),
        linear-gradient(180deg, rgba(5, 11, 23, .65) 0%, rgba(5, 11, 23, 0) 18%);
}

/* HUD del gemello digitale */
.stage-hud { position: absolute; inset: 0; pointer-events: none; }
.hud-tag {
    position: absolute; left: 0; top: 0; will-change: transform, opacity; opacity: 0;
    display: flex; flex-direction: column; gap: 2px;
    padding: .55rem .8rem .55rem 1rem; margin: -20px 0 0 14px;
    background: rgba(8, 20, 42, .78); border: 1px solid rgba(90, 168, 255, .35); border-radius: 10px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    font-size: .78rem; color: var(--text-secondary); white-space: nowrap;
}
.hud-tag::before { content: ""; position: absolute; left: -14px; top: 50%; width: 14px; height: 1px; background: rgba(90, 168, 255, .6); }
.hud-tag::after { content: ""; position: absolute; left: -18px; top: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent-cyan)); box-shadow: 0 0 0 4px rgba(255, 255, 255, .12); }
.hud-tag b { font-family: var(--font-mono); font-weight: 500; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--c, #7FB8FF); }
.hud-tag em { font-style: normal; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Indicatore passi */
.stage-dots {
    position: absolute; right: 2rem; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 1rem;
    opacity: clamp(0, calc(var(--phase, 0) * 2 - .6), 1);
    transition: opacity .3s;
}
.stage-dots li { display: flex; align-items: center; justify-content: flex-end; gap: .7rem; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.stage-dots li::after { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--text-muted); transition: all .3s; }
.stage-dots li span { opacity: 0; transform: translateX(6px); transition: all .3s; }
.stage-dots li.is-active { color: #fff; }
.stage-dots li.is-active span { opacity: 1; transform: none; }
.stage-dots li.is-active::after { background: var(--accent-cyan); border-color: var(--accent-cyan); box-shadow: 0 0 0 4px rgba(0, 203, 154, .2); }

/* Hero */
.hero { position: relative; z-index: 1; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: calc(var(--header-h) + 2rem) 0 6rem; }
.hero-content { max-width: 640px; }
.hero-badge {
    display: inline-flex; align-items: center; gap: .6rem; margin-bottom: 1.6rem;
    padding: .45rem .9rem; border-radius: var(--radius-full);
    background: rgba(0, 203, 154, .08); border: 1px solid rgba(0, 203, 154, .28);
    font-family: var(--font-mono); font-size: .74rem; letter-spacing: .04em; color: #7FF0CF;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-cyan); position: relative; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--accent-cyan); animation: pulse 2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.hero-title { font-size: clamp(2.6rem, 5.6vw, 4.6rem); font-weight: 800; line-height: 1.04; letter-spacing: -0.035em; margin-bottom: 1.5rem; }
.hero-title .gradient-text { display: block; }
.hero-subtitle { font-size: 1.15rem; color: var(--text-secondary); max-width: 560px; margin-bottom: 2.2rem; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: .8rem; }
.hero-proof { display: flex; flex-wrap: wrap; gap: 2.2rem; margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--border-color); }
.hero-proof li { display: flex; flex-direction: column; }
.hero-proof strong { font-family: var(--font-head); font-size: 1.02rem; }
.hero-proof span { font-size: .85rem; color: var(--text-muted); }
.hero-scroll {
    position: absolute; left: 50%; bottom: 2rem; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: .7rem;
    font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-muted); text-decoration: none;
}
.hero-scroll i { width: 22px; height: 36px; border: 1px solid var(--border-light); border-radius: 12px; position: relative; }
.hero-scroll i::after { content: ""; position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--accent-cyan); animation: wheel 1.8s ease-in-out infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* Passi della storia */
.story { position: relative; z-index: 1; }
.story-step { min-height: 105vh; display: flex; align-items: center; }
.story-card {
    width: min(460px, calc(100% - 4rem)); margin-left: max(2rem, calc((100vw - 1280px) / 2 + 2rem));
    padding: 2rem 2rem 2.1rem; border-radius: var(--radius-2xl);
    background: linear-gradient(160deg, rgba(14, 27, 52, .82), rgba(8, 18, 38, .72));
    border: 1px solid var(--border-light);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-lg);
}
.story-num { display: inline-block; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-cyan); margin-bottom: .9rem; }
.story-card h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin-bottom: .8rem; }
.story-card p { color: var(--text-secondary); font-size: 1rem; }
.story-card small { display: block; margin-top: .9rem; font-size: .75rem; color: var(--text-muted); }

/* ==========================================================
   STRISCIA TECNOLOGIE
   ========================================================== */
.tech-strip { position: relative; z-index: 2; background: var(--bg-primary); border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); padding: 1.4rem 0; overflow: hidden; }
.marquee { display: flex; width: max-content; animation: marquee 40s linear infinite; }
.marquee ul { display: flex; flex-shrink: 0; }
.marquee li { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; color: rgba(226, 235, 248, .42); padding: 0 1.6rem; white-space: nowrap; position: relative; }
.marquee li::after { content: ""; position: absolute; right: -3px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 2px; background: rgba(47, 123, 255, .5); }
.tech-strip:hover .marquee { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ==========================================================
   SEZIONI
   ========================================================== */
.section { position: relative; padding: 7.5rem 0; background: var(--bg-primary); }
.section-dark { background: var(--bg-secondary); }
.section-light { background: var(--paper); color: var(--ink); }
.section-header { max-width: 780px; margin: 0 auto 3.5rem; text-align: center; }
.section-header-left { text-align: left; margin: 0; }
.section-label {
    display: inline-flex; align-items: center; gap: .6rem; margin-bottom: 1.1rem;
    font-family: var(--font-mono); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-cyan);
}
.section-label::before { content: ""; width: 22px; height: 1px; background: currentColor; }
.section-title { font-size: clamp(2rem, 3.8vw, 3rem); font-weight: 800; margin-bottom: 1.1rem; }
.section-subtitle { font-size: 1.08rem; color: var(--text-secondary); }
.section-light .section-label { color: #0C8F6E; }
.section-light .section-title { color: var(--ink); }
.section-light .section-subtitle { color: var(--ink-muted); }

/* Elenchi con spunta */
.check-list { display: grid; gap: .55rem; }
.check-list li { position: relative; padding-left: 1.6rem; font-size: .93rem; color: var(--text-secondary); }
.check-list li::before {
    content: ""; position: absolute; left: 0; top: .32em; width: 1rem; height: 1rem; border-radius: 5px;
    background: rgba(0, 203, 154, .14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.4L12 5.4' fill='none' stroke='%2300CB9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
}
.section-light .check-list li { color: var(--ink-muted); }
.section-light .check-list li::before { background-color: rgba(0, 143, 110, .12); }

/* Comparsa allo scroll */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ==========================================================
   CHI SIAMO
   ========================================================== */
.about-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 4.5rem; align-items: center; }
.about-text { color: var(--text-secondary); margin-bottom: 1.1rem; }
.about-text strong { color: #fff; font-weight: 600; }
.about-side { display: grid; gap: 1.25rem; }
.about-image { position: relative; border-radius: var(--radius-2xl); overflow: hidden; border: 1px solid var(--border-light); box-shadow: var(--shadow-lg); }
.about-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(200deg, rgba(47, 123, 255, .25), transparent 50%); mix-blend-mode: screen; }
.about-image img { width: 100%; aspect-ratio: 16 / 11; object-fit: cover; }
.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.stat { padding: 1.1rem 1rem; border-radius: var(--radius-lg); background: var(--bg-card); border: 1px solid var(--border-color); }
.stat-number { font-family: var(--font-head); font-size: 1.15rem; font-weight: 800; background: var(--gradient-main); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: .82rem; color: var(--text-muted); margin-top: .2rem; }

/* ==========================================================
   SERVIZI (bento)
   ========================================================== */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.service-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border-radius: var(--radius-2xl); background: var(--bg-card); border: 1px solid var(--border-color);
    transition: transform .4s var(--ease), border-color .3s, box-shadow .4s;
}
.service-card:hover { transform: translateY(-4px); border-color: rgba(47, 123, 255, .45); box-shadow: 0 24px 50px -24px rgba(47, 123, 255, .45); }
.service-card-image { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.service-card-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg-card) 0%, rgba(14, 27, 52, 0) 60%); }
.service-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.service-card:hover .service-card-image img { transform: scale(1.05); }
.service-card-body { position: relative; padding: 0 1.6rem 1.7rem; margin-top: -1.2rem; display: flex; flex-direction: column; flex: 1; }
.service-index { font-family: var(--font-mono); font-size: .75rem; color: var(--accent-cyan); margin-bottom: .5rem; }
.service-title { font-size: 1.22rem; margin-bottom: .6rem; }
.service-description { color: var(--text-secondary); font-size: .95rem; margin-bottom: 1.1rem; }
.service-features { display: grid; gap: .45rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.service-features li { position: relative; padding-left: 1.1rem; font-size: .87rem; color: var(--text-muted); }
.service-features li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent-blue); }
.service-card-wide { grid-column: span 2; flex-direction: row; }
.service-card-wide .service-card-image { flex: 1.1; aspect-ratio: auto; min-height: 100%; }
.service-card-wide .service-card-image::after { background: linear-gradient(270deg, var(--bg-card) 0%, rgba(14, 27, 52, 0) 45%); }
.service-card-wide .service-card-body { flex: 1; margin-top: 0; padding: 2rem; justify-content: center; }
.service-card-wide .service-title { font-size: 1.5rem; }

/* ==========================================================
   ROBOTICA
   ========================================================== */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem 1.75rem; }
.feature-card figure { position: relative; border-radius: var(--radius-xl); overflow: hidden; margin-bottom: 1.3rem; border: 1px solid var(--border-color); }
.feature-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .8s var(--ease); }
.feature-card:hover img { transform: scale(1.05); }
.feature-card figcaption {
    position: absolute; left: .9rem; top: .9rem; padding: .3rem .65rem; border-radius: var(--radius-full);
    background: rgba(5, 11, 23, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    font-family: var(--font-mono); font-size: .7rem; letter-spacing: .05em; color: #fff; border: 1px solid var(--border-light);
}
.feature-card h3 { font-size: 1.25rem; margin-bottom: .55rem; }
.feature-card p { color: var(--text-secondary); font-size: .95rem; margin-bottom: 1rem; }

/* ==========================================================
   NEXT SUITE / LASER CONTROL
   ========================================================== */
.section-next { background: radial-gradient(900px 500px at 85% 0%, rgba(31, 107, 255, .22), transparent 60%), #071228; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.next-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 3rem; margin-bottom: 2.5rem; }
.next-head > div { max-width: 780px; }
.next-head .section-title { margin-bottom: 1rem; }
.next-products { display: grid; grid-template-columns: repeat(5, 1fr); gap: .75rem; margin-bottom: 3rem; }
.next-products a {
    display: flex; align-items: center; gap: .8rem; padding: .9rem; border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .03); border: 1px solid var(--border-color); text-decoration: none;
    transition: border-color .25s, background-color .25s, transform .25s var(--ease);
}
.next-products a:hover { border-color: var(--p); background: rgba(255, 255, 255, .05); transform: translateY(-2px); }
.next-products img { width: 44px; height: 44px; flex-shrink: 0; }
.next-products b { display: block; font-family: var(--font-head); font-size: .9rem; letter-spacing: .02em; }
.next-products small { font-size: .78rem; color: var(--text-muted); }

.tabs { border-radius: var(--radius-2xl); border: 1px solid var(--border-light); background: rgba(5, 11, 23, .6); overflow: hidden; }
.tab-list { display: flex; gap: .25rem; padding: .5rem; overflow-x: auto; border-bottom: 1px solid var(--border-color); scrollbar-width: none; }
.tab-list::-webkit-scrollbar { display: none; }
.tab-list button {
    padding: .6rem 1rem; border-radius: var(--radius-full); font-size: .88rem; font-weight: 500;
    color: var(--text-muted); white-space: nowrap; transition: color .2s, background-color .2s;
}
.tab-list button:hover { color: #fff; }
.tab-list button[aria-selected="true"] { color: #fff; background: rgba(47, 123, 255, .18); box-shadow: inset 0 0 0 1px rgba(47, 123, 255, .5); }
.tab-panel { display: grid; grid-template-columns: 1.45fr 1fr; gap: 2.5rem; align-items: center; padding: 2rem; }
.tab-panel[hidden] { display: none; }
.tab-panel figure { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border-color); background: #000; }
.tab-panel figure img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }
.tab-panel figcaption { position: absolute; left: .8rem; bottom: .8rem; padding: .3rem .65rem; border-radius: var(--radius-full); background: rgba(5, 11, 23, .8); font-family: var(--font-mono); font-size: .7rem; border: 1px solid var(--border-light); }
.tab-panel h3 { font-size: 1.5rem; margin-bottom: .7rem; }
.tab-panel p { color: var(--text-secondary); margin-bottom: 1.2rem; }
.tab-panel:not([hidden]) { animation: fadeUp .5s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ==========================================================
   SOFTWARE & AI (sezione chiara)
   ========================================================== */
.soft-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.soft-card {
    display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; align-items: start;
    padding: 1.25rem; border-radius: var(--radius-2xl); background: #fff; border: 1px solid var(--ink-stroke);
    transition: box-shadow .35s, transform .35s var(--ease);
}
.soft-card:hover { transform: translateY(-3px); box-shadow: 0 24px 50px -28px rgba(11, 27, 51, .35); }
.soft-card img { width: 100%; height: 100%; min-height: 170px; object-fit: cover; border-radius: var(--radius-lg); }
.soft-card h3 { font-size: 1.2rem; color: var(--ink); margin: .2rem 0 .5rem; }
.soft-card p { color: var(--ink-muted); font-size: .94rem; margin-bottom: .9rem; }

/* ==========================================================
   GALLERY
   ========================================================== */
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 210px; grid-auto-flow: dense; gap: 1rem; }
.gallery-item { position: relative; overflow: hidden; border-radius: var(--radius-xl); border: 1px solid var(--border-color); }
.gallery-item.g-wide { grid-column: span 2; }
.gallery-item.g-tall { grid-row: span 2; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease), filter .5s; filter: saturate(.85); }
.gallery-item:hover img { transform: scale(1.06); filter: saturate(1.05); }
.gallery-item figcaption {
    position: absolute; inset: auto 0 0 0; padding: 2.5rem 1rem .9rem;
    background: linear-gradient(0deg, rgba(5, 11, 23, .9), transparent);
    font-family: var(--font-head); font-weight: 700; font-size: .95rem;
    transform: translateY(6px); opacity: .9; transition: transform .4s var(--ease), opacity .4s;
}
.gallery-item:hover figcaption { transform: none; opacity: 1; }

/* ==========================================================
   PROCESSO
   ========================================================== */
.workflow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.25rem; position: relative; counter-reset: step; }
.workflow::before { content: ""; position: absolute; left: 2rem; right: 2rem; top: 27px; height: 1px; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue), rgba(47, 123, 255, .1)); }
.workflow-step { position: relative; }
.workflow-number {
    position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
    font-family: var(--font-mono); font-size: .95rem; color: #fff; margin-bottom: 1.4rem;
    background: var(--bg-primary); border: 1px solid var(--border-light); box-shadow: 0 0 0 6px var(--bg-primary);
}
.workflow-step:first-child .workflow-number { border-color: var(--accent-cyan); }
.workflow-title { font-size: 1.12rem; margin-bottom: .5rem; }
.workflow-description { color: var(--text-secondary); font-size: .92rem; }

/* ==========================================================
   SETTORI (chiaro)
   ========================================================== */
.sectors-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.sector-card { padding: 1.9rem; border-radius: var(--radius-2xl); background: #fff; border: 1px solid var(--ink-stroke); transition: transform .35s var(--ease), box-shadow .35s, border-color .3s; }
.sector-card:hover { transform: translateY(-3px); border-color: rgba(31, 107, 255, .35); box-shadow: 0 24px 50px -28px rgba(11, 27, 51, .35); }
.sector-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 1.2rem; background: linear-gradient(135deg, rgba(0, 203, 154, .14), rgba(47, 123, 255, .16)); color: var(--accent-blue-2); }
.sector-icon svg { width: 26px; height: 26px; }
.sector-title { font-size: 1.2rem; color: var(--ink); margin-bottom: .5rem; }
.sector-description { color: var(--ink-muted); font-size: .95rem; }

/* ==========================================================
   VANTAGGI
   ========================================================== */
.vantaggi-layout, .faq-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 4rem; align-items: start; }
.vantaggi-layout .section-header, .faq-layout .section-header { position: sticky; top: calc(var(--header-h) + 2rem); }
.vantaggi-layout .btn { margin-top: 1.5rem; }
.advantages-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.advantage-card { padding: 2rem; border-radius: var(--radius-2xl); background: linear-gradient(160deg, var(--bg-card), rgba(14, 27, 52, .4)); border: 1px solid var(--border-color); }
.advantage-number { font-family: var(--font-head); font-size: 2.6rem; font-weight: 800; line-height: 1; margin-bottom: 1.2rem; background: var(--gradient-main); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.advantage-title { font-size: 1.2rem; margin-bottom: .5rem; }
.advantage-description { color: var(--text-secondary); font-size: .95rem; }

/* ==========================================================
   FAQ
   ========================================================== */
.faq-list { border-top: 1px solid var(--border-color); }
.faq-item { border-bottom: 1px solid var(--border-color); }
.faq-item summary {
    list-style: none; cursor: pointer; position: relative; padding: 1.25rem 3rem 1.25rem 0;
    font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; transition: color .2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: #7FB8FF; }
.faq-item summary::after {
    content: ""; position: absolute; right: .4rem; top: 50%; width: 26px; height: 26px; margin-top: -13px; border-radius: 50%;
    border: 1px solid var(--border-light);
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 4v8M4 8h8' stroke='%23fff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / 12px no-repeat;
    transition: transform .3s var(--ease), background-color .3s;
}
.faq-item[open] summary::after { transform: rotate(45deg); background-color: rgba(47, 123, 255, .25); }
.faq-item p { color: var(--text-secondary); padding: 0 3rem 1.4rem 0; }

/* ==========================================================
   RICERCA E SOLUZIONI
   ========================================================== */
.local-seo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border-color); border: 1px solid var(--border-color); border-radius: var(--radius-2xl); overflow: hidden; }
.local-seo-card { padding: 2rem; background: var(--bg-primary); display: flex; flex-direction: column; transition: background-color .3s; }
.local-seo-card:hover { background: var(--bg-secondary); }
.local-seo-card h3 { font-size: 1.12rem; margin-bottom: .6rem; }
.local-seo-card p { color: var(--text-secondary); font-size: .93rem; margin-bottom: 1rem; }
.local-seo-card a { margin-top: auto; color: #7FB8FF; font-weight: 600; font-size: .9rem; text-decoration: none; }
.local-seo-card a::after { content: " →"; transition: margin-left .2s; }
.local-seo-card a:hover { color: #fff; }

/* ==========================================================
   CTA
   ========================================================== */
.cta-section { position: relative; overflow: hidden; padding: 8rem 0; text-align: center; }
.cta-bg-image { position: absolute; inset: 0; background-size: cover; background-position: center; transform: scale(1.05); }
.cta-overlay { position: absolute; inset: 0; background: radial-gradient(800px 400px at 50% 40%, rgba(31, 107, 255, .45), transparent 70%), linear-gradient(180deg, rgba(5, 11, 23, .88), rgba(5, 11, 23, .94)); }
.cta-content { position: relative; max-width: 760px; margin: 0 auto; }
.cta-title { font-size: clamp(2.2rem, 4.5vw, 3.6rem); font-weight: 800; margin-bottom: 1.1rem; }
.cta-subtitle { color: var(--text-secondary); font-size: 1.12rem; margin-bottom: 2.2rem; }
.cta-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: .8rem; }
.cta-info { display: flex; justify-content: center; flex-wrap: wrap; gap: 2rem; margin-top: 2rem; color: var(--text-muted); font-size: .92rem; }
.cta-info strong { color: var(--text-secondary); }

/* ==========================================================
   FOOTER
   ========================================================== */
.footer { background: #030812; border-top: 1px solid var(--border-color); padding: 5rem 0 2rem; font-size: .92rem; }
.footer-top { display: grid; grid-template-columns: 1.6fr 1fr 1.2fr 1.1fr; gap: 3rem; padding-bottom: 3rem; border-bottom: 1px solid var(--border-color); }
.footer-logo { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.2rem; }
.footer-logo img { width: 40px; height: 40px; border-radius: 50%; }
.footer-logo-text { font-family: var(--font-head); font-weight: 600; color: var(--text-secondary); }
.footer-logo-text strong { color: #fff; font-weight: 800; }
.footer-description { color: var(--text-muted); margin-bottom: 1.4rem; max-width: 420px; }
.footer-contact p { color: var(--text-muted); margin-bottom: .3rem; }
.footer-contact strong { color: var(--text-secondary); font-weight: 600; }
.footer-contact a { text-decoration: none; }
.footer-contact a:hover { color: #fff; }
.footer-column h4 { font-size: .95rem; margin-bottom: 1rem; }
.footer-column .footer-sub { margin-top: 1.6rem; }
.footer-column ul { display: grid; gap: .5rem; }
.footer-column a { color: var(--text-muted); text-decoration: none; transition: color .2s; }
.footer-column a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding-top: 1.6rem; color: var(--text-muted); font-size: .82rem; }
.footer-legal { display: flex; gap: 1.4rem; }
.footer-legal a { color: var(--text-muted); text-decoration: none; }
.footer-legal a:hover { color: #fff; }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 1180px) {
    .nav-menu a { padding: .5rem .55rem; font-size: .87rem; }
    .header-buttons .btn-outline { display: none; }
    .next-products { grid-template-columns: repeat(3, 1fr); }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .mobile-toggle { display: block; }
    .nav {
        position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0;
        flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 1.5rem;
        padding: 1.5rem 2rem 2rem; background: rgba(5, 11, 23, .98);
        transform: translateX(100%); transition: transform .35s var(--ease); overflow-y: auto;
    }
    .nav.active { transform: none; }
    .nav-menu { flex-direction: column; align-items: stretch; }
    .nav-menu a { font-size: 1.15rem; padding: .95rem .5rem; border-radius: 0; border-bottom: 1px solid var(--border-color); }
    .nav-menu .nav-next { padding-left: 1.6rem; }
    .nav-menu .nav-next::before { left: .5rem; }
    .header-buttons { flex-direction: column; }
    .header-buttons .btn-outline { display: inline-flex; }
    .header.menu-open { background: rgba(5, 11, 23, .98); }

    .about-grid, .vantaggi-layout, .faq-layout { grid-template-columns: 1fr; gap: 3rem; }
    .vantaggi-layout .section-header, .faq-layout .section-header { position: static; }
    .services-grid { grid-template-columns: repeat(2, 1fr); }
    .service-card-wide { grid-column: span 2; }
    .tab-panel { grid-template-columns: 1fr; }
    .soft-grid { grid-template-columns: 1fr; }
    .workflow { grid-template-columns: 1fr; gap: 0; }
    .workflow::before { left: 27px; right: auto; top: 0; bottom: 0; width: 1px; height: auto; background: linear-gradient(180deg, var(--accent-cyan), var(--accent-blue), rgba(47, 123, 255, .1)); }
    .workflow-step { display: grid; grid-template-columns: 56px 1fr; column-gap: 1.4rem; padding-bottom: 2rem; }
    .workflow-number { grid-row: span 2; margin-bottom: 0; }
    .sectors-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-top { grid-template-columns: 1fr 1fr; }
    .next-head { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
    .stage-dots { display: none; }
}

@media (max-width: 900px) {
    /* Su schermi stretti il robot sta in alto, il testo in basso */
    .stage-vignette {
        background:
            linear-gradient(0deg, rgba(5, 11, 23, .96) 0%, rgba(5, 11, 23, .7) 38%, rgba(5, 11, 23, 0) 62%),
            linear-gradient(180deg, rgba(5, 11, 23, .6) 0%, rgba(5, 11, 23, 0) 16%);
    }
    .hero { align-items: flex-end; padding-bottom: 5.5rem; }
    .hero-scroll { display: none; }
    .story-step { align-items: flex-end; min-height: 100vh; padding-bottom: 12vh; }
    .story-card { margin: 0 auto; width: calc(100% - 2rem); padding: 1.5rem; }
    .hud-tag { font-size: .7rem; padding: .4rem .6rem .4rem .8rem; }
}

@media (max-width: 680px) {
    body { font-size: 16px; }
    .container { padding: 0 1rem; }
    .section { padding: 5rem 0; }
    .logo-text { font-size: .92rem; }
    .hero { align-items: flex-start; padding-top: 44vh; padding-top: 44svh; padding-bottom: 4rem; }
    .hero-badge { font-size: .66rem; }
    .hero-title { font-size: 2.2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-proof { gap: 1.2rem; margin-top: 2rem; }
    .hero-proof li { flex-basis: calc(50% - .6rem); }
    .about-stats { grid-template-columns: 1fr; }
    .services-grid, .feature-grid, .sectors-grid, .advantages-grid, .local-seo-grid { grid-template-columns: 1fr; }
    .service-card-wide { grid-column: auto; flex-direction: column; }
    .service-card-wide .service-card-image { aspect-ratio: 16 / 9; min-height: 0; }
    .service-card-wide .service-card-image::after { background: linear-gradient(0deg, var(--bg-card) 0%, rgba(14, 27, 52, 0) 60%); }
    .service-card-wide .service-card-body { padding: 0 1.6rem 1.7rem; margin-top: -1.2rem; }
    .service-card-wide .service-title { font-size: 1.22rem; }
    .next-products { grid-template-columns: 1fr 1fr; }
    .next-products li:last-child { grid-column: span 2; }
    .tab-panel { padding: 1.25rem; }
    .soft-card { grid-template-columns: 1fr; }
    .soft-card img { min-height: 0; aspect-ratio: 16 / 9; }
    .gallery-grid { grid-template-columns: 1fr 1fr; grid-auto-rows: 150px; }
    .footer-top { grid-template-columns: 1fr; }
    .cta-section { padding: 5.5rem 0; }
    .btn-lg { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .marquee, .pulse::after, .hero-scroll i::after { animation: none; }
}

/* ========================================
   COOKIE CONSENT BANNER (GDPR)
   Overlay modale centrato
======================================== */

/* Sfondo scuro che copre tutto il sito */
.cookie-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.cookie-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Card modale centrata */
.cookie-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: 94%;
    max-width: 540px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 2rem 2rem 1.5rem;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
}

.cookie-banner.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.cookie-banner-content {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.cookie-banner-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cookie-banner-header h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.cookie-icon {
    color: var(--accent-cyan);
    flex-shrink: 0;
}

.cookie-banner-content > p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.65;
    margin: 0;
}

.cookie-banner-content a {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 600;
}

.cookie-banner-content a:hover {
    text-decoration: underline;
}

/* Cookie categories detail */
.cookie-details {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.cookie-category {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.9rem 1rem;
}

.cookie-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.cookie-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
}

.cookie-toggle-label input {
    display: none;
}

.cookie-toggle-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 11px;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.cookie-toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.cookie-toggle-label input:checked + .cookie-toggle-slider {
    background: var(--accent-cyan);
}

.cookie-toggle-label input:checked + .cookie-toggle-slider::after {
    transform: translateX(18px);
}

.cookie-toggle-disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.cookie-category-name {
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
}

.cookie-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cookie-badge-required {
    background: rgba(0, 203, 154, 0.12);
    color: var(--accent-cyan);
}

.cookie-category-desc {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
    margin: 0.5rem 0 0;
}

.cookie-category-desc a {
    font-weight: 500;
    font-size: 0.78rem;
}

/* Pulsanti azione */
.cookie-banner-actions {
    display: flex;
    gap: 0.6rem;
}

.btn-cookie {
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    justify-content: center;
    border-radius: 10px;
}

.btn-cookie-reject {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
}

.btn-cookie-reject:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
}

.cookie-legal-note {
    color: var(--text-muted) !important;
    font-size: 0.7rem !important;
    line-height: 1.45 !important;
    opacity: 0.6;
    border-top: 1px solid var(--border-color);
    padding-top: 0.65rem;
    margin: 0;
}

/* Pulsante per riaprire le preferenze cookie */
.cookie-settings-btn {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--accent-cyan);
    cursor: pointer;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cookie-settings-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.cookie-settings-btn.visible {
    display: flex;
}

@media (max-width: 768px) {
    .cookie-banner {
        padding: 1.5rem 1.25rem 1.25rem;
        width: 96%;
        max-height: 92vh;
        border-radius: 16px;
    }
    .cookie-banner-actions {
        flex-direction: column;
    }
    .btn-cookie {
        width: 100%;
    }
    .cookie-category-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

