/* SEOLab - Agenzia Marketing Verona */
/* Custom Styles - Optimized for Core Web Vitals */

/* Base & Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #0f0f1a;
    color: #ffffff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    /* Prevent layout shift */
    overflow-x: hidden;
}

/* Typography */
.font-display {
    font-family: 'Space Grotesk', sans-serif;
}

.gradient-text {
    background: linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Backgrounds */
.gradient-bg {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #252542 100%);
}

.bg-dark-900 { background-color: #0f0f1a; }
.bg-dark-800 { background-color: #1a1a2e; }
.bg-dark-700 { background-color: #252542; }

/* Gradient Border Effect */
.gradient-border {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e, #252542);
    border-radius: 1rem;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    padding: 1px;
    background: linear-gradient(135deg, #0ea5e9, #8b5cf6, #ec4899);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Glow Effects */
.glow {
    box-shadow: 0 0 60px rgba(14, 165, 233, 0.3), 0 0 100px rgba(139, 92, 246, 0.2);
}

.glow-sm {
    box-shadow: 0 0 30px rgba(14, 165, 233, 0.2), 0 0 50px rgba(139, 92, 246, 0.1);
}

/* Card Hover Effect - Optimized */
.card-hover {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    contain: layout style;
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(14, 165, 233, 0.25);
}

/* Animations - Optimized with will-change and contain */
.floating {
    animation: floating 6s ease-in-out infinite;
    will-change: transform;
    contain: layout style;
}

@keyframes floating {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* Reduce motion for accessibility and performance */
@media (prefers-reduced-motion: reduce) {
    .floating,
    .pulse-glow,
    .scroll-indicator,
    .fade-in-up,
    .card-hover,
    .service-card {
        animation: none;
        transition: none;
    }
    
    .fade-in-up {
        opacity: 1;
        transform: none;
    }
}

.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(14, 165, 233, 0.4); }
    50% { box-shadow: 0 0 40px rgba(139, 92, 246, 0.6); }
}

.scroll-indicator {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) translateX(-50%); }
    40% { transform: translateY(-10px) translateX(-50%); }
    60% { transform: translateY(-5px) translateX(-50%); }
}

/* Fade In Up Animation - Optimized */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

.fade-in-up.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Prevent CLS - show content immediately if JS fails */
.no-js .fade-in-up {
    opacity: 1;
    transform: none;
}

/* Staggered animations */
.fade-in-up:nth-child(1) { transition-delay: 0.1s; }
.fade-in-up:nth-child(2) { transition-delay: 0.2s; }
.fade-in-up:nth-child(3) { transition-delay: 0.3s; }
.fade-in-up:nth-child(4) { transition-delay: 0.4s; }
.fade-in-up:nth-child(5) { transition-delay: 0.5s; }

/* Navigation - Fixed height to prevent CLS */
.nav-blur {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

header {
    min-height: 80px;
    height: 80px;
}

/* Hero Section */
.hero-gradient {
    background: radial-gradient(ellipse at 50% 0%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
                radial-gradient(ellipse at 20% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 40%);
}

.hero-pattern {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 100%);
    border-radius: 9999px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(14, 165, 233, 0.3);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Service Cards - Optimized for CLS */
.service-card {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8), rgba(37, 37, 66, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    padding: 2rem;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s ease, box-shadow 0.4s ease;
    will-change: transform;
    contain: layout style;
    /* Explicit min-height to prevent CLS */
    min-height: 280px;
}

.service-card:hover {
    transform: translateY(-8px);
    border-color: rgba(14, 165, 233, 0.3);
    box-shadow: 0 25px 50px -12px rgba(14, 165, 233, 0.2);
}

.service-icon {
    width: 4rem;
    height: 4rem;
    min-width: 4rem;
    min-height: 4rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* Stats Counter */
.stat-item {
    text-align: center;
    padding: 2rem;
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0ea5e9 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    color: #9ca3af;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
}

/* Testimonial Cards */
.testimonial-card {
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.6), rgba(37, 37, 66, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    padding: 2rem;
}

/* Process Steps */
.process-step {
    position: relative;
    padding-left: 4rem;
}

.process-step::before {
    content: '';
    position: absolute;
    left: 1.25rem;
    top: 3rem;
    bottom: -2rem;
    width: 2px;
    background: linear-gradient(to bottom, #0ea5e9, transparent);
}

.process-step:last-child::before {
    display: none;
}

.process-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

/* FAQ Accordion */
.faq-item {
    background: rgba(26, 26, 46, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.3s ease;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.02);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer.open {
    max-height: 500px;
    padding: 0 1.5rem 1.5rem;
}

.faq-icon {
    transition: transform 0.3s ease;
}

.faq-item.open .faq-icon {
    transform: rotate(180deg);
}

/* Contact Form */
.form-input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-input::placeholder {
    color: #6b7280;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #d1d5db;
}

/* Logos Slider */
.logos-slider {
    display: flex;
    animation: scroll 30s linear infinite;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Responsive */
@media (max-width: 768px) {
    .stat-number {
        font-size: 2.25rem;
    }
    
    .service-card {
        padding: 1.5rem;
    }
    
    .process-step {
        padding-left: 3rem;
    }
}

/* Utility Classes */
.text-balance {
    text-wrap: balance;
}

.container {
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Core Web Vitals Optimizations */

/* Prevent CLS for iframes */
iframe {
    aspect-ratio: 16 / 9;
    width: 100%;
    height: auto;
}

/* Content-visibility for below-the-fold sections */
section:not(:first-of-type) {
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
}

/* Prevent CLS for images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Prevent CLS for buttons */
.btn-primary,
.btn-secondary {
    min-height: 48px;
    min-width: 120px;
}

/* Optimize paint for fixed elements */
header {
    contain: layout style;
    will-change: background-color, box-shadow;
}

/* GPU acceleration for animated elements */
.floating,
.card-hover,
.service-card,
.gradient-border {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Prevent FOUT (Flash of Unstyled Text) */
.font-display,
h1, h2, h3, h4, h5, h6 {
    font-display: swap;
}

/* Optimize form inputs for INP */
.form-input {
    touch-action: manipulation;
}

/* Lazy load background images for non-critical sections */
.hero-pattern {
    background-image: none;
}

@media (min-width: 768px) {
    .hero-pattern {
        background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    }
}
