/* ==========================================================================
   CSS Variables & Tokens
   ========================================================================== */
:root {
    /* Colori principali */
    --color-primary: #0f284a;      /* Navy Blue */
    --color-secondary: #2c3e50;    /* Charcoal */
    --color-accent: #f39c12;       /* Amber/Orange */
    --color-accent-hover: #e67e22; /* Darker Amber */
    
    /* Colori di sfondo */
    --color-bg: #ffffff;
    --color-bg-light: #f8f9fa;
    --color-bg-dark: #1a1a1a;
    
    /* Colori di testo */
    --color-text-main: #333333;
    --color-text-muted: #666666;
    --color-text-light: #ffffff;
    
    /* Tipografia */
    --font-main: 'Inter', sans-serif;
    
    /* Spaziature & Layout */
    --container-width: 1200px;
    --section-padding: 5rem;
    
    /* Transizioni & Effetti */
    --transition: all 0.3s ease;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.12);
    --border-radius: 8px;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

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

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

ul {
    list-style: none;
}

img, svg {
    max-width: 100%;
    display: block;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-primary);
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 1rem;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: var(--color-text-light);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

p {
    margin-bottom: 1rem;
}

.lead {
    font-size: 1.25rem;
    color: var(--color-secondary);
    font-weight: 500;
}

/* ==========================================================================
   Layout & Components
   ========================================================================== */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

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

.bg-light {
    background-color: var(--color-bg-light);
}

.accent {
    color: var(--color-accent);
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-header p {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

.divider {
    height: 4px;
    width: 60px;
    background-color: var(--color-accent);
    margin: 1.5rem auto;
    border-radius: 2px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    border: none;
    font-family: var(--font-main);
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--color-accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(243, 156, 18, 0.4);
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.6);
}

.btn-block {
    display: block;
    width: 100%;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    padding: 1rem 0;
}

#main-header.scrolled {
    padding: 0.5rem 0;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--color-secondary);
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    padding: 0.5rem 0;
}

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

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

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

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown > a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    min-width: 280px;
    box-shadow: var(--shadow-md);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu a {
    padding: 0.75rem 1.5rem !important;
    display: block;
    color: var(--color-secondary);
    font-size: 0.95rem !important;
}

.dropdown-menu a::after {
    display: none !important;
}

.dropdown-menu a:hover {
    background-color: var(--color-bg-light);
    color: var(--color-accent);
}

/* Mobile Menu Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 24px;
    position: relative;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--color-primary);
    position: absolute;
    left: 0;
    transition: var(--transition);
}

.mobile-menu-toggle span:nth-child(1) { top: 0; }
.mobile-menu-toggle span:nth-child(2) { top: 11px; }
.mobile-menu-toggle span:nth-child(3) { top: 22px; }

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg);
    top: 11px;
}
.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg);
    top: 11px;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    background-color: var(--color-primary);
    padding-top: 80px; /* Offset for header */
    overflow: hidden;
}

.hero-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
                      radial-gradient(circle at 80% 20%, rgba(243, 156, 18, 0.1) 0%, transparent 40%);
    z-index: 1;
}

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

.hero-content {
    max-width: 800px;
}

.hero .subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
    margin: 0 auto 2.5rem auto;
    max-width: 800px;
}

/* ==========================================================================
   Services Section
   ========================================================================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2rem;
}

.service-card {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--color-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

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

.service-card:hover::before {
    transform: scaleX(1);
}

.icon-wrapper {
    width: 64px;
    height: 64px;
    background-color: rgba(243, 156, 18, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--color-accent);
    transition: var(--transition);
}

.service-card:hover .icon-wrapper {
    background-color: var(--color-accent);
    color: #fff;
}

.service-card p {
    color: var(--color-text-muted);
    margin-bottom: 0;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    color: var(--color-primary);
    font-weight: 600;
}

.card-link svg {
    transition: transform 0.3s ease;
}

.service-card:hover .card-link {
    color: var(--color-accent);
}

.service-card:hover .card-link svg {
    transform: translateX(5px);
}

/* ==========================================================================
   Inner Pages (Service Details)
   ========================================================================== */
.inner-hero {
    min-height: 40vh;
    padding-top: 120px;
    padding-bottom: 4rem;
    display: flex;
    align-items: center;
    text-align: center;
}

.inner-hero h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    margin-bottom: 1rem;
}

.service-detail-content {
    padding-top: 4rem;
}

.service-features {
    list-style: none;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.service-features li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1rem;
}

.service-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
    font-size: 1.2rem;
}

.service-cta {
    background-color: var(--color-bg-light);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    margin-top: 4rem;
    border: 1px solid rgba(0,0,0,0.05);
}

/* ==========================================================================
   About Section
   ========================================================================== */
.about-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    align-items: center;
}

.about-content {
    flex: 1;
}

.about-content .divider {
    margin-left: 0;
}

.about-image {
    flex: 1;
    width: 100%;
}

.image-placeholder {
    background-color: rgba(15, 40, 74, 0.05);
    border-radius: var(--border-radius);
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(15, 40, 74, 0.1);
}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

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

.info-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background-color: #fff;
    padding: 2.5rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.03);
    transition: var(--transition);
}

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

.info-icon {
    width: 64px;
    height: 64px;
    background-color: rgba(243, 156, 18, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.info-card:hover .info-icon {
    background-color: var(--color-accent);
    color: #fff;
}

.info-text p {
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.info-text a:hover {
    color: var(--color-accent);
}

.contact-form-container {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    display: none;
}

.form-message.success {
    display: block;
    background-color: rgba(46, 204, 113, 0.1);
    color: #27ae60;
    border: 1px solid #2ecc71;
}

/* ==========================================================================
   Footer
   ========================================================================== */
#main-footer {
    background-color: var(--color-bg-dark);
    color: #fff;
    padding: 4rem 0 1.5rem;
}

.footer-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand h3 {
    color: #fff;
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.7);
    margin-top: 1rem;
}

.footer-links h4,
.footer-contact h4 {
    color: #fff;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-links h4::after,
.footer-contact h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--color-accent);
}

.footer-links ul li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
}

.footer-links a:hover {
    color: var(--color-accent);
    padding-left: 5px;
}

.footer-contact p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* ==========================================================================
   Animations
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Media Queries (Responsive)
   ========================================================================== */
/* Tablet */
@media (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-content .divider {
        margin-left: 0;
    }
    
    .footer-top {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .about-container {
        flex-direction: row;
        align-items: center;
    }
    
    .contact-grid {
        max-width: 800px;
        margin: 0 auto;
    }

    .footer-top {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

/* Mobile specific */
@media (max-width: 767.98px) {
    .container {
        padding: 0 1.25rem;
    }

    .logo {
        font-size: 1.3rem;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Menu mobile overlay */
    body::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(15, 40, 74, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
    }

    body.menu-open::after {
        opacity: 1;
        visibility: visible;
    }

    #main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background-color: #fff;
        padding: 80px 2rem 2rem;
        box-shadow: var(--shadow-lg);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(0);
        z-index: 1000;
        overflow-y: auto;
    }

    #main-nav.active {
        left: 0;
    }

    .nav-links {
        flex-direction: column;
        gap: 0;
    }

    .nav-links a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 1.15rem;
        padding: 1rem 0;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    .nav-links a::after {
        display: none;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding: 0 0 0 1.5rem;
        background-color: transparent;
        display: none; /* Gestito da JS */
    }
    
    .dropdown.active .dropdown-menu {
        display: flex;
    }

    .dropdown-menu a {
        padding: 0.75rem 0 !important;
        font-size: 1rem !important;
    }
    
    .section-padding {
        padding: 3.5rem 0;
    }
    
    .section-header {
        margin-bottom: 2.5rem;
    }

    .section-header p {
        font-size: 1rem;
    }
    
    /* Hero section ottimizzata */
    .hero {
        padding-top: 100px;
        text-align: center;
    }
    
    .hero .subtitle {
        font-size: 1.1rem;
        margin-bottom: 2rem;
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero .btn {
        width: 100%;
        max-width: 320px;
    }
    
    /* Card servizi */
    .service-card {
        padding: 1.75rem 1.5rem;
    }
    
    .icon-wrapper {
        margin-left: auto;
        margin-right: auto;
    }
    
    .service-card h3,
    .service-card p {
        text-align: center;
    }

    /* Chi siamo */
    .about-content {
        text-align: center;
    }

    .about-content .divider {
        margin: 1.5rem auto;
    }

    .image-placeholder {
        height: 250px;
    }
    
    /* Contatti */
    .info-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
    }
    
    .contact-form-container {
        padding: 1.75rem 1.25rem;
    }
    
    /* Footer */
    .footer-top {
        gap: 2.5rem;
        text-align: center;
    }

    .footer-links h4::after,
    .footer-contact h4::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-links a {
        display: inline-block;
        padding: 0.5rem 0;
    }
}
