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

:root {
    --primary-black: #1a1a1a;
    --primary-white: #ffffff;
    --grey-light: #f5f5f5;
    --grey-medium: #888888;
    --grey-dark: #333333;
    --accent-color: #e07434;
    --transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--primary-black);
    overflow-x: hidden;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 50px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 20px;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: var(--primary-black);
    text-decoration: none;
    transition: var(--transition);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 40px;
}

.nav-menu a {
    text-decoration: none;
    color: var(--primary-black);
    font-weight: 400;
    font-size: 15px;
    letter-spacing: 0.3px;
    position: relative;
    transition: var(--transition);
}

.nav-menu a.active,
.nav-menu a:hover {
    color: var(--accent-color);
}

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

.nav-menu a.active::after,
.nav-menu a:hover::after {
    width: 100%;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--primary-black);
    margin: 3px 0;
    transition: var(--transition);
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

@media (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
    }

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

    .nav-menu {
        position: absolute;
        top: 70px;
        right: 20px;
        width: 250px;
        background: rgba(255,255,255,0.95);
        backdrop-filter: blur(15px);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 15px 0;
        border-radius: 12px;
        transform: translateY(-100%);
        opacity: 0;
        transition: transform 0.4s ease, opacity 0.4s ease;
        pointer-events: none;
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-menu li {
        text-align: left;
        padding: 12px 20px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-menu a {
        display: block;
        color: var(--primary-black);
        font-size: 16px;
    }
}

/* Hero Section */
.portfolio-hero {
    padding: 180px 50px 80px;
    background: linear-gradient(
        rgba(255, 255, 255, 0.7),
        rgba(255, 255, 255, 0.8)
    ), url('../images/Sfondo-portfolio.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    text-align: center;
    position: relative;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
}

.page-subtitle {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.page-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 100;
    letter-spacing: -1px;
    color: var(--primary-black);
    margin-bottom: 30px;
}

.page-title strong {
    font-weight: 700;
}

.page-description {
    font-size: 18px;
    color: var(--grey-dark);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.8;
}

/* Filter Section */
.filter-section {
    padding: 10px 0;
    background: var(--primary-white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 70px;
    z-index: 900;
}

.filter-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.filter-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 5px 15px;
    background: transparent;
    color: var(--grey-medium);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 30px;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--accent-color);
    color: var(--primary-white);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.view-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.view-btn {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.view-btn:hover,
.view-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--primary-white);
}

.search-box {
    position: relative;
}

.search-input {
    padding: 12px 40px 12px 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    font-size: 14px;
    width: 250px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--grey-medium);
}

/* Portfolio Grid */
.portfolio-section {
    padding: 60px 50px 120px;
    background: var(--grey-light);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Masonry Grid Layout */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.portfolio-grid.list-view {
    grid-template-columns: 1fr;
    gap: 40px;
}

.portfolio-item {
    background: var(--primary-white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

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

/* List View Styling */
.portfolio-item.list-item {
    display: flex;
    height: 300px;
    border-radius: 15px;
}

.portfolio-item.list-item .portfolio-image {
    width: 40%;
    flex-shrink: 0;
}

.portfolio-item.list-item .portfolio-content {
    width: 60%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.portfolio-image {
    width: 100%;
    height: 280px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.portfolio-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(26, 26, 26, 0) 0%,
        rgba(26, 26, 26, 0.3) 100%
    );
    opacity: 0;
    transition: var(--transition);
}

.portfolio-item:hover .portfolio-image::before {
    opacity: 1;
}

.portfolio-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    opacity: 0;
    transform: translateY(-20px);
    transition: var(--transition);
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-year {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-color);
}

.portfolio-content {
    padding: 30px;
}

.portfolio-category {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.portfolio-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary-black);
    line-height: 1.3;
}

.portfolio-location {
    font-size: 14px;
    color: var(--grey-medium);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.portfolio-description {
    font-size: 15px;
    color: var(--grey-dark);
    line-height: 1.6;
    margin-bottom: 20px;
}

.portfolio-specs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.portfolio-area {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-black);
}

.portfolio-status {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-completed {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.status-ongoing {
    background: rgba(249, 115, 22, 0.1);
    color: #ea580c;
}

.status-planned {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

/* Project Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--primary-white);
    max-width: 800px;
    width: 90%;
    max-height: 90%;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    animation: slideUp 0.4s ease;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

.modal-image {
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
}

.modal-body {
    padding: 40px;
    max-height: calc(90vh - 400px); /* Sottrae l'altezza dell'immagine/carousel */
    overflow-y: auto;
}

.modal-header {
    margin-bottom: 30px;
}

.modal-category {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--primary-black);
}

.modal-location {
    font-size: 16px;
    color: var(--grey-medium);
    margin-bottom: 20px;
}

.modal-description {
    font-size: 16px;
    line-height: 1.8;
    color: var(--grey-dark);
    margin-bottom: 30px;
}

.modal-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    padding: 30px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.spec-item {
    text-align: center;
}

.spec-label {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--grey-medium);
    margin-bottom: 5px;
}

.spec-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-black);
}

/* Loading Animation */
.loading {
    display: none;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loading.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(212, 165, 116, 0.2);
    border-left: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* No Results */
.no-results {
    display: none;
    text-align: center;
    padding: 80px 20px;
    color: var(--grey-medium);
}

.no-results.active {
    display: block;
}

.no-results h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--grey-dark);
}

/* Footer */
.footer {
    padding: 40px 50px;
    background: var(--primary-black);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: var(--grey-medium);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Staggered Animation */
.portfolio-item:nth-child(1) { animation-delay: 0.1s; }
.portfolio-item:nth-child(2) { animation-delay: 0.2s; }
.portfolio-item:nth-child(3) { animation-delay: 0.3s; }
.portfolio-item:nth-child(4) { animation-delay: 0.4s; }
.portfolio-item:nth-child(5) { animation-delay: 0.5s; }
.portfolio-item:nth-child(6) { animation-delay: 0.6s; }
.portfolio-item:nth-child(7) { animation-delay: 0.7s; }
.portfolio-item:nth-child(8) { animation-delay: 0.8s; }
.portfolio-item:nth-child(9) { animation-delay: 0.9s; }

/* Responsive */
@media (max-width: 1024px) {
    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .filter-section {
        top: 65px;
    }

    .portfolio-hero {
        padding: 160px 20px 60px;
    }

    .filter-container {
        padding: 0 20px;
        flex-direction: column;
        gap: 20px;
    }

    .filter-buttons {
        justify-content: center;
    }

    .portfolio-section {
        padding: 40px 20px 80px;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .portfolio-item.list-item {
        flex-direction: column;
        height: auto;
    }

    .portfolio-item.list-item .portfolio-image {
        width: 100%;
        height: 200px;
    }

    .portfolio-item.list-item .portfolio-content {
        width: 100%;
        padding: 30px;
    }

    .search-input {
        width: 200px;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-body {
        padding: 30px 20px;
    }

    .modal-specs {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Floating Action Buttons */
.fab {
    position: fixed;
    right: 20px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    z-index: 2000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.fab svg {
    width: 24px;
    height: 24px;
}

.fab:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

.fab-whatsapp {
    bottom: 90px;
    background-color: var(--accent-color);
    color: var(--primary-white);
}

.fab-phone {
    bottom: 20px;
    background-color: var(--primary-black);
    color: var(--primary-white);
}


/* Modal Carousel Styles */
.modal-carousel {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
}

.carousel-container {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    z-index: 10;
    transition: var(--transition);
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

.carousel-counter {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    z-index: 10;
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.carousel-indicator.active {
    background: var(--accent-color);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--grey-light);
}

::-webkit-scrollbar-thumb {
    background: var(--grey-medium);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.hero-divider {
  width: 100%;                 /* tutta la larghezza */
  height: 20px;                /* spessore */
  background-color: var(--accent-color); /* colore della scritta Contattaci */
}

@media (max-width: 768px) {

    /* HERO */
    .page-subtitle {
        font-size: 12px;
        letter-spacing: 2px;
        margin-bottom: 10px;
    }

    .page-title {
        font-size: 2rem; /* NON tocca titolo topbar */
        margin-bottom: 20px;
    }

    .page-description {
        font-size: 15px;
        line-height: 1.6;
        margin-bottom: 30px;
    }

    /* FILTER */
    .filter-btn {
        font-size: 12px;
        padding: 4px 12px;
    }

    .search-input {
        font-size: 13px;
        padding: 10px 35px 10px 15px;
    }

    /* PORTFOLIO CARD */
    .portfolio-category {
        font-size: 11px;
        letter-spacing: 1.5px;
        margin-bottom: 8px;
    }

    .portfolio-title {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .portfolio-location {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .portfolio-description {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 15px;
    }

    .portfolio-area {
        font-size: 13px;
    }

    .portfolio-status {
        font-size: 11px;
        padding: 3px 10px;
    }

    /* MODAL */
    .modal-title {
        font-size: 22px;
    }

    .modal-location {
        font-size: 14px;
    }

    .modal-description {
        font-size: 14px;
        line-height: 1.6;
    }

    .spec-label {
        font-size: 11px;
    }

    .spec-value {
        font-size: 14px;
    }

    /* FOOTER */
    .footer {
        font-size: 13px;
        padding: 30px 20px;
    }
  
  	.filter-section {
        display: none;
    }

}
