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

/* ============================================
   Leonardo Stari - Academic Portfolio Styles
   Modern, Clean, Professional Design
   ============================================ */

:root {
  /* Color Palette */
  --primary: #1a365d;
  --primary-light: #2b4c7e;
  --accent: #3182ce;
  --accent-hover: #2b6cb0;
  --success: #38a169;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f7fafc;
  --bg-tertiary: #edf2f7;
  --bg-card: #ffffff;
  
  /* Text Colors */
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-inverse: #ffffff;
  
  /* Borders & Shadows */
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
  
  /* Typography */
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-xxl: 4rem;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 50%;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --primary: #90cdf4;
  --primary-light: #bee3f8;
  --accent: #63b3ed;
  --accent-hover: #4299e1;
  
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --bg-tertiary: #4a5568;
  --bg-card: #2d3748;
  
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #a0aec0;
  
  --border-color: #4a5568;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
}

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

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: var(--space-sm);
}

h1 { font-size: 2.5rem; font-weight: 700; }
h2 { 
  font-size: 1.875rem; 
  font-weight: 600; 
  padding-bottom: var(--space-xs);
  border-bottom: 3px solid var(--accent);
  display: inline-block;
  margin-bottom: var(--space-lg);
}

h3 { font-size: 1.25rem; font-weight: 600; color: var(--primary); }

p { margin-bottom: var(--space-sm); color: var(--text-secondary); }
a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

strong { font-weight: 600; color: var(--text-primary); }
em { font-style: italic; color: var(--text-secondary); }

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

/* ============================================
   Navigation Bar
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: all 0.3s ease;
}

[data-theme="dark"] .navbar {
  background: rgba(26, 32, 44, 0.95);
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-xs) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  transition: color 0.2s ease;
}

.nav-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-md);
  align-items: center;
}

.nav-link {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: var(--space-xs) 0;
  position: relative;
  transition: color 0.2s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-link:hover {
  color: var(--accent);
  text-decoration: none;
}

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

/* Dark Mode Toggle */
.dark-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  color: var(--text-secondary);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.dark-toggle:hover {
  color: var(--accent);
}

/* Mobile Navigation Toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all 0.3s ease;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  margin-top: 60px;
  padding: var(--space-xxl) var(--space-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: var(--text-inverse);
  text-align: center;
}

.hero-content {
  max-width: 700px;
  margin: 0 auto;
}

.hero-image-container {
  margin-bottom: var(--space-lg);
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-image {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-full);
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.hero-image-container.no-image::after {
  content: '';
  display: block;
  width: 160px;
  height: 160px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

.hero-title {
  font-size: 2.75rem;
  color: var(--text-inverse);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-xs);
}

.hero-description {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: var(--space-lg);
}

/* Social Icons - Updated with Font Awesome */
.hero-social {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: var(--text-inverse);
  font-size: 1.25rem;
  transition: all 0.3s ease;
}

.social-icon:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Section Styling
   ============================================ */
section {
  margin-bottom: var(--space-xxl);
}

/* ============================================
   About Section
   ============================================ */
.about-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: var(--space-xl);
  align-items: flex-start;
}

.about-image {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.about-text h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
  color: var(--primary);
}

.timeline {
  margin-top: var(--space-lg);
  padding-left: var(--space-md);
  border-left: 3px solid var(--border-color);
}

.timeline-item {
  position: relative;
  padding-left: var(--space-md);
  margin-bottom: var(--space-md);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 6px;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: var(--radius-full);
  border: 3px solid var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.timeline-date {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-title {
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ============================================
   Skills Section
   ============================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.skill-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.skill-card h3 {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--border-color);
}

.skill-list {
  list-style: none;
}

.skill-list li {
  padding: var(--space-xs) 0;
  border-bottom: 1px dashed var(--border-color);
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.skill-list li:last-child {
  border-bottom: none;
}

/* ============================================
   Research Section
   ============================================ */
.research-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-lg);
}

.research-section:last-child {
  margin-bottom: 0;
}

.research-section h3 {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.research-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.highlight-text {
  background: linear-gradient(135deg, rgba(49, 130, 206, 0.1) 0%, rgba(49, 130, 206, 0.05) 100%);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent);
  margin: var(--space-sm) 0;
}

.stat-highlight {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9em;
}

/* ============================================
   Metrics Section
   ============================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.metric-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.metric-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.metrics-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-md);
}

/* ============================================
   Publications Section
   ============================================ */
.publications-list {
  list-style: none;
  counter-reset: pub-counter;
}

.publications-list li {
  position: relative;
  padding: var(--space-md) var(--space-lg) var(--space-md) calc(var(--space-lg) + 2rem);
  margin-bottom: var(--space-sm);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.publications-list li:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.pub-number {
  position: absolute;
  left: 0;
  top: var(--space-md);
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
}

.pub-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.pub-year {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pub-doi a {
  font-size: 0.8rem;
  color: var(--accent);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-left: var(--space-xs);
}

.pub-doi a:hover {
  background: var(--accent);
  color: white;
  text-decoration: none;
}

/* ============================================
   Contact Section
   ============================================ */
.contact-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-inverse);
}

.contact-card h2 {
  color: var(--text-inverse);
  border-bottom-color: rgba(255, 255, 255, 0.3);
}

.contact-email {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-inverse);
  margin-top: var(--space-md);
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.contact-email:hover {
  background: rgba(255, 255, 255, 0.25);
  color: var(--text-inverse);
  transform: translateY(-2px);
  text-decoration: none;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: var(--bg-tertiary);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  margin-top: var(--space-xxl);
}

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

.footer-subtitle {
  font-size: 0.8rem !important;
  margin-top: var(--space-xs) !important;
}

/* ============================================
   Loading Animation
   ============================================ */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   Fade-in Animation
   ============================================ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 968px) {
  h1 { font-size: 2rem; }
  .hero-title { font-size: 2.25rem; }
  
  .about-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .skills-grid {
    grid-template-columns: 1fr;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-xs);
    box-shadow: var(--shadow-lg);
    transform: translateY(-150%);
    transition: transform 0.3s ease;
    z-index: 999;
  }
  
  .nav-links.active {
    transform: translateY(0);
  }
  
  .nav-toggle {
    display: flex;
  }
  
  .hero {
    padding: var(--space-xl) var(--space-md);
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .contact-email {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  :root {
    --space-xl: 2rem;
    --space-xxl: 3rem;
  }
  
  .hero-image {
    width: 120px;
    height: 120px;
  }
  
  .about-image {
    width: 140px;
    height: 140px;
  }
}

/* Print Styles */
@media print {
  .navbar, .hero-social, .dark-toggle { display: none; }
  body { background: white; color: black; }
  section { margin-bottom: 2rem; page-break-inside: avoid; }
}
