:root {
    /* Apple-style color palette & Glassmorphism variables */
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 16px 40px rgba(0, 0, 0, 0.05);
    --text-main: #1d1d1f;
    --text-secondary: #424245;
    --bg-color: #fbfbfd;
    --button-bg: rgba(255, 255, 255, 0.85);
    --button-hover: rgba(255, 255, 255, 1);

    /* Animation Easing */
    --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bouncy: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Navbar (Sticky & Glass) */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 0;
    z-index: 1000;
    transition: all 0.5s var(--ease-apple);
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    padding: 12px 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.nav-links a:hover {
    opacity: 1;
}

/* Base Mobile Navbar Adjustments */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* Hide on mobile for cleaner look */
    }

    .brand {
        font-size: 1.15rem;
    }
}

/* Animated Liquid Glass Background */
.liquid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background-color: var(--bg-color);
    /* Fallback */
    transition: transform 0.2s ease-out;
    /* Parallax smoothness */
}

/* Base blob styles */
.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.6;
    animation: moveBlobs 20s infinite alternate var(--ease-apple);
    mix-blend-mode: multiply;
    /* Helps colors blend nicely like liquid */
}

/* Individual blobs with different colors, sizes, and starting positions */
.blob-1 {
    width: 60vw;
    height: 60vh;
    background: #b0c4de;
    /* light steel blue */
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.blob-2 {
    width: 50vw;
    height: 60vh;
    background: #c8beda;
    /* lavender */
    bottom: -20%;
    right: -10%;
    animation-delay: -5s;
    animation-duration: 25s;
}

.blob-3 {
    width: 55vw;
    height: 55vh;
    background: #bcd4bc;
    /* sage green */
    top: 30%;
    left: 40%;
    animation-delay: -10s;
    animation-duration: 22s;
}

.blob-4 {
    width: 45vw;
    height: 45vh;
    background: #ffe4e1;
    /* peach / misty rose */
    bottom: 10%;
    left: 10%;
    animation-delay: -15s;
    animation-duration: 28s;
}

.blob-5 {
    width: 40vw;
    height: 40vh;
    background: #f0e68c;
    /* khaki / warm yellow */
    top: 10%;
    right: 20%;
    animation-delay: -8s;
    animation-duration: 24s;
}

@media (max-width: 768px) {
    .blob {
        filter: blur(50px);
    }
}

/* Organic movement keyframes */
@keyframes moveBlobs {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(10vw, 15vh) scale(1.1);
    }

    66% {
        transform: translate(-15vw, 10vh) scale(0.9);
    }

    100% {
        transform: translate(5vw, -10vh) scale(1.05);
    }
}

/* Global Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
    /* Above background */
}

/* Complex Scroll Animations */
.fade-in-section {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
    transition: opacity 1.2s var(--ease-apple), transform 1.2s var(--ease-apple);
    will-change: opacity, transform;
    padding: 100px 0;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--ease-apple), transform 0.8s var(--ease-bouncy);
}

.step-card:nth-child(1) {
    transition-delay: 0.1s;
}

.step-card:nth-child(2) {
    transition-delay: 0.2s;
}

.step-card:nth-child(3) {
    transition-delay: 0.3s;
}

.step-card:nth-child(4) {
    transition-delay: 0.4s;
}

.is-visible .stagger-item {
    opacity: 1;
    transform: translateY(0);
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text-main);
}

h2 {
    font-size: 3rem;
    margin-bottom: 50px;
    text-align: center;
}

p {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Glassmorphism Components */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.6s var(--ease-apple), box-shadow 0.6s var(--ease-apple), background 0.6s var(--ease-apple);
}

@media (hover: hover) {
    .glass-panel:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 30px 60px rgba(0, 0, 0, 0.1);
        background: rgba(255, 255, 255, 0.6);
    }
}

/* Buttons (Apple Style CTA) */
.cta-button {
    display: inline-block;
    background: var(--button-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 18px 40px;
    border-radius: 980px;
    /* pill shape */
    font-size: 1.15rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.4s var(--ease-apple);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Button Shine Effect */
.cta-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transform: skewX(-20deg);
    transition: left 0.7s;
}

@media (hover: hover) {
    .cta-button:hover {
        background: var(--button-hover);
        transform: scale(1.05);
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    }

    .cta-button:hover::after {
        left: 150%;
    }
}

/* --- Hero Section --- */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 100vh;
    padding-top: 80px;
    padding-bottom: 60px;
    gap: 40px;
}

.hero-text {
    flex: 1;
    max-width: 650px;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 1.5s var(--ease-apple), transform 1.5s var(--ease-apple);
}

.hero-text.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.hero h1 {
    font-size: 5rem;
    line-height: 1.05;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #1d1d1f 0%, #555 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero h2.subtitle {
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 40px;
    text-align: left;
    line-height: 1.5;
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 1.5s var(--ease-apple), transform 1.5s var(--ease-apple);
    transition-delay: 0.2s;
}

.hero-visual.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.hero-image-container {
    width: 100%;
    max-width: 440px;
    aspect-ratio: 4/5;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    position: relative;
    /* Add inner highlight for 3d glass edge */
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8), 0 30px 60px rgba(0, 0, 0, 0.1);
}

.hero-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-apple);
}

/* --- Approccio Section --- */
.approach-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 60px auto;
}

.approach-intro p {
    font-size: 1.25rem;
    line-height: 1.8;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
}

.step-card {
    text-align: center;
    padding: 40px 24px;
    position: relative;
    overflow: hidden;
}

.step-number {
    font-size: 5rem;
    font-weight: 800;
    color: rgba(0, 0, 0, 0.03);
    position: absolute;
    top: -5px;
    right: 5px;
    line-height: 1;
    user-select: none;
    transition: color 0.4s;
}

@media (hover: hover) {
    .step-card:hover .step-number {
        color: rgba(0, 0, 0, 0.08);
    }
}

.step-card h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.step-card p {
    font-size: 1rem;
    position: relative;
    z-index: 1;
}

/* --- Servizi Section --- */
.services-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.service-column h3 {
    font-size: 1.75rem;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.service-list {
    list-style: none;
}

.service-list li {
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: transform 0.3s, color 0.3s;
}

@media (hover: hover) {
    .service-list li:hover {
        transform: translateX(8px);
        color: var(--text-main);
    }

    .service-list li:hover::before {
        opacity: 1;
        transform: scale(1.5);
    }
}

.service-list li::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--text-main);
    border-radius: 50%;
    margin-right: 16px;
    opacity: 0.3;
    transition: opacity 0.3s, transform 0.3s;
}

.service-list li:last-child {
    border-bottom: none;
}

/* --- Contatti Section --- */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.contact-card {
    text-align: center;
}

.contact-card h4 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text-main);
}

.contact-card p {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.contact-card a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s, text-shadow 0.3s;
    font-weight: 500;
}

.contact-card a:hover {
    color: var(--text-main);
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0 30px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

footer p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legal-note {
    margin-top: 8px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* --- Responsive Design (Mobile First Focus) --- */
@media (max-width: 1024px) {
    .hero h1 {
        font-size: 4rem;
    }

    .services-grid {
        gap: 30px;
    }

    .hero {
        min-height: 90vh;
    }
}

@media (max-width: 850px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding-top: 120px;
    }

    .hero-text {
        max-width: 100%;
        transform: translateY(30px) !important;
        /* Force reset translate for mobile */
    }

    .hero-text.is-visible {
        transform: translateY(0) !important;
    }

    .hero h2.subtitle {
        text-align: center;
        font-size: 1.25rem;
    }

    .hero-visual {
        transform: translateY(30px) !important;
        width: 100%;
        margin-top: 10px;
    }

    .hero-visual.is-visible {
        transform: translateY(0) !important;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .fade-in-section {
        padding: 80px 0;
    }

    h2 {
        font-size: 2.25rem;
        margin-bottom: 30px;
    }

    .glass-panel {
        padding: 32px 24px;
        border-radius: 28px;
    }

    .hero h1 {
        font-size: 3.25rem;
    }

    .hero h2.subtitle {
        font-size: 1.15rem;
        margin-bottom: 32px;
    }

    .hero-image-container {
        max-width: 320px;
        border-radius: 32px;
    }

    .approach-intro p {
        font-size: 1.1rem;
    }

    .service-column h3 {
        font-size: 1.5rem;
    }

    .service-list li {
        font-size: 1.05rem;
    }

    .cta-button {
        padding: 16px 32px;
        font-size: 1.05rem;
    }

    /* Adjust staggering on mobile so elements don't pop-in too disconnected */
    .stagger-item,
    .step-card {
        transition-delay: 0s !important;
    }
}

@media (max-width: 400px) {
    .hero h1 {
        font-size: 2.75rem;
    }

    .glass-panel {
        padding: 24px 20px;
        border-radius: 24px;
    }

    h2 {
        font-size: 2rem;
    }
}