@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=Outfit:wght@300;400;500;600&display=swap');

:root {
    --primary: #1db9b4;
    --primary-dark: #149c97;
    --text-dark: #243953;
    --text-light: #617d97;
    --bg-base: #f0f3f8;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.9);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.03);
    --shadow-deep: 0 24px 50px rgba(29, 185, 180, 0.15);
    --radius-lg: 32px;
    --radius-md: 24px;
    --font-serif: 'Cormorant Garamond', serif;
    --font-sans: 'Outfit', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--bg-base);
}

body {
    font-family: var(--font-sans);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Mesh Gradient Animated Background */
.mesh-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: #f4f7f6;
    background-image: 
        radial-gradient(at 0% 0%, hsla(167,42%,85%,1) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(189,40%,90%,1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(38,40%,90%,1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(167,42%,80%,1) 0px, transparent 50%);
    filter: blur(80px);
    opacity: 0.7;
    animation: pulseGradients 15s ease-in-out infinite alternate;
}

@keyframes pulseGradients {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(2deg); }
    100% { transform: scale(1) rotate(-2deg); }
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    color: var(--text-dark);
}

.title-serif {
    font-family: var(--font-serif);
    line-height: 1.1;
}

.title-italic {
    font-style: italic;
    font-weight: 400;
    color: var(--primary-dark);
}

p {
    font-size: 1.15rem;
    color: var(--text-light);
    font-weight: 300;
}

/* Custom Cursor */
.cursor {
    width: 32px;
    height: 32px;
    background-color: var(--primary);
    -webkit-mask-image: url("../img/logo-farfalla.svg");
    mask-image: url("../img/logo-farfalla.svg");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    display: none;
    transition: transform 0.3s ease, background-color 0.3s ease, opacity 0.3s ease;
}
.cursor.active {
    background-color: var(--primary-dark);
    transform: translate(-50%, -50%) scale(1.6) rotate(-15deg);
    opacity: 0.8;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    z-index: 1000;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-soft);
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo i { color: var(--primary); }

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 400;
    font-size: 1.05rem;
    transition: color 0.3s ease;
}
.nav-links a:hover { color: var(--primary); }

/* Buttons */
.btn-magnetic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px 40px;
    background-color: var(--text-dark);
    color: white;
    text-decoration: none;
    border-radius: 100px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.1s;
    cursor: pointer;
    border: none;
}
.btn-magnetic:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-deep);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 5% 50px;
}

.hero-content {
    max-width: 1000px;
}

.hero-title {
    font-size: clamp(4rem, 8vw, 7.5rem);
    letter-spacing: -1px;
    margin-bottom: 30px;
}

.hero-subtitle {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    max-width: 600px;
    margin: 0 auto 50px;
}

/* Bento Grid */
.bento-section {
    max-width: 1400px;
    margin: 0 auto 100px;
    padding: 0 5%;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto auto;
    gap: 24px;
}

/* Bento Cards (Glassmorphism + 3D Tilt) */
.bento-item {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transform: perspective(1000px);
    transition: box-shadow 0.4s ease;
}
.bento-item:hover {
    box-shadow: var(--shadow-deep);
}

/* Specific Bento Areas */
.bento-about {
    grid-column: span 2;
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.bento-about-img-container {
    width: 100%;
    height: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 30px;
}
.bento-about-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bento-service {
    grid-column: span 1;
    grid-row: span 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.bento-service .icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.bento-contact {
    grid-column: span 2;
    grid-row: span 1;
    background: var(--primary);
    color: white;
}
.bento-contact h3, .bento-contact p {
    color: white;
}
.bento-contact .btn-magnetic {
    background: white;
    color: var(--primary-dark);
    margin-top: 20px;
}
.bento-contact .btn-magnetic:hover {
    background: var(--text-dark);
    color: white;
}

.bento-quote {
    grid-column: span 2;
    grid-row: span 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.bento-quote h3 {
    font-size: 2.2rem;
    line-height: 1.3;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    font-size: 1rem;
}

/* Animations */
.reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-up.active {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Grid Classes */
.bento-grid-about { grid-template-columns: 1fr 1.5fr; }
.bento-grid-contact { grid-template-columns: 1fr 1fr; }
.col-span-2 { grid-column: span 2; }
.col-span-4 { grid-column: span 4; }

/* Hamburger Menu UIs */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 1001;
}
.hamburger span {
    width: 30px;
    height: 2px;
    background-color: var(--text-dark);
    transition: 0.3s;
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 1024px) {
    .bento-grid, .bento-grid-about, .bento-grid-contact { grid-template-columns: repeat(2, 1fr); }
    .bento-about { grid-column: span 2; }
    .bento-quote { grid-column: span 2; }
    .col-span-4 { grid-column: span 2; }
}

@media (max-width: 768px) {
    .bento-grid, .bento-grid-about, .bento-grid-contact { grid-template-columns: 1fr !important; }
    .bento-item, .bento-about, .bento-service, .bento-contact, .bento-quote, .col-span-2, .col-span-4 { grid-column: span 1 !important; }
    
    .navbar { width: 95%; padding: 15px 20px; border-radius: 20px; }
    .hamburger { display: flex; }
    
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 40px;
        transform: translateY(-100%);
        transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
        z-index: 1000;
        margin: 0;
        padding: 0;
    }
    .nav-links.nav-active {
        transform: translateY(0);
    }
    .nav-links a {
        font-size: 2rem;
        font-family: var(--font-serif);
    }
    
    /* Hamburger Animation */
    .hamburger.toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.toggle span:nth-child(2) { opacity: 0; }
    .hamburger.toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
    
    .hero-title { font-size: 3.5rem; }
    .hero, .bento-section { padding-top: 140px; }
    
    .whatsapp-float {
        width: 55px;
        height: 55px;
        bottom: 20px;
        right: 20px;
        font-size: 32px;
    }
}

/* WhatsApp Float Button */
.whatsapp-float {
    position: fixed;
    width: 65px;
    height: 65px;
    bottom: 30px;
    right: 30px;
    background-color: #25D366;
    color: white;
    border-radius: 50px;
    text-align: center;
    font-size: 38px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pulse-wa 2s infinite;
}

.whatsapp-float:hover {
    background-color: #128C7E;
    transform: scale(1.1);
    color: white;
    animation: none;
}

@keyframes pulse-wa {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transform: translateY(150%);
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-banner p {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.5;
}

.cookie-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
}

@media (max-width: 768px) {
    .cookie-banner {
        bottom: 90px; /* Above whatsapp button */
        left: 15px;
        right: 15px;
        max-width: none;
    }
}

/* --- AWWWARDS LEVEL STYLES --- */

/* Lenis Recommended CSS */
html.lenis, html.lenis body {
    height: auto;
}
.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}
.lenis.lenis-stopped {
    overflow: hidden;
}
.lenis.lenis-scrolling iframe {
    pointer-events: none;
}

/* Page Transitions */
body {
    background-color: var(--bg-base);
}
body.is-loading {
    overflow: hidden;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-base);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.preloader-butterfly {
    width: 60px;
    height: 60px;
    background-color: var(--primary);
    -webkit-mask-image: url('../img/logo-farfalla.svg');
    mask-image: url('../img/logo-farfalla.svg');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    animation: flutterWing 0.3s infinite alternate cubic-bezier(0.4, 0, 0.2, 1), floatHover 2s infinite ease-in-out;
}

@keyframes flutterWing {
    0% { transform: scaleX(1); }
    100% { transform: scaleX(0.15); }
}

@keyframes floatHover {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* Grain Overlay */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.45;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
}

/* Fluid Typography Updates */
h1.hero-title {
    font-size: clamp(3rem, 6vw + 1rem, 5rem) !important;
}
.bento-item h2.title-serif {
    font-size: clamp(2rem, 4vw, 3.5rem) !important;
}

/* Parallax Image Fix for Bento */
.bento-about-img-container img {
    will-change: transform;
    transform-origin: center;
    transition: transform 0.1s linear;
}

/* --- WOW EFFECTS --- */
.mouse-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(29, 185, 180, 0.12) 0%, rgba(29, 185, 180, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.8s ease;
    will-change: transform;
}
/* WhatsApp Chat Widget */
.wa-chat-box {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 340px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99999;
}

.wa-chat-box.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.wa-chat-header {
    background: #00A8B5; /* Usiamo il primario del sito invece del verde WA standard per eleganza */
    padding: 15px;
    display: flex;
    align-items: center;
    color: white;
    gap: 15px;
}

.wa-chat-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.wa-chat-title h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: white;
}

.wa-chat-title span {
    font-size: 0.75rem;
    opacity: 0.9;
    font-family: var(--font-sans);
}

.wa-chat-close {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.wa-chat-body {
    padding: 20px;
    background: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 20.5V18H0v-2h20v-2H0v-2h20v-2H0V8h20V6H0V4h20V2H0V0h22v20h2V0h2v20h2V0h2v20h2V0h2v20h2V0h2v20h2v2H20v-1.5zM0 20h2v20H0V20zm4 0h2v20H4V20zm4 0h2v20H8V20zm4 0h2v20h-2V20zm4 0h2v20h-2V20zm4 4h20v2H20v-2zm0 4h20v2H20v-2zm0 4h20v2H20v-2zm0 4h20v2H20v-2z' fill='%23d3cac1' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
    min-height: 120px;
}

.wa-chat-message {
    background: white;
    padding: 12px 16px;
    border-radius: 0 12px 12px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    color: #303030;
    position: relative;
    max-width: 85%;
    line-height: 1.4;
}

.wa-chat-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 10px solid white;
    border-left: 10px solid transparent;
}

.wa-chat-footer {
    padding: 12px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

#wa-chat-input {
    flex-grow: 1;
    border: none;
    padding: 12px 15px;
    border-radius: 24px;
    resize: none;
    height: 44px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    outline: none;
    line-height: 1.2;
}

.wa-send-btn {
    width: 44px;
    height: 44px;
    background: #00A8B5;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.1rem;
}

.wa-send-btn:hover {
    background: #008f99;
}

.word-anim {
    opacity: 0;
    transform: translateY(30px);
    -webkit-animation: slideUpWord 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation: slideUpWord 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@-webkit-keyframes slideUpWord {
    0% { opacity: 0; -webkit-transform: translateY(30px); transform: translateY(30px); }
    100% { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}

@keyframes slideUpWord {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Reviews Masonry Layout */
.reviews-masonry {
    column-count: 3;
    column-gap: 24px;
    width: 100%;
}

.reviews-masonry .bento-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 24px;
    break-inside: avoid;
    vertical-align: top;
}

@media (max-width: 1024px) {
    .reviews-masonry {
        column-count: 2;
        column-gap: 20px;
    }
    .reviews-masonry .bento-item {
        margin-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .reviews-masonry {
        column-count: 1;
        column-gap: 0;
    }
}
