/* ===== CONFIGURACIÓ GLOBAL ===== */
:root {
    /* PALETA DE COLORS NOVA: BLANC, BEIX, VERD FOSC */
    --color-bg-light: #F4F1EA;  
    --color-bg-white: #FFFFFF;  
    --color-bg-dark: #1F3B2E;   
    --color-glass-white: rgba(255, 255, 255, 0.85); 
    --color-text-main: #4A4F4B; 
    --color-text-title: #1F3B2E;
    --color-accent: #B09B78;    
    
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
    --font-script: 'Pinyon Script', cursive;
    
    --header-height: 80px; 
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    color: var(--color-text-main);
    background-color: var(--color-bg-light);
    line-height: 1.7;
    font-weight: 300;
    width: 100%;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-text-title);
    font-weight: 400;
    margin-bottom: 1rem;
}

h2 {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.2;
}

.script-decor {
    font-family: var(--font-script);
    font-size: 3rem;
    color: #cdb794;
    display: block;
    text-align: center;
    margin-bottom: -10px;
    z-index: 1;
    position: relative;
}
.script-decor.white-text { color: rgba(255,255,255,0.9); }
.white-text { color: #fff !important; }

a { text-decoration: none; transition: all 0.3s ease; }


/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 10px; 
    left: 50%;
    transform: translateX(-50%);
    width: 96%; 
    max-width: 1600px;
    height: 70px;
    background-color: var(--color-glass-white);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50px; 
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 0 2.5rem;
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    letter-spacing: 0.1em;
    color: var(--color-text-title); 
    text-transform: uppercase;
    font-weight: 600;
}

.nav-links { display: flex; gap: 2rem; list-style: none; }

.nav-link {
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-main);
    font-weight: 500;
    position: relative;
}

.nav-link:hover { color: var(--color-accent); }

.nav-link.active { color: var(--color-text-title); font-weight: 700; }
.nav-link.active::after {
    content: '';
    position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; background-color: var(--color-accent); border-radius: 50%;
}

.lang-separator {
    border-left: 1px solid rgba(0,0,0,0.1);
    padding-left: 1.5rem; margin-left: 1rem; display: flex;
}
.lang-switcher a { font-size: 0.75rem; color: #666; margin-right: 8px; }
.lang-switcher a.active { color: var(--color-text-title); font-weight: 600; }

.burger-menu { display: none; background: none; border: none; cursor: pointer; }
.burger-menu span {
    display: block; width: 25px; height: 2px;
    background-color: var(--color-text-title); margin: 5px 0;
}


/* ===== SECCIONS GENERALS ===== */
.page-section {
    padding: 6rem 2rem;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.section-container { max-width: 1200px; width: 100%; margin: 0 auto; }

.alt-bg { background-color: #1c3027; color: #fff; }
.alt-bg-light { background-color: var(--color-bg-white); }


/* ===== HERO SECTION ===== */
.hero-section {
    min-height: 100vh; 
    width: 100%;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    text-align: center;
    background: url('gallery/nuviescava.webp') no-repeat center center/cover;
    padding: 0 2rem;
    position: relative; 
    overflow: hidden; 
}

.hero-section::before {
    content: ''; 
    position: absolute; 
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.637); 
    z-index: 0; 
    pointer-events: none;
}
.hero-content { z-index: 1; position: relative; }

.hero-content h1 { 
    color: #fff; font-size: 4rem; letter-spacing: 0.05em; margin: 1rem 0; 
    text-shadow: 0 2px 15px rgba(0,0,0,0.2);
}
.hero-content p { 
    color: #fff; letter-spacing: 0.3em; text-transform: uppercase; font-size: 0.9rem; 
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.cta-button-outline {
    display: inline-block; margin-top: 1rem; padding: 1rem 2.5rem;
    border: 1px solid #fff; color: #fff; text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.8rem;
    text-shadow: 0 1px 5px rgba(0,0,0,0.2);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.cta-button-outline:hover { background: #fff; color: var(--color-bg-dark); text-shadow: none; }


/* ===== INTRO ===== */
.intro-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 5rem; align-items: center;
    width: 100%; max-width: 1100px; margin: 0 auto;
}
.intro-image-wrapper { position: relative; width: 100%; padding-left: 20px; padding-bottom: 20px; }

.intro-slider {
    width: 100%; 
    border-radius: 300px 300px 0 0; 
    overflow: hidden; 
    position: relative;
    z-index: 2; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.intro-slider.image-comparer {
    grid-column: auto; grid-row: auto; aspect-ratio: auto; height: 670px; 
}

.arch-border {
    position: absolute; top: 20px; left: 0; width: 100%; height: 100%;
    border: 1px solid var(--color-accent); 
    border-radius: 300px 300px 0 0; 
    z-index: 1; 
    pointer-events: none; 
}

.intro-content { text-align: center; }
.intro-kicker { display: block; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: #888; margin-bottom: 1.5rem; }
.intro-content h2 { text-align: center; font-size: 3.5rem; margin-bottom: 2rem; }

.team-grid {
    display: flex; gap: 2rem; margin-top: 2.5rem; margin-bottom: 1.5rem; justify-content: center; 
}

.team-member { display: flex; flex-direction: column; align-items: center; text-align: center; }

.team-member img {
    width: 80px; height: 80px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--color-accent); margin-bottom: 0.8rem; transition: transform 0.3s ease;
}
.team-member img:hover { transform: scale(1.1); }

.team-member span {
    font-family: var(--font-heading); font-size: 0.9rem; font-style: italic; color: var(--color-text-title);
}
.intro-signoff { font-family: var(--font-heading); font-style: italic; font-size: 1.5rem; margin-top: 1rem; color: var(--color-text-title); }


/* ===== SERVEIS ===== */
.services-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3rem; margin-top: 3rem; }
.service-box { text-align: center; }
.img-wrapper { 
    width: 100%; height: 550px; overflow: hidden; margin-bottom: 1.5rem; border-radius: 30px 30px 0 0; 
}
.img-wrapper img { 
    width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s; 
}
.service-box:hover img { transform: scale(1.05); }

.service-box .image-comparer {
    grid-column: auto !important; grid-row: auto !important;
    width: 100%; height: 100%; border: none !important; box-shadow: none !important;
    background: transparent; border-radius: 30px 30px 0 0; 
}


/* ===== GALERIA ===== */
.carousel-container {
    width: 100%; max-width: 1000px; margin: 0 auto 1.5rem auto; 
    overflow: hidden; position: relative; border-radius: 4px; aspect-ratio: 16/9;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 10; /* Per assegurar que les fletxes es vegin */
}

.carousel-track { 
    display: flex; 
    height: 100%; 
    transition: transform 0.8s cubic-bezier(0.7, 0, 0.3, 1);
    cursor: grab;
}
.carousel-track:active { cursor: grabbing; }

.carousel-slide { 
    min-width: 100%; height: 100%; 
    background-size: cover; background-position: center; 
}

/* ESTIL FLETXES (MODERN I SUTIL) */
.carousel-button {
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%);
    background: transparent; 
    color: rgba(255, 255, 255, 0.6); /* Blanc semi-transparent */
    border: none; 
    font-size: 3rem; /* Fina i gran */
    font-weight: 100;
    cursor: pointer; 
    padding: 0 1.5rem; 
    z-index: 20;
    transition: all 0.3s ease;
    user-select: none;
    outline: none;
    height: 100%; /* Ocupa tota l'alçada per fer més fàcil el clic */
    display: flex;
    align-items: center;
}

.carousel-button:hover {
    color: #fff; 
    background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, transparent 100%);
}

.carousel-button.prev { left: 0; text-align: left; }
.carousel-button.prev:hover { background: linear-gradient(90deg, rgba(0,0,0,0.3) 0%, transparent 100%); }

.carousel-button.next { right: 0; text-align: right; }
.carousel-button.next:hover { background: linear-gradient(-90deg, rgba(0,0,0,0.3) 0%, transparent 100%); }

.gallery-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-flow: dense; gap: 1.5rem;
    width: 100%; max-width: 1000px; margin: 0 auto;
}

.gallery-item {
    width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; cursor: pointer; transition: opacity 0.3s;
}
.gallery-item:hover { opacity: 0.8; }

.image-comparer {
    position: relative; width: 100%; height: 100%;
    grid-column: span 2; grid-row: span 2;    
    aspect-ratio: auto; overflow: hidden; cursor: ew-resize;
    user-select: none; -webkit-tap-highlight-color: transparent;
}
.image-comparer.right-pos { grid-column: 3 / span 2; }

.image-comparer img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.comparer-after { clip-path: inset(0 0 0 50%); }
.comparer-slider {
    position: absolute; top: 0; left: 50%; width: 2px; height: 100%;
    background: #fff; cursor: ew-resize; z-index: 10;
}
.comparer-slider::before, .comparer-slider::after {
    content: ''; position: absolute; top: 50%; border: 6px solid transparent; margin-top: -6px;
}
.comparer-slider::before { right: 2px; border-right-color: #fff; }
.comparer-slider::after { left: 2px; border-left-color: #fff; }


/* ===== FAQ ===== */
.faq-container { width: 100%; max-width: 800px; margin: 0 auto; }
.faq-item {
    background: transparent; border-bottom: 1px solid rgba(31, 59, 46, 0.15); 
    margin-bottom: 0; padding-bottom: 0.5rem; border-radius: 0;
}
.faq-question {
    width: 100%; background: none; border: none; padding: 1.5rem 0;
    text-align: left; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-heading); font-style: italic; font-size: 1.5rem;
    color: var(--color-text-title); transition: color 0.3s ease;
}
.faq-question:hover { color: var(--color-accent); }
.faq-question::after {
    content: '+'; font-family: var(--font-body); font-style: normal; font-weight: 300;
    font-size: 1.8rem; color: var(--color-accent); transition: transform 0.3s ease;
}
.faq-question.active::after { content: '−'; transform: rotate(180deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.5s cubic-bezier(0, 1, 0, 1); }
.faq-answer p { padding: 0 0 2rem 0; color: var(--color-text-main); font-size: 1rem; line-height: 1.8; }


/* ===== CONTACTE ===== */
.dark-footer-section { background-color: #1c3027; color: #fff; text-align: center; }

.contact-form { 
    max-width: 800px; width: 100%; margin: 3rem auto 0 auto; 
    display: flex; flex-direction: column; align-items: center;
}

.form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2rem 3rem; 
    width: 100%; margin-bottom: 2rem;
}

.contact-form input, .contact-form textarea, .contact-form select {
    width: 100%; 
    padding: 1rem 0; 
    background: transparent;
    border: none; 
    border-bottom: 1px solid rgba(255,255,255,0.3);
    color: #fff; 
    font-family: var(--font-heading); 
    font-style: italic;
    font-size: 1.1rem;
    text-align: center; 
    transition: border-color 0.3s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

.contact-form select option {
    background-color: #1c3027;
    color: #fff;
    font-family: var(--font-body);
    font-style: normal;
    padding: 10px;
}
.contact-form select { text-align-last: center; } 

.contact-form textarea {
    grid-column: 1 / -1; margin-bottom: 2rem; resize: vertical; min-height: 60px; 
}
.contact-form textarea::-webkit-scrollbar { width: 8px; }
.contact-form textarea::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 4px; }
.contact-form textarea::-webkit-scrollbar-thumb { background-color: var(--color-accent); border-radius: 4px; border: 2px solid rgba(0,0,0,0); background-clip: content-box; }
.contact-form textarea { scrollbar-width: thin; scrollbar-color: var(--color-accent) rgba(255, 255, 255, 0.05); }

.contact-form input:focus, .contact-form textarea:focus, .contact-form select:focus { 
    outline: none; border-bottom-color: var(--color-accent); 
}
.contact-form input::placeholder, .contact-form textarea::placeholder {
    color: rgba(255,255,255,0.5); font-family: var(--font-body); font-style: normal; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.1em;
}

.cta-button-solid {
    background: var(--color-accent); color: #fff; border: none; padding: 1rem 4rem; 
    font-family: var(--font-heading); font-style: italic; font-size: 1.2rem; 
    cursor: pointer; margin-top: 1rem; transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.cta-button-solid:hover { background: #fff; color: var(--color-bg-dark); transform: translateY(-2px); }

footer { background: #09130f; color: rgb(255, 255, 255); padding: 2rem; text-align: center; font-size: 0.8rem; border-top: 1px solid rgba(255,255,255,0.05); }

/* ===== UTILS ===== */
.hidden { opacity: 0; transform: translateY(30px); transition: all 0.8s ease-out; }
.show { opacity: 1; transform: translateY(0); }
.lightbox { display: none; position: fixed; z-index: 2000; top:0; left:0; width:100%; height:100%; background:rgba(31, 59, 46, 0.98); align-items:center; justify-content:center; }
.lightbox.active { display: flex; }
.lightbox-content { max-height: 90vh; max-width: 90vw; }
.lightbox-close { position: absolute; top: 2rem; right: 2rem; color: #fff; font-size: 3rem; background: none; border: none; cursor: pointer; }

/* ===== POPUP CONFIRMACIÓ ===== */
.popup-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(31, 59, 46, 0.8);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; /* Ocult per defecte */
    transition: opacity 0.4s ease, visibility 0.4s;
}
.popup-overlay.active { opacity: 1; visibility: visible; }

.popup-content {
    background: var(--color-bg-light); color: var(--color-text-main);
    padding: 3rem 2rem; max-width: 500px; width: 90%; text-align: center;
    border-radius: 8px; position: relative;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    border: 1px solid var(--color-accent);
    transform: scale(0.9); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.popup-overlay.active .popup-content { transform: scale(1); }

.popup-content h3 { font-family: var(--font-heading); font-size: 2rem; margin: 1rem 0; letter-spacing: 0.05em; color: var(--color-text-title); }
.popup-content p { margin-bottom: 2rem; font-size: 1rem; }
.popup-close-btn {
    position: absolute; top: 15px; right: 20px; background: none; border: none;
    font-size: 2rem; cursor: pointer; color: var(--color-text-main); transition: color 0.3s;
}
.popup-close-btn:hover { color: var(--color-accent); }


/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    h1, .hero-content h1 { font-size: 2.5rem; } 
    h2 { font-size: 2rem; } 
    .intro-content h2 { font-size: 2.2rem; } 
    .script-decor { font-size: 2rem; } 

    .page-section { padding: 4rem 1rem; }

    .navbar { width: 92%; top: 10px; }
    .nav-links {
        position: absolute; top: 80px; right: 0; width: 100%; 
        background: var(--color-bg-light);
        flex-direction: column; padding: 2rem; gap: 2rem; border-radius: 20px;
        transform: scaleY(0); transform-origin: top; opacity: 0; transition: all 0.3s;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    }
    .nav-links.nav-active { transform: scaleY(1); opacity: 1; }
    .nav-link { color: var(--color-text-title); font-size: 1.2rem; }
    
    .gallery-grid { grid-template-columns: repeat(2, 1fr); } 
    .image-comparer { grid-column: span 2; grid-row: span 1; aspect-ratio: 4/5; } 
    .image-comparer.right-pos { grid-column: span 2; } 
    
    .intro-grid { grid-template-columns: 1fr; gap: 3rem; text-align: center; }
    .intro-image-wrapper { max-width: 400px; margin: 0 auto; padding-left: 10px; }
    
    .intro-slider.image-comparer { height: 450px; }
    .team-grid { justify-content: center; } 
    .form-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .burger-menu { display: block; }

    .services-container { grid-template-columns: 1fr; gap: 4rem; }
    .service-box { width: 100%; max-width: 350px; margin: 0 auto; overflow: hidden; }
    .service-box .img-wrapper { width: 100%; height: auto !important; aspect-ratio: 2/3; margin-bottom: 1.5rem; }
    .service-box .image-comparer { grid-column: auto !important; aspect-ratio: 2/3 !important; width: 100%; border: none !important; box-shadow: none !important; background: transparent; border-radius: 30px 30px 0 0; }
    .service-box p { padding: 0 10px; }

    /* Amagar fletxes del carrusel en mòbil */
    .carousel-button { display: none !important; }
}