* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    background-color: #121212;
    color: #e0e0e0;
    line-height: 1.6;
}

.container {
    width: 85%;
    max-width: 1200px;
    margin: auto;
}

/* NAVBAR */
.navbar {
    background: #0a0a0a;
    padding: 20px 0;
    border-bottom: 1px solid #222;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: 0.3s;
}

.nav-links a:hover, .btn-nav {
    color: #fff;
}

/* HERO SECTION */
.hero {
    height: 80vh;
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('../img/hero-bg.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 15px;
}

.tagline {
    font-style: italic;
    color: #aaa;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 30px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    margin: 5px;
    display: inline-block;
}

.btn-primary { background: #fff; color: #000; }
.btn-secondary { border: 1px solid #fff; color: #fff; }

/* CATEGORIE */
.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 60px 0;
}

.card {
    background: #1e1e1e;
    padding: 30px;
    border: 1px solid #2a2a2a;
    transition: transform 0.3s;
}

.card:hover { transform: translateY(-5px); }
.card h3 { color: #fff; margin-bottom: 10px; }
.card a { color: #fff; text-decoration: none; font-weight: bold; display: inline-block; margin-top: 15px; }

/* FORM CONTATTI */
.contact-form input, .contact-form select, .contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: #1e1e1e;
    border: 1px solid #333;
    color: #fff;
}
/* ==========================================================================
   PORTFOLIO PAGE STYLES
   ========================================================================== */

/* Hero Banner della pagina Portfolio */
.portfolio-hero {
    height: 45vh;
    background: linear-gradient(rgba(0,0,0,0.75), rgba(0,0,0,0.85)), url('../img/portfolio-hero-bg.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #222;
}

.sub-title {
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 10px;
}

.text-center { text-align: center; }

/* Filter Bar */
.portfolio-filter-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 40px auto 30px auto;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 1px solid #333;
    color: #aaa;
    padding: 10px 22px;
    cursor: pointer;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.filter-btn:hover, .filter-btn.active {
    color: #fff;
    border-color: #fff;
    background: #1a1a1a;
}

/* Portfolio Grid System */
.portfolio-grid-section {
    padding-bottom: 80px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

/* Immagine Hero (Featured Item - occupa 2 colonne su desktop) */
@media (min-width: 992px) {
    .portfolio-item.featured {
        grid-column: span 2;
    }
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    background: #181818;
    border: 1px solid #252525;
    transition: all 0.3s ease;
}

.image-wrapper {
    position: relative;
    width: 100%;
    height: 380px;
}

.portfolio-item.featured .image-wrapper {
    height: 480px; /* Più alta per l'immagine Hero */
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* Overlay & Informazioni al Passaggio del Mouse */
.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.92) 10%, rgba(0,0,0,0.2));
    display: flex;
    align-items: flex-end;
    padding: 25px;
    opacity: 0.9; /* Visibile di default per estetica dark elegante */
    transition: opacity 0.3s ease;
}

.portfolio-item:hover .image-wrapper img {
    transform: scale(1.05); /* Effetto Zoom */
}

.overlay-info .tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 1.5px;
}

.overlay-info h3 {
    color: #fff;
    font-size: 1.3rem;
    margin: 5px 0;
    font-weight: 600;
}

.overlay-info p {
    color: #ccc;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 8px;
}

.tech-detail {
    display: inline-block;
    font-size: 0.7rem;
    background: #252525;
    color: #fff;
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid #333;
    text-transform: uppercase;
}

/* Portfolio CTA */
.portfolio-cta {
    background: #0a0a0a;
    padding: 70px 0;
    border-top: 1px solid #222;
}

.portfolio-cta h2 {
    color: #fff;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.portfolio-cta p {
    color: #888;
    margin-bottom: 25px;
}
/* --- LAYOUT IN STILE STUDIO CONTEMPORANEO --- */

:root {
    --bg-color: #0d0d0d;
    --card-bg: #141414;
    --text-color: #f5f5f7;
    --text-muted: #86868b;
    --accent-color: #ffffff;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
}

/* Header & Hero Minimal */
.portfolio-hero {
    padding: 120px 0 60px;
    text-align: left;
}

.portfolio-hero h1 {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 20px;
}

.portfolio-hero p {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 600px;
}

/* Filtri Minimal ad alta leggibilità */
.portfolio-filter-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 50px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
}

.filter-btn:hover,
.filter-btn.active {
    color: var(--accent-color);
}

/* Griglia Asimmetrica Stile Studio */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 30px;
}

/* Regole layout alternato per i singoli elementi */
.portfolio-item {
    grid-column: span 6; /* Default: 2 colonne di pari larghezza */
    position: relative;
    overflow: hidden;
    background-color: var(--card-bg);
    border-radius: 4px;
}

/* Elementi Hero / Featured occupano l'intera larghezza o 8 colonne */
.portfolio-item.featured {
    grid-column: span 12;
}

@media (min-width: 992px) {
    /* Alternanza dinamica stile editorial */
    .portfolio-item:nth-child(3n+1):not(.featured) {
        grid-column: span 7;
    }
    .portfolio-item:nth-child(3n+2):not(.featured) {
        grid-column: span 5;
    }
}

/* Effetto Hover e Overlay */
.image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.portfolio-item.featured .image-wrapper {
    aspect-ratio: 16 / 9;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.portfolio-item:hover .image-wrapper img {
    transform: scale(1.04);
}

.portfolio-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
    opacity: 0;
    display: flex;
    align-items: flex-end;
    padding: 30px;
    transition: opacity 0.4s ease;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.overlay-info h3 {
    font-size: 1.4rem;
    font-weight: 400;
    margin: 5px 0;
}

.overlay-info .tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}
/* ==========================================
   RESET & FLUID TYPOGRAPHY (TUTTI I DEVICE)
   ========================================== */
img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

/* ==========================================
   TABLET & LAPTOP SMALL (Sotto i 1024px)
   ========================================== */
@media (max-width: 1024px) {
    /* Hero Section */
    .hero {
        padding: 80px 0 40px;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }

    /* Griglie Categorie e Portfolio */
    .categories-grid,
    .grid-4-columns {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    /* Overlay iniziale */
    .overlay-slogan {
        font-size: clamp(2rem, 5vw, 3.5rem) !important;
        flex-direction: row;
    }
}

/* ==========================================
   SMARTPHONE / MOBILE (Sotto i 600px)
   ========================================== */
@media (max-width: 600px) {
    /* Padding di sicurezza nei margini */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Adjust Overlay per schermi stretti */
    .hero-overlay-content {
        padding: 15px;
    }

    .overlay-slogan {
        flex-direction: column; /* Dispone Luce. Materia. Visione. in verticale su mobile */
        gap: 0.2em;
        font-size: 2.2rem !important;
    }

    .overlay-caption {
        font-size: 0.95rem !important;
        margin-top: 15px;
    }

    /* Griglie a colonna singola per facilitare lo scroll da touch */
    .categories-grid,
    .grid-4-columns,
    .contact-grid,
    .studio-info-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    /* Bottoni e CTA Touch-friendly */
    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .btn {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
        box-sizing: border-box;
    }

    /* Filtri Portfolio */
    .portfolio-filter-bar {
        gap: 12px;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-btn {
        font-size: 0.85rem;
    }
}