/* ============================================================
   Prasanjit Dubey, personal site
   Plain CSS, no build step. Theme via CSS custom properties.
   Layout: a top bar on every page, one left-aligned column beneath it.
   ============================================================ */

:root {
  --bg: #fafaf8;
  --bg-soft: #efeee9;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-soft: #555049;
  --text-muted: #8a847b;
  --accent: #2a4d7a;
  --accent-soft: #e8eef6;
  --border: #e4e1da;
  --radius: 12px;
  --maxw: 58rem;
  /* The left column shared by dates, row labels and skill names, so they
     line up down every page. Wide enough for "Aug 2021 – May 2027". */
  --label-w: 9.5rem;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #15171c;
  --bg-soft: #232730;
  --surface: #1e2128;
  --text: #e8e6e1;
  --text-soft: #b3afa6;
  --text-muted: #847f76;
  --accent: #7da6dd;
  --accent-soft: #1f2a3a;
  --border: #2c2f38;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }

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

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------------- Top bar ---------------- */
/* Repeated verbatim in every page; the current page's link carries
   aria-current="page", which is also what styles it. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.8rem 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1.4rem;
}

.nav-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
  white-space: nowrap;
  margin-right: auto;
}
.nav-brand:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.15rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text-soft);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle-icon {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: inset -4px -4px 0 0 var(--bg);
  transition: all 0.3s;
}
[data-theme="dark"] .theme-toggle-icon {
  box-shadow: none;
  background: currentColor;
  transform: scale(0.7);
}

/* ---------------- Layout ---------------- */
/* The body is a column so that on a short page (Talks, News) the footer
   sits at the bottom of the window instead of halfway up it. */
main { flex: 1 0 auto; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 2.6rem 2rem 1rem; }

.section { margin: 0 0 3rem; }
.section-intro { color: var(--text-soft); margin: 0 0 1.8rem; }

/* Page titles and section headings sit on a hairline rule; a short accent
   bar at its left end anchors each section without a full-width colour line. */
.page-title {
  font-size: 1.95rem;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.section > h2 {
  font-size: 1.4rem;
  margin: 0 0 1.15rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.page-title::after,
.section > h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2.4rem;
  height: 2px;
  background: var(--accent);
}

/* A muted line directly under a heading, and a trailing "more" link. */
.note { font-size: 0.9rem; color: var(--text-muted); margin: -0.35rem 0 1.2rem; }
.more { font-size: 0.92rem; margin: 1.1rem 0 0; }

/* ---------------- Home: identity ---------------- */
/* Photo beside the name rather than above it, so the name, affiliation,
   links and the start of the bio all fit on the first screen. */
.hero { display: flex; align-items: center; gap: 2rem; margin: 0 0 2.2rem; }

.avatar {
  width: 150px;
  height: 150px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 22%;
  border: 3px solid var(--surface);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border);
}

.hero-text { min-width: 0; }
.hero-name { font-size: 2.3rem; letter-spacing: -0.01em; line-height: 1.15; margin: 0 0 0.3rem; }
.hero-title { color: var(--accent); font-weight: 500; margin: 0 0 0.3rem; }
.hero-affil { color: var(--text-soft); font-size: 0.93rem; line-height: 1.55; margin: 0 0 0.9rem; }

.hero-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}
.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}
.hero-links a:hover { color: var(--accent); text-decoration: none; }
/* Sized against the label's cap height, not the font size: at 17px the solid
   logos out-massed the text. The line-art icons fill only part of their
   24x24 box, so they need a bigger box to read at the same weight. */
.hero-links svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-muted); transition: color 0.15s; }
.hero-links .icon-stroke { width: 16px; height: 16px; }
.hero-links a:hover svg { color: var(--accent); }

.bio { margin: 0 0 1rem; }

.callout {
  margin: 1.5rem 0 0;
  padding: 0.85rem 1.1rem;
  background: var(--bg-soft);
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ---------------- Research topics (keyword chips) ---------------- */
.topics {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}
.topics li {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.28rem 0.8rem;
  line-height: 1.4;
}

/* ---------------- Research page ---------------- */
.thread > p { color: var(--text-soft); }
/* Numbered [n] as on the Publications page. The counter runs across all four
   research lines, so each paper keeps one number site-wide. */
.threads { counter-reset: paper; }
.thread-papers { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; color: var(--text-soft); }
.thread-papers > li { counter-increment: paper; position: relative; padding-left: 2.4rem; }
.thread-papers > li::before {
  content: "[" counter(paper) "]";
  position: absolute;
  left: 0;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.thread-papers li + li { margin-top: 0.35rem; }
/* Here the only label is "Papers", so its column fits the word rather than
   the site-wide date column, which left a wide gap before the list. */
.thread .row { grid-template-columns: auto minmax(0, 1fr); }

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

/* Numbered [1]..[n] in a left gutter, as the CV sets them. The counter lives
   on the wrapper, not the list, so it runs unbroken across the four groups
   instead of restarting at each heading. */
#publications { counter-reset: pub; }
.pub {
  counter-increment: pub;
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--border);
}
.pub::before {
  content: "[" counter(pub) "]";
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.75;
  font-variant-numeric: tabular-nums;
}
.pub:first-child { padding-top: 0.3rem; }
.pub:last-child { border-bottom: 0; padding-bottom: 0; }

/* The home page's selected papers are unnumbered: they are a hand-picked
   subset, so numbers there would disagree with the full list's. */
.pub-list-plain .pub { display: block; }
.pub-list-plain .pub::before { content: none; }

.pub-title { font-size: 1.12rem; margin: 0 0 0.35rem; line-height: 1.35; }
.pub-authors { margin: 0 0 0.3rem; color: var(--text-soft); font-size: 0.95rem; }
.pub-authors .me { color: var(--text); font-weight: 600; }
.pub-venue { margin: 0 0 0.6rem; font-size: 0.93rem; color: var(--text-soft); }
.pub-abstract { margin: 0 0 0.7rem; font-size: 0.93rem; color: var(--text-soft); max-width: 70ch; }
.pub-award { margin: 0 0 0.6rem; font-size: 0.88rem; color: var(--accent); }

.badge {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  border-radius: 5px;
  margin-right: 0.5rem;
  font-family: var(--sans);
  vertical-align: 0.05em;
}
.badge-review { background: #fbeede; color: #9a6212; }
.badge-pub { background: #e2f0e4; color: #2f7a3e; }
.badge-prep { background: var(--bg-soft); color: var(--text-muted); }
[data-theme="dark"] .badge-review { background: #3a2e1a; color: #e0a553; }
[data-theme="dark"] .badge-pub { background: #1d3322; color: #74c98a; }

.pub-links { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.pub-links a {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.22rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--sans);
}
.pub-links a:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); }

/* A paper's link sits at the end of its venue line, as [Paper] does on the
   CV, instead of taking a line of its own. */
.pub-link {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0 0.55rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.65;
  border: 1px solid var(--border);
  border-radius: 5px;
  white-space: nowrap;
  vertical-align: 0.05em;
}
.pub-link:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); }
.pub-body > :last-child { margin-bottom: 0; }

/* ---------------- Timeline: date left, entry right ---------------- */
/* Used for experience, education, talks, awards and news. */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  display: grid;
  grid-template-columns: var(--label-w) minmax(0, 1fr);
  column-gap: 1.25rem;
  margin: 0 0 1.5rem;
}
.timeline > li:last-child { margin-bottom: 0; }
.timeline-compact > li { margin-bottom: 0.75rem; }
.timeline-compact .t-body { font-size: 0.96rem; }

.t-date {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
  padding-top: 0.22rem;
  font-variant-numeric: tabular-nums;
}
.t-body { min-width: 0; }
.t-body > :last-child { margin-bottom: 0; }

/* A small label over a group of timeline entries (Industry, Sponsored
   Research), so a list grouped by kind does not read as out of date order. */
.group-label {
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
}
.timeline + .group-label { margin-top: 2.2rem; }

.exp-role { font-weight: 600; color: var(--text); margin: 0; line-height: 1.5; }
.exp-org { color: var(--accent); font-size: 0.95rem; margin: 0.1rem 0 0.4rem; }
.exp-desc { margin: 0; font-size: 0.95rem; color: var(--text-soft); }
.exp-links { margin-top: 0.6rem; }

.edu-detail {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.edu-detail li { margin-bottom: 0.2rem; }
.edu-detail li:last-child { margin-bottom: 0; }

.talk-title { font-size: 1.08rem; line-height: 1.4; margin: 0 0 0.35rem; }
.talk-venue { color: var(--text-soft); font-size: 0.93rem; margin: 0 0 0.15rem; }
.talk-venue + .pub-award { margin-top: 0.35rem; }
.pub-award + .talk-venue { margin-top: -0.3rem; }

.award-text, .news-text { color: var(--text-soft); }

/* ---------------- Label rows: service, papers, skills ---------------- */
.row {
  display: grid;
  grid-template-columns: var(--label-w) minmax(0, 1fr);
  column-gap: 1.25rem;
}
.row + .row { margin-top: 1.5rem; }
.row-label { color: var(--text-muted); font-size: 0.86rem; line-height: 1.5; padding-top: 0.22rem; }
.row-body { color: var(--text-soft); font-size: 0.96rem; min-width: 0; }
.row-body p { margin: 0 0 0.4rem; }
.row-body ul { margin: 0; padding-left: 1.1rem; }
.row-body li { margin-bottom: 0.35rem; }
.row-body li:last-child { margin-bottom: 0; }
.row-body li .pub-award { margin: 0.1rem 0 0; }

.skills-list { margin: 0; }
.skill-row {
  display: grid;
  grid-template-columns: var(--label-w) minmax(0, 1fr);
  column-gap: 1.25rem;
}
.skill-row + .skill-row { margin-top: 0.75rem; }
.skill-row dt { color: var(--text-muted); font-size: 0.86rem; line-height: 1.5; padding-top: 0.2rem; }
.skill-row dd { margin: 0; color: var(--text-soft); font-size: 0.95rem; line-height: 1.6; }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 2rem; }
.site-footer p {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.6rem 2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ---------------- Responsive ---------------- */
/* Below this width the links take their own row under the name, with the
   theme toggle staying top right; every page stays one tap away, with no
   menu to open. The seven links need about 870px on one row beside the name;
   the extra 30px covers fallback fonts wider than Inter. */
@media (max-width: 900px) {
  .nav-links { order: 1; flex-basis: 100%; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav { padding: 0.7rem 1.25rem; }
  .nav-links { gap: 0.15rem 1rem; }
  main { padding: 1.9rem 1.25rem 0.5rem; }

  .hero { flex-direction: column; align-items: flex-start; gap: 1.1rem; }
  .avatar { width: 124px; height: 124px; }
  .hero-name { font-size: 1.9rem; }
  .page-title { font-size: 1.7rem; }

  .pub { grid-template-columns: 1.9rem 1fr; }

  .timeline > li,
  .row,
  .skill-row { grid-template-columns: 1fr; }
  .t-date, .row-label, .skill-row dt { padding-top: 0; }
  .thread .row { grid-template-columns: 1fr; }

  .site-footer p { padding: 1.4rem 1.25rem; }
}
