/* ═══════════════════════════════════════════════════════════
   NUS·ID — Portafoli Peter Flakes
   style.css — Sistema de disseny complet
   ═══════════════════════════════════════════════════════════ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Source+Serif+4:ital,wght@0,400;0,600;1,400;1,600&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Variables globals --- */
:root {
    /* Colors */
    --bg-dark: #0a0a0a;
    --bg-dark-subtle: #111111;
    --bg-dark-overlay: rgba(10, 10, 10, 0.92);
    --bg-light: #f5f2ee;
    --bg-light-card: #ffffff;

    --text-light: #ffffff;
    --text-light-muted: #d1cfcd;
    --text-dark: #000000;
    --text-dark-muted: #2a2826;

    --accent: #c8956c;
    --accent-hover: #daa882;
    --accent-subtle: rgba(200, 149, 108, 0.15);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-light: rgba(0, 0, 0, 0.08);

    /* Tipografia */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Source Serif 4', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Mides */
    --max-width: 900px;
    --max-width-wide: 1100px;
    --header-height: 64px;

    /* Transicions */
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Reset i base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

::selection {
    background: var(--accent);
    color: var(--bg-dark);
}


/* ═══════════════════════════════════════════════════════════
   CAPÇALERA FIXA
   ═══════════════════════════════════════════════════════════ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    transition: background-color var(--transition-smooth),
        box-shadow var(--transition-smooth);
}

.header.scrolled {
    background-color: var(--bg-dark-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 var(--border-subtle);
}

.header__logo {
    font-family: var(--font-main);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text-light);
    text-transform: uppercase;
}

.header__logo span {
    color: var(--accent);
}

.header__nav {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.header__nav a {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-light-muted);
    text-transform: lowercase;
    transition: color var(--transition-fast);
    position: relative;
}

.header__nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--transition-smooth);
}

.header__nav a:hover,
.header__nav a.active {
    color: var(--text-light);
}

.header__nav a:hover::after,
.header__nav a.active::after {
    width: 100%;
}

/* Menú hamburguesa mòbil */
.header__burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
}

.header__burger span {
    width: 24px;
    height: 2px;
    background: var(--text-light);
    transition: all var(--transition-fast);
}


/* ═══════════════════════════════════════════════════════════
   SECCIÓ 1: HERO
   ═══════════════════════════════════════════════════════════ */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    min-height: 600px;
    text-align: center;
    padding: 2rem;
    position: relative;
    background: var(--bg-dark);
}

.hero__name {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.hero__tagline {
    font-family: var(--font-serif);
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 400;
    font-style: italic;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.hero__tagline strong {
    font-weight: 600;
    color: var(--accent);
}

.hero__subtitle {
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-light-muted);
    margin-bottom: 4rem;
}

.hero__scroll {
    position: absolute;
    bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--transition-fast), opacity var(--transition-fast);
    animation: pulse-down 2s ease-in-out infinite;
    text-decoration: none;
}

.hero__scroll span:first-child {
    position: relative;
    padding-bottom: 4px;
}

.hero__scroll span:first-child::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--transition-smooth);
}

.hero__scroll:hover span:first-child::after {
    width: 100%;
}

.hero__scroll:hover {
    color: var(--accent-hover);
    opacity: 0.9;
}

.hero__scroll-arrow {
    font-size: 1.4rem;
    text-shadow: 0 0 12px rgba(200, 149, 108, 0.5);
}

@keyframes pulse-down {

    0%,
    100% {
        transform: translateY(0);
        opacity: 1;
    }

    50% {
        transform: translateY(6px);
        opacity: 0.6;
    }
}


/* ═══════════════════════════════════════════════════════════
   SECCIÓ 2: SERVEIS
   ═══════════════════════════════════════════════════════════ */

.serveis {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: 6rem 2rem;
}

.serveis__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: var(--max-width-wide);
    margin: 0 auto;
}

.servei-card {
    background: var(--bg-light-card);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    border: 1px solid var(--border-light);
    transition: transform var(--transition-smooth),
        box-shadow var(--transition-smooth);
}

.servei-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.servei-card__icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-subtle);
    border-radius: 10px;
    font-size: 1.4rem;
}

.servei-card__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.servei-card__text {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-dark-muted);
}

.servei-card__text p {
    margin-bottom: 0.5rem;
}

.servei-card__footer {
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}


/* ═══════════════════════════════════════════════════════════
   SECCIÓ 3: QUI SOC — El Viatge
   ═══════════════════════════════════════════════════════════ */

.quisoc {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 6rem 2rem;
}

.quisoc__inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Full Stack */
.fullstack {
    text-align: center;
    margin-bottom: 4rem;
}

.fullstack__title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    margin-bottom: 2rem;
}

.fullstack__text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-light-muted);
    max-width: 700px;
    margin: 0 auto 1.5rem;
}

.fullstack__formula {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    margin: 1.5rem 0;
    letter-spacing: 0.02em;
}

.fullstack__note {
    font-size: 0.95rem;
    color: var(--text-light-muted);
}

/* El Viatge */
.viatge {
    margin-top: 4rem;
    padding-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.viatge__title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.viatge__intro {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-light-muted);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

/* Fórmula d'origen */
.formula-origen {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 3rem;
    padding: 1.2rem;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-dark-subtle);
}

.formula-origen__item {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light-muted);
    transition: color var(--transition-fast);
}

.formula-origen__item.active {
    color: var(--accent);
}

.formula-origen__arrow {
    color: var(--text-light-muted);
    opacity: 0.4;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-subtle);
}

.timeline__bloc-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 1.5rem;
    padding-top: 1rem;
}

.timeline__item {
    position: relative;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--transition-slow),
        transform var(--transition-slow);
}

.timeline__item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline__item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0.6rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-light-muted);
    border: 2px solid var(--bg-dark);
    transition: background var(--transition-fast);
}

.timeline__item:hover::before {
    background: var(--accent);
}

.timeline__year {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-light);
    margin-right: 0.3rem;
}

.timeline__age {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
    margin-right: 0.3rem;
}

.timeline__desc {
    font-size: 0.92rem;
    color: var(--text-light-muted);
    line-height: 1.6;
}

.timeline__tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.timeline__separator {
    margin: 2rem 0;
    border: none;
    border-top: 1px dashed rgba(255, 255, 255, 0.25);
}

/* La Mentalitat */
.mentalitat {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    max-width: 650px;
}

.mentalitat__title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.mentalitat__text {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--text-light-muted);
    font-style: italic;
}

/* La Intro (2003) */
.intro2003 {
    margin-top: 5rem;
    padding: 6rem 2rem;
    text-align: center;
    position: relative;
    background: var(--bg-dark-subtle);
    border-radius: 16px;
    overflow: hidden;
}

.intro2003__text {
    font-family: var(--font-mono);
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
    line-height: 2.2;
    color: var(--text-light-muted);
    max-width: 550px;
    margin: 0 auto;
}

.intro2003__text em {
    font-style: normal;
    display: block;
}

.intro2003__punchline {
    display: block;
    margin-top: 1.5rem;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--accent);
    font-style: normal;
}

.intro2003__note {
    margin-top: 2.5rem;
    font-family: var(--font-main);
    font-size: 0.75rem;
    color: var(--text-light-muted);
    opacity: 0.5;
    letter-spacing: 0.05em;
}


/* ═══════════════════════════════════════════════════════════
   SECCIÓ 4: PROJECTES
   ═══════════════════════════════════════════════════════════ */

.projectes {
    background: var(--bg-light);
    color: var(--text-dark);
    padding: 6rem 2rem;
}

.projectes__inner {
    max-width: var(--max-width-wide);
    margin: 0 auto;
}

.projectes__title {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-dark);
}

.projecte {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    margin-bottom: 4rem;
    padding-bottom: 4rem;
    border-bottom: 1px solid var(--border-light);
}

.projecte:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.projecte:nth-child(even) {
    direction: rtl;
}

.projecte:nth-child(even)>* {
    direction: ltr;
}

.projecte__img-wrap {
    aspect-ratio: 4/3;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-dark-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
}

.projecte__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.projecte__placeholder {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-light-muted);
    opacity: 0.4;
}

.projecte__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.projecte__text {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-dark-muted);
    margin-bottom: 1rem;
}

.projecte__text p {
    margin-bottom: 0.4rem;
}

.projecte__highlight {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
}


/* ═══════════════════════════════════════════════════════════
   SECCIÓ 5: CONTACTE
   ═══════════════════════════════════════════════════════════ */

.contacte {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 8rem 2rem;
    text-align: center;
}

.contacte__title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 2rem;
}

.contacte__email {
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 600;
    color: var(--accent);
    transition: color var(--transition-fast);
    letter-spacing: 0.02em;
    border-bottom: 2px solid transparent;
    padding-bottom: 4px;
}

.contacte__email:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}

.footer {
    margin-top: 4rem;
    font-size: 0.75rem;
    color: var(--text-light-muted);
    opacity: 0.4;
    letter-spacing: 0.05em;
}


/* ═══════════════════════════════════════════════════════════
   ANIMACIONS (fade-in amb scroll)
   ═══════════════════════════════════════════════════════════ */

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-slow),
        transform var(--transition-slow);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .header__nav {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-dark-overlay);
        backdrop-filter: blur(12px);
        flex-direction: column;
        align-items: center;
        padding: 2rem 0;
        gap: 1.5rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    .header__nav.open {
        display: flex;
    }

    .header__burger {
        display: flex;
    }

    .serveis__grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .projecte {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .projecte:nth-child(even) {
        direction: ltr;
    }

    .formula-origen {
        gap: 0.3rem;
        font-size: 0.8rem;
    }

    .timeline {
        padding-left: 1.5rem;
    }

    /* Hero subtitle: tres línies al mòbil */
    .hero__subtitle span:not(.hero__subtitle-sep) {
        display: block;
    }

    .hero__subtitle-sep {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero__name {
        font-size: 2.5rem;
    }

    .header {
        padding: 0 1.2rem;
    }

    .serveis,
    .quisoc,
    .projectes,
    .contacte {
        padding: 4rem 1.2rem;
    }
}

/* ═══════════════════════════════════════════════════════
   LIGHTBOX PER A IMATGES
   ═══════════════════════════════════════════════════════ */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.lightbox.active img {
    transform: scale(1);
}

.zoom-img {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.zoom-img:hover {
    opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════
   CARRUSEL D'IMATGES (MARQUEE)
   ═══════════════════════════════════════════════════════ */
.galeria {
    position: relative;
    padding: 1rem 0 3rem 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    overflow: hidden;
    background: transparent;
}

.galeria__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    position: relative;
}

.marquee {
    position: relative;
    width: 100vw;
    display: flex;
    overflow: hidden;
    margin-top: 1rem;
    cursor: grab;
    user-select: none;
}

.marquee.is-dragging {
    cursor: grabbing;
}

.marquee.is-dragging .zoom-img {
    pointer-events: none;
}

/* Fosos negres als laterals per transició suau */
.marquee::before,
.marquee::after {
    content: "";
    position: absolute;
    top: 0;
    width: 12vw;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.marquee::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-dark) 0%, transparent 100%);
}

.marquee::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-dark) 0%, transparent 100%);
}

.marquee__track {
    display: flex;
    width: max-content;
    will-change: transform;
}

.marquee img {
    height: 280px;
    width: auto;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 1.5rem;
    transition: transform 0.4s ease;
}

.marquee img:hover {
    transform: scale(1.10);
}

/* Animació eliminada per ser gestionada via JS interactiu */

@media (max-width: 768px) {
    .marquee img {
        height: 220px;
    }
}