:root {
    /* Palette: Corporate Tech */
    --color-bg: #F8FAFC;
    --color-surface: #FFFFFF;
    --color-primary: #2563EB; /* Royal Blue */
    --color-primary-dark: #1E40AF;
    --color-accent: #0F172A; /* Dark Slate */
    --color-text-main: #1E293B;
    --color-text-muted: #64748B;
    --color-border: #E2E8F0;
    
    /* Gradients */
    --gradient-hero: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    --gradient-accent: linear-gradient(135deg, #2563EB, #4F46E5);

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);

    /* Typography */
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden; /* Prevent horizontal scroll on mobile */
}

body {
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Tech Grid */
.tech-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: 
        linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.logo {
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

.logo-bracket {
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--color-text-main);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--color-primary);
}

.btn-nav {
    padding: 0.6rem 1.2rem;
    background: var(--color-accent);
    color: white !important;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: transform 0.2s !important;
}

.btn-nav:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* HERO SECTION (Asymmetric) */
.hero-section {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
    min-height: 80vh;
    margin-bottom: 6rem;
}

.hero-content {
    position: relative;
    z-index: 10;
}

.badge-tech {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-primary);
    background: rgba(37, 99, 235, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 800;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.highlight {
    position: relative;
    color: var(--color-accent);
    z-index: 1;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: -5px;
    width: 105%;
    height: 15px;
    background: #BFDBFE; /* Light Blue highlight */
    z-index: -1;
    transform: rotate(-2deg);
}

.highlight-tech {
    color: var(--color-primary);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    margin-bottom: 2.5rem;
    max-width: 90%;
}

/* Stats Row */
.hero-stats {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-accent);
    font-family: var(--font-mono);
}

.stat-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-separator {
    width: 1px;
    height: 40px;
    background: var(--color-border);
}

/* Buttons */
.hero-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 0.5rem;
}

.btn.primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn.primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn.secondary {
    background: white;
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
}

.btn.secondary:hover {
    border-color: var(--color-text-main);
    background: var(--color-bg);
}

/* Hero Image Area */
.hero-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-wrapper {
    position: relative;
    width: 400px;
    height: 400px;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 40px; /* Soft square */
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 2;
    filter: contrast(1.05);
}

/* Decorations */
.tech-decoration {
    position: absolute;
    z-index: 1;
}

.circle-1 {
    width: 420px;
    height: 420px;
    border: 2px solid rgba(37, 99, 235, 0.1);
    border-radius: 45px;
    top: -10px;
    left: -10px;
    animation: pulseBorder 4s infinite;
}

@keyframes pulseBorder {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.dots-1 {
    width: 100px;
    height: 100px;
    background-image: radial-gradient(var(--color-primary) 20%, transparent 20%);
    background-size: 10px 10px;
    opacity: 0.2;
    bottom: -30px;
    right: -30px;
}

.tech-card {
    position: absolute;
    background: white;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    z-index: 3;
    font-weight: 600;
    font-size: 0.8rem;
    border: 1px solid var(--color-border);
}

.floating-card-1 {
    top: 40px;
    left: -30px;
    animation: float 6s ease-in-out infinite;
}

.floating-card-2 {
    bottom: 40px;
    right: -20px;
    animation: float 7s ease-in-out infinite reverse;
}

.tech-card i {
    color: var(--color-primary);
    font-size: 1rem;
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

/* SECTIONS COMMON */
.content-section {
    margin-bottom: 8rem;
}

.section-header {
    margin-bottom: 3rem;
}

.section-tag {
    font-family: var(--font-mono);
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
}

.section-header h2 {
    font-size: 2.5rem;
    color: var(--color-accent);
    font-weight: 800;
}

/* BENTO GRID (About) */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 1.5rem;
}

.bento-item {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bento-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.bento-item.large-text {
    grid-column: span 2;
}

.bento-item.dark {
    background: var(--color-accent);
    color: white;
    border: none;
}

.bento-item.dark p, .bento-item.dark i {
    color: rgba(255,255,255,0.8);
}

/* Bento Item: Wide Image (Traveler) */
.bento-item.wide-image {
    grid-column: span 2;
    position: relative;
    overflow: hidden;
    min-height: 240px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: #0F172A; /* Dark fallback */
    border: none;
    text-decoration: none; /* Reset for anchor tag */
}

.bento-item.wide-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/travel_madera.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.4; /* Transparency adjusted as requested */
    transition: transform 0.5s ease;
    z-index: 0;
}

.bento-item.wide-image:hover::before {
    transform: scale(1.05);
    opacity: 0.5;
}

.bento-item.wide-image .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    z-index: 1;
}

.bento-item.wide-image h4,
.bento-item.wide-image p {
    position: relative;
    z-index: 2;
}

/* Bento Item: Professional (EIB) */
.bento-item.professional {
    position: relative;
    overflow: hidden;
    background: var(--color-accent); /* Keep dark bg */
}

.bento-item.professional::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background-image: url('images/eib_logo.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3; /* Subtle watermark effect */
    filter: grayscale(100%) brightness(200%); /* Make logo white/monochrome */
    z-index: 0;
    pointer-events: none;
}

.bento-item.professional i,
.bento-item.professional h4,
.bento-item.professional p {
    position: relative;
    z-index: 1;
}

.bento-item h3 { font-size: 1.5rem; margin-bottom: 1rem; }
.bento-item h4 { font-size: 1.1rem; margin-bottom: 0.5rem; font-weight: 700; }
.bento-item p { font-size: 0.95rem; color: var(--color-text-muted); }

.icon-large {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.text-tech { color: var(--color-primary); }

/* FEATURES */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    border-left: 3px solid var(--color-border);
    background: white;
    transition: border-color 0.3s;
}

.feature-card:hover {
    border-color: var(--color-primary);
}

.feature-icon {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

/* PROJECTS */
.projects-showcase {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.project-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    background: white;
    border-radius: 24px;
    padding: 3rem;
    border: 1px solid var(--color-border);
    align-items: center;
}

.project-desc {
    margin-bottom: 2.5rem !important; /* Ensure space for button */
}

.project-status {
    font-family: var(--font-mono);
    color: #10B981; /* Success Green */
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: inline-block;
    padding: 2px 8px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
}

.tech-stack {
    list-style: none;
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}

.tech-stack li {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--color-bg);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
}

.projects-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.project-mini {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--color-border);
    transition: transform 0.3s;
}

.project-mini:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
}

.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    margin-top: 1rem;
}

.project-visual {
    text-align: center;
}

/* Testimonials */
.testimonials-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.testimonial-single {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    position: relative;
    height: 100%; /* Equal height */
}

.quote-icon {
    font-size: 1.5rem;
    color: var(--color-border);
    margin-bottom: 1rem;
}

.author {
    margin-top: 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-accent);
}

/* CONTACT */
.contact-wrapper {
    background: var(--color-accent);
    border-radius: 24px;
    padding: 4rem;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.contact-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at top right, rgba(37, 99, 235, 0.2), transparent 50%);
    pointer-events: none;
}

.contact-box h2 {
    color: white;
    margin-bottom: 1rem;
}

.contact-info-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.contact-tile {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 12px;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.3s;
    border: 1px solid rgba(255,255,255,0.1);
}

.contact-tile:hover {
    background: rgba(255, 255, 255, 0.2);
}

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-family: var(--font-mono);
}

/* SCROLL ANIMATION */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   MOBILE OPTIMIZATION / RESPONSIVE DESIGN
   ========================================== */

/* Tablets & Small Laptops (Max 1024px) */
@media (max-width: 1024px) {
    .hero-section {
        gap: 2rem;
        grid-template-columns: 1fr 0.8fr;
    }

    .bento-grid {
        gap: 1rem;
    }
}

/* Tablets Portrait (Max 900px) */
@media (max-width: 900px) {
    .top-nav {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem 0;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 1.5rem;
        flex-wrap: wrap;
    }

    .hero-section {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
        margin-bottom: 4rem;
        display: flex;
        flex-direction: column-reverse; /* Image on top on mobile */
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-stats, .hero-actions {
        justify-content: center;
    }
    
    .image-wrapper {
        width: 340px;
        height: 340px;
        margin: 0 auto;
    }

    .bento-grid {
        grid-template-columns: 1fr 1fr; /* 2 columns */
    }
    
    .bento-item.large-text, .bento-item.wide-image {
        grid-column: span 2;
    }
    
    .project-main {
        grid-template-columns: 1fr;
        padding: 2rem;
        text-align: center;
    }

    .project-visual img {
        max-width: 60% !important;
        margin-top: 2rem;
    }
    
    .features-grid, .testimonials-wrapper, .projects-row {
        grid-template-columns: 1fr;
    }

    .contact-wrapper {
        padding: 2.5rem 1.5rem;
    }
}

/* Mobile Devices (Max 600px) */
@media (max-width: 600px) {
    .container {
        padding: 0 1.25rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .bento-grid {
        grid-template-columns: 1fr; /* 1 column */
    }

    .bento-item.large-text, .bento-item.wide-image {
        grid-column: span 1;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }

    .stat-separator {
        width: 50px;
        height: 1px;
        background: var(--color-border);
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .contact-info-grid {
        flex-direction: column;
        gap: 1rem;
    }

    .contact-tile {
        width: 100%;
        justify-content: center;
    }

    /* Fix for floating cards on small screens */
    .tech-card {
        transform: scale(0.85);
        padding: 0.6rem 1rem;
        width: max-content;
    }

    .floating-card-1 {
        left: -20px;
        top: 20px;
    }

    .floating-card-2 {
        right: -10px;
        bottom: 20px;
    }

    .image-wrapper {
        width: 280px;
        height: 280px;
    }

    .circle-1 {
        width: 300px;
        height: 300px;
    }
    
    .bento-item.wide-image {
        min-height: 200px;
    }
}

/* Small Phones (Max 380px) */
@media (max-width: 380px) {
    h1 {
        font-size: 2rem;
    }
    
    .tech-card {
        display: none; /* Hide decorative cards on very small screens to keep focus on face */
    }

    .image-wrapper {
        width: 240px;
        height: 240px;
    }

    .circle-1 {
        width: 250px;
        height: 250px;
    }
}