/*
 * =========================================
 * NOVA PALETA DE COLORS I TIPOGRAFIA
 * =========================================
 */

:root {
    /* NOVA PALETA PRIMÀRIA (Violeta) */
    --color-primari: #6D28D9;
    --color-primari-hover: #5B21B6;

    /* TEMA CLAR (DIA) */
    --color-fons: #F9FAFB; /* Gris molt clar */
    --color-fons-secundari: #FFFFFF; /* Blanc pur (per targetes) */
    --color-text: #374151; /* Gris fosc */
    --color-titol: #11182C; /* Blau/negre */
    --color-subtil: #6B7280;
    --color-border: #E5E7EB;
    --shadow-color: 220, 40%, 15%; /* Per ombres suaus */
}

[data-theme="dark"] {
    /* TEMA FOSC (NIT) */
    --color-fons: #11182C; /* Blau marí fosc */
    --color-fons-secundari: #1F2937; /* Blau/gris per targetes */
    --color-text: #D1D5DB; /* Gris clar */
    --color-titol: #F9FAFB; /* Blanc trencat */
    --color-subtil: #9CA3AF;
    --color-border: #374151;
    --shadow-color: 220, 40%, 3%;
}

/* Reseteig bàsic */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    /* NOVA TIPOGRAFIA */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--color-fons);
    color: var(--color-text);
    line-height: 1.7; /* Més espaiat */
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px; /* Ajustat padding */
}

/*
 * =========================================
 * NAVEGACIÓ (Header) - AMB EFECTE BLUR
 * =========================================
 */
.header {
    background-color: transparent;
    padding: 1.5rem 0; /* Més alt */
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background-color 0.4s ease, box-shadow 0.4s ease, padding 0.4s ease;
}

.header.scrolled {
    padding: 1rem 0;
    /* EFECTE VIDRE BORRÓS */
    background-color: var(--color-fons-secundari-transparent, hsla(0, 0%, 100%, 0.8));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px hsla(var(--shadow-color), 0.1);
    border-bottom: 1px solid var(--color-border);
}
[data-theme="dark"] .header.scrolled {
    --color-fons-secundari-transparent: hsla(222, 47%, 11%, 0.8);
}


.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header .logo {
    font-size: 1.5rem;
    font-weight: 800; /* Més pesat */
    color: var(--color-titol);
    text-decoration: none;
}

.header .nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem; /* Més espai */
}

.header ul li a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 0.95rem;
}
.header ul li a:hover {
    color: var(--color-primari);
}

.controls-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#theme-toggle {
    background: var(--color-fons-secundari);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex; /* Centrar icona */
    align-items: center;
    justify-content: center;
}
#theme-toggle:hover {
    color: var(--color-primari);
    border-color: var(--color-primari);
}

.lang-switcher {
    display: flex;
    background: var(--color-fons-secundari);
    border-radius: 20px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}
.lang-button {
    background: transparent;
    border: none;
    color: var(--color-subtil);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
}
.lang-button:hover {
    color: var(--color-text);
}
.lang-button.active {
    background-color: var(--color-primari);
    color: #fff;
}

/*
 * =========================================
 * NOU: MENÚ MÒBIL D'HAMBURGUESA
 * =========================================
 */
.nav-toggle {
    display: none; /* Ocult per defecte */
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-around;
    z-index: 1001; /* Per sobre del menú */
}
.nav-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--color-titol);
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}
/* Animació de l'hamburguesa a 'X' */
.nav-toggle.is-active span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}
.nav-toggle.is-active span:nth-child(2) {
    opacity: 0;
}
.nav-toggle.is-active span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

/*
 * =========================================
 * SECCIÓ HERO - MÉS IMPACTE
 * =========================================
 */
header#inici {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 90vh; /* Més alt */
    padding: 4rem 2rem;
    /* Gradient més subtil */
    background: radial-gradient(ellipse at bottom, var(--color-fons) 0%, var(--color-border) 100%);
}
[data-theme="dark"] header#inici {
    background: radial-gradient(ellipse at bottom, var(--color-fons) 0%, #1F2937 100%);
}

header#inici h1 {
    font-size: 3.5rem; /* Més gran */
    color: var(--color-titol);
    margin-bottom: 1rem;
    font-weight: 800;
}
header#inici h2 {
    font-size: 1.5rem;
    color: var(--color-primari);
    margin-bottom: 2rem; /* Més espai */
    font-weight: 500;
}
header#inici p {
    font-size: 1.125rem; /* Mida de text més còmoda */
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    color: var(--color-text);
}

.botons-hero { display: flex; justify-content: center; gap: 1rem; }
.boto { 
    display: inline-block; 
    padding: 0.85rem 1.75rem; /* Més grans */
    text-decoration: none; 
    border-radius: 8px; /* Més arrodonit */
    font-weight: 700;
    transition: all 0.3s ease;
    font-size: 1rem;
}
.boto:hover {
    transform: scale(1.05); /* Efecte "pop" */
    box-shadow: 0 10px 20px hsla(var(--shadow-color), 0.1);
}
.boto-primari { 
    background-color: var(--color-primari); 
    color: #FFF; 
}
.boto-primari:hover { 
    background-color: var(--color-primari-hover); 
    color: #FFF;
}
.boto-secundari { 
    background-color: var(--color-fons-secundari); 
    color: var(--color-primari); 
    border: 1px solid var(--color-border);
}
.boto-secundari:hover { 
    background-color: var(--color-fons-secundari); 
    color: var(--color-primari-hover);
    border-color: var(--color-primari-hover);
}

/*
 * =========================================
 * TARGETES I SECCIONS - MÉS NETES
 * =========================================
 */
section {
    padding: 5rem 0; /* Més padding */
    border-bottom: 1px solid var(--color-border);
}
section:last-of-type { border-bottom: none; }
section h2 { text-align: center; font-size: 2.5rem; color: var(--color-titol); margin-bottom: 3rem; font-weight: 700; }

/* Secció Sobre Mi */
#sobre-mi ul { list-style: none; margin-top: 1.5rem; }
#sobre-mi li { padding-left: 1.5rem; position: relative; margin-bottom: 0.5rem; }
#sobre-mi li::before { content: '✓'; color: var(--color-primari); position: absolute; left: 0; font-weight: bold; }

/* Habilitats - Més suau */
.graella-habilitats { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-top: 2rem; }
.habilitat {
    background-color: var(--color-fons-secundari);
    color: var(--color-text);
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
    font-weight: 500;
}
.habilitat:hover { 
    transform: scale(1.1); 
    background-color: var(--color-primari); 
    color: #fff;
    border-color: var(--color-primari);
}

/* Targetes de Projecte - Ombra suau */
.graella-projectes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; perspective: 1000px; }
.targeta-projecte {
    background-color: var(--color-fons-secundari);
    border: 1px solid var(--color-border);
    border-radius: 12px; /* Més arrodonit */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    transform-style: preserve-3d;
    box-shadow: 0 4px 6px -1px hsla(var(--shadow-color), 0.05), 0 2px 4px -2px hsla(var(--shadow-color), 0.05);
}
.targeta-projecte:hover {
    box-shadow: 0 10px 15px -3px hsla(var(--shadow-color), 0.1), 0 4px 6px -4px hsla(var(--shadow-color), 0.1);
    transform: rotateY(var(--rotateY)) rotateX(var(--rotateX)) scale(1.03);
}

/* AQUEST ÉS L'ESTIL DE LA IMATGE */
.targeta-projecte img { 
    width: 100%; 
    height: 200px; 
    object-fit: cover; /* Assegura que la imatge ompli l'espai sense deformar-se */
    background-color: #555; 
    transform: translateZ(10px); 
    border-bottom: 1px solid var(--color-border); /* Separador subtil */
}

.contingut-targeta { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; transform: translateZ(20px); }
.contingut-targeta h3 { color: var(--color-titol); margin-bottom: 0.5rem; font-weight: 700; }
.contingut-targeta p { font-size: 0.95rem; margin-bottom: 1rem; flex-grow: 1; }
.tecnologies-projecte { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tecnologies-projecte span { background-color: var(--color-primari); color: white; padding: 0.25rem 0.5rem; border-radius: 5px; font-size: 0.8rem; }
.enllacos-projecte a { color: var(--color-primari); text-decoration: none; font-weight: bold; margin-right: 1rem; }
.enllacos-projecte a:hover { text-decoration: underline; }

/* Targetes d'Experiència - Ombra suau */
.item-experiencia {
    background-color: var(--color-fons-secundari);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px -1px hsla(var(--shadow-color), 0.05), 0 2px 4px -2px hsla(var(--shadow-color), 0.05);
}
.item-experiencia:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px hsla(var(--shadow-color), 0.1), 0 4px 6px -4px hsla(var(--shadow-color), 0.1);
}
.item-experiencia h3 { color: var(--color-titol); font-size: 1.25rem; font-weight: 700; }
.item-experiencia span { color: var(--color-primari); font-weight: 700; display: block; margin-bottom: 0.5rem; }

/*
 * =========================================
 * FOOTER I FORMULARI
 * =========================================
 */
footer#contacte {
    background-color: var(--color-fons-secundari);
    text-align: center;
    padding: 4rem 1rem; /* Més padding */
    border-top: 1px solid var(--color-border);
}
footer#contacte h2 { margin-bottom: 1.5rem; }
footer#contacte p { margin-bottom: 1.5rem; font-size: 1.1rem; }
.enllacos-contacte { margin-bottom: 2rem; }
.enllacos-contacte a { color: var(--color-text); text-decoration: none; font-size: 1.1rem; margin: 0 1rem; transition: color 0.3s ease; font-weight: 500;}
.enllacos-contacte a:hover { color: var(--color-primari); }
.copyright { font-size: 0.9rem; color: var(--color-subtil); margin-top: 3rem; }

/* Animació d'entrada en fer scroll */
.animat-entrada { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.animat-entrada.is-visible { opacity: 1; transform: translateY(0); }

/* Botó animat */
.animated-button {
    background-color: var(--color-primari);
    color: #fff;
    border: none;
    padding: 0.85rem 1.75rem; /* Mida com els botons hero */
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease-in-out;
}
.animated-button span { position: relative; z-index: 1; }
.animated-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-color: var(--color-fons-secundari);
    transition: left 0.4s ease-in-out;
    z-index: 0;
}
.animated-button:hover { 
    color: var(--color-primari);
    box-shadow: 0 10px 20px hsla(var(--shadow-color), 0.1);
    transform: scale(1.05);
}
.animated-button:hover::before { left: 0; }
.animated-button i { margin-left: 0.5rem; transition: transform 0.3s ease; }
.animated-button:hover i { transform: translateX(5px); }

/* Mini-formulari del footer */
.contact-form-footer { max-width: 400px; margin: 2rem auto 0; }
.form-group-footer { display: flex; gap: 0.5rem; }
.form-group-footer input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--color-fons);
    color: var(--color-text);
}
.form-group-footer input:focus { 
    border-color: var(--color-primari); 
    outline: none;
    box-shadow: 0 0 0 3px hsla(262, 73%, 50%, 0.1); /* Sombra de focus violeta */
}
[data-theme="dark"] .form-group-footer input:focus {
    box-shadow: 0 0 0 3px hsla(262, 73%, 70%, 0.1);
}

.animated-button { flex-shrink: 0; }

/*
 * =========================================
 * DISSENY RESPONSIVE (MÒBIL)
 * =========================================
 */
@media (max-width: 900px) {
    .container { padding: 0 1.5rem; }

    .header .nav-menu {
        /* El menú ara està ocult */
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%; /* Comença fora de la pantalla */
        width: 70%;
        max-width: 300px;
        height: 100vh;
        /* Efecte vidre al menú mòbil */
        background-color: var(--color-fons-secundari-transparent, hsla(0, 0%, 100%, 0.8));
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        
        padding: 6rem 2rem 2rem;
        gap: 1.5rem;
        transition: right 0.4s ease-in-out;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        border-left: 1px solid var(--color-border);
    }
    [data-theme="dark"] .header .nav-menu {
         --color-fons-secundari-transparent: hsla(222, 47%, 11%, 0.8);
    }
    
    .nav-menu.is-active {
        right: 0; /* Entra a la pantalla */
    }
    .header .nav-menu li {
        width: 100%;
    }
    .header ul li a {
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--color-titol); /* Més visible en mòbil */
    }

    .nav-toggle {
        display: flex; /* Mostra el botó d'hamburguesa */
    }

    /* ===== AQUEST ÉS EL CANVI ===== */
    /* Ara el canviador d'idioma és visible en mòbil */
    /*
    .lang-switcher {
        display: none;
    }
    */
    /* ============================== */


    /* Podries afegir els botons d'idioma dins del menú mòbil si vols */

    /* Reducció de text per a mòbils */
    header#inici h1 { font-size: 2.5rem; }
    header#inici h2 { font-size: 1.25rem; }
    section h2 { font-size: 2rem; }
    
    .botons-hero { flex-direction: column; }
    .form-group-footer { flex-direction: column; }
}
