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

:root {
  /* INAOE Blue Inspired Light Theme */
  --bg-main: #f9f9fb;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-hover: rgba(0, 0, 0, 0.03);
  --text-main: #1e293b;
  --text-secondary: #64748b;
  --accent-color: #1b5bbb;      /* INAOE Blue */
  --accent-color-hover: #13428a; /* Deep INAOE Blue */
  --border-color: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  --nav-backdrop: blur(12px);
  --gradient-text: linear-gradient(135deg, #1b5bbb, #3b82f6);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: #0b1120;
    --bg-secondary: #162032;
    --bg-glass: rgba(11, 17, 32, 0.85);
    --bg-hover: rgba(255, 255, 255, 0.05);
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6; 
    --accent-color-hover: #60a5fa;
    --border-color: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    --gradient-text: linear-gradient(135deg, #60a5fa, #93c5fd);
  }
}

/* Explicit Overrides for theme toggle via JS */
[data-theme='light'] {
  --bg-main: #f9f9fb;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-hover: rgba(0, 0, 0, 0.03);
  --text-main: #1e293b;
  --text-secondary: #64748b;
  --accent-color: #1b5bbb;
  --accent-color-hover: #13428a;
  --border-color: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  --gradient-text: linear-gradient(135deg, #1b5bbb, #3b82f6);
}

[data-theme='dark'] {
  --bg-main: #0b1120;
  --bg-secondary: #162032;
  --bg-glass: rgba(11, 17, 32, 0.85);
  --bg-hover: rgba(255, 255, 255, 0.05);
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-color-hover: #60a5fa;
  --border-color: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --gradient-text: linear-gradient(135deg, #60a5fa, #93c5fd);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  margin-bottom: 1rem;
}

a { color: var(--accent-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-color-hover); text-decoration: underline; }

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.text-secondary { color: var(--text-secondary); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }

/* Navigation */
nav {
  position: fixed; top: 0; width: 100%; z-index: 100;
  background-color: var(--bg-glass);
  backdrop-filter: var(--nav-backdrop);
  -webkit-backdrop-filter: var(--nav-backdrop);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-content { display: flex; justify-content: space-between; align-items: center; height: 80px; }

.nav-logo-img { height: 45px; width: auto; display: block; object-fit: contain; }

.nav-links { display: flex; gap: 1.5rem; align-items: center; }

.nav-item {
  color: var(--text-secondary); font-weight: 500; padding: 0.5rem 0; cursor: pointer;
  position: relative; transition: color 0.2s; background: none; border: none;
  font-size: 1rem; font-family: 'Inter', sans-serif;
}

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

.nav-item.active { color: var(--text-main); }
.nav-item.active::after, .nav-item:hover::after { width: 100%; }
.nav-item:hover { color: var(--text-main); text-decoration: none; }

.theme-toggle-btn {
  background: transparent; border: 1px solid var(--border-color); color: var(--text-main);
  padding: 0.5rem; border-radius: 8px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: background 0.2s, transform 0.2s;
}
.theme-toggle-btn:hover { background: var(--bg-hover); transform: scale(1.05); }

/* Layouts & Utilities */
.page-section {
  display: none; opacity: 0; padding-top: 120px; padding-bottom: 60px; min-height: calc(100vh - 80px);
  animation: fadeIn 0.4s forwards;
}

.page-section.active { display: block; }
@keyframes fadeIn { to { opacity: 1; } }

.section-header { margin-bottom: 3rem; text-align: center; }
.section-header h2 { font-size: 2.5rem; display: inline-block; }
.section-header p { color: var(--text-secondary); max-width: 600px; margin: 0 auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 3rem; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2rem; margin-top: 2rem; }

/* Hero Section with Picture */
.hero {
  display: flex; flex-direction: row; align-items: center; gap: 4rem;
  min-height: 60vh; padding: 4rem 0;
}

.hero-content { flex: 1; }
.hero h1 { font-size: 3.5rem; line-height: 1.1; margin-bottom: 1rem; letter-spacing: -1px; }
.hero .subtitle { font-size: 1.5rem; font-weight: 300; color: var(--text-secondary); margin-bottom: 2rem; }

.hero-image {
  flex-shrink: 0;
  width: 300px; height: 300px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--bg-secondary);
  box-shadow: var(--card-shadow);
}
.hero-image img {
  width: 100%; height: 100%; object-fit: cover;
}

.btn {
  display: inline-flex; align-items: center; padding: 0.75rem 1.5rem; border-radius: 9999px;
  font-weight: 600; font-size: 1rem; cursor: pointer; transition: all 0.2s ease; text-decoration: none; gap: 0.5rem;
}
.btn-primary { background-color: var(--accent-color); color: #fff; border: none; }
.btn-primary:hover { background-color: var(--accent-color-hover); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(27, 91, 187, 0.3); text-decoration: none; }
.btn-cv { background-color: var(--text-main); color: var(--bg-secondary); border: none; }
.btn-cv:hover { background-color: var(--text-secondary); color: var(--bg-secondary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); text-decoration: none; }
.btn-outline { background-color: transparent; color: var(--text-main); border: 1px solid var(--border-color); }
.btn-outline:hover { background-color: var(--bg-hover); border-color: var(--text-secondary); text-decoration: none; }
.social-links { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }

.info-list { list-style: none; margin-bottom: 2rem; }
.info-list li { margin-bottom: 0.5rem; position: relative; padding-left: 1.5rem; color: var(--text-secondary); }
.info-list li::before { content: '→'; position: absolute; left: 0; color: var(--accent-color); }

/* Cards */
.card, .info-card {
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 16px;
  padding: 2rem; transition: transform 0.3s ease, box-shadow 0.3s ease; position: relative;
  box-shadow: var(--card-shadow); display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1); border-color: var(--accent-color); }
.card h3 { font-size: 1.25rem; margin-bottom: 0.5rem; line-height: 1.3; }
.card .card-subtitle { font-size: 0.875rem; color: var(--accent-color); font-weight: 600; margin-bottom: 1rem; display: block; }
.card p { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 1.5rem; flex-grow: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.tag { background: var(--bg-hover); color: var(--text-secondary); font-size: 0.75rem; padding: 0.25rem 0.75rem; border-radius: 9999px; font-weight: 500; border: 1px solid var(--border-color); }
.contact-prompt { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: 0.9rem; font-weight: 500; display: flex; align-items: center; gap: 0.5rem; }

.team-credit {
  font-size: 0.8rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}
.btn-accent:hover {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.4);
  text-decoration: none;
}

/* Student Lists (Home) */
.opportunities-banner {
  margin: 2rem auto 0;
  max-width: 800px;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  text-align: left;
}
.opportunities-banner i { font-size: 1.75rem; color: var(--accent-color); flex-shrink: 0; }
.opportunities-banner span { font-size: 0.95rem; color: var(--text-main); line-height: 1.5; }
.opportunities-banner a { font-weight: 600; text-decoration: underline; color: var(--accent-color); }
.opportunities-banner a:hover { color: var(--accent-color-hover); }

/* Student Projects & Outreach (Home) */
.student-projects-outreach { margin-top: 3rem; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.video-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
  color: var(--text-main);
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-color);
  text-decoration: none;
}

.video-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  overflow: hidden;
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 40px;
  background-color: rgba(255, 0, 0, 0.9);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  opacity: 0.8;
  transition: all 0.3s ease;
}

.video-card:hover .play-overlay {
  opacity: 1;
  background-color: #ff0000;
  transform: translate(-50%, -50%) scale(1.1);
}

.video-card:hover .video-thumbnail img {
  transform: scale(1.05);
  opacity: 0.9;
}

.video-info {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.video-info h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  flex-grow: 1;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.video-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Outreach Articles */
.outreach-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.outreach-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  gap: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.outreach-list li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.outreach-content {
  display: flex;
  flex-direction: column;
}

.outreach-content .pub-authors {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.outreach-content .pub-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.outreach-content .pub-venue {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-secondary);
}

.outreach-btn {
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
}

@media (max-width: 768px) {
  .outreach-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .outreach-btn {
    align-self: flex-start;
  }
}

/* People / Collaborator Lists */
.people-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.people-list li { padding: 1rem 1.25rem; border-left: 3px solid var(--accent-color); background: var(--bg-secondary); border-radius: 0 8px 8px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.02); display: flex; flex-direction: column; justify-content: center; }
.people-list li strong { display: block; color: var(--text-main); font-size: 1.05rem; margin-bottom: 0.25rem; }
.people-list li strong a { color: inherit; text-decoration: none; transition: color 0.2s; }
.people-list li strong a:hover { color: var(--accent-color); text-decoration: underline; }
.people-list li .affiliation { font-family: 'Outfit', sans-serif; font-weight: 500; color: var(--text-secondary); font-size: 0.85rem; }
.people-list li .supervisor-note { font-size: 0.8rem; color: var(--accent-color); margin-top: 0.35rem; display: flex; align-items: center; gap: 0.35rem; font-weight: 500; }

.student-section { margin-top: 5rem; padding-top: 3rem; border-top: 1px solid var(--border-color); }
.student-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.student-list li { padding: 1rem; border-left: 3px solid var(--accent-color); background: var(--bg-secondary); border-radius: 0 8px 8px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.student-list li strong { display: block; color: var(--text-main); font-size: 1.05rem; }
.student-list li span { color: var(--text-secondary); font-size: 0.9rem; }

/* Publications Styling */
.publication-group { margin-bottom: 4rem; }
.publication-group h3 { font-size: 1.75rem; border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; margin-bottom: 1.5rem; }
.pub-list { list-style-position: outside; padding-left: 2rem; color: var(--text-main); }
.pub-list li { margin-bottom: 1.25rem; line-height: 1.6; padding-left: 0.5rem; }
.pub-list li::marker { color: var(--accent-color); font-weight: bold; }
.pub-list li a { font-size: 0.85rem; padding: 0.2rem 0.6rem; border-radius: 4px; background: var(--bg-hover); border: 1px solid var(--border-color); margin-left: 0.5rem; text-decoration: none; }
.pub-list li a:hover { background: var(--accent-color); color: white; border-color: var(--accent-color); }
.pub-title { font-weight: 600; color: var(--text-main); }
.pub-authors { color: var(--text-secondary); }
.pub-venue { font-style: italic; color: var(--text-main); }

/* Teaching Section Redesign */
.teaching-history { counter-reset: course-counter; }

.teaching-current-card {
  background: linear-gradient(145deg, var(--bg-secondary), var(--bg-main));
  border: 2px solid var(--accent-color); border-radius: 16px; padding: 2.5rem;
  box-shadow: 0 10px 30px rgba(27, 91, 187, 0.15); margin-bottom: 3rem;
  position: relative; overflow: hidden;
}
.teaching-current-card::before {
  content: 'Current'; position: absolute; top: 1rem; right: -2.5rem;
  background: var(--accent-color); color: #fff; padding: 0.25rem 3rem;
  font-weight: 600; font-size: 0.85rem; transform: rotate(45deg);
  text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.teaching-current-card h3 { font-size: 1.5rem; color: var(--accent-color); margin-bottom: 0.5rem; }
.teaching-current-card .course-detail { font-size: 1.05rem; color: var(--text-secondary); margin-bottom: 1.5rem; font-weight: 500; }

.btn-dropbox { background-color: #0061FF; color: #fff; border: none; }
.btn-dropbox:hover { background-color: #004ecc; color: #fff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 97, 255, 0.3); text-decoration: none; }

.teaching-special-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; margin-bottom: 4rem; }
.teaching-special-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.5rem; transition: transform 0.3s ease, box-shadow 0.3s ease; display: flex; flex-direction: column; }
.teaching-special-card:hover { transform: translateY(-5px); box-shadow: var(--card-shadow); border-color: var(--accent-color); }
.teaching-special-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; flex-grow: 1; }
.teaching-special-card .course-version { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1.5rem; font-weight: 500; }

.teaching-section-title { margin-bottom: 1.5rem; font-size: 1.75rem; color: var(--text-main); border-bottom: 2px solid var(--border-color); padding-bottom: 0.5rem; }

.teaching-year-group { margin-bottom: 2rem; }
.teaching-year-group h4 { font-size: 1.35rem; color: var(--accent-color); margin-bottom: 1rem; }
.teaching-course-list { list-style: none; }
.teaching-course-list li {
  counter-increment: course-counter; margin-bottom: 0.75rem; padding: 1rem 1.25rem;
  background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 8px; font-weight: 500; transition: background 0.2s;
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
}
.teaching-course-list li:hover { background: var(--bg-hover); border-color: var(--accent-color); }
.teaching-course-list li::before {
  content: counter(course-counter) "."; font-weight: 700; color: var(--accent-color); margin-right: 0.25rem; min-width: 1.5rem;
}
.teaching-course-list li span.course-name { flex-grow: 1; }
.teaching-course-list li span.course-info { color: var(--text-secondary); font-size: 0.9rem; font-weight: 400; margin-left: auto; }

/* Resources */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.resource-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.resource-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-color);
}

.resource-card-header {
  background: var(--bg-hover);
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.resource-card-header i {
  font-size: 1.75rem;
  color: var(--accent-color);
}

.resource-card-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.resource-card-content {
  padding: 1.5rem;
  flex-grow: 1;
}

.resource-sub-category {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--border-color);
  display: inline-block;
}

.resource-card-content .resource-sub-category:not(:first-child) {
  margin-top: 1.5rem;
}

.resource-link-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.resource-link-list li a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: transparent;
  transition: all 0.2s ease;
  font-weight: 500;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
}

.resource-link-list li a:hover {
  background: var(--bg-hover);
  color: var(--accent-color);
  border-left-color: var(--accent-color);
  text-decoration: none;
  transform: translateX(4px);
}

/* Footer */
footer { border-top: 1px solid var(--border-color); padding: 3rem 0; margin-top: 4rem; text-align: center; color: var(--text-secondary); font-size: 0.875rem; }

/* Multi-device responsiveness */
@media (max-width: 900px) {
  .hero { flex-direction: column-reverse; text-align: center; align-items: center; gap: 2rem;}
  .hero-content { display: flex; flex-direction: column; align-items: center; }
  .social-links { justify-content: center; }
  .grid-2 { grid-template-columns: 1fr; }
  
  /* removed timeline override */
}

@media (max-width: 768px) {
  .hero h1 { font-size: 2.5rem; }
  .nav-content { flex-wrap: wrap; height: auto; padding: 1rem 0; justify-content: center; gap: 1rem;}
  .nav-links { width: 100%; overflow-x: auto; padding-top: 0.5rem; gap: 1rem; border-top: 1px solid var(--border-color); justify-content: flex-start;}
}
