@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --secondary: #f472b6;
    --accent: #2dd4bf;
    --bg: #030712;
    --surface: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --white: #ffffff;
    --transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    --container-width: 1200px;
    --radius: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Parallax Blobs */
.parallax-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    transition: transform 0.2s ease-out;
    will-change: transform;
    transform: translateY(calc(var(--scroll-y, 0) * var(--speed, 0.1) * 1px)) 
               translate(calc(var(--mouse-x, 0) * 30px), calc(var(--mouse-y, 0) * 30px));
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    --speed: 0.05;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: -50px;
    right: -50px;
    --speed: 0.12;
}

.blob-3 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    top: 40%;
    left: 60%;
    --speed: 0.08;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Typography */
h1, h2, h3 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h1 { font-size: clamp(2.5rem, 8vw, 4rem); }
h2 { font-size: clamp(2rem, 5vw, 2.5rem); }

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

section {
    padding: 8rem 0;
}

/* Glassmorphism Utility */
.glass {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.2rem 0;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 1rem;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--white);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 2rem;
    border-radius: 100px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    gap: 0.5rem;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary:hover {
    background: var(--surface-hover);
    transform: translateY(-3px);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    text-align: center;
    padding-top: 120px;
}

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

.hero-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    padding: 5px;
    background: var(--bg);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.2);
}

.hero-text h1 {
    margin-bottom: 0.5rem;
}

.hero-text .subtitle {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.hero-text .description {
    max-width: 700px;
    margin: 0 auto 2.5rem;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.hero-btns {
    display: flex;
    gap: 1.5rem;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.skill-card {
    padding: 2.5rem;
    transition: var(--transition);
}

.skill-card:hover {
    transform: translateY(-10px);
    background: var(--surface-hover);
    border-color: var(--primary);
}

.skill-card h3 {
    -webkit-text-fill-color: var(--white);
    margin-bottom: 1rem;
}

/* Projects Section */
.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 4rem;
    gap: 2rem;
}

.filters {
    display: flex;
    gap: 1rem;
}

.filter-select {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--surface);
    color: var(--white);
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.filter-select:focus {
    border-color: var(--primary);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.project-card {
    position: relative;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* Box Model Visualization (Margin) */
.project-card::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    z-index: -1;
    opacity: 0;
    transition: var(--transition);
}

/* Hover State */
.project-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.project-card:hover::after {
    opacity: 0.5;
    filter: blur(8px);
}

/* Interactive Glow (managed by JS) */
.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(800px circle at var(--x, 50%) var(--y, 50%), rgba(129, 140, 248, 0.15), transparent 40%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 0;
    border-radius: var(--radius);
}

.project-card:hover::before {
    opacity: 1;
}

.project-card > * {
    position: relative;
    z-index: 1;
}

.project-card h3 {
    -webkit-text-fill-color: var(--white);
    font-size: 1.5rem;
}

.project-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    flex-grow: 1;
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.tag {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 0.3rem 1rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.8rem;
}

/* New Modern Tag System */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    max-width: 80%;
}

.badge {
    background: var(--surface-hover);
    padding: 8px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 1px solid var(--glass-border);
    color: var(--primary);
    transition: var(--transition);
    backdrop-filter: blur(4px);
}

.badge-text {
    display: none; /* satisfy "no quiero texto" */
}

.badge:hover {
    transform: translateY(-3px);
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 5px 15px rgba(129, 140, 248, 0.3);
}

.project-card:hover .badge {
    border-color: var(--primary);
    background: rgba(129, 140, 248, 0.1);
}

/* Icon Containers */
.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
}

.project-icon-container {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    position: relative;
}

.project-icon-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary);
    opacity: 0;
    filter: blur(15px);
    border-radius: 50%;
    transition: var(--transition);
}

.project-card:hover .project-icon-container::after {
    opacity: 0.2;
}

.project-card:hover .project-icon-container {
    transform: scale(1.1) rotate(5deg);
    border-color: var(--primary);
    background: rgba(129, 140, 248, 0.1);
}

.project-icon-container img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: brightness(1.1) drop-shadow(0 0 8px rgba(129, 140, 248, 0.2));
    border-radius: 4px;
}

.project-icon-container i {
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Academic Projects Specific */
.tab-bar {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-bottom: 3rem;
    scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    border-radius: 100px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--surface-hover);
    color: var(--white);
}

.tab-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.academic-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.academic-content.active {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.video-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.project-img-placeholder {
    width: 100%;
    height: 200px;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border: 1px solid var(--glass-border);
    transform: translateY(calc(var(--scroll-y, 0) * 0.1px));
    transition: transform 0.1s linear;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.animate-in {
    animation: fadeIn 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* Modern Subject Intro */
.subject-intro {
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    padding: 5rem;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    margin-bottom: 4rem;
    text-align: left;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(40px);
}

.subject-intro::after {
    content: '';
    position: absolute;
    bottom: -50px;
    right: -50px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle at center, var(--primary), transparent 70%);
    opacity: 0.1;
    filter: blur(60px);
}

.subject-intro h2 {
    font-size: 4rem;
    margin-bottom: 2rem;
    background: linear-gradient(to right, var(--white), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.subject-intro p {
    font-size: 1.4rem;
    color: var(--text-muted);
    max-width: 1000px;
    line-height: 1.9;
}

/* Full Width & Detailed Project Layouts */
.full-width-project {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    margin-top: 2rem;
}

.project-section {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 4rem;
    align-items: center;
    background: var(--surface);
    padding: 4rem;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    transition: var(--transition);
}

.project-section:hover {
    border-color: var(--primary);
    background: var(--surface-hover);
}

.project-section.reverse {
    direction: rtl;
}

.project-section.reverse > * {
    direction: ltr;
}

.project-media-full img, 
.project-media-full video {
    width: 100%;
    border-radius: calc(var(--radius) / 2);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
}

.project-details-full h3 {
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, var(--white), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.project-details-full p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.feature-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-main);
    font-size: 1rem;
}

.feature-list li::before {
    content: "→";
    color: var(--accent);
}



/* CV Page Styles */
.cv-header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.cv-container {
    padding: 4rem;
    margin-bottom: 4rem;
}

.cv-header {
    display: flex;
    gap: 3rem;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 3rem;
    margin-bottom: 3rem;
}

.cv-photo {
    width: 150px;
    height: 150px;
    border-radius: 20px;
    object-fit: cover;
}

.cv-info {
    flex-grow: 1;
}

.cv-contact-info {
    text-align: right;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.cv-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.6fr;
    gap: 4rem;
}

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

.cv-section h2 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
    -webkit-text-fill-color: initial;
    background: none;
}

.cv-item {
    margin-bottom: 2rem;
}

.cv-item h3 {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    -webkit-text-fill-color: var(--white);
}

.cv-item .date {
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

.cv-item .company {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: block;
}

.cv-item ul {
    margin-left: 1.2rem;
    color: var(--text-muted);
}

.cv-item ul li {
    margin-bottom: 0.5rem;
    list-style-type: disc;
}

/* Contact Page Styles */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.contact-card {
    padding: 3rem;
    text-align: center;
    transition: var(--transition);
}

.contact-card:hover {
    transform: translateY(-10px);
    background: var(--surface-hover);
    border-color: var(--primary);
}

.contact-card svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

/* Footer */
footer {
    padding: 4rem 0;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text-muted);
}

.footer-links {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

/* Icon button base */
.footer-icon {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    justify-content: center;
    font-size: 1.4rem;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 0.3s ease,
                background 0.3s ease,
                border-color 0.3s ease;
    overflow: visible;
}

/* Tooltip label */
.footer-icon-label {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    letter-spacing: 0.5px;
}

.footer-icon:hover .footer-icon-label {
    opacity: 1;
}

/* Hover lift */
.footer-icon:hover {
    transform: translateY(-6px);
    border-color: transparent;
}

/* GitHub — white */
.footer-icon-github { color: #f0f6fc; }
.footer-icon-github:hover {
    background: #24292e;
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* LinkedIn — official blue */
.footer-icon-linkedin { color: #0a66c2; }
.footer-icon-linkedin:hover {
    background: #0a66c2;
    box-shadow: 0 10px 25px rgba(10, 102, 194, 0.4);
    color: #fff;
}

/* Instagram — brand gradient */
.footer-icon-instagram { color: #e1306c; }
.footer-icon-instagram:hover {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    box-shadow: 0 10px 25px rgba(225, 48, 108, 0.4);
    color: #fff;
    border-color: transparent;
}

/* Email — accent teal */
.footer-icon-email { color: var(--accent); }
.footer-icon-email:hover {
    background: var(--accent);
    box-shadow: 0 10px 25px rgba(45, 212, 191, 0.35);
    color: #030712;
}

/* Extra bottom padding on footer to make room for tooltip labels */
footer {
    padding-bottom: 5rem;
}

.text-center { text-align: center; }
.section-desc {
    max-width: 800px;
    margin: 0 auto 4rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}
.text-muted { color: var(--text-muted); }
.primary-link { color: var(--primary); }
.primary-link:hover { color: var(--secondary); }
.pt-header { padding-top: 150px; }
.text-sm { font-size: 0.9rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-large { margin-top: 8rem; }
.no-padding { padding: 0; }

/* Responsive */
@media (max-width: 992px) {
    .cv-grid { grid-template-columns: 1fr; }
    .cv-header { flex-direction: column; text-align: center; }
    .cv-contact-info { text-align: center; margin-top: 1.5rem; }
}

@media (max-width: 768px) {
    .nav-links { display: none; } /* Could add a mobile menu later */
    section { padding: 4rem 0; }
    .hero { padding-top: 100px; }
    .hero-btns { flex-direction: column; width: 100%; }
    .cv-container { padding: 2rem; }
}

@media print {
    body { background: white; color: black; }
    .navbar, footer, .cv-header-actions { display: none; }
    .cv-container { border: none; padding: 0; box-shadow: none; background: none; }
    .glass { border: none; backdrop-filter: none; }
}
