/* ============================================
   Sagar Joglekar - Personal Academic Website
   Dark/Minimal Theme
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #161625;
  --bg-card: #1c1c2e;
  --bg-nav: rgba(15, 15, 26, 0.95);
  --text-primary: #e0e0e8;
  --text-secondary: #9a9ab0;
  --text-muted: #6b6b82;
  --accent: #5b8def;
  --accent-hover: #7aa5f5;
  --accent-dim: #3a5a9e;
  --border: #2a2a40;
  --tag-bg: #1e2a3a;
  --tag-text: #7aa5f5;
  --selected-badge: #2a4a2a;
  --selected-text: #6fcf6f;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Source Serif 4', 'Charter', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 960px;
  --nav-height: 60px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 20px);
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-inner {
  width: 100%;
  max-width: var(--max-width);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background-color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  background: var(--tag-bg);
}

/* --- Sections --- */
section {
  padding: 80px 24px;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 40px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* --- Hero Section --- */
.hero {
  padding-top: calc(var(--nav-height) + 80px);
  padding-bottom: 60px;
  background: var(--bg-primary);
}

.hero-inner {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

.hero-photo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.hero-content {
  flex: 1;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}

.hero-role {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.hero-org a {
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 500;
}

.hero-bio {
  margin-top: 20px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 640px;
}

.hero-bio p + p {
  margin-top: 12px;
}

.social-links {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.social-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all 0.2s;
}

.social-links a:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--tag-bg);
}

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

/* --- About / Education & Interests --- */
.about {
  background: var(--bg-secondary);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

.about-grid h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.education-list {
  list-style: none;
}

.education-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.education-list li:last-child {
  border-bottom: none;
}

.edu-degree {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.edu-institution {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.edu-year {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.interests-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.interests-list li {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* --- Experience --- */
.experience {
  background: var(--bg-primary);
}

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 36px;
}

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

.timeline-item::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
}

.timeline-item:first-child::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--tag-bg);
}

.timeline-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.timeline-company {
  color: var(--accent);
  font-weight: 500;
}

.timeline-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 4px 0 8px;
}

.timeline-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* --- Publications --- */
.publications {
  background: var(--bg-secondary);
}

.pub-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.pub-toggle {
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--border);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

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

.pub-toggle.active {
  background: var(--accent-dim);
  color: #fff;
  border-color: var(--accent);
}

.pub-list {
  display: flex;
  flex-direction: column;
}

.pub-item {
  padding: 16px 0;
  border-bottom: 1px solid rgba(42, 42, 64, 0.5);
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-item.hidden {
  display: none;
}

.pub-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.pub-authors {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 4px 0;
}

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

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

.pub-links {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.pub-link {
  font-size: 0.78rem;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  transition: all 0.2s;
}

.pub-link:hover {
  background: var(--tag-bg);
  border-color: var(--accent-dim);
}

.pub-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
}

.pub-badge.selected {
  background: var(--selected-badge);
  color: var(--selected-text);
}

.pub-badge.journal {
  background: #2a2a4a;
  color: #a0a0e0;
}

.pub-badge.conference {
  background: #2a3a4a;
  color: #80c0e0;
}

/* --- Posts --- */
.posts {
  background: var(--bg-primary);
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.post-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
  gap: 16px;
}

.post-item:hover {
  border-color: var(--accent-dim);
  transform: translateX(4px);
}

.post-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  flex: 1;
}

.post-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.post-summary {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 6px;
  line-height: 1.6;
}

.post-tags {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.post-tag {
  font-size: 0.72rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 2px 8px;
  border-radius: 3px;
}

.older-posts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* --- Projects --- */
.projects {
  background: var(--bg-secondary);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

a.project-card {
  color: inherit;
  text-decoration: none;
  display: block;
}

.project-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.project-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.project-body {
  padding: 20px;
}

.project-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.project-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.7;
}

.project-tags {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* --- Talks --- */
.talks {
  background: var(--bg-primary);
}

.talk-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.talk-item:last-child {
  border-bottom: none;
}

.talk-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.talk-event {
  color: var(--accent);
  font-size: 0.9rem;
}

.talk-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 4px 0;
}

.talk-links {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* --- Footer --- */
.footer {
  padding: 40px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-photo {
    width: 140px;
    height: 140px;
  }

  .hero-bio {
    max-width: 100%;
  }

  .social-links {
    justify-content: center;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .nav-name {
    font-size: 0.95rem;
  }

  .nav-links a {
    font-size: 0.78rem;
    padding: 4px 8px;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .hero-name {
    font-size: 2rem;
  }

  .post-item {
    flex-direction: column;
    gap: 4px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .nav-links {
    gap: 4px;
  }

  .nav-links a {
    font-size: 0.72rem;
    padding: 4px 6px;
  }

  section {
    padding: 60px 16px;
  }

  .hero {
    padding-top: calc(var(--nav-height) + 40px);
  }
}

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