/* =============================================
   Moshiur Farazi — Personal Academic Website
   Inspired by al-folio
   ============================================= */

/* --- Base & Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 270px;
  --accent: #15803d;
  --accent-hover: #166534;
  --bg: #fafaf9;
  --bg-sidebar: #f3f4f2;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: #e2e0db;
  --link: #15803d;
  --tag-bg: #dcfce7;
  --tag-color: #166534;
  --transition: 0.2s ease;
  --font-main: 'Source Serif 4', 'Georgia', serif;
  --font-ui: 'Inter', system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #171712;
  --bg-sidebar: #1e1e18;
  --text: #e8e5de;
  --text-muted: #a8a095;
  --border: #33322c;
  --link: #4ade80;
  --accent: #4ade80;
  --accent-hover: #86efac;
  --tag-bg: #14532d;
  --tag-color: #4ade80;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

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

/* --- Layout --- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  z-index: 100;
}

.sidebar-profile {
  text-align: center;
  margin-bottom: 1.5rem;
}

.profile-img-wrapper {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 1rem;
  border: 3px solid var(--border);
}

.profile-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e8f0fe, #c5d8f8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--accent);
  font-weight: 700;
}

.sidebar-name {
  font-family: var(--font-main);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.sidebar-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2rem 0;
}

/* Contact info */
.sidebar-contact {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.sidebar-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sidebar-contact-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 3px;
  fill: var(--text-muted);
}

.sidebar-contact-item a {
  color: var(--text-muted);
  word-break: break-all;
}

.sidebar-contact-item a:hover { color: var(--accent); text-decoration: none; }

/* Social icons */
.sidebar-social {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.social-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--tag-bg);
  text-decoration: none;
}

.social-link svg { width: 16px; height: 16px; fill: currentColor; }

/* Nav */
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 0.2rem; }
.sidebar-nav a {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: var(--tag-bg);
  color: var(--accent);
  text-decoration: none;
}

/* Theme toggle at bottom */
.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  text-align: center;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  max-width: 820px;
  padding: 3rem 3rem 4rem;
}

/* --- Sections --- */
.section { margin-bottom: 3.5rem; }

.section-title {
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.2rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  letter-spacing: -0.01em;
}

/* --- About --- */
.about-text p { margin-bottom: 1rem; }
.about-text p:last-child { margin-bottom: 0; }

.research-interests {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  background: var(--tag-bg);
  color: var(--tag-color);
  font-size: 0.78rem;
  font-weight: 500;
}

/* --- News --- */
.news-list { list-style: none; }
.news-item {
  display: flex;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.news-item:last-child { border-bottom: none; }
.news-date { color: var(--text-muted); white-space: nowrap; min-width: 80px; font-size: 0.82rem; padding-top: 2px; }
.news-text { color: var(--text); }

/* --- Publications --- */
.pub-list { list-style: none; }

.pub-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.pub-item:last-child { border-bottom: none; }

.pub-year-badge {
  min-width: 46px;
  height: 24px;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 3px;
}

.pub-content { flex: 1; }

.pub-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.pub-authors {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.pub-authors strong { color: var(--text); }

.pub-venue {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.pub-venue strong { font-style: normal; color: var(--accent); }

.pub-links {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.pub-link {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.pub-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.pub-link.pdf { border-color: var(--accent); color: var(--accent); }

.view-all-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Experience --- */
.exp-list { list-style: none; }

.exp-item {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}
.exp-item:last-child { border-bottom: none; }

.exp-org {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}
.exp-role {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.exp-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}
.exp-loc {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
}
.exp-bullets {
  grid-column: 1 / -1;
  list-style: none;
  margin-top: 0.3rem;
}
.exp-bullets li {
  font-size: 0.83rem;
  color: var(--text-muted);
  padding-left: 1rem;
  position: relative;
  margin-bottom: 0.2rem;
}
.exp-bullets li::before {
  content: '–';
  position: absolute;
  left: 0;
}

/* --- Education --- */
.edu-item {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.3rem;
}
.edu-item:last-child { border-bottom: none; }
.edu-degree { font-weight: 600; font-size: 0.9rem; }
.edu-school { font-size: 0.85rem; color: var(--text-muted); }
.edu-thesis { font-size: 0.8rem; color: var(--text-muted); font-style: italic; margin-top: 0.15rem; }
.edu-year { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.edu-badge {
  font-size: 0.72rem;
  color: #d4880c;
  font-weight: 600;
}

/* --- Awards --- */
.award-list { list-style: none; }
.award-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  gap: 1rem;
}
.award-item:last-child { border-bottom: none; }
.award-name { color: var(--text); }
.award-year { color: var(--text-muted); white-space: nowrap; font-size: 0.8rem; }

/* --- Mobile header (hamburger) --- */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 200;
}

.mobile-logo { font-weight: 700; font-size: 1rem; color: var(--text); }

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text);
}

.hamburger svg { width: 22px; height: 22px; fill: currentColor; }

/* --- Mobile profile header (inline at top of main content) --- */
.mobile-profile { display: none; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    top: 56px;
    height: calc(100vh - 56px);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-profile { display: none; }
  .sidebar-contact { display: none; }
  .sidebar-social:not(.mobile-profile-social) { display: none; }
  .sidebar .sidebar-divider:first-of-type,
  .sidebar .sidebar-divider:nth-of-type(2) { display: none; }

  .mobile-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
  }

  .mobile-profile .profile-img-wrapper {
    width: 110px;
    height: 110px;
    margin-bottom: 0.8rem;
  }

  .mobile-profile-name {
    font-family: var(--font-main);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
  }

  .mobile-profile-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 0.3rem;
  }

  .mobile-profile-location {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
  }

  .mobile-profile-social {
    margin-bottom: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 5rem 1.2rem 3rem;
    max-width: 100%;
  }

  .research-interests {
    flex-wrap: wrap;
  }

  .tag {
    max-width: 100%;
    word-break: break-word;
  }

  .pub-item { flex-direction: column; gap: 0.5rem; }
  .exp-item { grid-template-columns: 1fr; }
  .exp-date, .exp-loc { text-align: left; }
  .edu-item { grid-template-columns: 1fr; }
}

/* --- Publications Page specific --- */
.pub-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 2rem 0 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pub-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.pub-number {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 32px;
  padding-top: 3px;
}
