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

:root {
  --bg:        #f7f6f2;
  --text:      #1a1a18;
  --muted:     #6b6b65;
  --accent:    #2e5e3e;
  --accent2:   #7aab8a;
  --border:    #d8d6ce;
  --serif:     'EB Garamond', Georgia, serif;
  --sans:      'Inter', system-ui, sans-serif;
  --max:       860px;
}

html { scroll-behavior: smooth; }

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

/* ── Nav ── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  height: 52px;
}
nav .name {
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}
nav ul { list-style: none; display: flex; gap: 1.8rem; }
nav ul a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  transition: color 0.2s;
}
nav ul a:hover, nav ul a.active { color: var(--accent); }

/* ── Layout ── */
main { max-width: var(--max); margin: 0 auto; padding: 0 2rem 5rem; }

section { padding-top: 4.5rem; }

/* ── Hero ── */
#about {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: start;
  padding-top: 3.5rem;
}
#about .bio h1 {
  font-family: var(--serif);
  font-size: 2.8rem;
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 0.3rem;
}
#about .bio .role {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 1.4rem;
}
#about .bio p {
  color: #3a3a36;
  font-size: 0.95rem;
  max-width: 560px;
  margin-bottom: 1rem;
}
#about .bio .links {
  display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap;
}
#about .bio .links a {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent2);
  padding-bottom: 1px;
  transition: opacity 0.2s;
}
#about .bio .links a:hover { opacity: 0.65; }

/* ── Avatar / Photo ── */
/* To use your own photo, replace the .avatar div in HTML with:
   <div class="avatar"><img src="photo.jpg" alt="Saubhagya Joshi" /></div>  */
.avatar {
  flex-shrink: 0;
  margin-top: 0.4rem;
  width: 24%;
  min-width: 80px;   /* floor: never smaller than this on narrow screens */
  max-width: 200px;  /* ceiling: never larger than this on wide screens  */
}
.avatar img {
  width: 100%;       /* fill the .avatar container */
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover; /* crop cleanly if photo isn't square */
  display: block;
}
/* Fallback initials circle (shown when no <img> is inside .avatar) */
.avatar:not(:has(img)) {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-size: 2rem;
}

/* ── Section headings ── */
.section-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 1.4rem;
  display: flex; align-items: center; gap: 0.8rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Research / Projects ── */
.paper {
  border-top: 1px solid var(--border);
  padding: 1.2rem 0;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0 1.4rem;
}
.paper:last-child { border-bottom: 1px solid var(--border); }
.paper .venue-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: #e6f0ea;
  border-radius: 3px;
  padding: 3px 6px;
  text-align: center;
  line-height: 1.3;
  height: fit-content;
  margin-top: 3px;
}
.paper h3 {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}
.paper .authors {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.paper .meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}
.paper .plinks { margin-top: 0.5rem; display: flex; gap: 0.8rem; }
.paper .plinks a {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent2);
}
.paper .plinks a:hover { opacity: 0.65; }

/* ── News ── */
.news-table { width: 100%; border-collapse: collapse; }
.news-table tr { border-top: 1px solid var(--border); }
.news-table tr:last-child { border-bottom: 1px solid var(--border); }
.news-table td { padding: 0.9rem 0; vertical-align: top; }
.news-table .date {
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--muted);
  padding-right: 2rem;
  padding-top: 1rem;
  font-variant-numeric: tabular-nums;
}
.news-table .item { font-size: 0.9rem; line-height: 1.6; }

/* ── Skills ── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.skill-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.2rem;
}
.skill-card h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.skill-card p { font-size: 0.84rem; color: #3a3a36; line-height: 1.5; }

/* ── Education / Experience timeline ── */
.titem {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0 1.4rem;
  border-top: 1px solid var(--border);
  padding: 1rem 0;
}
.titem:last-child { border-bottom: 1px solid var(--border); }
.titem .year {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.titem .detail h3 {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.1rem;
}
.titem .detail .inst {
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.titem .detail .desc {
  font-size: 0.82rem;
  color: #4a4a46;
  line-height: 1.5;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  max-width: var(--max);
  margin: 0 auto;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  #about { grid-template-columns: 1fr; }
  .avatar { display: none; }
  nav ul { gap: 1rem; }
  .paper { grid-template-columns: 1fr; }
  .paper .venue-badge { width: fit-content; margin-bottom: 0.5rem; }
  .titem { grid-template-columns: 70px 1fr; }
}

/* ── Blog ── */

#blog {
  padding-top: 3.5rem;
}

#blog h1,
.blog-post h1 {
  font-family: var(--serif);
  font-size: 2.8rem;
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.blog-intro {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 3rem;
  max-width: 600px;
}

.blog-preview {
  border-top: 1px solid var(--border);
  padding: 1.4rem 0;
}

.blog-preview:last-child {
  border-bottom: 1px solid var(--border);
}

.blog-preview h2 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: 0.3rem;
}

.blog-preview h2 a {
  color: var(--text);
  text-decoration: none;
}

.blog-preview h2 a:hover {
  color: var(--accent);
}

.blog-date {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

.blog-preview .excerpt {
  color: #4a4a46;
  font-size: 0.88rem;
  max-width: 650px;
}

/* ── Individual post ── */

.blog-post {
  padding-top: 3.5rem;
  max-width: 720px;
}

.blog-post .blog-date {
  margin-bottom: 0.7rem;
}

.blog-post .blog-description {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 2.5rem;
}

.blog-content {
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.75;
}

.blog-content h2 {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 400;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
}

.blog-content h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

.blog-content p {
  margin-bottom: 1.2rem;
}

.blog-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent2);
}

.blog-content a:hover {
  opacity: 0.65;
}

.blog-content ul,
.blog-content ol {
  margin: 0 0 1.2rem 1.5rem;
}

.blog-content li {
  margin-bottom: 0.35rem;
}

.blog-content blockquote {
  border-left: 2px solid var(--accent2);
  margin: 1.5rem 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-style: italic;
}

.blog-content code {
  font-family: monospace;
  font-size: 0.85em;
  background: #eeede8;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.blog-content pre {
  background: #eeede8;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.blog-content pre code {
  background: none;
  padding: 0;
}

.blog-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto;
}

@media (max-width: 640px) {
  #blog {
    padding-top: 2.5rem;
  }

  #blog h1,
  .blog-post h1 {
    font-size: 2.3rem;
  }

  .blog-post {
    padding-top: 2.5rem;
  }

  .blog-content {
    font-size: 1.05rem;
  }
}
