/* Reset e base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff6e03;
    --secondary-color: #868106;
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --dark-gray: #333333;
    --black: #000000;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Michroma', sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    /* `overflow-x: hidden;` removed from `body`. If horizontal scroll is present,
       it's best to identify the overflowing element and fix its width. */
}

/* REGOLA FONDAMENTALE PER LE IMMAGINI RESPONSIVE */
img {
    max-width: 100%;
    height: auto;
    display: block; /* Useful for removing extra spaces and facilitating layout */
}

.container {
    max-width: 1200px;
    width: 100%; /* Crucial for container responsiveness */
    margin: 0 auto;
    padding: 0 20px; /* Maintains side padding even on mobile */
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Michroma', sans-serif;
    font-weight: 500;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--dark-gray); /* Default color for ALL section titles */
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.section-subtitle {
    text-align: center;
    font-size: 1.2rem;
    color: var(--dark-gray); /* Default color for ALL section subtitles */
    margin-bottom: 3rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

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

.btn-primary:hover {
    background: #e55a02;
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: #757009;
}

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

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

.btn-large {
    padding: 15px 40px;
    font-size: 1.1rem;
}

/* H1 title hidden for accessibility (screen readers only) */
.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;
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--dark-gray);
    color: var(--white);
    padding: 20px;
    z-index: 1000;
    transform: translateY(100%);
    transition: var(--transition);
}

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

.cookie-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    flex-wrap: wrap; /* Allows elements to wrap on small screens */
    text-align: center; /* Centers text when wrapped */
    justify-content: center; /* Centers buttons on mobile */
}

.cookie-content p {
    flex: 1;
    min-width: 250px; /* Allows paragraph to take more space */
}

.cookie-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap; /* Allows buttons to wrap */
    justify-content: center; /* Centers buttons */
    margin-top: 10px; /* Space between text and buttons on mobile */
}

.cookie-buttons .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Specific styles for 'Personalizza' button in cookie banner */
.cookie-banner .cookie-buttons .btn-outline {
    color: var(--white); /* White text */
    border-color: var(--white); /* White border */
    background-color: transparent; /* Ensures transparent background */
}

.cookie-banner .cookie-buttons .btn-outline:hover {
    color: var(--dark-gray); /* Dark text on hover */
    background-color: var(--white); /* White background on hover */
    border-color: var(--white); /* Maintains white border */
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
}

.navbar {
    padding: 1rem 0;
}

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

.logo {
    height: 70px;
    width: auto;
}

.nav-menu {
    display: flex; /* Keeps flex for desktop */
    list-style: none; /* Keeps list-style for desktop */
    gap: 2rem; /* Keeps gap for desktop */
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: 300;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    cursor: pointer;
    z-index: 1001; /* Above nav-menu when open */
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--dark-gray);
    margin: 3px 0;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    color: var(--white);
    padding: 150px 0 100px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Services Section */
.services {
    padding: 100px 0;
    background: var(--light-gray);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem; /* Add space between grid and button container */
}

.service-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.service-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--white);
    font-size: 2rem;
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--dark-gray);
}

.service-card p {
    color: #666;
    line-height: 1.6;
}

/* Stili per il contenitore del pulsante "SCOPRI DI PIÙ" */
#servizi .container .services-more-button {
    text-align: center;      /* Centra orizzontalmente il pulsante all'interno del suo div */
    margin-top: 60px;        /* Spazio sopra il pulsante, separandolo dalla griglia */
    margin-bottom: 60px;     /* Spazio sotto il pulsante, separandolo dalla sezione successiva */
    /* Queste due proprietà assicurano che il div occupi tutta la larghezza
       e si comporti come un blocco per la centratura del testo */
    display: block;          /* Assicura che l'elemento sia un blocco */
    width: 100%;             /* Assicura che l'elemento occupi tutta la larghezza disponibile */
}

/* About Section */
.about {
    padding: 100px 0;
    background: var(--white);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #666;
}

.about-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap; /* Allows elements to wrap on mobile */
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary-color);
    font-weight: 500;
}

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

/* Portfolio Section */
.portfolio {
    padding: 100px 0;
    background-image: url('images/banner-portfolio.jpg'); /* Ensure correct file extension */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll; /* Use 'fixed' for parallax effect */
    position: relative;
    z-index: 1;
}

/* Overlay for portfolio background image */
.portfolio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Semi-transparent black overlay */
    z-index: -1;
}

/* White titles and subtitles for Portfolio section only */
.portfolio .section-title,
.portfolio .section-subtitle {
    color: var(--white);
}


.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.portfolio-image {
    height: 200px;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.portfolio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.portfolio-image a {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.portfolio-text-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: var(--white);
    display: flex;
    flex-direction: column; /* Allows content inside overlay to stack */
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease-out;
    pointer-events: none;
    box-sizing: border-box;
}

.portfolio-placeholder p {
    font-size: 1rem;
    margin-bottom: 5px;
}

.portfolio-placeholder br {
    display: none; /* Generally good practice to avoid <br> for layout */
}

.portfolio-placeholder {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--dark-gray);
}

.portfolio-placeholder a {
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    display: block; /* Make links block-level for better click area */
    margin-top: 5px; /* Space between text and link */
}

.portfolio-image a:hover .portfolio-text-overlay {
    opacity: 1;
    pointer-events: auto;
}

.portfolio-text-overlay p {
    margin: 0;
    line-height: 1.3;
}

/* Contact Section */
.contact {
    padding: 100px 0;
    background: var(--white);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.contact-item i {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.contact-item h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-gray);
}

.contact-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.social-links {
    margin-top: 2rem;
}

.social-icons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
    font-size: 1.2rem;
}

.social-link.facebook {
    background: #1877f2;
}

.social-link.instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Contact Form */
.contact-form {
    background: var(--light-gray);
    padding: 2rem;
    border-radius: 10px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Footer */
.footer {
    background: var(--dark-gray);
    color: var(--white);
    padding: 50px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-logo {
    height: 60px;
    width: auto;
    max-width: 100%;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--white);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-section a:visited {
    color: var(--white);
}

.footer-section a:active {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #555;
    color: #ccc;
    font-size: 0.85rem;
}

/* WhatsApp sticky icon */
.whatsapp-sticky-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* Increased size for better visibility */
    height: 40px; /* Increased size for better visibility */
    background-color: transparent;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.whatsapp-sticky-icon:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.whatsapp-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Media Queries for Responsiveness --- */

@media (max-width: 992px) {
    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .contact-content {
        grid-template-columns: 1fr; /* Single column for contacts on tablet/mobile */
        gap: 2rem;
    }

    .about-features {
        flex-direction: column; /* Stack features vertically */
        align-items: center;
    }

    .feature {
        margin-bottom: 10px;
    }

    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .header .container {
        padding: 0 15px;
    }

    .nav-brand {
        flex-grow: 1;
        text-align: left;
    }

    .logo {
        height: 50px;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-width: 300px;
        height: 100vh;
        background: var(--dark-gray);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 80px;
        transition: right 0.3s ease-in-out;
        z-index: 998;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-list {
        flex-direction: column;
        gap: 1.5rem;
        width: 100%;
        text-align: center;
    }

    .nav-link {
        color: var(--white);
        font-size: 1.1rem;
        padding: 10px 0;
    }

    .nav-link::after {
        background: var(--primary-color);
    }

    .nav-toggle {
        display: flex; /* Show hamburger icon on mobile */
    }

    /* Hamburger icon animation */
    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .hero {
        padding: 100px 0 60px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    .btn-large {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .services-grid {
        grid-template-columns: 1fr; /* Single column for services on mobile */
    }

    .about-text {
        font-size: 1rem;
    }

    .contact-item {
        flex-direction: column; /* Stack icon and text in contact */
        text-align: center;
    }

    .contact-item i {
        margin-bottom: 10px;
    }

    .footer-content {
        grid-template-columns: 1fr; /* Single column for footer on mobile */
        text-align: center;
    }

    .footer-section ul {
        padding: 0;
    }

    .social-links .social-icons {
        justify-content: center; /* Center social icons in footer */
    }

    .whatsapp-sticky-icon {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .cookie-buttons {
        flex-direction: column; /* Stack cookie banner buttons */
    }

    .cookie-buttons .btn {
        width: 100%; /* Make buttons take full width */
    }

    .whatsapp-sticky-icon {
        bottom: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
    }
}
/* Regola specifica per centrare il pulsante "Scopri di più" nella sezione Servizi */
#servizi .container .services-more-button .btn-large {
    display: block; /* Fa in modo che il pulsante si comporti come un blocco */
    margin: 0 auto;  /* Centra orizzontalmente il blocco stesso */
    max-width: 200px; /* Imposta una larghezza massima per il pulsante (puoi regolare questo valore) */
    width: auto; /* Permette alla larghezza di adattarsi al contenuto, ma non superare max-width */
}
}