/* Import Font */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');

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

/* Variabili di Colore */
:root {
    --font-family: 'Roboto', sans-serif;

    /* Default (Home/Contatti) */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #ffffff;
    --text-color: #333333;
    --header-bg: #ffffff;
    --header-text: #2c3e50;
    --footer-bg: #2c3e50;
    --footer-text: #ffffff;
}

body.page-accessibilita {
    --primary-color: #005A9C; /* Blu istituzionale */
    --secondary-color: #7f8c8d;
    --background-color: #F0F0F0;
    --text-color: #1c1c1c;
    --header-bg: #ffffff;
    --footer-bg: #005A9C;
}

body.page-automazione {
    --primary-color: #1db76a; /* Verde Elettrico */
    --secondary-color: #95a5a6;
    --background-color: #ffffff;
    --text-color: #333333;
    --header-bg: #ffffff;
    --header-text: #2c3e50;
    --footer-bg: #2c3e50;
    --footer-text: #ffffff;
}

body.page-sport {
    --primary-color: #FF6B6B; /* Arancione Corallo */
    --secondary-color: #1A535C; /* Verde Bosco */
    --background-color: #f9f9f9;
    --text-color: #333333;
    --header-bg: #ffffff;
    --footer-bg: #1A535C;
}


/* Stili Globali */
body {
    font-family: var(--font-family);
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

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

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

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Header */
.main-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-bottom: 3px solid var(--primary-color);
}

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

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--header-text);
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li {
    margin-left: 20px;
}

.main-nav ul li a {
    color: var(--header-text);
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.main-nav ul li a:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* Main Content Area */
main {
    /* padding: 40px 0; */ /* Removed to allow full-width sections */
    min-height: 70vh; /* Assicura che il footer stia in basso */
}

.content-section {
    padding: 4rem 0;
}

/* Footer */
.main-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

.main-footer a {
    color: var(--footer-text);
    text-decoration: underline;
}

/* --- Homepage Specific Styles --- */

/* Hero Section */
.hero {
    background: var(--primary-color);
    color: #fff;
    padding: 4rem 20px;
    text-align: center;
}

.hero h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero .subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    max-width: 700px;
    margin: 0 auto;
}

.hero-actions {
    margin-top: 2rem;
}

/* Sections Grid */
.sections-grid {
    padding: 4rem 0;
}

.sections-grid h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
}

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

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.card p {
    flex-grow: 1;
    margin-bottom: 1.5rem;
    color: #555;
}

/* Card specific colors for titles and buttons */
.card-accessibilita h3 { color: #005A9C; }
.card-accessibilita .btn { background-color: #005A9C; }

.card-automazione h3 { color: #00C853; } /* Using a slightly more readable green */
.card-automazione .btn { background-color: #00C853; color: #fff; }

.card-sport h3 { color: #FF6B6B; }
.card-sport .btn { background-color: #FF6B6B; }


/* Button Style */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-weight: 700;
    text-transform: uppercase;
    transition: opacity 0.3s;
    cursor: pointer;
}

.btn:hover {
    opacity: 0.9;
}

.btn-outline {
    background: transparent;
    border: 2px solid currentColor;
}

.hero .btn-outline {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.9);
    transition: background-color 0.3s, color 0.3s, opacity 0.3s;
}

.hero .btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

/* --- Generic Content Page Styles --- */

.page-header {
    background: var(--primary-color);
    color: #fff;
    padding: 3rem 20px;
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #fff;
    font-size: 2.8rem;
}

.page-header .subtitle {
    font-size: 1.3rem;
    font-weight: 300;
    margin-top: 0.5rem;
    opacity: 0.9;
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

@media (min-width: 992px) {
    .content-layout {
        grid-template-columns: 2.5fr 1fr;
    }
}

.main-content h2 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.main-content h2:first-child {
    margin-top: 0;
}

.main-content p, .main-content ul {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.main-content ul {
    list-style-position: outside;
    padding-left: 1.5rem;
}

.main-content li {
    margin-bottom: 0.75rem;
}

.main-content hr {
    border: 0;
    height: 1px;
    background: #ddd;
    margin: 2rem 0;
}

/* Sidebar */
.sidebar .widget {
    background: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    border: 1px solid #e0e0e0;
}

body.page-accessibilita .sidebar .widget {
    background: #fff;
}

.sidebar .widget h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.sidebar .widget p {
    margin-bottom: 1rem;
}

.sidebar .widget img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
}

.sidebar .btn {
    width: 100%;
    text-align: center;
    background-color: var(--primary-color);
    color: #fff;
}

/* Specific styles for dark mode sidebar widgets */
body.page-automazione .sidebar .widget {
    background: #3a3a3a;
    border-color: #444;
}

/* Tech Tags in Sidebar */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tags .tag {
    background-color: var(--primary-color);
    color: var(--background-color); /* Contrasting text color */
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 700;
}

/* Specific override for automation page to make tags pop */
body.page-automazione .tech-tags .tag {
    color: #252525;
    background-color: var(--primary-color);
}


/* --- Accessibility, Active States, & Responsive --- */

/* Style for the active navigation link */
.main-nav ul li a.active {
    background-color: var(--primary-color);
    color: #fff !important;
}

/* Clear focus state for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Fix contrast on automation card button */
.card-automazione .btn {
    color: #252525;
}

.nav-toggle {
    display: none;
}

@media (max-width: 767px) {
    /* General mobile typography adjustments */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.6rem; }
    .hero h1 { font-size: 2.2rem; }
    .page-header h1 { font-size: 2.4rem; }

    /* Hamburger Menu Button */
    .nav-toggle {
        display: block;
        position: absolute;
        z-index: 1000;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        cursor: pointer;
        border: 0;
        background: transparent;
        width: 2em;
        height: 2em;
    }

    .hamburger {
        display: block;
        position: relative;
        width: 100%;
        height: 3px;
        background: var(--header-text);
        transition: transform 250ms ease-in-out;
    }
    .hamburger::before,
    .hamburger::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--header-text);
        transition: transform 250ms ease-in-out, opacity 250ms linear;
    }
    .hamburger::before { top: -8px; }
    .hamburger::after { bottom: -8px; }

    /* Mobile Navigation Panel */
    .main-nav {
        visibility: hidden;
        position: fixed;
        background: var(--header-bg);
        top: 0; bottom: 0; left: 0; right: 0;
        z-index: 999;
        transform: translateX(100%);
        transition: transform 250ms cubic-bezier(.5, 0, .5, 1), visibility 0s 250ms;
    }

    .main-nav.nav--visible {
        visibility: visible;
        transform: translateX(0);
        transition: transform 250ms cubic-bezier(.5, 0, .5, 1);
    }

    .main-nav ul {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100%;
    }

    .main-nav ul li {
        margin-left: 0;
        margin-bottom: 2rem;
    }

    .main-nav ul li a {
        font-size: 1.5rem;
    }

    /* Hamburger animation when nav is open */
    .nav-toggle.nav--open .hamburger {
        transform: rotate(.625turn);
    }
    .nav-toggle.nav--open .hamburger::before {
        transform: rotate(90deg) translateX(-8px);
    }
    .nav-toggle.nav--open .hamburger::after {
        opacity: 0;
    }
}

/* --- Contact Page Styles --- */

.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}

@media (min-width: 992px) {
    .contact-wrapper {
        grid-template-columns: 1fr 2fr;
        padding: 3rem;
        gap: 3rem;
    }
}

.contact-info h3, .contact-form h3 {
    margin-bottom: 1.5rem;
}

.contact-info p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(44, 62, 80, 0.2);
}

.contact-form .btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    background-color: var(--primary-color);
    color: #fff;
}

/* Dark mode adjustments for contact form */
body.page-automazione .contact-wrapper {
    background: #3a3a3a;
    border-color: #444;
}

body.page-automazione .form-group label {
    color: #ccc;
}

body.page-automazione .form-group input,
body.page-automazione .form-group textarea {
    background: #2c2c2c;
    border-color: #555;
    color: #fff;
}
