/* --- PREMIUM STYLE 2025 (Definitivo) --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Montserrat:wght@300;400;600;800&family=Fredoka+One&display=swap');

:root {
    --primary: #d35400; 
    --secondary: #e67e22;
    --dark: #2c3e50;
    --light: #f8f9fa;
    --text: #34495e;
    --white: #ffffff;
    --shadow-soft: 0 10px 30px rgba(0,0,0,0.05);
    --shadow-card: 0 15px 35px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Montserrat', sans-serif;
    color: var(--text);
    background-color: #fffcf9;
    line-height: 1.8;
    margin: 0;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }

/* --- HEADER & LOGO ORIGINALE --- */
header {
    background: var(--white);
    padding: 15px 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.navbar { display: flex; justify-content: space-between; align-items: center; }

/* LOGO: Stile originale mantenuto ma integrato nel nuovo design */
.logo {
    font-family: 'Fredoka One', cursive; 
    font-size: 2.2rem;
    color: #48dbfb; /* Colore originale del logo */
    letter-spacing: 0.5px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

.logo span {
    color: #ff9f43; /* Colore originale dell'accento */
}

.logo:hover {
    transform: scale(1.05) rotate(-2deg);
}

/* Navigazione */
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { 
    font-weight: 600; font-size: 0.95rem; color: var(--dark); 
    position: relative;
}
.nav-links a:hover { color: var(--primary); }

.mobile-toggle { display: none; font-size: 1.5rem; cursor: pointer; }

/* --- HERO SECTION --- */
.page-hero {
    position: relative;
    height: 50vh;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: #2c3e50; /* Fallback */
    background-size: cover;
    background-position: center;
    color: white;
    overflow: hidden;
}

.page-hero::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(44,62,80,0.5), rgba(44,62,80,0.9));
    z-index: 1;
}

.hero-content { position: relative; z-index: 2; max-width: 800px; padding: 20px; animation: fadeInUp 1s ease-out; }

.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.hero-meta {
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 10px;
    display: block;
}

/* --- ARTICLE CONTENT --- */
.article-container {
    max-width: 850px;
    margin: -50px auto 0; /* Sormonta l'header */
    position: relative;
    z-index: 10;
}

/* BLOCCHI GENERATI (LISTICLE) */
.article-block {
    background: white;
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 50px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,0.02);
    transition: transform 0.3s;
}

.article-block:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-card);
}

.article-body { font-size: 1.15rem; color: #4a4a4a; }

.article-body h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    color: var(--dark);
    margin-bottom: 30px;
    margin-top: 40px;
    text-align: center;
    position: relative;
    display: inline-block;
}

.article-body h2::after {
    content: ''; display: block; width: 50px; height: 3px; background: var(--primary);
    margin: 10px auto 0;
}

.article-block h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--primary);
    font-size: 1.4rem;
    margin-bottom: 15px;
    border-left: 4px solid var(--secondary);
    padding-left: 15px;
}

/* IMMAGINI NEL TESTO */
.generated-img-wrapper {
    margin-top: 25px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.generated-img-wrapper img { 
    width: 100%; 
    display: block; 
    transition: transform 0.5s; 
}

.generated-img-wrapper:hover img { transform: scale(1.03); }

/* BOTTONE DOWNLOAD SMART */
.btn-dl-smart {
    position: absolute;
    bottom: 15px; right: 15px;
    background: rgba(255,255,255,0.9);
    color: var(--dark);
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; gap: 8px;
    transition: all 0.3s;
}

.btn-dl-smart:hover { 
    background: var(--primary); 
    color: white; 
    transform: translateY(-2px);
}

/* --- GRIGLIA FINALE --- */
.section-title {
    text-align: center; font-family: 'Playfair Display', serif; font-size: 2rem;
    margin-bottom: 40px; color: var(--dark);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card, .gallery-item {
    border-radius: 10px;
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s;
    border: none;
}

.card:hover, .gallery-item:hover { 
    transform: translateY(-5px); 
    box-shadow: var(--shadow-card); 
}

.card-img, .gallery-item img { 
    width: 100%; height: 250px; object-fit: cover; 
    display: block;
}

/* Bottoni Standard */
.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(211, 84, 0, 0.3);
}
.btn:hover { background: var(--secondary); transform: translateY(-2px); }

.btn-create {
    background: #48dbfb; /* Colore secondario originale */
    color: white !important;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* --- FOOTER --- */
.site-footer {
    background: var(--dark);
    color: #bdc3c7;
    padding: 60px 0 20px;
    margin-top: 80px;
    text-align: center;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    text-align: left;
    margin-bottom: 40px;
}

.footer-col h3 { color: white; margin-bottom: 15px; font-family: 'Fredoka One'; }
.footer-bottom { border-top: 1px solid #444; padding-top: 20px; font-size: 0.8rem; }

/* PAGINAZIONE */
.pagination { display: flex; justify-content: center; gap: 10px; margin-top: 50px; }
.page-link {
    padding: 10px 15px; background: white; border: 1px solid #ddd;
    border-radius: 5px; color: var(--dark); font-weight: 600;
}
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

/* DROPDOWN MENU */
.dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0;
    background: white; box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 8px; min-width: 200px; z-index: 1000; padding: 10px 0;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu li a {
    display: block; padding: 10px 20px; font-size: 0.9rem;
    color: var(--dark); border-bottom: 1px solid #f0f0f0;
}
.dropdown-menu li a:hover { background: #f9f9f9; color: var(--primary); }

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

/* MOBILE */
@media (max-width: 768px) {
    .logo { font-size: 1.8rem; }
    .nav-links { display: none; } 
    .mobile-toggle { display: block; }
    .hero-title { font-size: 2.5rem; }
    .article-block { padding: 25px; }
    .article-container { margin-top: 0; }
}
/* --- PULSANTE DOWNLOAD PREMIUM --- */
.generated-img-wrapper {
    position: relative; /* Necessario per posizionare il bottone sopra */
    display: block;
    border-radius: 15px;
    overflow: hidden;
}

/* Stile del bottone */
.btn-dl-smart {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    border: 2px solid transparent;
}

/* Icona colorata */
.btn-dl-smart i {
    color: #d35400; /* Colore Primary */
    font-size: 1.1rem;
}

/* Hover Desktop */
.btn-dl-smart:hover {
    background: #d35400;
    color: white;
    transform: translateY(-3px) scale(1.05);
    border-color: #fff;
    box-shadow: 0 8px 20px rgba(211, 84, 0, 0.4);
}
.btn-dl-smart:hover i { color: white; }

/* Click (Active) per Mobile */
.btn-dl-smart:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Mobile Optimization: Bottone sempre ben visibile */
@media (max-width: 768px) {
    .btn-dl-smart {
        padding: 12px 25px; /* Più facile da toccare col dito */
        bottom: 10px;
        right: 10px;
        width: auto;
        justify-content: center;
        background: #ffffff; /* Bianco pieno su mobile per contrasto */
    }
}

/* --- MOBILE MENU FIX --- */
@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap; /* Permette al menu di andare a capo */
    }

    .logo { font-size: 1.6rem; }
    
    .nav-links {
        display: none; /* Nascosto di default */
        width: 100%;
        flex-direction: column;
        text-align: center;
        background: white;
        padding: 20px 0;
        border-top: 1px solid #f0f0f0;
        margin-top: 15px;
    }

    /* Classe che aggiungeremo con JS */
    .nav-links.active {
        display: flex;
        animation: fadeIn 0.3s ease;
    }

    .nav-links li {
        margin: 10px 0;
    }

    .mobile-toggle { 
        display: block; 
        font-size: 1.8rem;
        cursor: pointer;
        color: var(--primary);
    }
    
    /* Gestione Dropdown su Mobile */
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: 1px solid #eee;
        display: none; /* Nascosto anche se aperto il menu principale */
    }
    
    .dropdown:hover .dropdown-menu {
        display: block; /* Su mobile lo mostriamo al tocco */
    }
}