
/* === Modern Academic Site Theme ========================================= */
/* Color system (light) */
:root {
  --primary: #2563eb;
  --primary-600: #1e40af;
  --bg: #0b1020; /* used in gradients only */
  --surface: #ffffff;
  --page: #f7f9fc;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
  --radius: 14px;
  --focus: 0 0 0 3px rgba(37, 99, 235, .35);
}

/* Dark mode tokens override when body.dark-mode is set */
body.dark-mode {
  --primary: #93c5fd;
  --primary-600: #60a5fa;
  --surface: #0d1324;
  --page: #0a0f1f;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #1f2937;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Base layout */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 600px at 80% -10%, rgba(37,99,235,.08), rgba(255,255,255,0)) ,
              radial-gradient(800px 400px at -10% 10%, rgba(59,130,246,.10), rgba(255,255,255,0)) ,
              var(--page);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .35s ease, color .35s ease, background .5s ease;
}

/* Container */
.container { max-width: 1024px; margin: 0 auto; padding: 0 24px; }

/* Header */
header {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto auto; gap: 16px;
  align-items: center;
  padding: 18px 32px;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  border-bottom: 1px solid var(--border);
}

.site-title a {
  font-family: Lora, serif;
  font-weight: 600;
  font-size: 1.375rem;
  color: var(--text);
  letter-spacing: .2px;
  text-decoration: none;
}

/* Nav */
nav { display: flex; gap: 18px; align-items: center; }
nav a {
  position: relative; text-decoration: none;
  color: var(--muted); font-weight: 600;
  padding: 6px 2px;
  transition: color .2s ease;
}
nav a:hover, nav a.active { color: var(--text); }
nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-600));
  border-radius: 2px; transform: scaleX(0); transform-origin: right;
  transition: transform .35s ease;
}
nav a:hover::after, nav a.active::after { transform: scaleX(1); transform-origin: left; }

/* Theme toggle button */
.theme-toggle {
  appearance: none; border: 1px solid var(--border); background: var(--surface);
  padding: 8px 10px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: none; box-shadow: var(--focus); }
.theme-toggle .sun-icon, .theme-toggle .moon-icon { display: inline-block; line-height: 1; }
body.dark-mode .sun-icon { display: none; }
body.dark-mode .moon-icon { display: inline-block; }
body:not(.dark-mode) .moon-icon { display: none; }

/* Cards */
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 26px 0;
  box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease, background .3s ease, border-color .3s ease;
}
.content-card:hover { transform: translateY(-4px); }

/* Headings */
h1, h2, h3 { font-family: Lora, serif; margin: 0 0 12px; }
h1 { font-size: clamp(2rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Intro grid */
.intro-section { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: center; }
.profile-picture {
  width: 220px; height: 220px; border-radius: 999px; object-fit: cover;
  border: 6px solid color-mix(in srgb, var(--surface) 75%, transparent);
  box-shadow: var(--shadow);
  transform: translateZ(0);
  animation: float 8s ease-in-out infinite;
}
@keyframes float { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-8px) } }

/* Lists */
.content-card ul { list-style: none; padding-left: 0; margin: 0; }
.content-card li { position: relative; padding-left: 20px; margin: 10px 0; }
.content-card li::before {
  content: ""; position: absolute; left: 0; top: .9em; width: 10px; height: 10px;
  border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-600));
  transform: translateY(-50%);
}

/* News timeline */
.news-list {
  list-style: none;
  margin: 1;

  /* Push timeline inward */
  margin-left: 4.5rem;   /* increase spacing from card edge */
  padding-left: 3rem;

  /* border-left: 2px solid var(--border); */
}

.news-list li {
  position: relative;
  margin-bottom: 1.2rem;
  line-height: 1.6;
}

/* .news-list li::before {
  content: "";
  position: absolute;
  left: -1.0rem;   /* adjust so the dot aligns with the line */
  top: 0.8em;      /* fine-tune vertical alignment with text */
  width: 12px;
  height: 12px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--surface);
} */



.news-list .date {
  font-weight: 600;
  font-family: monospace;
  color: var(--primary);
  display: inline-block;
  margin-right: 8px;
  min-width: 70px;
}


.news-toggle {
  margin-top: 12px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.news-toggle:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

/* Social links */
.social-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.social-links a {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 600; padding: 6px 10px;
  background: color-mix(in srgb, var(--surface) 90%, var(--primary) 10%);
  border: 1px solid var(--border); border-radius: 999px; text-decoration: none;
  transition: transform .2s ease;
}
.social-links a:hover { transform: translateY(-2px); }

/* Publications Grid */
.publications-grid {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.publication-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  padding: 20px;
  background: color-mix(in srgb, var(--surface) 98%, var(--primary) 2%);
  border: 1px solid color-mix(in srgb, var(--border) 80%, var(--primary) 20%);
  border-radius: 12px;
  transition: all 0.3s ease;
  align-items: start;
}

.publication-item:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.publication-thumbnail {
  width: 120px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.publication-item:hover .publication-thumbnail img {
  transform: scale(1.05);
}

.publication-content {
  min-width: 0; /* Allows text to wrap properly */
}

.publication-title {
  font-family: Lora, serif;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px 0;
  color: var(--text);
}

.publication-title a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

.publication-authors {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 6px 0;
  line-height: 1.3;
}

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

.publication-venue {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.publication-status {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.publication-status.accepted {
  background: color-mix(in srgb, #10b981 20%, transparent);
  color: #047857;
}

.publication-status.published {
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--primary-600);
}

.publication-status.award {
  background: color-mix(in srgb, #f59e0b 20%, transparent);
  color: #d97706;
}

.publication-status.award a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.publication-status.award a:hover {
  text-decoration: underline;
}

.publications-link {
  text-align: right;
  margin-top: 20px;
  font-weight: 600;
}

.publications-link a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.publications-link a:hover {
  color: var(--primary-600);
  text-decoration: underline;
}

/* Footer */
footer { text-align: center; padding: 36px 0; color: var(--muted); border-top: 1px solid var(--border); margin-top: 40px; }

/* Reveal animation */
.fade-in { opacity: 0; transform: translateY(18px); }
.fade-in.visible { opacity: 1; transform: translateY(0); transition: opacity .6s ease, transform .6s ease; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Visitor Statistics Styles */
.visitor-subtle {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 12px 0;
  margin: 16px 0;
  text-align: center;
}

.visitor-subtle:hover {
  transform: none;
}

.visitor-countries-subtle {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  padding: 8px;
}

.visitor-country-subtle {
  font-size: 0.9rem;
  color: var(--muted);
  cursor: default;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.visitor-country-subtle:hover {
  color: var(--text);
}

.visitor-country {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--surface) 95%, var(--primary) 5%);
  border: 1px solid color-mix(in srgb, var(--border) 80%, var(--primary) 20%);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.visitor-country:hover {
  transform: translateX(4px);
  background: color-mix(in srgb, var(--surface) 90%, var(--primary) 10%);
  border-color: var(--primary);
}

.country-info {
  display: flex;
  align-items: center;
  gap: 12px;
  grid-column: 1;
  grid-row: 1;
}

.country-flag {
  font-size: 1.5rem;
  line-height: 1;
}

.country-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.visitor-count {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}

.visitor-count .count {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
}

.visitor-count .percentage {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.visitor-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.visitor-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-600));
  border-radius: 2px;
  transition: width 0.6s ease;
  min-width: 4px;
}

.no-visitors,
.error-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-style: italic;
}

.error-state {
  color: #ef4444;
}

/* Loading state for subtle display */
.visitor-countries-subtle:empty::before {
  content: "";
  display: none;
}

/* Custom scrollbar for visitor countries */
.visitor-countries::-webkit-scrollbar {
  width: 6px;
}

.visitor-countries::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: 3px;
}

.visitor-countries::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 3px;
}

.visitor-countries::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Responsive */
@media (max-width: 860px) {
  header { grid-template-columns: 1fr auto; grid-auto-flow: row; gap: 12px; }
  .intro-section { grid-template-columns: 1fr; text-align: center; }
  .profile-picture { margin: 0 auto; }
  
  .visitor-country {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    text-align: center;
  }
  
  .country-info {
    justify-content: center;
    grid-column: 1;
    grid-row: 1;
  }
  
  .visitor-count {
    justify-content: center;
    grid-column: 1;
    grid-row: 2;
  }
  
  .visitor-bar {
    grid-column: 1;
    grid-row: 3;
  }
  
  /* Publications responsive */
  .publication-item {
    grid-template-columns: 100px 1fr;
    gap: 16px;
    padding: 16px;
  }
  
  .publication-thumbnail {
    width: 100px;
    height: 67px;
  }
  
  .publication-title {
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .publication-item {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
  }
  
  .publication-thumbnail {
    width: 120px;
    height: 80px;
    margin: 0 auto;
  }
  
  .publication-venue {
    justify-content: center;
  }
}
