/* ============================================================
   SOLARPUNK ACADEMIC — Yalbi I. Balderas-Martínez
   Palette inspired by solarpunk illustration:
   teal, terracotta, warm cream, forest green, sky blue
   ============================================================ */

/* --- CSS Variables / Design Tokens --- */
:root {
  /* Solarpunk palette */
  --teal:          #3B9B8F;
  --teal-dark:     #2D7A70;
  --teal-light:    #5DB8B4;
  --terracotta:    #C17A4A;
  --terracotta-dark: #A0603A;
  --copper:        #8B5E3C;
  --green-forest:  #4A7A52;
  --green-mint:    #B8D4C8;
  --sky-blue:      #4A90B8;
  --cream:         #FAF6F0;
  --cream-dark:    #F0EAE0;
  --warm-white:    #FEFCF8;
  --charcoal:      #2C2C2C;
  --text-primary:  #3A3A3A;
  --text-secondary:#6B6B6B;
  --text-light:    #9A9A9A;
  --screen-glow:   #D4C87A;

  /* Typography */
  --font-heading: 'Space Grotesk', 'Inter', sans-serif;
  --font-body:    'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 5rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
}

/* --- 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);
  color: var(--text-primary);
  background-color: var(--warm-white);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--teal-dark);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--terracotta);
}

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--charcoal);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.3rem; }

.section-title {
  font-size: 1.8rem;
  margin-bottom: var(--space-lg);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--terracotta));
  border-radius: 2px;
}

/* --- Navigation --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.8rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(250, 246, 240, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(59, 155, 143, 0.1);
  transition: all var(--transition-base);
}

.navbar.scrolled {
  padding: 0.5rem 2rem;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.02em;
}

.nav-logo span {
  color: var(--teal);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.8rem;
  align-items: center;
}

.nav-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
  padding-bottom: 2px;
}

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

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

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

/* Language toggle */
.lang-toggle {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--teal-light);
  border-radius: 20px;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.lang-toggle button {
  border: none;
  background: transparent;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.78rem;
  transition: all var(--transition-fast);
}

.lang-toggle button.active {
  background: var(--teal);
  color: white;
}

.lang-toggle button:hover:not(.active) {
  color: var(--teal-dark);
}

/* Mobile menu */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--charcoal);
  margin: 5px 0;
  transition: all var(--transition-fast);
  border-radius: 2px;
}

/* --- Hero Section (Split) --- */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 0;
}

.hero-art {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
}

.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-art::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80px;
  background: linear-gradient(90deg, transparent, var(--warm-white));
  pointer-events: none;
}

.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 4rem 4rem 3rem;
  position: relative;
}

.hero-profile {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: var(--space-lg);
}

.hero-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--teal-light);
  box-shadow: 0 4px 20px rgba(59, 155, 143, 0.2);
}

.hero-name {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--charcoal);
  line-height: 1.2;
}

.hero-title {
  font-size: 1rem;
  color: var(--teal-dark);
  font-weight: 500;
  margin-top: 0.3rem;
}

.hero-affiliation {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.hero-bio {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  max-width: 520px;
}

.hero-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-lg);
}

.keyword {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  background: var(--cream-dark);
  color: var(--teal-dark);
  border: 1px solid rgba(59, 155, 143, 0.15);
}

.hero-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--teal-light);
  color: var(--teal-dark);
  transition: all var(--transition-fast);
}

.hero-links a:hover {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
  transform: translateY(-1px);
}

.hero-links a svg {
  width: 16px;
  height: 16px;
}

/* Decorative elements */
.deco-circuit {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  width: 120px;
  height: 120px;
  opacity: 0.06;
}

/* --- Sections --- */
.section {
  padding: var(--space-2xl) 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section-alt {
  background: var(--cream);
}

.section-alt .section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-2xl) 2rem;
}

/* --- Research Cards --- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.research-card {
  background: white;
  border-radius: 12px;
  padding: 1.8rem;
  border: 1px solid rgba(59, 155, 143, 0.1);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.research-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--terracotta));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.research-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

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

.research-card-icon {
  font-size: 1.8rem;
  margin-bottom: var(--space-md);
}

.research-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--charcoal);
}

.research-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Publication List --- */
.pub-list {
  list-style: none;
}

.pub-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0.6rem;
  align-items: baseline;
}

.pub-item:last-child {
  border-bottom: none;
}

/* Hidden items beyond the initial display count */
.pub-item.pub-hidden {
  display: none !important;
}

.pub-year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--teal);
  font-weight: 600;
}

.pub-title {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--charcoal);
  margin-bottom: 0;
  line-height: 1.35;
  display: inline;
}

.pub-title a {
  color: var(--charcoal);
}

.pub-title a:hover {
  color: var(--teal);
}

.pub-authors {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.pub-authors strong {
  color: var(--terracotta);
  font-weight: 600;
}

.pub-journal {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
  display: inline;
}

.pub-journal::before {
  content: " — ";
  font-style: normal;
  color: var(--text-light);
}

/* Show all / Show less toggle button */
.pub-toggle {
  display: block;
  margin: 1.2rem auto 0;
  padding: 0.5rem 1.5rem;
  background: transparent;
  border: 1.5px solid var(--teal);
  border-radius: 20px;
  color: var(--teal);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pub-toggle:hover {
  background: var(--teal);
  color: white;
}

.pub-links {
  display: none;
}

.pub-links a {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--cream-dark);
  color: var(--teal-dark);
  font-weight: 500;
}

.pub-links a:hover {
  background: var(--teal);
  color: white;
}

/* --- Teaching Timeline --- */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--teal), var(--terracotta), var(--green-forest));
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.35rem;
  top: 0.3rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--warm-white);
}

.timeline-item h3 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--teal);
  margin-bottom: 0.3rem;
}

.timeline-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.timeline-institution {
  font-size: 0.85rem;
  color: var(--terracotta);
  font-weight: 500;
}

/* --- Team Grid --- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.team-card {
  text-align: center;
  padding: 1.5rem;
  border-radius: 12px;
  background: white;
  border: 1px solid rgba(59, 155, 143, 0.1);
  transition: all var(--transition-base);
}

.team-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

.team-card h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.team-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.team-avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-light), var(--green-mint));
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  font-family: var(--font-heading);
  font-weight: 700;
}

/* --- Contact --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.contact-info-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.contact-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--cream-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--teal);
}

.contact-info-item h4 {
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}

.contact-info-item p,
.contact-info-item a {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 2rem;
  background: var(--charcoal);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.82rem;
}

.footer a {
  color: var(--teal-light);
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: var(--space-md);
}

.footer-social a {
  color: rgba(255, 255, 255, 0.4);
  transition: color var(--transition-fast);
}

.footer-social a:hover {
  color: var(--teal-light);
}

/* --- Utility: Language toggle --- */
[data-lang="en"] { display: none; }
body.lang-en [data-lang="en"] { display: revert; }
body.lang-en [data-lang="es"] { display: none; }

/* Keep both language toggle buttons always visible */
.lang-toggle button[data-lang] { display: block !important; }

/* --- Animations (scroll reveal) --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* --- Responsive --- */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-art {
    min-height: 50vh;
    max-height: 50vh;
  }

  .hero-art::after {
    width: 0;
    height: 60px;
    bottom: 0;
    top: auto;
    right: 0;
    left: 0;
    background: linear-gradient(180deg, transparent, var(--warm-white));
  }

  .hero-content {
    padding: 2rem;
  }

  .hero-name {
    font-size: 1.8rem;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(250, 246, 240, 0.98);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 1.5rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid rgba(59, 155, 143, 0.1);
  }

  .nav-links.open {
    display: flex;
  }

  .menu-toggle {
    display: block;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .pub-item {
    grid-template-columns: 38px 1fr;
  }

  .pub-year {
    font-size: 0.72rem;
  }
}

@media (max-width: 600px) {
  .hero-profile {
    flex-direction: column;
    text-align: center;
  }

  .hero-keywords {
    justify-content: center;
  }

  .hero-links {
    justify-content: center;
  }

  .research-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Print --- */
@media print {
  .navbar, .footer, .lang-toggle, .menu-toggle { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-art { display: none; }
  body { font-size: 11pt; }
}
