/* ---------------------------
   1. Core Variables & Reset
--------------------------- */
:root {
  /* Light Theme */
  --bg-body: #ffffff;
  --bg-header: #fafafa;
  --bg-card: #ffffff;
  --bg-badge: #fff;
  --bg-hobby: #f0f4ff;
  --bg-img-wrap: #f7f7f7;
  
  --text-main: #111111;
  --text-muted: #666666;
  --text-accent: #2b6cb0;
  
  --border-color: #eeeeee;
  --shadow-sm: 0 1px 0 rgba(16,24,40,0.02);
  --shadow-md: 0 8px 20px rgba(2,6,23,0.06);
  --shadow-lg: 0 16px 32px rgba(2,6,23,0.15);
  --shadow-hover-color: rgba(43,108,176,0.12);

  --font-sans: Inter, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark Theme Overrides */
body.dark-mode {
  --bg-body: #111111;
  --bg-header: #1a1a1a;
  --bg-card: #1e1e1e;
  --bg-badge: #2d2d2d;
  --bg-hobby: #2a3b55;
  --bg-img-wrap: #2d2d2d;

  --text-main: #eeeeee;
  --text-muted: #aaaaaa;
  --text-accent: #63b3ed;

  --border-color: #333333;
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.2);
  --shadow-md: 0 8px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 16px 32px rgba(0,0,0,0.5);
  --shadow-hover-color: rgba(99, 179, 237, 0.2);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  margin: 0;
  color: var(--text-main);
  background-color: var(--bg-body);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1,h2,h3,h4,h5,h6 { color: var(--text-main); }
a { color: var(--text-accent); text-decoration: none; }

.container { max-width: 980px; margin: 0 auto; padding: 24px; position:relative; }

/* ---------------------------
   2. Header & Nav
--------------------------- */
.site-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.3s ease;
}

.site-title {
  margin: 0;
  display: inline-block;
  font-size: 18px;
  line-height: 42px; /* vertical align with nav */
}
.site-title a { color: var(--text-accent); font-weight: 700; }

/* Mobile Menu Toggle */
.menu-controls { float: right; display: flex; align-items: center; gap: 10px; }

#theme-toggle, #menu-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}
#theme-toggle:hover, #menu-toggle:hover {
  background: var(--bg-card);
  border-color: var(--text-accent);
}

.nav { display: inline-block; margin-right: 15px; }
.nav a {
  margin-left: 16px;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-block;
}
.nav a:hover {
  background: var(--bg-hobby);
  color: var(--text-accent);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  #menu-toggle { display: inline-block; }
  .nav {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 0 0 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
  }
  .nav.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav a {
    display: block;
    margin: 5px 20px;
    text-align: center;
  }
}
@media (min-width: 641px) {
  #menu-toggle { display: none; }
}

/* ---------------------------
   3. Hero & Content
--------------------------- */
.hero { padding: 40px 0; overflow: hidden; }

/* Post Article & Hero Image */
.post-article { max-width: 720px; margin: 0 auto; }
.post-hero {
  width: 100%;
  margin-bottom: 24px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.post-hero img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}
.post-meta { margin-bottom: 16px; }
.post-article h2 { font-size: 28px; margin-bottom: 12px; }
.post-article h3 { font-size: 22px; margin-top: 28px; margin-bottom: 12px; }
.post-article p { margin-bottom: 16px; }
.post-article ul { margin-bottom: 16px; }
.post-article .info-list { list-style: none; padding-left: 0; }
.post-article .info-list li { margin-bottom: 8px; }
.post-article .lead { font-size: 18px; line-height: 1.7; color: var(--text-muted); }
.post-article .summary {
  background: var(--bg-hobby);
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid var(--text-accent);
}
.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--text-accent);
  color: #fff;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.btn:hover { background: #1a4971; transform: translateY(-2px); }

/* Typewriter Cursor */
#typewriter-text::after {
  content: '|';
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.avatar {
  width: 420px;
  max-width: 60%;
  aspect-ratio: 4/3;
  height: auto;
  border-radius: 12px;
  float: left;
  margin-right: 28px;
  box-shadow: var(--shadow-md);
  object-fit: cover;
  transition: all 0.3s ease;
}
.avatar:hover { transform: scale(1.02); }

.muted { color: var(--text-muted); }
.section-divider { border: 0; border-top: 1px solid var(--border-color); margin: 24px 0; }

/* ---------------------------
   4. Animations
--------------------------- */
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------
   5. Components
--------------------------- */
/* Contact Badges */
.contact-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
}
.contact-row:first-of-type { border-top: none; }

.contact-badge-link {
  display: inline-block;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
.contact-badge-link:hover {
  transform: translateY(-3px) scale(1.05);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2));
}
.contact-badge-link img {
  height: 20px;
  display: block;
  border-radius: 6px;
}

/* Leadership & Collaborator Cards */
.lead-card, .collab-card, .blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}
.lead-card:hover, .collab-card:hover, .blog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--text-accent);
}

.leadership-grid { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.lead-card { padding: 16px; }
.lead-card .lead-card-img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 10px;
  background: var(--bg-img-wrap);
}

/* Publications */
.pub-section .entry {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--text-accent);
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  transition: all 0.3s ease;
}
.pub-section .entry:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.pub-section .entry h3 { margin: 0 0 6px 0; font-size: 18px; }

/* Filter Buttons */
.filter-controls { margin-bottom: 20px; }
.filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  margin-right: 8px;
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  margin-bottom: 8px;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--text-accent);
  color: #fff;
  border-color: var(--text-accent);
}
.filter-item.hidden { display: none; }
.filter-item { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Hobby Items */
.hobby-item {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-hobby);
  color: var(--text-accent);
  transition: all 0.3s ease;
  cursor: default;
}
.hobby-item:hover {
  background: var(--text-accent);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--shadow-hover-color);
}

/* Back to Top */
#back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--text-accent);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 99;
}
#back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
#back-to-top:hover { transform: translateY(-4px); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }

/* Footer */
.site-footer {
  background: var(--bg-header);
  border-top: 1px solid var(--border-color);
  padding: 12px;
  margin-top: 28px;
  text-align: center;
  color: var(--text-muted);
}

/* Collab Specific */
.collab-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 12px; }
.collab-card { display: flex; gap: 18px; align-items: center; border-left: 4px solid var(--text-accent); padding: 14px; }
.collab-avatar { width: 120px; height: 120px; border-radius: 50%; border: 1px solid var(--border-color); object-fit: cover; }
.collab-body { flex: 1; min-width: 0; }
.small-btn {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-hobby);
  color: var(--text-accent);
  border: 1px solid var(--border-color);
}
.small-btn:hover { background: var(--text-accent); color: #fff; }

/* Responsive adjustments */
@media (max-width: 640px) {
  .avatar { float: none; margin: 0 auto 18px; display: block; max-width: 90%; }
  .collab-grid { grid-auto-rows: auto; }
  .collab-avatar { width: 88px; height: 88px; min-width: 88px; }
  .collab-card { padding: 12px; }
  .lead-card .lead-card-img { aspect-ratio: 4/3; }
}
