/* 
 * Academic Website CSS - Horizontal Compact Cards Design
 * Clean, professional, space-efficient layout
 */

/* ============================================
   1. VARIABLES
   ============================================ */

:root {
  /* Colors - Professional palette */
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --text-light: #868e96;
  
  --accent: #2c5aa0;
  --accent-hover: #1e3d6f;
  --accent-light: #e7f1ff;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-light: #fafbfc;
  
  --border: #dee2e6;
  --border-light: #e9ecef;
  
  /* Typography */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  
  /* Sizing */
  --container-max: 1100px;
  --container-narrow: 800px;
  --nav-height: 64px;
  
  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.375rem;
  --space-md: 0.625rem;
  --space-lg: 0.875rem;
  --space-xl: 1.25rem;
  --space-2xl: 1.75rem;
  --space-3xl: 2.5rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);
}

/* ============================================
   2. RESET & BASE
   ============================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
}

/* ============================================
   3. TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
  line-height: 1.7;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

/* ============================================
   4. NAVIGATION
   ============================================ */

.main-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  height: var(--nav-height);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.nav-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-2xl);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.nav-items {
  display: flex;
  gap: var(--space-2xl);
  list-style: none;
  padding: 0;
}

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

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

.nav-link.active {
  color: var(--accent);
}

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

.nav-link.active::after,
.nav-link:hover::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  position: relative;
  width: 30px;
  height: 30px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  margin: 5px 0;
  transition: all 0.3s ease;
  position: absolute;
  left: 4px;
}

.nav-toggle span:nth-child(1) { top: 7px; }
.nav-toggle span:nth-child(2) { top: 14px; }
.nav-toggle span:nth-child(3) { top: 21px; }

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg);
  top: 14px;
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg);
  top: 14px;
}

/* Fix for navbar offset when jumping to sections */
section[id] {
  scroll-margin-top: calc(var(--nav-height) + 1rem);
}

/* ============================================
   5. HERO SECTION
   ============================================ */

.hero-section {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-light) 100%);
  padding: var(--space-3xl) 0 var(--space-2xl);
  border-bottom: 1px solid var(--border-light);
}

.hero-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-2xl);
}

.hero-header {
  display: flex;
  align-items: center;
  gap: var(--space-3xl);
  margin-bottom: var(--space-xl);
}

.hero-image {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-primary);
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}

.hero-text {
  flex: 1;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 400;
}

.hero-contact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: 0.95rem;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-xl);
}

.hero-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

.hero-link i {
  font-size: 1.1em;
}

.hero-icon-custom {
  height: 1.2em;
  width: auto;
  vertical-align: middle;
}

.hero-separator {
  color: var(--border);
  margin: 0 var(--space-xs);
  font-size: 0.75rem;
}

/* ============================================
   6. ABOUT SECTION
   ============================================ */

.section-about {
  background: var(--bg-primary);
}

.about-section {
  padding: var(--space-2xl) 0;
}

.about-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-2xl);
}

.about-content {
  max-width: var(--container-narrow);
  margin: 0 auto var(--space-2xl) auto;
}

.section-subtitle {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.about-text {
  margin-bottom: var(--space-xl);
}

.about-paragraph {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.about-paragraph:last-child {
  margin-bottom: 0;
}

/* Three-column layout */
.info-three-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-2xl);
  padding-top: var(--space-2xl);
  margin-top: var(--space-xl);
}

.info-column {
  min-width: 0;
}

.column-section {
  margin-bottom: var(--space-xl);
}

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

.column-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-light);
}

/* Timeline list */
.timeline-list {
  list-style: none;
  padding: 0;
}

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

.timeline-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.timeline-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 2px;
  line-height: 1.4;
}

.timeline-org {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Inline collapse button */
.collapse-toggle-inline {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--accent);
  padding: 1px 8px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.2s ease;
  margin-left: var(--space-sm);
  margin-top: 2px;
  vertical-align: middle;
}

.collapse-toggle-inline:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.collapse-icon {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.collapsed-items {
  margin-top: var(--space-md);
  padding-left: 0;
  list-style: none;
  animation: slideDown 0.3s ease-out;
}

.timeline-collapse {
  list-style: none;
  padding-left: 0;
  margin-top: 0;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

/* Activities list */
.activities-list {
  list-style: none;
  padding: 0;
}

.activity-item {
  position: relative;
  padding-left: var(--space-lg);
  padding-top: 2px;
  padding-bottom: var(--space-xs);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: var(--space-xs);
}

.activity-item::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.875rem;
}

/* Research interests tags */
.interest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.interest-tag {
  display: inline-block;
  padding: 3px var(--space-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
  cursor: default;
}

.interest-tag:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   7. HORIZONTAL COMPACT CARDS
   ============================================ */

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-horizontal {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px 16px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card-horizontal::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.card-horizontal:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--accent);
  transform: translateX(2px);
}

.card-horizontal:hover::before {
  transform: scaleX(1);
}

.card-year {
  background: var(--accent);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  margin-right: 16px;
  min-width: 48px;
  text-align: center;
  flex-shrink: 0;
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 3px;
  line-height: 1.3;
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.card-meta {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.card-separator {
  color: var(--text-muted);
  margin: 0 6px;
}

.card-authors {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 2px;
}

.card-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-left: 16px;
}

.card-link {
  padding: 4px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.card-link:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Publication specific */
.publication-card .card-venue {
  font-style: italic;
}

/* Teaching specific */
.teaching-institution {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 30px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.teaching-institution:first-child {
  margin-top: 0;
}

.course-card .card-program {
  color: var(--accent);
  font-weight: 500;
}

/* Project specific */
.project-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 24px;
  margin-bottom: 12px;
}

.project-section-title:first-child {
  margin-top: 0;
}

.project-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 8px;
}

.status-ongoing {
  background: #d4edda;
  color: #155724;
}

.status-completed {
  background: #f8f9fa;
  color: var(--text-muted);
}

/* ============================================
   8. CONTENT SECTIONS
   ============================================ */

.content-section {
  padding: var(--space-3xl) 0;
  border-bottom: 1px solid var(--border-light);
}

.content-section:nth-child(even) {
  background: var(--bg-light);
}

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

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2xl);
  letter-spacing: -0.02em;
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--border-light);
}

.section-content {
  /* No max-width restriction for horizontal cards */
  width: 100%;
}

/* ============================================
   9. FOOTER
   ============================================ */

.site-footer {
  background: var(--text-primary);
  color: white;
  padding: var(--space-2xl) 0;
  margin-top: 0;
}

.footer-content {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-2xl);
  text-align: center;
}

.footer-content p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--space-md);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.footer-links a {
  color: white;
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  transition: opacity 0.2s ease;
}

.footer-links a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.footer-separator {
  color: rgba(255, 255, 255, 0.4);
  margin: 0 var(--space-xs);
}

.footer-update {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* ============================================
   10. RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .info-three-columns {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
  
  .column-section {
    margin-bottom: var(--space-lg);
  }
}

@media (max-width: 768px) {
  /* Typography adjustments */
  h1 { font-size: 1.75rem; }
  .hero-title { font-size: 2rem; }
  .section-title { font-size: 1.5rem; }
  
  /* Navigation */
  .nav-toggle {
    display: block;
  }
  
  .nav-items {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    flex-direction: column;
    padding: var(--space-xl);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    gap: var(--space-lg);
  }
  
  .nav-items.active {
    display: flex;
  }
  
  /* Hero adjustments */
  .hero-header {
    flex-direction: column;
    text-align: center;
    gap: var(--space-xl);
  }
  
  .hero-text {
    text-align: center;
  }
  
  .hero-image {
    width: 120px;
    height: 120px;
  }
  
  .hero-contact {
    flex-direction: column;
    gap: var(--space-xs);
  }
  
  .hero-separator {
    display: none;
  }
  
  /* Horizontal cards on mobile */
  .card-horizontal {
    flex-wrap: wrap;
    padding: 12px;
  }
  
  .card-year {
    margin-bottom: 8px;
    margin-right: 8px;
  }
  
  .card-content {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .card-links {
    margin-left: 0;
    width: 100%;
  }
  
  .card-meta {
    font-size: 12px;
  }
  
  /* General spacing */
  .content-section {
    padding: var(--space-2xl) 0;
  }
  
  .section-inner {
    padding: 0 var(--space-xl);
  }
  
  .about-container {
    padding: 0 var(--space-xl);
  }
}

@media (max-width: 480px) {
  /* Further reductions for mobile */
  .hero-title {
    font-size: 1.5rem;
  }
  
  .hero-image {
    width: 100px;
    height: 100px;
  }
  
  .section-inner,
  .about-container {
    padding: 0 var(--space-lg);
  }
  
  .footer-links {
    flex-direction: column;
    gap: var(--space-sm);
  }
  
  .footer-separator {
    display: none;
  }
  
  /* Card adjustments */
  .card-title {
    font-size: 14px;
  }
  
  .card-separator {
    display: inline;
  }
  
  .card-meta {
    line-height: 1.6;
  }
  
  /* Timeline items */
  .timeline-title {
    font-size: 0.9rem;
  }
  
  .timeline-org {
    font-size: 0.8rem;
  }
  
  .activity-item {
    font-size: 0.85rem;
  }
}

/* ============================================
   11. UTILITIES
   ============================================ */

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-small { font-size: 0.875rem; }
.text-center { text-align: center; }

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.skip-to-content {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: var(--space-md) var(--space-lg);
  background: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 4px;
}

.skip-to-content:focus {
  left: 50%;
  transform: translateX(-50%);
  top: var(--space-md);
}

/* ============================================
   12. ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-section {
  animation: fadeIn 0.6s ease-out;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Selection colors */
::selection {
  background: var(--accent-light);
  color: var(--accent);
}

::-moz-selection {
  background: var(--accent-light);
  color: var(--accent);
}

/* Print styles */
@media print {
  .main-nav,
  .nav-toggle,
  .hero-contact,
  .card-links,
  .footer-links {
    display: none;
  }
  
  .card-horizontal {
    page-break-inside: avoid;
    border: 1px solid #ccc;
  }
  
  .content-section {
    page-break-before: auto;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  a {
    color: inherit;
    text-decoration: none;
  }
  
  .card-year {
    background: none;
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
  }
}

.course-page-btn {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 5px 12px;
}

.course-page-btn:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-1px);
}