/* ===== VARIABLES ===== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #0f0f18;
    --bg-card: #141420;
    --bg-card-hover: #1a1a2e;

    --red: #A50044;
    --red-glow: rgba(165, 0, 68, 0.35);
    --blue: #004D98;
    --blue-glow: rgba(0, 77, 152, 0.35);
    --red-light: #D4245E;
    --blue-light: #2568B5;

    --text-primary: #e8e8f0;
    --text-secondary: #9898b0;
    --text-muted: #5a5a75;

    --border: rgba(255, 255, 255, 0.06);
    --font-main: 'Inter', -apple-system, sans-serif;
    --font-code: 'Fira Code', monospace;
    --radius: 12px;
    --transition: 0.3s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; }

/* ===== CONTAINER ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    padding: 16px 0;
    transition: background var(--transition), box-shadow var(--transition);
}
.navbar.scrolled {
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 var(--border);
}
.nav-container {
    max-width: 1100px; margin: 0 auto; padding: 0 24px;
    display: flex; justify-content: space-between; align-items: center;
}
.nav-logo {
    font-size: 1.6rem; font-weight: 700; letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--red-light), var(--blue-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-logo .dot {
    -webkit-text-fill-color: var(--red-light);
}
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a {
    font-size: 0.9rem; font-weight: 400; color: var(--text-secondary);
    transition: color var(--transition); position: relative;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a::after {
    content: ''; position: absolute; bottom: -4px; left: 0;
    width: 0; height: 2px; background: var(--red-light);
    transition: width var(--transition);
}
.nav-links a:hover::after { width: 100%; }
.nav-cta {
    background: linear-gradient(135deg, var(--red), var(--blue));
    padding: 8px 20px !important;
    border-radius: 8px;
    color: var(--text-primary) !important;
    font-weight: 500 !important;
}
.nav-cta::after { display: none !important; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span {
    display: block; width: 24px; height: 2px; background: var(--text-primary);
    margin: 5px 0; transition: var(--transition);
}

/* ===== HERO ===== */
.hero {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: space-between;
    padding: 120px 24px 80px;
    max-width: 1100px; margin: 0 auto;
    gap: 60px;
    position: relative;
}
.hero::before {
    content: '';
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 420px; height: 420px;
    background: url('/static/img/barca.jpg.jpg') center/contain no-repeat;
    opacity: 0.04;
    z-index: 0;
    pointer-events: none;
}
.hero-content { flex: 1; }
.hero-greeting {
    font-size: 1rem; color: var(--red-light); font-weight: 500;
    margin-bottom: 8px; letter-spacing: 1px;
}
.hero-name {
    font-size: clamp(2.4rem, 5vw, 3.8rem);
    font-weight: 700; line-height: 1.15; margin-bottom: 12px;
}
.highlight-red { color: var(--red-light); }
.highlight-blue { color: var(--blue-light); }
.hero-title {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    color: var(--text-secondary); font-weight: 400; margin-bottom: 20px;
}
.hero-description {
    color: var(--text-secondary); max-width: 480px;
    font-size: 1rem; margin-bottom: 32px;
}
.hero-buttons { display: flex; gap: 16px; margin-bottom: 40px; flex-wrap: wrap; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 28px; border-radius: 8px;
    font-size: 0.95rem; font-weight: 500;
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer; border: none;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
    background: linear-gradient(135deg, var(--red), var(--blue));
    color: #fff;
    box-shadow: 0 4px 24px var(--red-glow);
}
.btn-primary:hover { box-shadow: 0 8px 32px var(--red-glow); }
.btn-outline {
    border: 1px solid var(--text-muted);
    color: var(--text-primary); background: transparent;
}
.btn-outline:hover {
    border-color: var(--blue-light);
    box-shadow: 0 4px 24px var(--blue-glow);
}

.hero-socials { display: flex; gap: 20px; }
.hero-socials a {
    font-size: 1.3rem; color: var(--text-muted);
    transition: color var(--transition), transform var(--transition);
}
.hero-socials a:hover { color: var(--blue-light); transform: translateY(-3px); }

/* Hero photo + code block */
.hero-visual { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.hero-photo-wrapper {
    width: 280px; height: 280px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid transparent;
    background: linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
                linear-gradient(135deg, var(--red), var(--blue)) border-box;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.hero-photo {
    width: 100%; height: 100%;
    object-fit: cover;
}
.hero-visual:hover .hero-photo {
    transform: scale(1.05);
    transition: transform var(--transition);
}
.code-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.9;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    position: relative;
}
.code-block::before {
    content: '● ● ●'; position: absolute; top: 10px; left: 16px;
    font-size: 0.55rem; letter-spacing: 6px;
    background: linear-gradient(90deg, var(--red-light), #e8a84c, #4caf50);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.code-keyword { color: var(--red-light); }
.code-class { color: #e8c84c; }
.code-func { color: var(--blue-light); }

/* ===== SECTIONS ===== */
.section { padding: 100px 0; }
.section-alt { background: var(--bg-secondary); }
.section-title {
    font-size: 2rem; font-weight: 700; text-align: center;
    margin-bottom: 56px; position: relative;
}
.section-title::after {
    content: ''; display: block; width: 50px; height: 3px;
    background: linear-gradient(90deg, var(--red), var(--blue));
    margin: 12px auto 0; border-radius: 2px;
}
.section-subtitle {
    text-align: center; color: var(--text-secondary);
    max-width: 500px; margin: -36px auto 48px; font-size: 1rem;
}

/* ===== ABOUT ===== */
.about-grid { max-width: 700px; margin: 0 auto; }
.about-text p {
    color: var(--text-secondary); margin-bottom: 20px; font-size: 1.02rem;
}
.about-stats {
    display: flex; gap: 40px; margin-top: 32px;
    padding-top: 32px; border-top: 1px solid var(--border);
}
.stat { text-align: center; }
.stat-number {
    display: block; font-size: 1.8rem; font-weight: 700;
    background: linear-gradient(135deg, var(--red-light), var(--blue-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 0.85rem; color: var(--text-muted); }

/* ===== SKILLS ===== */
.skills-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}
.skill-category {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.skill-category:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    border-color: var(--red);
}
.skill-category:nth-child(even):hover { border-color: var(--blue); }
.skill-icon {
    font-size: 1.8rem; margin-bottom: 16px;
    background: linear-gradient(135deg, var(--red-light), var(--blue-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.skill-category h3 { font-size: 1.1rem; margin-bottom: 16px; font-weight: 600; }
.skill-list li {
    color: var(--text-secondary); font-size: 0.9rem;
    padding: 4px 0; position: relative; padding-left: 16px;
}
.skill-list li::before {
    content: '▸'; position: absolute; left: 0; color: var(--red-light);
}
.skill-category:nth-child(even) .skill-list li::before { color: var(--blue-light); }

/* ===== PROJECTS ===== */
.projects-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    display: flex; flex-direction: column;
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    border-color: var(--blue);
}
.project-card:nth-child(odd):hover { border-color: var(--red); }
.project-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.project-header > i { font-size: 2rem; color: var(--blue-light); }
.project-card:nth-child(odd) .project-header > i { color: var(--red-light); }
.project-links { display: flex; gap: 14px; }
.project-links a {
    font-size: 1.1rem; color: var(--text-muted);
    transition: color var(--transition);
}
.project-links a:hover { color: var(--text-primary); }
.project-card h3 { font-size: 1.15rem; margin-bottom: 10px; font-weight: 600; }
.project-card p { color: var(--text-secondary); font-size: 0.92rem; flex: 1; margin-bottom: 20px; }
.project-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.project-tags span {
    font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-code);
    background: rgba(255,255,255,0.04); padding: 4px 10px;
    border-radius: 4px;
}

/* ===== EXPERIENCE TIMELINE ===== */
.timeline { max-width: 650px; margin: 0 auto; position: relative; padding-left: 32px; }
.timeline::before {
    content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--red), var(--blue));
}
.timeline-item { position: relative; margin-bottom: 40px; }
.timeline-dot {
    position: absolute; left: -28px; top: 6px;
    width: 12px; height: 12px;
    background: var(--red-light); border-radius: 50%;
    box-shadow: 0 0 12px var(--red-glow);
}
.timeline-item:nth-child(even) .timeline-dot {
    background: var(--blue-light);
    box-shadow: 0 0 12px var(--blue-glow);
}
.timeline-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    transition: border-color var(--transition);
}
.timeline-content:hover { border-color: var(--red); }
.timeline-item:nth-child(even) .timeline-content:hover { border-color: var(--blue); }
.timeline-date {
    font-size: 0.8rem; color: var(--red-light); font-weight: 500;
    letter-spacing: 0.5px;
}
.timeline-item:nth-child(even) .timeline-date { color: var(--blue-light); }
.timeline-content h3 { font-size: 1.1rem; margin: 6px 0 2px; font-weight: 600; }
.timeline-content h4 { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; margin-bottom: 8px; }
.timeline-content p { color: var(--text-secondary); font-size: 0.9rem; }

/* ===== CONTACT ===== */
.contact-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 48px; max-width: 900px; margin: 0 auto;
}
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.form-group input, .form-group textarea {
    width: 100%; padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-group input:focus, .form-group textarea:focus {
    border-color: var(--blue-light);
    box-shadow: 0 0 0 3px var(--blue-glow);
}
.form-group input::placeholder, .form-group textarea::placeholder {
    color: var(--text-muted);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.contact-info { display: flex; flex-direction: column; gap: 28px; justify-content: center; }
.contact-item {
    display: flex; align-items: flex-start; gap: 16px;
}
.contact-item i {
    font-size: 1.3rem; margin-top: 4px;
    background: linear-gradient(135deg, var(--red-light), var(--blue-light));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.contact-item h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 2px; }
.contact-item p { font-size: 0.9rem; color: var(--text-secondary); }
.contact-item a { color: var(--blue-light); transition: color var(--transition); }
.contact-item a:hover { color: var(--text-primary); }

/* ===== FLASH MESSAGES ===== */
.flash-messages { max-width: 600px; margin: 0 auto 32px; }
.flash {
    padding: 14px 20px; border-radius: 8px;
    font-size: 0.92rem;
}
.flash-success {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81c784;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center; padding: 32px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.85rem;
}

/* ===== ANIMATIONS ===== */
.fade-in {
    opacity: 0; transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero {
        flex-direction: column; text-align: center;
        padding-top: 100px; gap: 40px;
    }
    .hero-description { margin-left: auto; margin-right: auto; }
    .hero-buttons { justify-content: center; }
    .hero-socials { justify-content: center; }
    .hero-visual { order: -1; }
    .hero-visual { min-width: unset; }
    .hero-photo-wrapper { width: 220px; height: 220px; }
    .code-block { font-size: 0.75rem; padding: 24px 20px; }

    .nav-links {
        position: fixed; top: 0; right: -100%;
        width: 70%; height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        justify-content: center; align-items: center;
        gap: 28px;
        transition: right var(--transition);
        box-shadow: -4px 0 24px rgba(0,0,0,0.4);
    }
    .nav-links.active { right: 0; }
    .nav-toggle { display: block; z-index: 1001; }
    .nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .nav-toggle.active span:nth-child(2) { opacity: 0; }
    .nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    .about-stats { justify-content: center; }
    .contact-grid { grid-template-columns: 1fr; }
    .section { padding: 72px 0; }
    .section-title { font-size: 1.65rem; }
}

@media (max-width: 480px) {
    .hero-name { font-size: 2rem; }
    .skills-grid { grid-template-columns: 1fr; }
    .projects-grid { grid-template-columns: 1fr; }
    .about-stats { flex-direction: column; gap: 20px; }
}
