/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Platinum Palette */
    --platinum-light: #f5f5f5;
    --platinum-base: #e5e4e2;
    --platinum-dark: #b3b3b3;
    --platinum-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    --platinum-metallic: linear-gradient(135deg, #e0e0e0 0%, #ffffff 50%, #e0e0e0 100%);

    /* Accent & Text */
    --text-main: #333333;
    --text-light: #666666;
    --accent-color: #2c3e50;
    /* Elegant Dark Blue/Grey for contrast */
    --accent-gold: #c5a059;
    /* Subtle gold touch for high-end feel */

    /* Spacing */
    --container-width: 1200px;
    --header-height: 80px;

    /* Shadows */
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: #ffffff;
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--platinum-metallic);
    color: var(--text-main);
    border: 1px solid var(--platinum-dark);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-main);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--text-main);
    color: #fff;
}

/* Header */
header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

header .container {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 50px;
    width: auto;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}

.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1;
}

.logo-top {
    font-size: 0.9rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-gold);
}

.logo-bottom {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-main);
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-main);
    position: relative;
    font-size: 1rem;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--accent-gold);
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero {
    height: 50vh;
    /* Further reduced to show cards above fold */
    min-height: 400px;
    /* Reduced minimum height */
    /* Technical Grid Pattern (CTR/Cadastral Style) - SVG Topographic Pattern */
    background-color: var(--platinum-light);
    background-image:
        url('../images/ctr-pattern.svg'),
        var(--platinum-gradient);
    background-size: 300px 300px, 100% 100%;
    background-position: center;
    background-repeat: repeat;

    display: flex;
    align-items: center;
    position: relative;
    margin-top: var(--header-height);
    /* Push down below fixed header */
    padding-top: 0;
    overflow: hidden;
    border-top: 4px solid var(--accent-gold);
    border-bottom: 4px solid var(--accent-gold);
}

.page-header {
    margin-top: var(--header-height);
    /* Push below header to show top border */
    padding: 60px 0;

    /* CTR Pattern Background */
    background-color: var(--platinum-light);
    background-image:
        url('../images/ctr-pattern.svg'),
        var(--platinum-gradient);
    background-size: 300px 300px, 100% 100%;
    background-position: center;
    background-repeat: repeat;

    text-align: center;
    border-top: 4px solid var(--accent-gold);
    border-bottom: 4px solid var(--accent-gold);
}

/* ... existing styles ... */

.hero h1 {
    font-size: 3rem;
    /* Adjusted for smaller container */
    /* ... */
}

/* Homepage Activity Cards */
.visual-activities-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Force 3 columns in a single row */
    gap: 30px;
    /* Reduced gap slightly to ensure fit on smaller screens */
    margin-bottom: 60px;
}

/* Responsive & Mobile Optimization */
/* ... */

@media (max-width: 768px) {
    /* ... existing nav styles ... */

    /* Force stacking on mobile/tablets where 3 columns usually break */
    .visual-activities-grid {
        grid-template-columns: 1fr;
        /* Stack vertically on small screens */
    }

    /* ... existing styles ... */
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    /* Reduced size slightly */
    height: 600px;
    background: radial-gradient(circle, rgba(229, 228, 226, 0.4) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: 0;
}

.hero-content {
    max-width: 700px;
    /* Widened slightly for better centered layout */
    margin: 0 auto;
    /* Center the block horizontally */
    z-index: 1;
    text-align: center;
    /* Center buttons and H1 */
}

.hero h1 {
    font-size: 3.5rem;
    /* Slightly smaller to save space */
    line-height: 1.1;
    margin-bottom: 20px;
    font-weight: 700;
    background: -webkit-linear-gradient(#333, #666);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 30px;
    text-align: justify;
    /* Justified as requested */
    text-align-last: center;
    /* Better look for the last line in a centered layout */
}

/* Footer */
footer {
    background: var(--text-main);
    color: #fff;
    padding: 50px 0 20px;
}

/* Global Justification for Content */
section p,
.about-text p,
.service-card p,
.tech-desc p,
.contact-info p {
    text-align: justify;
}

/* Exceptions */
.footer-col p {
    text-align: left;
    /* Keep footer links/info left aligned for readability */
}

.hero p {
    text-align: justify;
    text-align-last: center;
}

/* Homepage Activity Cards */
.visual-activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    /* Slightly wider min-width */
    gap: 50px;
    /* Increased gap as requested */
    margin-bottom: 60px;
}

.activity-card {
    background: var(--platinum-gradient);
    padding: 40px 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    /* Prepare for gold border */
}

.activity-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-gold);
    box-shadow: 0 15px 30px rgba(197, 160, 89, 0.15);
}

.activity-card-icon {
    font-size: 3.5rem;
    color: var(--accent-color);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.activity-card:hover .activity-card-icon {
    color: var(--accent-gold);
}

.activity-card h4 {
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 15px;
}

.activity-card p {
    font-size: 1rem;
    color: var(--text-light);
    margin: 0;
}

/* Policy Pages */
.policy-content h3 {
    color: var(--text-main);
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.policy-content ul {
    list-style: disc;
    padding-left: 20px;
    margin-bottom: 20px;
    color: var(--text-light);
}

.policy-content li {
    margin-bottom: 10px;
}

/* Cookie Banner */
#cookie-banner {
    position: fixed;
    bottom: -100%;
    /* Hidden by default */
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    z-index: 9999;
    transition: bottom 0.5s ease-in-out;
    border-top: 4px solid var(--accent-gold);
}

#cookie-banner.show {
    bottom: 0;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-text p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-main);
}

.cookie-buttons {
    display: flex;
    gap: 10px;
}

.btn-cookie-accept {
    background: var(--text-main);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

.btn-cookie-deny {
    background: transparent;
    color: var(--text-light);
    border: 1px solid #ddd;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
}

.btn-cookie-accept:hover {
    background: var(--accent-color);
}

/* Footer Global Override for this block only */
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h3 {
    margin-bottom: 20px;
    color: var(--platinum-base);
}

.footer-col p,
.footer-col a {
    color: #bbb;
    margin-bottom: 10px;
    display: block;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid var(--accent-gold);
    padding-top: 20px;
    color: #777;
    font-size: 0.9rem;
}

/* Responsive & Mobile Optimization */
img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        right: -100%;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        width: 100%;
        background: #fff;
        flex-direction: column;
        justify-content: flex-start;
        /* Changed from center to allow scrolling if needed */
        padding-top: 50px;
        align-items: center;
        gap: 30px;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
        overflow-y: auto;
        /* Allow scrolling for landscape/small phones */
    }

    .nav-links.active {
        right: 0;
    }

    .mobile-toggle {
        display: block;
    }

    /* Hero adjustments */
    .hero {
        height: auto;
        min-height: 100vh;
        /* Fill screen on mobile */
        padding: 120px 0 60px;
        /* More top padding for header */
        text-align: center;
    }

    .hero::before {
        width: 300px;
        height: 300px;
        top: -100px;
        right: -50px;
        opacity: 0.5;
        /* Fade out decorative element */
    }

    .hero-content {
        padding: 0 15px;
    }

    .hero h1 {
        font-size: 2.2rem;
        /* Smaller for mobile */
    }

    .hero p {
        font-size: 1rem;
        text-align: center !important;
        /* Force center on mobile for better readability */
    }

    /* General Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    /* Cookie Banner Mobile */
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-buttons {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {

    /* Extra small devices */
    .btn {
        width: 100%;
        /* Full width buttons on phones */
        margin-bottom: 10px;
        text-align: center;
    }

    .contact-grid,
    .footer-content {
        gap: 30px;
    }

    .logo-text .logo-top {
        font-size: 0.7rem;
    }

    .logo-text .logo-bottom {
        font-size: 0.9rem;
    }
}

/* About Image Hover Effects */
.about-image {
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid transparent;
    /* Kept transparent for layout stability */
    transition: all 0.5s ease;
    /* Smoother floating transition */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    /* "Bordi sfuocati" / Floating effect */
    transform: translateY(0);
}

.about-image:hover {
    border-color: var(--accent-gold);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(197, 160, 89, 0.4);
    /* Sfumatura dorata (gold glow) */
}

.about-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}