/* ============================================
   ARTURO VICENTE JAÉN - MODERN PORTFOLIO CSS
   ============================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Colors - Light Mode */
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e9ecef;
  --text-primary: #1a1a2e;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #8b5cf6 100%);
  --accent-glow: rgba(99, 102, 241, 0.3);
  --border-color: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 12px 40px rgba(99, 102, 241, 0.15);
  --nav-bg: rgba(255, 255, 255, 0.85);
  --nav-border: rgba(0, 0, 0, 0.06);
  --footer-bg: #1a1a2e;
  --footer-text: #e2e8f0;
  --hero-overlay: linear-gradient(135deg, rgba(99, 102, 241, 0.85) 0%, rgba(139, 92, 246, 0.75) 100%);
  --badge-bg: rgba(99, 102, 241, 0.1);
  --badge-text: #6366f1;
  --tag-bg: rgba(99, 102, 241, 0.08);
  --tag-text: #6366f1;
  --tag-border: rgba(99, 102, 241, 0.2);
  --code-bg: #f1f5f9;
  --code-text: #e11d48;
  --scrollbar-track: #e2e8f0;
  --scrollbar-thumb: #c1c9d6;
  --scrollbar-thumb-hover: #a0aab6;
  --divider: rgba(0, 0, 0, 0.06);

  /* --- HERO SPACING (edit these to adjust space above/below hero title) --- */
  --hero-top-spacing: 50rem;   /* Space between navbar and hero title */
  --hero-bottom-spacing: 4rem; /* Space between subtitle and cards/timeline */

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --font-heading: 'Inter', sans-serif;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;
  --spacing-3xl: 6rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #818cf8;
  --accent-secondary: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c4b5fd 100%);
  --accent-gradient-hover: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  --accent-glow: rgba(129, 140, 248, 0.3);
  --border-color: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 12px 40px rgba(129, 140, 248, 0.2);
  --nav-bg: rgba(15, 23, 42, 0.9);
  --nav-border: rgba(255, 255, 255, 0.06);
  --footer-bg: #020617;
  --footer-text: #cbd5e1;
  --hero-overlay: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.85) 100%);
  --badge-bg: rgba(129, 140, 248, 0.15);
  --badge-text: #a78bfa;
  --tag-bg: rgba(129, 140, 248, 0.1);
  --tag-text: #a78bfa;
  --tag-border: rgba(129, 140, 248, 0.3);
  --code-bg: #1e293b;
  --code-text: #fb7185;
  --scrollbar-track: #1e293b;
  --scrollbar-thumb: #475569;
  --scrollbar-thumb-hover: #64748b;
  --divider: rgba(255, 255, 255, 0.06);
}

/* --- Global Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.7;
  overflow-x: hidden;
  padding-top: 56px;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); }
h5 { font-size: clamp(1.1rem, 2vw, 1.25rem); }

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--accent-secondary);
}

/* --- Glassmorphism Utility --- */
.glass {
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--nav-border);
}

/* --- Navbar --- */
.navbar {
  background: var(--nav-bg) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid var(--nav-border) !important;
  padding: 0.75rem 0;
  transition: all var(--transition-base);
  z-index: 1050;
}

.navbar .navbar-toggler {
  margin-left: auto;
}

.navbar .navbar-collapse {
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--nav-border);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  padding: 1rem;
}

.navbar-brand {
  font-weight: 800;
  font-size: 1.3rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.nav-link {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary) !important;
  padding: 0.5rem 1rem !important;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-primary) !important;
  background: var(--badge-bg);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent-primary);
  border-radius: 50%;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-size: 1.1rem;
}

.theme-toggle:hover {
  background: var(--badge-bg);
  border-color: var(--accent-primary);
  transform: rotate(15deg);
}

/* --- Hero / Carousel --- */
header {
  position: relative;
  overflow: hidden;
}

.carousel-item {
  height: 80vh;
  min-height: 400px;
  background: no-repeat center center scroll;
  background-size: cover;
  position: relative;
}

.carousel-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hero-overlay);
  z-index: 1;
  opacity: 0.9;
}

.carousel-caption {
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  padding: 2rem;
  max-width: 700px;
  margin: 0 auto;
}

.carousel-caption h4 {
  color: #ffffff;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 1rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
  letter-spacing: -0.03em;
}

.carousel-caption p {
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 400;
  text-shadow: 0 1px 10px rgba(0,0,0,0.2);
}

.carousel-indicators {
  bottom: 2rem;
  z-index: 3;
}

.carousel-indicators [data-target] {
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: none;
  transition: all var(--transition-base);
}

.carousel-indicators .active {
  background: #ffffff;
  width: 32px;
  border-radius: var(--radius-full);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
  width: 48px;
  height: 48px;
  background-color: rgba(255,255,255,0.2);
  border-radius: 50%;
  backdrop-filter: blur(10px);
}

/* --- Cards --- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  transition: all var(--transition-slow);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--accent-primary);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--divider);
  padding: 1.25rem 1.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.card-body {
  padding: 1.5rem;
}

.card-body p {
  color: var(--text-secondary);
  line-height: 1.8;
}

.card-footer {
  background: transparent;
  border-top: 1px solid var(--divider);
  padding: 1rem 1.5rem;
}

/* --- Buttons --- */
.btn {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-full);
  border: none;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff !important;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--accent-glow);
  color: #ffffff !important;
}

.btn-outline-primary {
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--accent-primary);
  color: #ffffff !important;
  transform: translateY(-2px);
}

/* --- Badges / Tags --- */
.badge-tech {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--tag-border);
  margin: 0.15rem;
  transition: all var(--transition-fast);
}

.badge-tech:hover {
  background: var(--accent-primary);
  color: #ffffff;
  transform: translateY(-1px);
}

/* --- Section Headings --- */
.section-title {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
  position: relative;
}

.section-title h2 {
  font-weight: 800;
  letter-spacing: -0.03em;
}

.section-title .subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: var(--spacing-sm);
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  margin: var(--spacing-md) auto 0;
}

/* --- Breadcrumb --- */
.breadcrumb {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
}

.breadcrumb-item a {
  color: var(--accent-primary);
  font-weight: 500;
}

.breadcrumb-item.active {
  color: var(--text-muted);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '›';
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* --- Project Cards (Publications) --- */
.pub-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: var(--spacing-lg);
  transition: all var(--transition-base);
}

.pub-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--card-shadow-hover);
}

.pub-year {
  display: inline-block;
  padding: 0.3rem 1rem;
  background: var(--accent-gradient);
  color: #ffffff;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: var(--spacing-md);
}

.pub-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.pub-authors {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-sm);
}

.pub-journal {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: var(--spacing-sm);
}

.pub-keywords {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-md);
}

/* --- About Page --- */
.profile-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--card-shadow);
}

.profile-img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 4px solid var(--accent-primary);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.timeline-item {
  position: relative;
  padding-left: 2rem;
  padding-bottom: 1.5rem;
  border-left: 2px solid var(--accent-primary);
  margin-left: 0.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  background: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--badge-bg);
}

.timeline-item:last-child {
  border-left-color: transparent;
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-title {
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.25rem 0;
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* --- Contact Page --- */
.contact-info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: all var(--transition-base);
}

.contact-info-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.contact-icon {
  width: 48px;
  height: 48px;
  background: var(--badge-bg);
  color: var(--accent-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: var(--spacing-sm);
}

/* --- Footer --- */
footer {
  background: var(--footer-bg) !important;
  border-top: 1px solid rgba(255,255,255,0.05);
}

footer p {
  color: var(--footer-text);
  opacity: 0.7;
  font-size: 0.9rem;
}

footer a {
  color: var(--accent-primary);
}

/* --- Scroll Reveal Animation --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* --- Skills / Tech Stack --- */
.skill-bar {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
  margin-top: var(--spacing-sm);
}

.skill-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

/* --- Stats Counter --- */
.stat-card {
  text-align: center;
  padding: var(--spacing-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .carousel-item {
    height: 60vh;
  }
  
  .carousel-caption {
    padding: 1rem;
    max-width: 90%;
  }
  
  .carousel-caption h4 {
    font-size: 1.5rem;
  }
  
  .profile-img {
    width: 150px;
    height: 150px;
  }
  
  .stat-card {
    margin-bottom: var(--spacing-md);
  }
}

/* --- Page-specific: About Hero --- */
.about-hero {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4rem;
}

/* --- Page-specific: Subpage Hero (About, Projects, Open-source, Publications, Contact) --- */
.subpage-hero {
  padding-top: var(--hero-top-spacing);
  padding-bottom: var(--hero-bottom-spacing);
}

@media (min-width: 992px) {
  .subpage-hero {
    padding-top: 8rem;
  }
}

/* --- Page-specific: Home Hero --- */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--spacing-3xl) var(--spacing-md);
  position: relative;
  overflow: hidden;
}

@media (min-width: 992px) {
  .hero-section {
    padding-top: 80rem;
  }
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: var(--spacing-md);
  position: relative;
  z-index: 1;
}

.hero-title .gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto var(--spacing-xl);
  position: relative;
  z-index: 1;
}

.hero-cta {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

/* --- Divider --- */
.divider {
  border: none;
  height: 2px;
  background: var(--divider);
  margin: var(--spacing-xl) 0;
}

/* --- Nav link active indicator --- */
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
}

/* --- Image styling --- */
.img-fluid {
  border-radius: var(--radius-md);
  transition: transform var(--transition-base);
}

.img-fluid:hover {
  transform: scale(1.02);
}

/* --- List styling --- */
.list-modern {
  list-style: none;
  padding: 0;
}

.list-modern li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--text-secondary);
}

.list-modern li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-weight: 700;
}

/* --- Loading animation for images --- */
.img-loading {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

