:root {
    /* Color Palette */
    --color-primary: #e67e22; /* Arancio */
    --color-primary-dark: #d35400;
    --color-secondary: #3498db; /* Blue Mare */
    --color-accent: #f1c40f; /* Giallo Sole */
    --color-text: #2c3e50;
    --color-text-light: #7f8c8d;
    --color-background: #fdfefe;
    --color-white: #ffffff;
    --color-sand: #fcf3cf;
    
    /* Typography */
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 8rem;
    
    /* Shadows & Border Radius */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    
    /* Animation */
    --transition: all 0.3s ease;
}

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

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-background);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, .font-display {
    font-family: var(--font-display);
    font-weight: 500;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-sm);
}

.section {
    padding: var(--space-lg) 0;
}

/* Typography Utilities */
.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
}

.btn--primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn--primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn--outline {
    background-color: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn--outline:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .section { padding: var(--space-md) 0; }
}

/* --- PageSpeed Optimization & CLS Fixes --- */

/* Hero section - layout containment */
.hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    contain: layout;  /* Previene propagazione layout shift */
    color: var(--color-white);
}

.hero__media {
    position: absolute;
    inset: 0;
    z-index: 1; /* Background layer */
    contain: strict;  /* Isolamento totale */
}

.hero__media img,
.hero__media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 16/9;  /* Riserva spazio prima del caricamento */
    will-change: transform;  /* GPU compositing */
}

.hero__content {
    position: relative;
    z-index: 2; /* Content layer on top */
    text-align: center;
    max-width: 800px;
    padding: var(--space-md);
    /* Optional: background darken for contrast */
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-lg);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.hero__title {
    font-size: 3.5rem;
    margin-bottom: var(--space-sm);
    color: var(--color-white);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero__subtitle {
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
    color: rgba(255,255,255,0.9);
}

/* Card images with fixed aspect ratio */
.card__image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Animazioni sicure (solo transform e opacity) */
[data-animate] {
    opacity: 0;
    will-change: opacity, transform;
}

[data-animate].animated {
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }
.items-center { align-items: center; }
.bg-sand { background-color: var(--color-sand); }
.bg-primary { background-color: var(--color-primary); color: white; }
.text-white { color: white; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.1rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-4xl { font-size: 2.5rem; }
.opacity-80 { opacity: 0.8; }
.d-block { display: block; }
.columns-2 { columns: 2; }
.max-w-800 { max-width: 800px; }
.rounded-lg { border-radius: var(--radius-lg); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.bg-white-20 { background: rgba(255,255,255,0.2); }
.border-white { border-color: white !important; }
.text-light { color: var(--color-text-light) !important; }

.map-container {
    background: #eee;
    height: 450px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
