/* ==========================================================================
   Martin Lopez-Daneri - Academic Website Styles
   Modern Minimalist Academic Design
   ========================================================================== */

/* CSS Variables for consistent theming */
:root {
  --bg-header: #F2F4F7;     /* Light gray header background */
  --text-strong: #111111;   /* Near-black text */
  --accent: #0052CC;        /* Corporate blue - professional and modern */
  --accent-alt: #6366F1;    /* Indigo purple accent - sophisticated and distinctive */
  --border-subtle: #E6E6E6; /* Thin separator */
  --primary-color: #111111;
  --secondary-color: #0052CC;
  --background-color: #FAFAFB; /* Subtle tone for body */
  --text-color: #111111;
  --text-light: #6B7280;    /* Updated to match requirements */
  --white: #ffffff;
  --border-color: #E5E7EB;  /* Updated to match requirements */
  --shadow: none;            /* Remove heavy shadows */
  --border-radius: 8px;      /* Updated to match requirements */
  --transition: all 0.2s ease;
  --accent-color: #f8f9fa;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  font-family: inherit;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--background-color);
  font-family: 'Montserrat', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-color);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
  overflow-x: hidden; /* Prevent horizontal scrolling on mobile */
  width: 100%;
}



/* Container Layout */
.container {
  max-width: 1000px; /* Desktop: centered max-width container */
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box; /* Include padding in width calculation */
  overflow-x: hidden; /* Prevent horizontal overflow */
}

/* Mobile: Ensure container doesn't exceed viewport */
@media (max-width: 768px) {
  .container {
    max-width: 100%;
    padding: 0 16px;
  }
}

/* Header Styles */
.header {
  background: var(--bg-header);
  color: var(--text-strong);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px;
  z-index: 30;
}

.header h1 {
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0;
  font-size: clamp(24px, 3.5vw, 36px);
  color: var(--accent);
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 32px 0;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 16px;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  justify-content: center;
}

.nav a {
  color: var(--text-strong);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: var(--transition);
  padding: 8px 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a:focus {
  color: var(--accent);
  border-bottom-color: var(--accent-alt);
  border-bottom-width: 2px;
}

.nav a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent-alt);
  border-bottom-width: 2px;
}

/* Main Content */
.main-content {
  flex: 1;
  margin: 32px 0;
  overflow-x: hidden; /* Prevent horizontal overflow */
  width: 100%;
  box-sizing: border-box;
}

.main-content a:hover,
.main-content a:focus {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Hero layout */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
}
.hero-text { flex: 1 1 320px; }
.hero-text h1,
.hero-text h2 { font-size: 2rem; margin-bottom: 0.5rem; }
.tagline { font-weight: 500; margin-bottom: 0.5rem; }
.fields { font-size: 0.95rem; color: #555; margin-bottom: 1rem; }

/* CTAs */
.hero-cta .btn {
  display: inline-block;
  padding: 8px 16px;
  margin-right: 10px;
  border-radius: 6px;
  text-decoration: none;
}
.btn.primary { background-color: #0052CC; color: #fff; }
.btn.secondary { background-color: #E5E7EB; color: #111; }

/* Photo */
.hero-photo img {
  border-radius: 50%; /* keep circular shape */
  object-fit: cover; /* fill frame */
  object-position: center top; /* focus on upper part of image */
  transform: scale(1.02); /* slight zoom to remove extra space above head */
  border: 1px solid #E5E7EB; /* subtle light border */
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08); /* soft shadow for presence */
  width: 100%;
  height: auto;
  display: block;
}

/* Dark mode adjustments for hero photo */
@media (prefers-color-scheme: dark) {
  .hero-photo img {
    border-color: #374151; /* slightly darker neutral in dark mode */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30); /* stronger shadow for dark mode */
  }
}

/* Subtle hover effect on desktop */
@media (hover: hover) and (pointer: fine) {
  .hero-photo img {
    transition: box-shadow .2s ease, transform .2s ease;
  }
  .hero:hover .hero-photo img {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.10);
  }
  
  /* Dark mode hover effect */
  @media (prefers-color-scheme: dark) {
    .hero:hover .hero-photo img {
      box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
    }
  }
}

/* Summary card */
.summary {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 40px;
}

.intro-paragraph {
  margin: 0 0 16px 0;
  line-height: 1.7;
  font-size: 1rem;
  color: var(--text-color);
  padding: 0;
}
.summary h2 { 
  margin-top: 18px; 
  font-size: 1.15rem; 
  color: var(--accent);
  border-bottom: 1px solid var(--accent-alt);
  padding-bottom: 8px;
}
.summary h2:first-child { margin-top: 0; }
.summary ul { margin: 8px 0 16px 20px; padding: 0; }
.summary li { margin-bottom: 6px; }
.summary a:hover,
.summary a:focus {
    text-decoration: underline;
    text-underline-offset: 3px;
}
/* Summary CTA layout */
.summary-cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* Small button modifier */
.btn.sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.95rem;
  line-height: 1.2;
  border-radius: 0.5rem;
}

/* Contact block consistent with minimal style */
.contact-info {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 40px;
}

/* Responsive sizes */
@media (min-width: 769px) {
  .hero-photo img {
    max-width: 360px; /* desktop size */
  }
}

/* Mobile: Center hero photo when stacked below text */
@media (max-width: 768px) {
  .hero { gap: 16px; }
  .hero-photo {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .hero-photo img { 
    max-width: 240px; /* mobile size */
    margin: 0 auto; /* center on small screens */
  }
}

.section-heading {
  font-size: 2.5em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 24px;
  text-align: center;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--accent-alt);
  padding-bottom: 16px;
  display: inline-block;
  width: 100%;
}

/* CV Page Specific Styles */
.cv-intro-section {
  text-align: center;
  margin-bottom: 48px;
  padding: 32px 0;
}

.cv-subheading {
  font-size: 1.2em;
  color: var(--text-light);
  margin-top: 8px;
  font-weight: 500;
}

.cv-download-section {
  margin-bottom: 48px;
}

.subsection-heading {
  font-size: 1.8em;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 24px;
  border-bottom: 2px solid var(--accent-alt);
  padding-bottom: 12px;
}

.cv-download-container {
  text-align: center;
}

.cv-download-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 2px solid var(--accent);
  border-radius: var(--border-radius);
  padding: 24px 32px;
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cv-download-btn:hover,
.cv-download-btn:focus {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent-alt);
  box-shadow: 0 0 0 2px var(--accent-alt);
  transform: translateY(-2px);
}

.cv-download-btn i {
  font-size: 2em;
  margin-bottom: 8px;
}

.btn-text {
  font-size: 1.2em;
  font-weight: 700;
}

.last-updated {
  font-size: 0.9em;
  opacity: 0.8;
  font-weight: 400;
}

/* CV Summary Section */
.cv-summary {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 16px 20px;
  margin-block: 20px;
}

.cv-summary h3 {
  margin-top: 16px;
  font-weight: 700;
  color: var(--accent);
}

.cv-summary ul {
  margin: 8px 0 16px 20px;
  padding: 0;
}

.cv-summary li {
  margin-bottom: 4px;
}

.cv-preview-section {
  margin-bottom: 48px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: clip; /* Prevent horizontal overflow - clip is more strict than hidden */
}

.iframe-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden; /* Prevent content overflow */
  background: var(--white);
  box-sizing: border-box; /* Include border in width calculation */
}

/* Preview iframe */
.iframe-container iframe {
  display: block; /* Remove inline spacing */
  width: 100%;
  max-width: 100%; /* Never exceed container width */
  height: 80vh;
  border: 1px solid #E5E7EB;
  box-sizing: border-box; /* Include border in width calculation */
  margin: 0; /* Remove any default margins */
  padding: 0; /* Remove any default padding */
}

/* Mobile: Enforce strict constraints to prevent overflow */
@media (max-width: 768px) {
  .cv-preview-section {
    overflow-x: clip; /* Strict overflow control on mobile */
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
  
  .iframe-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  
  .iframe-container iframe {
    width: 100%;
    max-width: 100%;
    height: 70vh; /* Slightly smaller on tablets */
    margin: 0;
    padding: 0;
    border-left: 0;
    border-right: 0;
  }
}

@media (max-width: 480px) {
  .iframe-container iframe {
    height: 60vh; /* More compact on small phones for better UX */
  }
}

/* Overlay: bottom aligned, hover-only on desktop */
.iframe-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; align-items: center;
  background: rgba(255,255,255,0.85);
  padding: 8px 0;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}

.overlay-buttons {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: wrap;
  justify-content: center;
}

/* Mobile: Reduce button gap on small screens */
@media (max-width: 480px) {
  .overlay-buttons {
    gap: 8px;
    padding: 8px;
  }
}

.iframe-container:hover .iframe-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile: overlay always available (no hover) */
@media (hover: none) {
  .iframe-overlay { opacity: 1; pointer-events: auto; }
}

.open-modal-btn {
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  padding: 16px 24px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  box-sizing: border-box;
  min-height: 56px;
  pointer-events: auto;
}

/* Mobile: Responsive button padding */
@media (max-width: 480px) {
  .open-modal-btn {
    padding: 12px 16px;
    font-size: 1em;
    min-height: 48px;
    gap: 8px;
  }
}

.open-modal-btn:hover,
.open-modal-btn:focus {
  background: var(--accent-alt);
  box-shadow: 0 0 0 3px var(--accent-alt);
  transform: scale(1.05);
  color: var(--white);
  text-decoration: none;
}

.download-pdf-btn {
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  padding: 16px 24px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  box-sizing: border-box;
  min-height: 56px;
}

/* Mobile: Responsive button padding */
@media (max-width: 480px) {
  .download-pdf-btn {
    padding: 12px 16px;
    font-size: 1em;
    min-height: 48px;
    gap: 8px;
  }
}

.download-pdf-btn:hover,
.download-pdf-btn:focus {
  background: var(--accent-alt);
  box-shadow: 0 0 0 3px var(--accent-alt);
  transform: scale(1.05);
  color: var(--white);
  text-decoration: none;
}


/* Contact Introduction Styles */
.contact-intro {
  margin-bottom: 24px;
  line-height: 1.7;
  color: var(--text-color);
}

.contact-intro p {
  margin-bottom: 16px;
}

/* Increased spacing before "Current affiliation" section for clear visual separation */
.contact-intro p.contact-section-start {
  margin-top: 56px; /* ~3.5× normal paragraph spacing for clear visual section break */
}

.contact-intro p:last-child {
  margin-bottom: 0;
}

.contact-intro strong {
  font-weight: 600;
  color: var(--text-strong);
}

.contact-intro a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.contact-intro a:hover,
.contact-intro a:focus {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Contact Section Styles - Box styling removed, kept for semantic structure only */
.contact-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
}

/* Research Filters */
.research-filters {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 12px 20px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  color: var(--text-color);
}

.filter-btn:hover,
.filter-btn:focus {
  background: var(--accent-color);
  border-color: var(--accent-alt);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-alt);
}

.filter-btn i {
  margin-right: 8px;
}

/* Sort Section */
.sort-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  justify-content: center;
}

.sort-label {
  font-weight: 600;
  color: var(--text-strong);
}

.sort-btn {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 8px 16px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9em;
  color: var(--text-color);
}

.sort-btn:hover,
.sort-btn:focus {
  background: var(--accent-color);
  border-color: var(--accent);
}

.sort-btn.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-alt);
}

/* Research Sections */
.research-section {
  margin-bottom: 32px;
}

.research-section[data-category] {
  transition: var(--transition);
}

.research-section.hidden {
  display: none;
}

.research-card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.research-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.research-card.featured {
  border-left: 0;
  background: linear-gradient(135deg, var(--white) 0%, var(--accent-color) 100%);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 16px;
}

.publication-type {
  background: var(--accent-color);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.publication-type i {
  margin-right: 6px;
}



.featured-badge {
  background: #E7F1FB;        /* Light editorial blue (celeste) background */
  color: #003366;             /* Navy text */
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 700;           /* Bold weight for distinction */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid #BFD6EE;  /* Light blue border */
}

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: auto;
}

.status-badge.submitted {
  background: #E8EEF6;        /* Subtle blue-gray background */
  color: #003366;             /* Navy text */
  border: 1px solid #C9D6EA;  /* Light navy border */
}

.status-badge.revision {
  background: #E6F7F5;        /* Very light teal tint background */
  color: #0F766E;             /* Deep teal text */
  border: 1px solid #99D5CF;  /* Light teal border */
}

.paper-title {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  line-height: 1.4;
}

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

.paper-title a:hover,
.paper-title a:focus {
  color: var(--accent-alt);
  text-decoration: underline;
  text-decoration-color: var(--accent-alt);
  text-underline-offset: 3px;
}

.authors {
  color: var(--text-light);
  margin-bottom: 16px;
  font-size: 0.95em;
}

/* Remove manually typed commas and control comma+space via CSS */
.authors span {
  margin-right: 0; /* remove any default gaps */
}

.authors span::after {
  content: ", ";
}

.authors span:last-child::after {
  content: "";
}

.author {
  font-weight: 600;
  color: var(--text-strong);
}

.coauthor {
  color: var(--text-light);
}

.journal-info {
  background: var(--accent-color);
  padding: 16px;
  border-radius: var(--border-radius);
  margin-bottom: 16px;
  border-left: 4px solid var(--accent-alt);
}

.journal-info i {
  color: var(--accent);
  margin-right: 8px;
}

.journal-info em {
  font-style: normal;
  font-weight: 600;
  color: var(--text-strong);
}

.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.action-btn {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 8px 16px;
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.9em;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-btn:hover,
.action-btn:focus {
  background: var(--accent-color);
  border-color: var(--accent-alt);
  color: var(--accent);
}

.action-btn.download-btn {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.action-btn.download-btn:hover,
.action-btn.download-btn:focus {
  background: var(--accent-alt);
  border-color: var(--accent-alt);
  box-shadow: 0 0 0 2px var(--accent-alt);
}

.action-btn.external-btn {
  background: var(--success-color);
  color: var(--white);
  border-color: var(--success-color);
}

.action-btn.external-btn:hover,
.action-btn.external-btn:focus {
  background: var(--accent);
  border-color: var(--accent);
}

.abstract-content {
  background: var(--accent-color);
  padding: 16px;
  border-radius: var(--border-radius);
  margin-top: 16px;
  border-left: 4px solid var(--accent-alt);
  border-top: 1px solid var(--accent-alt);
}

.abstract-content p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-color);
}

.citation-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}

.citation-popup:not([hidden]) {
  display: block;
}

.citation-content h5 {
  margin-top: 0;
  color: var(--text-strong);
  font-size: 1.2em;
  margin-bottom: 16px;
}

.citation-format {
  background: var(--accent-color);
  padding: 16px;
  border-radius: var(--border-radius);
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  line-height: 1.5;
  overflow-x: auto;
}

.citation-format strong {
  color: var(--accent);
  font-weight: 600;
}

.citation-format code {
  background: var(--white);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-family: inherit;
}

.close-citation {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5em;
  color: var(--text-light);
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-citation:hover,
.close-citation:focus {
  background: var(--border-color);
  color: var(--text-strong);
}

/* Highlight Box */
.highlight-box {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.research-paper {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 20px;
  transition: var(--transition);
}

.research-paper:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.research-paper a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.research-paper a:hover,
.research-paper a:focus {
  color: var(--accent-alt);
  text-decoration: underline;
  text-decoration-color: var(--accent-alt);
  text-underline-offset: 3px;
}

.research-description {
  color: var(--text-light);
  margin-top: 8px;
  line-height: 1.5;
}

/* Course Section */
.course-section {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.course-section:hover,
.course-section:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  border-color: #D1D5DB;
}

.course-title {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}

.course-description {
  color: var(--text-light);
  line-height: 1.6;
}

/* Teaching List */
.teaching-list {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  line-height: 1.7;
}

.teaching-list li {
  margin-bottom: 20px;
  padding-left: 0;
  color: var(--text-color);
}

.teaching-list li::before {
  content: "•";
  color: var(--accent);
  font-weight: 700;
  display: inline-block;
  width: 1em;
  margin-left: 0;
  margin-right: 0.5em;
}

.teaching-list strong {
  font-weight: 700;
  color: var(--text-color);
}

.teaching-list em {
  font-style: italic;
  color: var(--text-light);
  font-weight: 400;
}

/* Figure */
.figure {
  text-align: center;
  margin: 24px 0;
}

.figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

/* Contact Information - General */
.contact-info {
  margin-top: 40px;
}

.contact-info h3 {
  font-size: 1.6em;
  color: var(--accent);
  margin-bottom: 16px;
}

.contact-info p {
  font-size: 1.1em;
  line-height: 1.6;
  margin-bottom: 16px;
}

.contact-info a {
  color: var(--secondary-color);
  text-decoration: none;
}

.contact-info a:hover,
.contact-info a:focus {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* iFrame Container - Duplicate definition removed, consolidated above */

/* Disclaimer - Editorial footnote style */
.disclaimer {
  margin-top: 64px;
  font-size: 0.85em;
  color: var(--text-light);
  line-height: 1.6;
}

.disclaimer p {
  margin: 0;
}

/* Footer */
.footer {
  background: var(--bg-header);
  color: var(--text-light);
  text-align: center;
  padding: 24px;
  margin-top: 40px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.9em;
}

/* Utility Classes */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus Styles */
*:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .nav,
  .hamburger-menu,
  .mobile-nav-overlay {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .container {
    max-width: none !important;
    padding: 0 !important;
  }
  
  .research-card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  
  .cv-download-btn {
    display: none !important;
  }
  
  .cv-download-btn {
    display: none !important;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .header {
    padding: 16px 20px;
  }
  
  .nav-list {
    gap: 20px;
  }
  
  .nav a {
    font-size: 1.05rem;
  }
  
  .research-filters {
    gap: 12px;
  }
  
  .filter-btn {
    padding: 10px 16px;
    font-size: 0.9em;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .card-actions {
    gap: 8px;
  }
  
  /* iframe-container and iframe styles already defined in base media query above */
  
  .cv-download-btn {
    padding: 16px 20px;
  }
}

@media (max-width: 600px) {
  .header {
    padding: 12px 16px;
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .header h1 {
    font-size: 28px;
  }
  
  .nav-list {
    gap: 16px;
    flex-wrap: wrap;
  }
  
  .nav a {
    font-size: 1rem;
    padding: 6px 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* cv-preview-section styles already defined in 768px media query above */
  
  .header {
    padding: 16px;
  }
  
  .research-card {
    padding: 16px;
  }
  
  .paper-title {
    font-size: 1.1em;
  }
  
  .authors {
    font-size: 0.9em;
  }
  
  /* Mobile responsive author comma handling */
  .authors span::after {
    content: ", ";
  }
  
  .authors span:last-child::after {
    content: "";
  }
  
  /* iframe-container and iframe styles already defined in 768px media query above */
  
  .research-paper a {
    font-size: 0.9em;
  }
  
  .course-title {
    font-size: 1.1em;
  }
  
  .cv-download-btn {
    padding: 14px 18px;
    font-size: 0.95em;
  }
  
  .cv-download-btn i {
    font-size: 1.4em;
  }
  
  .btn-text {
    font-size: 0.95em;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --bg-header: #000000;
    --text-strong: #ffffff;
    --accent: #ffff00;
    --border-subtle: #ffffff;
    --border-color: #ffffff;
    --accent-color: #f0f0f0;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
  
  .research-card:hover {
    transform: none;
  }
  
  .cv-download-btn:hover,
  .action-btn:hover {
    transform: none;
  }
  
  .course-section:hover,
  .course-section:focus-within {
    transform: none;
  }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, 
              background-color var(--transition), border-color var(--transition),
              box-shadow var(--transition);
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent-alt);
  box-shadow: 0 4px 12px rgba(0, 82, 204, 0.25);
  outline: none;
}

.back-to-top:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.back-to-top::before {
  content: '↑';
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  
  .back-to-top::before {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
  
  .back-to-top::before {
    font-size: 18px;
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: opacity 0.01ms, visibility 0.01ms, background-color 0.01ms, 
                border-color 0.01ms, box-shadow 0.01ms;
  }
  
  .back-to-top.visible {
    transform: none;
  }
}

/* Desktop Navigation */
@media (min-width: 769px) {
  .nav-list {
    display: flex !important;
    position: static;
    background: none;
    flex-direction: row;
    gap: 32px;
    padding: 0;
    box-shadow: none;
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  
  .mobile-nav-overlay {
    display: none;
  }
}

/* Mobile Navigation */
.hamburger-menu {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 25px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 40;
}

/* Mobile navigation overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile navigation menu */
.mobile-nav-menu {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  min-width: 200px;
  transform: translateY(-20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 40;
}

.mobile-nav-menu.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.mobile-nav-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-menu li {
  margin: 0;
}

.mobile-nav-menu a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text-color);
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.mobile-nav-menu a:hover {
  background-color: var(--accent-color);
}

.hamburger-menu span {
  width: 100%;
  height: 3px;
  background: var(--text-strong);
  border-radius: 10px;
  transition: all 0.3s linear;
  position: relative;
  transform-origin: 1px;
}

.hamburger-menu.active span:nth-child(1) {
  transform: rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: rotate(-45deg);
}

.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .hamburger-menu {
    display: block;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
  }
  
  .nav-list {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    background: var(--white);
    flex-direction: column;
    gap: 0;
    padding: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 40;
  }
  
  .nav-list.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-list li {
    width: 100%;
  }
  
  .nav-list a {
    display: block;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-size: 1.1em;
  }
  
  .nav-list a:last-child {
    border-bottom: none;
  }
  
  .mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}


/* ===== Sticky Header ===== */
.site-header,
.header {
  position: sticky;          /* Fija el header al hacer scroll */
  top: 0;                    /* Se pega al tope de la ventana */
  z-index: 1000;             /* Por encima del contenido */
  background: var(--white, #fff); /* Fondo sólido para legibilidad */
  /* Opcional, si tenés un diseño glassmorphism:
  backdrop-filter: saturate(180%) blur(10px);
  background: color-mix(in srgb, var(--white, #fff) 85%, transparent);
  */
  /* Soporte iOS notch/safe area */
  padding-top: env(safe-area-inset-top, 0);
  /* Línea sutil para separar del contenido */
  border-bottom: 1px solid var(--border-color, #eee);
}

/* Asegurar que el contenido no quede "tapado" si el header gana altura */
/* main, .page-content, .content {
  scroll-margin-top: 72px;
} */

/* ===== Always show horizontal nav ===== */
.nav-list {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center;
  align-items: center;
  gap: 12px;
  position: static !important;
  background: none !important;
  padding: 0;
  margin: 0;
  box-shadow: none !important;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  list-style: none;
}

/* Enlaces compactos */
.nav-list a {
  display: inline-block;
  padding: 8px 10px;
  font-size: 1.15rem;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}

/* ===== Horizontal scroll en mobile si no entra todo ===== */
@media (max-width: 768px) {
  .nav-list {
    justify-content: flex-start;       /* Alinea al inicio para que el scroll sea natural */
    overflow-x: auto;                  /* Habilita scroll horizontal */
    -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
    padding: 0 8px;                    /* Pequeños márgenes laterales */
    scrollbar-width: none;             /* Oculta scrollbar en Firefox */
  }
  .nav-list::-webkit-scrollbar {
    display: none;                     /* Oculta scrollbar en WebKit */
  }

  /* Compactación extra si hiciera falta */
  .nav-list a {
    padding: 8px 8px;
    font-size: 1.05rem;
  }
}

/* ===== Desactivar restos del menú mobile previo ===== */
.mobile-nav-overlay,
.mobile-nav-menu,
.hamburger-menu {
  display: none !important;
}

/* ===== Cookie Consent Banner ===== */
.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border-color);
  padding: 20px 24px;
  z-index: 10000;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  font-family: inherit;
}

.cookie-consent-banner.visible {
  transform: translateY(0);
}

.cookie-consent-content {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.cookie-consent-text {
  flex: 1;
  min-width: 280px;
  color: var(--text-color);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

.cookie-consent-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.cookie-consent-btn {
  padding: 10px 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  background: var(--white);
  color: var(--text-color);
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  touch-action: manipulation;
  user-select: none;
}

.cookie-consent-btn:hover,
.cookie-consent-btn:focus {
  background: var(--accent-color);
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.cookie-consent-btn.accept {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.cookie-consent-btn.accept:hover,
.cookie-consent-btn.accept:focus {
  background: var(--accent-alt);
  border-color: var(--accent-alt);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.cookie-consent-btn.reject {
  background: var(--white);
  color: var(--text-color);
  border-color: var(--border-color);
}

.cookie-consent-btn.reject:hover,
.cookie-consent-btn.reject:focus {
  background: var(--accent-color);
  border-color: var(--accent);
  color: var(--accent);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .cookie-consent-banner {
    padding: 16px 20px;
  }
  
  .cookie-consent-content {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  
  .cookie-consent-text {
    min-width: auto;
    font-size: 0.9rem;
  }
  
  .cookie-consent-actions {
    width: 100%;
    justify-content: stretch;
  }
  
  .cookie-consent-btn {
    flex: 1;
    padding: 12px 16px;
  }
}

@media (max-width: 480px) {
  .cookie-consent-banner {
    padding: 14px 16px;
  }
  
  .cookie-consent-text {
    font-size: 0.85rem;
  }
  
  .cookie-consent-btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .cookie-consent-banner {
    transition: transform 0.01ms;
  }
}
