/* ─── PALETA DINÀMICA VARIABLE SYSTEM (MODE FOSC PER DEFECTE) ─── */
:root {
    --bg-base: #0d2117;
    --g0: #0d2117;
    --g1: #163322;
    --g2: #1e4a30;
    --g3: #2d7a4f;
    --g4: #3da864;
    --g5: #5ec87c;
    --g6: #a8e8c0;
    --g7: #d4f5e2;
    --sky1: #1a3a5c;
    --sky2: #2e6fa3;
    --sky3: #87ceeb;
    --sky4: #c5e8f7;
    --gold: #e8c96a;
    --gold2: #f5e090;

    --glass: rgba(255,255,255,0.07);
    --glass-mid: rgba(255,255,255,0.12);
    --glass-hi: rgba(255,255,255,0.22);
    --glass-border: rgba(255,255,255,0.18);
    --glass-border-hi: rgba(255,255,255,0.35);
    --navbar-bg: rgba(13,33,23,0.75);

    --text: #e8f5ec;
    --text-dim: rgba(232,245,236,0.65);
    --text-dimmer: rgba(232,245,236,0.40);
    --shadow: 0 8px 32px rgba(0,0,0,0.35);
    --shadow-sm: 0 4px 16px rgba(0,0,0,0.25);
    --glow-green: 0 0 20px rgba(94,200,124,0.35);
    --glow-gold: 0 0 16px rgba(232,201,106,0.45);
    --radius: 20px;
    --radius-sm: 12px;
    --radius-pill: 999px;
    --orb-opacity: 0.25;
    --hero-overlay: linear-gradient(to bottom, rgba(13,33,23,0.6) 0%, rgba(13,33,23,0.1) 40%, rgba(13,33,23,0.85) 100%);
    --star-color: #ffffff;
}

/* ─── TRASLACIÓ VISUAL AUTOMÀTICA MODE CLAR FRUTIGER AERO ─── */
html[data-theme="light"] {
    --bg-base: #f0fdf4;
    --g0: #f0fdf4;
    --g1: #dcfce7;
    --g2: #bbf7d0;
    --g3: #22c55e;
    --g4: #16a34a;
    --g5: #15803d;
    --g6: #166534;
    --g7: #14532d;
    --sky1: #bae6fd;
    --sky2: #38bdf8;
    --sky3: #0284c7;
    --sky4: #0369a1;
    --gold: #b45309;
    --gold2: #d97706;

    --glass: rgba(255,255,255,0.6);
    --glass-mid: rgba(255,255,255,0.75);
    --glass-hi: rgba(255,255,255,0.9);
    --glass-border: rgba(21,128,61,0.2);
    --glass-border-hi: rgba(21,128,61,0.35);
    --navbar-bg: rgba(240,253,244,0.85);

    --text: #14532d;
    --text-dim: #1e293b;
    --text-dimmer: #475569;
    --shadow: 0 8px 32px rgba(21,128,61,0.06);
    --shadow-sm: 0 4px 16px rgba(21,128,61,0.04);
    --glow-green: 0 0 20px rgba(34,197,94,0.15);
    --glow-gold: 0 0 16px rgba(217,119,6,0.15);
    --orb-opacity: 0.35;
    --hero-overlay: linear-gradient(to bottom, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.15) 40%, rgba(240,253,244,0.95) 100%);
    --star-color: #22c55e;
}

/* ─── GENERALS ─── */
body { font-family: 'Nunito', sans-serif; background: var(--bg-base); color: var(--text); overflow-x: hidden; min-height: 100vh; transition: background 0.4s, color 0.4s; }

/* ─── RENDIZAT NET DE TIPOGRAFIA PÍXEL RPG ─── */
.vt323-regular {
    font-family: "VT323", monospace;
    font-weight: 400;
    font-style: normal;
    font-size: 1.6rem;
    letter-spacing: 0.03em;
    line-height: 1;
    image-rendering: pixelated;
}

h1.vt323-regular { font-size: clamp(3rem, 8vw, 5.5rem); }
h2.vt323-regular { font-size: 2.3rem; color: var(--text); }
.skill-category-title.vt323-regular { font-size: 1.45rem; color: var(--gold); }
.cv-column-title.vt323-regular { font-size: 1.45rem; color: var(--sky3); }
.about-name.vt323-regular { font-size: 1.75rem; color: var(--text); margin-bottom: 4px; }

.ico-corp {
    color: var(--g5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s;
    display: inline-block;
}
.skill-card:hover .ico-corp, .contact-card:hover .ico-corp {
    transform: scale(1.25) rotate(5deg);
    color: var(--gold);
    filter: drop-shadow(0 0 8px var(--g5));
}

/* ─── ENVIRONMENTS & LAYERS ─── */
.bg-layer {
    position: fixed; inset: 0; z-index: 0;
    background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(94,200,124,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(30,111,163,0.15) 0%, transparent 55%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(13,33,23,0.05) 0%, transparent 70%),
    linear-gradient(170deg, var(--sky1) 0%, var(--g0) 40%, var(--g1) 100%);
    pointer-events: none;
}

.orb { position: fixed; border-radius: 50%; filter: blur(60px); opacity: var(--orb-opacity); pointer-events: none; z-index: 0; animation: orbFloat linear infinite; transition: opacity 0.4s; }
.orb-1 { width: 500px; height: 500px; background: radial-gradient(circle, var(--g4), transparent 70%); top: -100px; left: -100px; animation-duration: 22s; }
.orb-2 { width: 350px; height: 350px; background: radial-gradient(circle, var(--sky2), transparent 70%); top: 30%; right: -80px; animation-duration: 28s; animation-delay: -8s; }
.orb-3 { width: 280px; height: 280px; background: radial-gradient(circle, var(--g5), transparent 70%); bottom: 10%; left: 20%; animation-duration: 20s; animation-delay: -5s; }
.orb-4 { width: 200px; height: 200px; background: radial-gradient(circle, var(--gold), transparent 70%); top: 60%; right: 25%; animation-duration: 35s; animation-delay: -12s; opacity: 0.15; }

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-15px, 30px) scale(0.97); }
    75% { transform: translate(20px, 10px) scale(1.03); }
}

.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); border: 1px solid var(--glass-border); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi); border-radius: var(--radius); transition: background 0.4s, border 0.4s; }
.glass-sm { background: var(--glass-mid); backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%); border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.25); border-radius: var(--radius-sm); }

/* ─── NAVIGATION BAR ─── */
.header-wrapper { position: fixed; top: 16px; left: 0; width: 100%; z-index: 100; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
#navbar { display: flex; align-items: center; gap: 4px; padding: 6px 16px; border-radius: var(--radius-pill); background: var(--navbar-bg); border: 1px solid var(--glass-border); box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi); width: auto; max-width: 100%; pointer-events: auto; transition: all 0.4s ease; }
.nav-links-container { display: flex; align-items: center; gap: 4px; }
.nav-link { color: var(--text-dim); text-decoration: none; font-family: 'Josefin Sans', sans-serif; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 6px 14px; border-radius: var(--radius-pill); transition: all 0.3s ease; white-space: nowrap; }
.nav-link:hover, .nav-link.active { color: var(--g6); background: rgba(94,200,124,0.15); text-shadow: 0 0 12px rgba(94,200,124,0.6); }
.nav-divider { width: 1px; height: 16px; background: var(--glass-border); margin: 0 2px; }
.rpg-burger-btn { display: none; background: none; border: 2px outset var(--g3); padding: 6px 10px; border-radius: 6px; color: var(--g5); cursor: pointer; font-size: 1rem; }
.right-hud-group { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.rpg-clock-hud { display: inline-flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, 0.3); border: 2px outset var(--g3); padding: 4px 10px; border-radius: 6px; color: #4ade80; text-shadow: 0 0 6px rgba(74,222,128,0.8); white-space: nowrap; }
.rpg-clock-hud .clock-label { font-size: 0.95rem; color: var(--gold); text-shadow: 0 0 4px var(--gold); }
.lang-switcher { display: flex; gap: 2px; }
.lang-btn { background: none; border: 1px solid transparent; color: var(--text-dimmer); font-family: 'Josefin Sans', sans-serif; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; padding: 4px 8px; border-radius: var(--radius-pill); cursor: pointer; transition: all 0.2s; }
.lang-btn:hover { color: var(--g5); border-color: var(--g4); }
.lang-btn.active { color: var(--g5); border-color: var(--g5); background: rgba(94,200,124,0.12); }
.theme-toggle-btn { background: none; border: 1px solid var(--glass-border); color: var(--gold); font-size: 1rem; padding: 4px 8px; border-radius: var(--radius-pill); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }

/* ─── STRUCTURAL BLOCS ─── */
section { position: relative; z-index: 1; }
.section-inner { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.section-tag { display: inline-flex; align-items: center; gap: 8px; font-family: 'Josefin Sans', sans-serif; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--g5); margin-bottom: 10px; }
.section-tag::before { content: ''; display: block; width: 24px; height: 2px; background: linear-gradient(90deg, var(--g5), transparent); border-radius: 2px; }
.section-sub { color: var(--text-dim); font-size: 0.95rem; font-weight: 300; margin-bottom: 48px; max-width: 560px; line-height: 1.7; }

/* ─── HERO BLOC ─── */
#hero {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
padding: 120px 24px 80px;
position: relative;
overflow: hidden;
}

#hero::before {
content: '';
position: absolute;
inset: 0;
background: url('/assets/img/segarra.jpg') center/cover no-repeat;
opacity: 0.22;
z-index: 0;
}

#hero::after {
content: '';
position: absolute;
inset: 0;
background: var(--hero-overlay);
z-index: 1;
transition: background 0.4s ease;
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    border-radius: var(--radius-pill);
    background: rgba(94,200,124,0.1);
    border: 1px solid rgba(94,200,124,0.3);
    font-family: 'Josefin Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--g5);
    margin-bottom: 28px;
    backdrop-filter: blur(8px);
    animation: fadeInDown 0.8s ease both;
}

.hero-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--g5);
    box-shadow: 0 0 8px var(--g5);
    animation: pulse 2s ease infinite;
}

.hero-name span { color: var(--g5); }

.hero-role {
    font-family: 'Josefin Sans', sans-serif;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    font-weight: 300;
    color: var(--text-dim);
    margin-bottom: 36px;
    animation: fadeInUp 0.9s ease 0.2s both;
    min-height: 2em;
}

.hero-role .typed-text { color: var(--g5); font-weight: 600; }
.hero-role .cursor { display: inline-block; width: 2px; height: 1.1em; background: var(--g5); margin-left: 2px; vertical-align: middle; }

.hero-ctas {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 0.9s ease 0.35s both;
    margin-top: 20px;
}

.btn-primary {
    display: inline-block;
    background: var(--g4);
    color: var(--bg-base);
    padding: 12px 28px;
    border-radius: var(--radius-pill);
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-green);
    background: var(--g5);
}

.hero-scroll { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-dimmer); font-size: 0.7rem; font-family: 'Josefin Sans', sans-serif; letter-spacing: 0.15em; text-transform: uppercase; pointer-events: none; }
.scroll-line { width: 1px; height: 40px; background: linear-gradient(to bottom, var(--g5), transparent); animation: scrollPulse 2s ease infinite; }
@keyframes scrollPulse { 0%,100%{opacity:0.3;height:30px} 50%{opacity:1;height:45px} }

/* ─── CARDS I BLOCS INTERNS ─── */
.about-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 32px; align-items: start; }
.about-card { padding: 36px; text-align: center; position: relative; }
.avatar-ring { width: 140px; height: 140px; border-radius: 50%; margin: 0 auto 20px; position: relative; background: linear-gradient(135deg, var(--g3), var(--sky2)); padding: 3px; box-shadow: var(--glow-green); overflow: hidden;}
.avatar-img {
    width: 100%; height: 100%; border-radius: 50%;
    background: url('../../assets/img/profile.php') center/cover no-repeat;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
}
.about-role { font-family: 'Josefin Sans', sans-serif; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--g5); margin-bottom: 20px; }
.about-info-list { list-style: none; text-align: left; }
.about-info-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.85rem; color: var(--text-dim); border-bottom: 1px solid rgba(255,255,255,0.06); }
.about-info-list li:last-child { border: none; }
.about-info-list a { color: var(--g5); text-decoration: none; }
.about-text { padding: 36px; }
.about-text p { font-size: 0.95rem; line-height: 1.85; color: var(--text-dim); margin-bottom: 18px; }
.about-highlight { background: rgba(94,200,124,0.06); border-left: 3px solid var(--g5); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 14px 18px; font-size: 0.9rem; color: var(--text-dim); margin-top: 8px; font-style: italic; }

/* ─── DOWNLOAD SPACE ─── */
.download-cv-box { margin: -20px 0 35px 0; padding: 20px; text-align: center; border: 2px dashed var(--g3); border-radius: var(--radius-sm); background: rgba(94,200,124,0.03); transition: background 0.3s; }
.download-cv-box:hover { background: rgba(94,200,124,0.08); }
.btn-download { display: inline-flex; align-items: center; gap: 10px; padding: 12px 28px; border-radius: var(--radius-pill); background: linear-gradient(135deg, var(--sky2), var(--sky3)); color: white; font-family: 'Josefin Sans', sans-serif; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; text-decoration: none; box-shadow: var(--shadow-sm); transition: all 0.3s; }
.btn-download:hover { transform: translateY(-2px); box-shadow: 0 0 15px var(--sky2); }

/* ─── GRAPHIC CHARTS & TIMELINES ─── */
.skills-categories { display: flex; flex-direction: column; gap: 40px; }
.skill-category-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.skill-category-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(232,201,106,0.3), transparent); }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.skill-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; transition: transform 0.3s, box-shadow 0.3s; }
.skill-card:hover { transform: translateY(-3px); box-shadow: var(--shadow), var(--glow-green); }
.skill-header { display: flex; align-items: center; justify-content: space-between; }
.skill-name { font-family: 'Josefin Sans', sans-serif; font-weight: 600; font-size: 0.88rem; letter-spacing: 0.03em; color: var(--text); display: flex; align-items: center; gap: 8px; }
.skill-lvl { font-size: 0.75rem; color: var(--g5); background: rgba(94,200,124,0.1); border: 1px solid rgba(94,200,124,0.25); padding: 2px 8px; border-radius: var(--radius-pill); }
.skill-bar-track { height: 6px; background: rgba(255,255,255,0.08); border-radius: var(--radius-pill); overflow: hidden; }

.skill-bar-fill { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--g3), var(--g5)); box-shadow: 0 0 8px rgba(94,200,124,0.5); transform: scaleX(0); transform-origin: left; transition: transform 1s cubic-bezier(0.4,0,0.2,1); }
.skill-card.animate .skill-bar-fill { transform: scaleX(1); }
.skill-tools { font-size: 0.75rem; color: var(--text-dimmer); font-family: 'Josefin Sans', sans-serif; letter-spacing: 0.03em; }

.cv-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 32px; }
.cv-column-title { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 16px; padding-bottom: 24px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-left { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--g4); border: 2px solid var(--g6); box-shadow: 0 0 10px rgba(94,200,124,0.5); margin-top: 4px; }
.timeline-dot.current { background: var(--gold); border-color: var(--gold2); box-shadow: var(--glow-gold); animation: pulse 2s ease infinite; }
.timeline-line { flex: 1; width: 1px; background: linear-gradient(to bottom, rgba(94,200,124,0.3), rgba(94,200,124,0.05)); margin-top: 4px; }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-content { flex: 1; }
.timeline-date { font-family: 'Josefin Sans', sans-serif; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; color: var(--g5); text-transform: uppercase; margin-bottom: 4px; }
.timeline-date.current { color: var(--gold); }
.timeline-title { font-family: 'Josefin Sans', sans-serif; font-weight: 700; font-size: 0.9rem; color: var(--text); margin-bottom: 3px; line-height: 1.4; }
.timeline-sub { font-size: 0.8rem; color: var(--g5); font-style: italic; margin-bottom: 6px; }
.timeline-desc { font-size: 0.82rem; color: var(--text-dim); line-height: 1.65; }
.timeline-desc ul { list-style: none; padding: 0; }
.timeline-desc ul li::before { content: '▸ '; color: var(--g5); }

/* ─── CONTACT PIPELINES ─── */
#contact { padding: 80px 0 100px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.contact-card { padding: 28px 24px; text-align: center; text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.contact-icon { width: 56px; height: 56px; border-radius: 50%; background: rgba(94,200,124,0.1); border: 1px solid rgba(94,200,124,0.25); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.contact-label { font-family: 'Josefin Sans', sans-serif; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-dimmer); }
.contact-value { font-size: 0.88rem; color: var(--text-dim); font-weight: 400; word-break: break-all; }

footer { position: relative; z-index: 1; text-align: center; padding: 24px; border-top: 1px solid var(--glass-border); font-family: 'Josefin Sans', sans-serif; font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-dimmer); }
footer span { color: var(--g5); }

/* ─── RESPONSIVE CRÍTIC DISPOSITIUS MÒBILS (CHROME & FIREFOX) ─── */
@media(max-width: 950px) {
    .header-wrapper { top: 0; padding: 0; width: 100%; }
    #navbar { width: 100%; border-radius: 0; padding: 10px 20px; justify-content: space-between; }
    .rpg-burger-btn { display: block; }
    .nav-links-container { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; width: 100%; background: var(--navbar-bg); border-bottom: 2px solid var(--g3); padding: 20px; gap: 10px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
    .nav-links-container.open { display: flex; }
    .nav-divider { display: none; }
    .right-hud-group { margin-left: 0; }

    .about-grid, .cv-grid {
        grid-template-columns: 1fr !important;
        gap: 24px;
    }
    .about-text, .about-card {
        padding: 24px 16px;
    }
    .section-inner {
        padding: 60px 16px;
    }
}

.stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: var(--star-color); animation: twinkle linear infinite; transition: background 0.4s; }
@keyframes twinkle { 0%,100%{opacity:0.1} 50%{opacity:0.8} }

/* ─── KEYFRAMES HERO (FALTAVEN) ─── */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(94,200,124,0.45); }
    50%       { box-shadow: 0 0 0 7px rgba(94,200,124,0); }
}
.timeline-dot.current {
    animation: pulseDot 2s ease infinite;
}
@keyframes pulseDot {
    0%, 100% { box-shadow: var(--glow-gold), 0 0 0 0 rgba(232,201,106,0.45); }
    50%       { box-shadow: var(--glow-gold), 0 0 0 7px rgba(232,201,106,0); }
}

/* ─── CURSOR PARPELLEIG ─── */
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.hero-role .cursor { animation: blink 0.85s step-end infinite; }

/* ─── REVEAL ON SCROLL (FALTAVEN) ─── */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22,1,0.36,1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}
