:root {
    --primary-color: #007bff; 
    --primary-dark: #0056b3;
    --secondary-color: #f0f2f5; 
    --accent-color: #28a745; 

    --text-primary: #1a1a1a; 
    --text-secondary: #555555;
    --text-light: #999999; 

    --bg-primary: #ffffff; 
    --bg-secondary: #fdfdfd; 
    --bg-tertiary: #f0f2f5; 
    --border-color: #e0e0e0; 

    --card-bg: var(--bg-secondary);
    --card-border: var(--border-color);
    --button-primary-bg: var(--primary-color);
    --button-primary-text: #ffffff;
    --button-secondary-bg: transparent;
    --button-secondary-text: var(--primary-color);
    --button-secondary-border: var(--primary-color);

    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-dark: rgba(0, 0, 0, 0.15);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Animation */
    --transition-speed: 0.3s;
    --transition-fast: 0.2s; 
}

/* Dark Theme Variables */
body.dark-theme {
    --secondary-color: #333333; 
    --accent-color: #28a745;

    --text-primary: #f0f0f0; 
    --text-secondary: #cccccc;
    --text-light: #888888;

    --bg-primary: #121212; 
    --bg-secondary: #1e1e1e; 
    --bg-tertiary: #2a2a2a; 
    --border-color: #444444; 

    --card-bg: var(--bg-secondary);
    --card-border: var(--border-color);
    --button-primary-bg: var(--primary-color);
    --button-primary-text: #ffffff;
    --button-secondary-bg: transparent;
    --button-secondary-text: var(--primary-color);
    --button-secondary-border: var(--primary-color);

    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-dark: rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease; 
    scroll-behavior: smooth;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Layout helpers */
.section {
    padding: 80px 40px;
    max-width: 1400px; 
    margin: 0 auto;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.section-dark {
    background-color: var(--bg-tertiary);
}

.full-section {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    background-color: var(--bg-primary);
    position: relative;
    overflow: hidden;
    transition: background-color var(--transition-speed) ease;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-primary);
    opacity: 0; 
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section-title.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.section-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 60px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0; 
    transform: translateY(20px);
    transition: opacity 0.6s ease-out 0.1s, transform 0.6s ease-out 0.1s;
}

.section-subtitle.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.section-cta {
    text-align: center;
    margin-top: 60px;
}

/* --- Navbar --- */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: background var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

body.dark-theme #navbar {
    background: rgba(18, 18, 18, 0.8);
    border-color: var(--border-color);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    position: relative; 
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

body.dark-theme .logo {
    color: var(--text-primary);
}

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

body.dark-theme .logo:hover {
    color: var(--primary-color);
}

/* --- Menú Hamburguesa Toggle --- */
.menu-toggle {
    display: none; 
    background: transparent;
    border: none;
    font-size: 1.8rem;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 1001; 
    transition: color var(--transition-speed) ease;
}

.menu-toggle:hover {
    color: var(--primary-color);
}

/* Menú de navegación principal */
.nav-menu {
    display: flex; 
    list-style: none;
    gap: 30px;
    align-items: center;
    margin: 0; 
    padding: 0; 
}

.nav-menu a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 5px 0;
    position: relative;
    transition: color var(--transition-speed) ease;
}

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

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width var(--transition-speed) ease, left var(--transition-speed) ease;
}

.nav-menu a:hover::after {
    width: 100%;
    left: 0;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

@media (max-width: 992px) {
  .nav-controls {
    display: none !important;
  }
  .nav-menu .nav-controls-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
    gap: 20px;
    width: 100%;
  }
  .nav-menu.active .nav-controls-mobile .nav-controls {
    display: flex !important;
    flex-direction: row;
    gap: 20px;
    justify-content: center;
    width: 100%;
  }
}

.language-switcher {
    position: relative;
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-speed) ease;
    background: var(--bg-primary); 
}

body.dark-theme .language-switcher {
    background: var(--bg-secondary);
}

.lang-button {
    background: transparent; 
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 500;
    transition: color var(--transition-fast) ease;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px; 
    color: var(--text-secondary); 
}

.lang-button img {
    width: 24px;
    height: 18px; /* Maintain aspect ratio for flags */
    border-radius: 2px; /* Slight border-radius for flags */
    object-fit: cover;
    pointer-events: none; /* Don't interfere with button clicks */
}

.lang-button.active {
    color: var(--button-primary-text); /* Active button text color */
}

.lang-selection-indicator {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%; /* Half the width for each button */
    background: var(--primary-color);
    border-radius: var(--radius-md);
    z-index: 1; /* Below the buttons */
    transition: transform var(--transition-speed) cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bounce effect */
    /* cubic-bezier values for a bouncy effect */
}

.lang-button:first-child.active ~ .lang-selection-indicator {
    transform: translateX(0);
}

.lang-button:last-child.active ~ .lang-selection-indicator {
    transform: translateX(100%);
}

/* --- Theme Toggle Button (Updated) --- */
.theme-toggle-button {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease, transform var(--transition-speed) ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

body.dark-theme .theme-toggle-button {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.theme-toggle-button:hover {
    background-color: var(--secondary-color);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

body.dark-theme .theme-toggle-button:hover {
    background-color: var(--bg-tertiary);
}

.theme-toggle-button i {
    font-size: 1.2rem;
    color: #f1c40f; /* Default sun color */
    transition: color 0.1s ease; /* Instant color change for icon */
}

body.dark-theme .theme-toggle-button i {
    color: var(--primary-color); /* Moon color in dark theme */
}

/* --- Welcome Section (Hero) --- */
#welcome-section {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
    position: relative;
    overflow: hidden;
    padding-top: 120px; /* Offset for fixed navbar */
}

body.dark-theme #welcome-section {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px); /* Adjust height for nav */
}

.hero-avatar-wrapper {
    /* CAMBIO AQUÍ: Aumenta el tamaño del width y height */
    width: 200px; /* Tamaño más grande para el avatar */
    height: 200px; /* Mantener la proporción cuadrada */
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid var(--primary-color);
    box-shadow: 0 8px 20px var(--shadow-dark);
    margin-bottom: 40px;
    animation: bounceIn 1s ease-out forwards;
}

.hero-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(10%); /* Subtle effect */
    transition: filter 0.3s ease;
}

.hero-avatar-image:hover {
    filter: grayscale(0%);
}

.hero-content h1 {
    font-size: clamp(3.5rem, 8vw, 6rem);
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    line-height: 1.1;
    animation: fadeIn 1s ease-out forwards 0.2s;
    opacity: 0;
}

.hero-content h1 span {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--text-secondary);
    margin-bottom: 30px;
    animation: fadeIn 1s ease-out forwards 0.4s;
    opacity: 0;
}

.hero-description {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    margin-bottom: 50px;
    max-width: 700px;
    animation: fadeIn 1s ease-out forwards 0.6s;
    opacity: 0;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeIn 1s ease-out forwards 0.8s;
    opacity: 0;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 15px var(--shadow-light);
    font-size: 1.05rem;
    position: relative;
    overflow: hidden; /* For ripple effect */
}

.cta-button i {
    font-size: 1.1em;
}

.cta-button.primary {
    background: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
}

.cta-button.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow-dark);
}

.cta-button.secondary {
    background: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    border: 2px solid var(--button-secondary-border);
}

.cta-button.secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow-dark);
}

.cta-button.large {
    padding: 18px 35px;
    font-size: 1.15rem;
}

/* Botón terciario para descargar CV */
.cta-button.tertiary {
  background: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border: 2px solid var(--button-secondary-border);
  box-shadow: none;
  font-weight: 500;
}

.cta-button.tertiary:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px var(--shadow-dark);
}

.cta-button.tertiary i {
  color: inherit;
  margin-right: 6px;
}

/* --- Projects Section --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
}

.project-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    border: 1px solid var(--card-border);
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow-light);
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    opacity: 0; /* For scroll animation */
    transform: translateY(30px);
}

.project-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px var(--shadow-dark);
}

.project-card-image img {
  width: 100%;
  height: 300px; /* Puedes ajustar a 300px si quieres más alto */
  object-fit: cover;
  border-radius: 1rem 1rem 0 0;
  display: block;
}

.project-card-image i {
    z-index: 1;
}

.project-card-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%23ffffff" fill-opacity="0.1"><rect width="2" height="2" rx="1"/></g></svg>');
    opacity: 0.8;
    pointer-events: none; 
}

.project-card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.project-card-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.7;
    flex-grow: 1;
}

.project-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.project-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
}

body.dark-theme .project-tag {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.project-tag:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.project-card-links {
    display: flex;
    gap: 20px;
    margin-top: auto; /* Push links to bottom */
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary-color);
}

.project-link:hover {
    transform: translateX(5px);
}

.project-link-btn { 
  color: var(--primary-color);
  font-weight: bold;
  padding: 0.5em 1.2em;
  border-radius: 0.5rem;
  font-size: 1em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.project-link-btn:hover,
.project-link-btn:focus {
  background: var(--primary-color);  /* Azul normal */
  color: white;                    /* Texto negro */
  box-shadow: 0 4px 16px var(--shadow-dark);
  transform: translateY(-2px) scale(1.03);
  outline: none;
}

/* --- Skills Section --- */
.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    /* ESTO ES CLAVE: hace que los hijos se estiren a la altura del más alto de la fila */
    align-items: stretch;
}

.skill-category-card {
    flex: 1 1 calc(33.333% - 20px);
    max-width: calc(33.333% - 20px);
    min-width: 280px;

    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 30px;
    box-shadow: 0 4px 15px var(--shadow-light);
    border: 1px solid var(--card-border);
    transition: all var(--transition-speed) ease;
    opacity: 0;
    transform: translateY(30px);

    display: flex;
    flex-direction: column;
}

.skill-category-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.skill-category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px var(--shadow-dark);
}

.skill-category-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--primary-color);
    text-align: center;
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 0;
}

.skill-item {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) ease;
}

body.dark-theme .skill-item {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.skill-item i {
    color: var(--primary-color);
    transition: color var(--transition-speed) ease;
}

.skill-item:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.skill-item:hover i {
    color: white;
}


/* --- Trajectory Section (Timeline) --- */
.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding-top: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 50px;
    width: 50%;
    padding: 10px 0; /* Add padding for visual spacing */
    opacity: 0; /* For scroll animation */
    transform: translateY(30px);
}

.timeline-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Alternate sides */
.timeline-item:nth-child(odd) {
    float: left;
    clear: both;
    padding-right: 40px;
}

.timeline-item:nth-child(even) {
    float: right;
    clear: both;
    padding-left: 40px;
}

.timeline-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: 0 4px 15px var(--shadow-light);
    border: 1px solid var(--card-border);
    transition: all var(--transition-speed) ease;
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-dark);
}

/* Arrow for content bubble */
.timeline-item:nth-child(odd) .timeline-content::after {
    content: '';
    position: absolute;
    top: 25px;
    right: -15px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 15px solid var(--card-bg);
    border-right: none;
}

.timeline-item:nth-child(even) .timeline-content::after {
    content: '';
    position: absolute;
    top: 25px;
    left: -15px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 15px solid var(--card-bg);
    border-left: none;
}

.timeline-date {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.timeline-company {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 15px;
    font-size: 1rem;
}

.timeline-description {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 15px;
}

.timeline-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.timeline .skill-tag { /* Reusing skill-tag from projects */
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.timeline .skill-tag:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Circle markers */
.timeline-item::before {
    content: '';
    position: absolute;
    top: 35px; /* Aligns with content arrow */
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border: 4px solid var(--bg-primary); /* Matches section background */
    border-radius: 50%;
    z-index: 2;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

body.dark-theme .timeline-item::before {
    border-color: var(--bg-primary);
}

.timeline-item:nth-child(odd)::before {
    right: -9px; /* Adjust based on line and padding */
    transform: translateX(50%);
}

.timeline-item:nth-child(even)::before {
    left: -9px; /* Adjust based on line and padding */
    transform: translateX(-50%);
}

/* Clear floats for timeline */
.timeline::after {
    content: '';
    display: table;
    clear: both;
}


/* --- Contact Section --- */
.contact-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    justify-items: center; 
    align-items: stretch;
    margin-bottom: 50px;
}

.contact-item {
    width: 300px;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 30px;
    box-shadow: 0 4px 15px var(--shadow-light);
    border: 1px solid var(--card-border);
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0; /* For scroll animation */
    transform: translateY(30px);
}

.contact-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.contact-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px var(--shadow-dark);
}

.contact-icon {
    width: 70px;
    height: 70px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.contact-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.contact-content a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1.05rem;
    word-break: break-all; /* For long emails/links */
}

/* --- Footer --- */
.footer {
    margin-top: 50px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 50px 40px 30px;
    text-align: center;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-content p {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 1px;
    background: var(--primary-color);
    transition: width var(--transition-speed) ease, left var(--transition-speed) ease;
}

.footer-links a:hover::after {
    width: 100%;
    left: 0;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

/* Intersection Observer Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.active {
    opacity: 1;
    transform: translateY(0);
}

/* Ensure delays for staggered animation */
.projects-grid .project-card { transition-delay: calc(var(--item-index, 0) * 0.1s); }
.skills-grid .skill-category-card { transition-delay: calc(var(--item-index, 0) * 0.1s); }
.timeline-item { transition-delay: calc(var(--item-index, 0) * 0.1s); }
.contact-info .contact-item { transition-delay: calc(var(--item-index, 0) * 0.1s); }


/* --- Responsive Design --- */
@media (max-width: 992px) {
    .navbar-container {
        padding: 15px 20px;
        flex-wrap: nowrap; 
        justify-content: space-between;
    }

    .logo {
        margin-bottom: 0; 
        width: auto; 
        text-align: left; 
    }

    .menu-toggle {
        display: block; 
    }

    .nav-menu {
        display: none; 
        flex-direction: column;
        position: absolute; 
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh; 
        background: var(--bg-primary);
        padding-top: 80px; 
        align-items: center;
        justify-content: flex-start; 
        gap: 30px; 
        box-shadow: 0 0 10px rgba(0,0,0,0.2);
        opacity: 0;
        visibility: hidden;
        transform: translateX(100%); 
        transition: opacity 0.4s ease-out, transform 0.4s ease-out, visibility 0.4s ease-out;
    }

    .nav-menu.active {
        display:flex;
        opacity: 1;
        visibility: visible;
        transform: translateX(0); 
    }

    .nav-menu a {
        font-size: 1.5rem; 
        padding: 15px 0;
        width: 80%; 
        text-align: center;
        border-bottom: 1px solid var(--border-color); 
    }
    
    .nav-menu a:last-child {
        border-bottom: none; 
    }

    .nav-menu a::after {
        bottom: 0px; 
    }

    .nav-controls {
        display: flex;
        flex-direction: column;
        gap: 20px;
        margin-top: 40px;
    }

    .nav-menu.active + .nav-controls {
        display: flex;
        position: absolute;
        bottom: 30px; 
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row; 
        gap: 20px;
        background: transparent; 
        z-index: 1002;
    }

    body.dark-theme .nav-menu {
        background: var(--bg-primary); 
    }

    body.dark-theme .nav-menu a {
        border-color: var(--border-color);
    }

    .hero-content h1 {
        font-size: clamp(2.8rem, 7vw, 5rem);
    }

    .hero-subtitle {
        font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    }

    .section {
        padding: 60px 20px;
    }

    .section-title {
        font-size: clamp(2rem, 4.5vw, 3.5rem);
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 30px;
    }

    .skills-grid {
        gap: 25px;
    }

    .skill-category-card {
        flex: 1 1 calc(50% - 20px);
        max-width: calc(50% - 20px);
        height: auto; 
    }

    .timeline::before {
        left: 20px;
    }

    .contact-info {
        grid-template-columns: 1fr;
        gap: 20px;
        justify-items: center;
    }

    .timeline-item {
        width: 100%;
        float: none;
        clear: both;
        padding: 0 0 0 60px; /* Adjust padding for single column */
    }

    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        padding-right: 0; /* Remove right padding for odd items */
        padding-left: 60px; /* Ensure consistent left padding */
    }

    .timeline-item:nth-child(odd) .timeline-content::after {
        right: auto;
        left: -15px; /* Arrow points left */
        border-left: none;
        border-right: 15px solid var(--card-bg);
    }

    .timeline-item:nth-child(even) .timeline-content::after {
        left: -15px;
        border-left: none;
        border-right: 15px solid var(--card-bg);
    }

    .timeline-item::before {
        left: 10px; /* Align circle with line */
        transform: translateX(0);
    }
}

@media (max-width: 600px) {
    .navbar-container {
        padding: 15px;
    }

    .hero-avatar-wrapper {
        width: 150px; 
        height: 150px;
    }

    .nav-menu {
        gap: 15px;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-description {
        font-size: 0.95rem;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .cta-button {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .section {
        padding: 40px 15px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 40px;
    }

    .projects-grid {
        gap: 25px;
    }

    .skills-grid {
        gap: 20px;
    }

    .skill-category-card {
        flex: 1 1 100%;
        max-width: 100%;
        height: auto; 
    }

    .skill-category-title {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }

    .skill-item {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .timeline-content {
        padding: 20px;
    }

    .timeline-date {
        font-size: 0.85rem;
    }

    .timeline-title {
        font-size: 1.1rem;
    }

    .timeline-company {
        font-size: 0.9rem;
    }

    .timeline-description {
        font-size: 0.9rem;
    }

    .contact-item {
        padding: 25px;
    }

    .contact-icon {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }

    .contact-info {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .contact-content h3 {
        font-size: 1.2rem;
    }

    .contact-content a {
        font-size: 0.95rem;
    }

    .footer {
        padding: 40px 15px 25px;
    }

    .footer-content p {
        font-size: 0.85rem;
    }

    .footer-links {
        gap: 20px;
    }
}

#hero-nodes-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0;
  pointer-events: auto;
  display: block;
}