/* ---------------------------------------------------------------
   Aalok Tiwari — personal site
   Layout modelled after robertavaltorta.com:
   gray sticky header · full-width banner · two-column (sidebar + content)
   Plain CSS, no build step.
--------------------------------------------------------------- */

:root {
  --ink: #1f2328;
  --muted: #59636e;
  --faint: #8c959f;
  --line: #d0d7de;
  --bg: #ffffff;
  --header-bg: #f0f0f0;
  --accent: #0969da;
  --accent-soft: rgba(9,105,218,0.08);
  --accent2: #0f766e;
  --accent2-soft: rgba(15,118,110,0.08);
  --radius: 6px;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-head: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: Calibri, Candara, "Segoe UI", Optima, Arial, sans-serif;
  --profile-w: 210px;
  --content-maxw: 660px;
}

:root { color-scheme: light; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #dde4ed;
  --muted: #6b839e;
  --faint: #56687f;
  --line: #1a2535;
  --bg: #0d1117;
  --header-bg: #161b22;
  --accent: #58a6ff;
  --accent-soft: rgba(88,166,255,0.12);
  --accent2: #6ecfbb;
  --accent2-soft: rgba(110,207,187,0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
::selection { background: var(--accent-soft); color: var(--accent); }

a:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color .25s ease;
}

.header-inner {
  max-width: calc(var(--profile-w) + var(--content-maxw) + 120px);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.top-nav {
  display: flex;
  gap: 24px;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.top-nav a {
  text-decoration: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.88rem;
  transition: color .15s ease;
  white-space: nowrap;
}
.top-nav a:hover { color: var(--accent); text-decoration: underline; }
.top-nav a.active { color: var(--ink); font-weight: 600; }

.theme-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  transition: color .2s ease, border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Page layout ---------- */
.page-layout {
  max-width: calc(var(--profile-w) + var(--content-maxw) + 120px);
  margin: 0 auto;
  padding: 40px 32px 80px;
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

/* ---------- Profile sidebar ---------- */
.profile-col {
  flex: 0 0 var(--profile-w);
  position: sticky;
  top: 80px;
}

.profile-avatar {
  width: 100%;
  background: var(--header-bg);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.profile-avatar img { width: 100%; height: auto; display: block; }

.wip-label {
  font-family: var(--font-mono);
  font-size: 0.60rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  display: inline-block;
  margin-bottom: 12px;
}

.profile-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 2px;
}

.profile-title {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.4;
}

.profile-rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

.profile-dept {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.profile-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 16px;
}
.profile-links a {
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  line-height: 1;
}
.profile-links a svg { width: 18px; height: 18px; }
.profile-links a:hover { color: var(--accent); }

/* ---------- Content column ---------- */
.content-col {
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--content-maxw);
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--font-head); line-height: 1.3; font-weight: 700; text-align: left; }
h1 { font-size: 2.2rem; font-weight: 700; margin: 0 0 14px; }
h2 {
  font-size: 1.05rem;
  margin: 40px 0 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
h3 { font-size: 1rem; margin: 26px 0 4px; }

p { margin: 0 0 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.tagline { color: var(--muted); font-size: 0.95rem; margin: 0 0 18px; }
.small { font-size: 0.9rem; color: var(--faint); }
.muted { color: var(--muted); }

/* ---------- Button ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.80rem;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 5px 12px;
  border-radius: var(--radius);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); text-decoration: none; }

/* ---------- Publications ---------- */
.pub { margin-bottom: 22px; }
.pub:last-child { margin-bottom: 0; }
.pub .pubtext { margin: 0; line-height: 1.65; }
.pub .pubtext strong, .pub .pubtext b { font-weight: 600; color: var(--ink); }
.pub .pubtext em { font-style: normal; font-family: var(--font-mono); color: var(--muted); font-size: 0.92em; }
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.3px; text-transform: uppercase;
  color: var(--accent);
  margin-left: 6px; vertical-align: middle;
}
.tag::before { content: "["; }
.tag::after { content: "]"; }
.links-inline { font-family: var(--font-mono); font-size: 0.8rem; margin-top: 6px; }
.links-inline a { margin-right: 12px; }

/* ---------- Talks ---------- */
.talk { margin-bottom: 22px; }
.talk:last-child { margin-bottom: 0; }
.talk .meta { font-size: 0.82rem; color: var(--faint); font-family: var(--font-mono); }
.talk .t { font-weight: 500; }
.talk .kind {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 8px;
  vertical-align: middle;
}
.talk .kind::before { content: "["; }
.talk .kind::after { content: "]"; }
.kind-talk { color: var(--accent); }
.kind-poster { color: var(--accent2); }
.talk .t a { color: inherit; }
.cvitem .kind { margin-right: 8px; }

/* ---------- Section helpers ---------- */
.section-intro { color: var(--muted); font-size: 0.92rem; margin: 0 0 18px; }
.group-desc { font-size: 0.82rem; color: var(--muted); margin: -4px 0 10px; }
.subhead {
  font-size: 0.85rem;
  margin: 22px 0 10px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ---------- Expertise chips ---------- */
.expertise-group { margin: 14px 0 16px; }
.expertise-group h4 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--faint);
  font-weight: 600;
  margin: 0 0 9px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px 0; }
.chip { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink); line-height: 1.3; transition: color .18s ease; }
.chip:not(:last-child)::after { content: " \00b7 "; color: var(--faint); }
.chip:hover { color: var(--accent); }

/* ---------- CV grid entries ---------- */
.cvitem {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.cvitem:last-child { margin-bottom: 0; }
.cvitem .when { font-family: var(--font-mono); font-size: 0.82rem; color: var(--faint); padding-top: 2px; }
.cvitem .what strong { font-weight: 600; }
.cvitem .what .course { color: var(--muted); font-size: 0.92rem; margin-top: 3px; }
.cvitem .what .term { color: var(--faint); }
.cvlist { margin: 6px 0 4px; padding-left: 1.15em; }
.cvlist li { margin: 7px 0; }
.cvlist .cvlist { margin: 4px 0 0; font-size: 0.95em; color: var(--muted); }

/* ---------- Footer ---------- */
footer.site {
  padding: 24px 0 40px;
  color: var(--faint);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  text-align: center;
  border-top: 1px solid var(--line);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .page-layout {
    flex-direction: column;
    gap: 0;
    padding: 0 0 60px;
  }
  .profile-col {
    position: static;
    flex: none;
    width: 100%;
    display: flex;
    gap: 16px 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 20px 20px 16px;
    background: var(--header-bg);
  }
  .profile-avatar {
    width: 90px;
    flex: 0 0 90px;
    margin-bottom: 0;
  }
  .profile-text-block {
    flex: 1 1 160px;
  }
  .profile-links { flex-direction: row; flex-wrap: wrap; gap: 3px 14px; margin: 10px 0 0; }
  .content-col { max-width: none; padding: 28px 20px 0; }
}

@media (max-width: 500px) {
  .header-inner { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .top-nav { gap: 14px; justify-content: flex-start; }
  .top-nav a { font-size: 0.78rem; }
  .brand { font-size: 0.9rem; }
  body { font-size: 15px; }
  h1 { font-size: 1.6rem; }
  .banner-strip { height: 120px; }
  .cvitem { grid-template-columns: 1fr; gap: 3px; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .banner-strip, footer.site, .btn { display: none; }
  .page-layout { flex-direction: column; padding: 0; }
  .profile-col { position: static; background: none; }
  body { font-size: 11pt; color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
  .pub, .talk, .cvitem { break-inside: avoid; }
}
