/* Reset and Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #ffffff;
  --text: #333333;
  --muted: #666666;
  --primary: #0f4c81;
  --card: #ffffff;
  --card-shadow: rgba(0,0,0,.1);
  --pill-bg: #e3f2fd;
  --nav-bg: rgba(255,255,255,0.95);
  --nav-border: #e5e7eb;
  --tile-start: #f8f9ff;
  --tile-end: #eaf3ff;
  --heading: #0f4c81;
  --subheading: #44536a;
}

[data-theme="dark"] {
  --bg: #0b1320;
  --text: #e5e7eb;
  --muted: #cbd5e1;
  --primary: #7cc1ff;
  --card: #111a2b;
  --card-shadow: rgba(0,0,0,.6);
  --pill-bg: #1e293b;
  --nav-bg: rgba(8,13,24,0.9);
  --nav-border: #0f172a;
  --tile-start: #0f1b2e;
  --tile-end: #132236;
  --heading: #bfe3ff;      /* brighter for program titles */
  --subheading: #d2deee;   /* high-contrast university line */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6; color: var(--text); background-color: var(--bg);
}

.container { max-width: 1400px; margin: 0 auto; padding: 0 40px; }

/* Navbar */
.navbar {
  position: fixed; top: 0; width: 100%;
  background: var(--nav-bg); backdrop-filter: blur(10px);
  z-index: 1000; padding: 1rem 0; border-bottom: 1px solid var(--nav-border);
}
.nav-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
.nav-logo a { font-size: 1.5rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.nav-menu { display: flex; list-style: none; gap: 2rem; }
.nav-menu a { text-decoration: none; color: var(--text); font-weight: 500; transition: color .3s; opacity:.95; }
.nav-menu a:hover { color: var(--primary); }

.nav-toggle { display: none; flex-direction: column; cursor: pointer; background: transparent; border: 0; }
.nav-toggle span { width: 25px; height: 3px; background: var(--text); margin: 3px 0; transition: .3s; }

/* Theme toggle */
.theme-toggle { display:flex; align-items:center; gap:8px; margin-right:12px; cursor:pointer; color: var(--text); }
.theme-toggle i { font-size: 1.1rem; opacity:.75; }
.theme-toggle .fa-moon { display:none; }
[data-theme="dark"] .theme-toggle .fa-sun { display:none; }
[data-theme="dark"] .theme-toggle .fa-moon { display:inline-block; }

/* Hero */
.hero { 
  min-height: 100vh; 
  display: flex; 
  align-items: center; 
  background: linear-gradient(135deg,#667eea 0%,#764ba2 100%); 
  color: #fff; 
  padding-top: 80px; 
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
}

.hero-container { 
  max-width: 1400px; 
  margin: 0 auto; 
  padding: 0 40px; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  text-align: center; 
  position: relative;
  z-index: 2;
}

.hero-greeting {
  margin-bottom: 1rem;
}

.greeting-text {
  font-size: 1.5rem;
  font-weight: 400;
  opacity: 0.9;
  display: inline-block;
  animation: fadeInUp 0.8s ease forwards;
}

.hero-name {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  background: linear-gradient(45deg, #fff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease 0.2s forwards;
  opacity: 0;
}

.hero-title {
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease 0.4s forwards;
  opacity: 0;
}

.title-text {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.location-text {
  display: block;
  font-size: 1.1rem;
  opacity: 0.8;
  font-style: italic;
}

.hero-description {
  max-width: 600px;
  margin: 0 auto 3rem;
  animation: fadeInUp 0.8s ease 0.6s forwards;
  opacity: 0;
}

.hero-description p {
  font-size: 1.1rem;
  line-height: 1.7;
  opacity: 0.9;
}

.hero-buttons { 
  display: flex; 
  gap: 1.5rem; 
  flex-wrap: wrap; 
  justify-content: center;
  margin-bottom: 4rem;
  animation: fadeInUp 0.8s ease 0.8s forwards;
  opacity: 0;
}

.btn { 
  padding: 14px 28px; 
  border-radius: 12px; 
  text-decoration: none; 
  font-weight: 600; 
  transition: all .3s ease; 
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-primary { 
  background: #fff; 
  color: #0f4c81; 
}

.btn-primary:hover { 
  background: #f8f9fa; 
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.btn-secondary { 
  background: rgba(255,255,255,0.1); 
  color: #fff; 
  border: 2px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover { 
  background: rgba(255,255,255,0.2); 
  border-color: rgba(255,255,255,0.5);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
  animation: fadeInUp 0.8s ease 1s forwards;
  opacity: 0;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #fff;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
}

.scroll-arrow {
  width: 2px;
  height: 30px;
  background: rgba(255,255,255,0.6);
  position: relative;
}

.scroll-arrow::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid rgba(255,255,255,0.6);
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-10px); }
  60% { transform: translateX(-50%) translateY(-5px); }
}

/* Sections */
section { padding: 80px 0; }
.section-title { font-size: 2.5rem; font-weight: 700; text-align: center; margin-bottom: 2rem; color: var(--primary); }

/* === Sliding Skills Pills === */
.skills-pills { background: var(--bg); }
.pills-viewport {
  overflow: hidden; width: 100%; border-radius: 12px; background: var(--card);
  box-shadow: 0 2px 10px var(--card-shadow); margin: 18px 0; padding: 12px 0;
}
.pills-track {
  display: inline-flex; align-items: center; gap: 12px; white-space: nowrap;
  animation: scrollLeft linear infinite;
  --speed: 50s; /* default if JS missing */
  animation-duration: var(--speed);
}
.pills-track.reverse {
  animation-name: scrollRight;
  --speed: 60s;
}
.skill-pill {
  display: inline-block; padding: 10px 16px; border-radius: 9999px;
  background: var(--pill-bg); color: var(--primary); font-weight: 600; font-size: .95rem;
  border: 1px solid rgba(124,193,255,.25); box-shadow: 0 1px 0 rgba(15,76,129,.06) inset;
}
@keyframes scrollLeft { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
@keyframes scrollRight { 0% { transform: translateX(-50%); } 100% { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .pills-track { animation: none; } }

/* === About: image left, text right === */
.about { background: var(--bg); }

.about-content {
  display: grid;
  grid-template-columns: 1fr 1.4fr; /* photo | text */
  gap: 3rem;
  align-items: stretch; /* text drives the row height */
}

.about-photo {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
}

.about-photo img {
  width: 100%;
  height: auto;              /* JS will set a px height on desktop */
  object-fit: cover;         /* graceful crop when height is locked by JS */
  border-radius: 16px;
  border: 4px solid #ffffff;
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
}

.about-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.about-text p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  line-height: 1.8;
  text-align: justify;
  text-justify: inter-word;
}

/* Timeline */
.timeline { position: relative; max-width: 800px; margin: 0 auto; }
.timeline::before { content: ''; position: absolute; left: 50%; transform: translateX(-50%); width: 2px; height: 100%; background: var(--primary); }
.timeline-item { position: relative; margin-bottom: 3rem; display: flex; align-items: center; }
.timeline-item:nth-child(odd) { flex-direction: row; }
.timeline-item:nth-child(even) { flex-direction: row-reverse; }
.timeline-date { background: var(--primary); color: #fff; padding: .5rem 1rem; border-radius: 20px; font-weight: 600; font-size: .9rem; min-width: 120px; text-align: center; }
.timeline-content { background: var(--card); padding: 2rem; border-radius: 12px; box-shadow: 0 4px 20px var(--card-shadow); margin: 0 2rem; flex: 1; }
.timeline-content h3 { color: var(--heading); margin-bottom: .5rem; font-size: 1.35rem; font-weight: 700; }
.timeline-content h4 { color: var(--subheading); margin-bottom: 1rem; font-weight: 600; }
.timeline-content ul { margin-left: 1.5rem; }
.timeline-content li { margin-bottom: .5rem; }

/* IFRoS Special Styling */

/* IFRoS card should follow theme */
.ifros-item .timeline-content {
  background: var(--card);
  border: 2px solid rgba(124,193,255,.25);
  box-shadow: 0 8px 30px var(--card-shadow);
  transform: scale(1.02);
  transition: all 0.3s ease;
}

.ifros-item .timeline-content:hover {
  transform: scale(1.03);
  box-shadow: 0 12px 40px var(--card-shadow);
  border-color: var(--primary);
}

.ifros-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.ifros-info {
  flex: 1;
}

.ifros-info h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.ifros-info h4 {
  font-size: 1.1rem;
  color: var(--subheading);
  margin-bottom: 1rem;
  font-weight: 600;
}

.ifros-badge {
  display: inline-block;
  margin-bottom: 1rem;
}

.badge-text {
  background: linear-gradient(135deg, #0f4c81 0%, #1e88e5 100%);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(15, 76, 129, 0.3);
}

.ifros-image {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.ifros-image:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.ifros-image a {
  display: block;
  width: 100%;
  height: 100%;
}

.ifros-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.ifros-image:hover img {
  transform: scale(1.05);
}

.ifros-description h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skills-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.skill-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--tile-start) 0%, var(--tile-end) 100%);
  padding: 1rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(124,193,255,.25);
  transition: all 0.25s ease;
  cursor: pointer;
  text-align: center;
  min-height: 80px;
  justify-content: center;
  box-shadow: 0 6px 16px var(--card-shadow);
}

.skill-tab:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 10px 24px var(--card-shadow);
}

.skill-tab i {
  color: var(--primary);
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.skill-tab span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Thesis links */
.thesis-link {
  color: var(--primary) !important;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.thesis-link i {
  color: var(--primary);
}

.thesis-link span {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Projects */
.projects { background: var(--bg); }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem; }
.project-card { background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px var(--card-shadow); transition: transform .3s, box-shadow .3s; animation: fadeInUp .6s ease forwards; }
.project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.project-image { height: 200px; background: linear-gradient(135deg,#667eea 0%,#764ba2 100%); display: flex; align-items: center; justify-content: center; font-size: 3rem; color: #fff; }
.project-content { padding: 1.5rem; }
.project-content h3 { color: var(--primary); margin-bottom: 1rem; font-size: 1.2rem; }
.project-content p { color: var(--muted); margin-bottom: 1.5rem; line-height: 1.6; }
.project-tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.project-tags span { background: var(--pill-bg); color: var(--primary); padding: .25rem .75rem; border-radius: 15px; font-size: .8rem; font-weight: 500; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px);} to { opacity: 1; transform: translateY(0);} }
.project-card:nth-child(2){animation-delay:.1s}
.project-card:nth-child(3){animation-delay:.2s}
.project-card:nth-child(4){animation-delay:.3s}
.project-card:nth-child(5){animation-delay:.4s}
.project-card:nth-child(6){animation-delay:.5s}

/* Duo layout styles for WSSS */
.project-duo{position:relative;display:grid;grid-template-columns:1.3fr 1fr;gap:2rem;margin-top:1rem;margin-bottom:2.5rem}
.project-media{position:relative;border-radius:16px;overflow:hidden;background:#000;box-shadow:0 10px 30px var(--card-shadow);min-height:360px}
.project-media-frame{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000;opacity:0;transition:opacity .7s ease}
.project-media-frame.visible{opacity:1}
.project-media-badge{position:absolute;top:12px;left:12px;background:rgba(255,255,255,.9);color:#111;padding:.25rem .6rem;border-radius:9999px;font-size:.75rem;font-weight:700}
.project-desc{position:relative;background:var(--card);border-radius:18px;padding:22px;box-shadow:0 12px 35px var(--card-shadow);border:1px solid rgba(124,193,255,.25);transform:translate(0,26px) rotate(-1deg)}
.project-desc h3{margin-bottom:.6rem;color:var(--heading)}
.project-desc p{color:var(--muted);margin-bottom:1rem}
.project-points{margin-left:1.25rem;color:var(--muted);margin-bottom:1rem}
.project-points li{margin:.25rem 0}
.project-links{display:flex;gap:1rem;align-items:center;margin-top:.5rem;flex-wrap:wrap}
.project-link{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:10px;background:var(--pill-bg);color:var(--primary);text-decoration:none;font-weight:600;border:1px solid rgba(124,193,255,.25);transition:transform .2s ease, box-shadow .2s ease}
.project-link i{font-size:1rem;color:var(--primary)}
.project-link:hover{transform:translateY(-2px);box-shadow:0 8px 20px var(--card-shadow)}

/* Mobile refinements for duo layout */
@media (max-width: 992px) {
  .project-duo{grid-template-columns:1fr;gap:1.25rem}
  .project-media{min-height:240px}
  .project-desc{transform:none}
  .project-links{gap:.75rem}
}

/* Description slider for ML Labs */
.desc-slider{position:relative}
.desc-slide{display:none}
.desc-slide.active{display:block}
.desc-slide h4{margin-bottom:.4rem;color:var(--heading)}
.desc-dots{display:flex;gap:.5rem;margin-top:.5rem;flex-wrap:wrap}
.desc-dot{width:10px;height:10px;border-radius:50%;border:1px solid var(--primary);background:transparent;cursor:pointer}
.desc-dot.active{background:var(--primary)}
@media (max-width: 480px) {
  .project-media{min-height:200px}
  .project-desc{padding:16px;border-radius:14px}
  .project-media-badge{font-size:.7rem;padding:.2rem .5rem}
}

/* Publications */
.publications-list { max-width: 800px; margin: 0 auto; }
.publication-item { 
  background: var(--card); 
  padding: 2rem; 
  border-radius: 12px; 
  box-shadow: 0 2px 10px var(--card-shadow); 
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.publication-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--card-shadow);
  border-color: rgba(124,193,255,0.2);
}

.publication-item a {
  text-decoration: none;
  color: inherit;
}

.publication-item h3 { 
  color: var(--primary); 
  margin-bottom: .5rem; 
  font-size: 1.2rem;
  transition: color 0.3s ease;
}

.publication-item:hover h3 {
  color: var(--heading);
}

.publication-item p { 
  color: var(--muted); 
  font-style: italic;
  margin: 0;
}

/* Contact */
.contact { background: var(--bg); }
.contact-content { max-width: 800px; margin: 0 auto; }
.contact-info { display: grid; grid-template-columns: repeat(auto-fit,minmax(300px,1fr)); gap: 2rem; }
.contact-item { background: var(--card); padding: 2rem; border-radius: 12px; box-shadow: 0 2px 10px var(--card-shadow); display: flex; align-items: center; gap: 1rem; }
.contact-item i { font-size: 1.5rem; color: var(--primary); width: 40px; text-align: center; }
.contact-item h4 { color: var(--primary); margin-bottom: .5rem; font-size: 1.1rem; }
.contact-item p { color: var(--muted); margin-bottom: .25rem; }
.contact-item a { color: var(--primary); text-decoration: none; }
.contact-item a:hover { text-decoration: underline; }

/* Footer */
.footer { background: #0f4c81; color: #fff; text-align: center; padding: 2rem 0; }

/* Responsive */
@media (max-width: 992px) {
  .nav-menu { 
    display: none; 
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--nav-border);
    flex-direction: column;
    padding: 0.5rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  }
  
  .nav-menu.active {
    display: flex;
  }
  
  .nav-menu li {
    margin: 0;
    padding: 0.15rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  
  .nav-menu li:last-child {
    border-bottom: none;
  }
  
  .nav-menu a {
    display: block;
    padding: 0.1rem 0;
    font-size: 0.9rem;
  }
  
  .nav-toggle { display: flex; }
  .hero-container { text-align: center; }
  .hero-content h2 { font-size: 2.5rem; }
  .about-content { grid-template-columns: 1fr; gap: 2rem; }
  .about-photo { max-width: 420px; }
  .about-photo img { height: auto !important; } /* override JS when stacked */
  .timeline::before { left: 20px; transform: none; }
  .timeline-item { flex-direction: column !important; align-items: flex-start; margin-left: 40px; }
  .timeline-date { margin-bottom: 1rem; }
  .timeline-content { margin: 0; width: 100%; }
  .projects-grid { grid-template-columns: 1fr; }
  .contact-info { grid-template-columns: 1fr; }
  .hero-buttons { justify-content: center; }
  
  /* IFRoS responsive adjustments */
  .ifros-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .ifros-image {
    width: 100px;
    height: 100px;
    align-self: center;
  }
  
  .skills-tabs {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
  }
  
  .skill-tab {
    min-height: 70px;
    padding: 0.8rem 0.6rem;
  }
  
  .skill-tab i {
    font-size: 1rem;
  }
  
  .skill-tab span {
    font-size: 0.75rem;
  }
}
@media (max-width: 480px) {
  .hero-content h2 { font-size: 2rem; }
  .section-title { font-size: 2rem; }
  .container { padding: 0 15px; }
  
  /* Ensure all sections are accessible on mobile */
  section {
    padding: 60px 0 80px 0;
  }
  
  /* Extra padding for bottom sections */
  .publications {
    padding-bottom: 100px;
  }
  
  .contact {
    padding-bottom: 100px;
  }
}

/* Smooth scroll */
html { scroll-behavior: smooth; }