/* SEO & Performance Optimization CSS */

/* Image optimization for faster loading */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Responsive images with srcset support */
picture {
    display: block;
    width: 100%;
}

/* Optimize font loading */
@font-face {
    font-family: 'Roboto';
    font-display: swap;
    src: local('Roboto');
}

/* Critical CSS for above-the-fold content */
.hero,
.pg3d-hero,
.payment-hero {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Reduce layout shift */
.service-card,
.feature-card,
.payment-card {
    min-height: 300px;
    contain: layout style paint;
}

/* Optimize animations for performance */
@media (prefers-reduced-motion: no-preference) {
    .fade-in {
        animation: fadeIn 0.5s ease-in;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(20px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* Improve text readability */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Optimize for Core Web Vitals */
.container {
    contain: layout style;
}

/* Reduce Cumulative Layout Shift (CLS) */
.showcase-grid,
.gallery-grid,
.services-grid {
    display: grid;
    gap: 1.5rem;
}

.showcase-item,
.gallery-item {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

/* Improve Largest Contentful Paint (LCP) */
.hero-title,
.section-title {
    font-size: clamp(1.5rem, 5vw, 3rem);
    line-height: 1.2;
}

/* Optimize for mobile-first */
@media (max-width: 768px) {
    .hero,
    .pg3d-hero,
    .payment-hero {
        min-height: 50vh;
        padding: 2rem 1rem;
    }
    
    .showcase-grid,
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .service-card,
    .feature-card {
        min-height: 250px;
    }
}

/* Improve First Input Delay (FID) */
button,
a,
input,
select,
textarea {
    touch-action: manipulation;
}

/* Optimize for SEO - Structured content */
article,
section {
    margin-bottom: 2rem;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* Improve accessibility for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Optimize for print */
@media print {
    .nav-actions,
    .mobile-menu-btn,
    .back-to-top,
    .promo-banner,
    .cta-section {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* Optimize for high-DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Optimize for dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
    }
}

/* Improve contrast for accessibility */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #6B1CAF;
        --text-color: #000;
        --background-color: #fff;
    }
    
    [data-theme="dark"] {
        --primary-color: #AD5EED;
        --text-color: #fff;
        --background-color: #000;
    }
}

/* Optimize for touch devices */
@media (hover: none) and (pointer: coarse) {
    button,
    a,
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1.5rem;
    }
}

/* Improve loading performance */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-load.loaded {
    opacity: 1;
}

/* Optimize for slow connections */
@media (prefers-reduced-data: reduce) {
    .hero-background,
    .cta-background,
    .floating-icons {
        display: none;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Improve SEO with semantic HTML */
main {
    display: block;
    min-height: 60vh;
}

header,
footer,
nav,
article,
section,
aside {
    display: block;
}

/* Optimize for crawlers */
.breadcrumb {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    padding: 0 0.5rem;
    color: var(--text-color);
    opacity: 0.6;
}

/* Improve social sharing */
.social-share {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.social-share a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    transition: transform 0.2s;
}

.social-share a:hover {
    transform: scale(1.1);
}

/* Optimize for international users */
html[lang="fr"] body {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

html[lang="es"] body {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* Improve mobile navigation */
@media (max-width: 992px) {
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background: var(--card-background);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-menu.active {
        transform: translateX(0);
    }
}

/* Optimize for tablets */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 720px;
    }
    
    .services-grid,
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Improve page speed */
.preload {
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

/* Optimize for Core Web Vitals */
.above-fold {
    content-visibility: visible;
}

.below-fold {
    content-visibility: auto;
    contain-intrinsic-size: 1000px;
}
