/* =========================================================
   Animesh Sachan — academic homepage
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root {
  color-scheme: light;
  --bg:        #ffffff;
  --surface:   #f6f8f9;
  --surface-2: #eef1f3;
  --border:    #e2e7ea;
  --text:      #15212b;
  --muted:     #5a6a76;
  --accent:    #2563eb;        /* blue-600 */
  --accent-ink:#1d4ed8;        /* blue-700 */
  --on-accent: #ffffff;
  --shadow:    0 1px 2px rgba(16, 35, 45, 0.06), 0 8px 24px rgba(16, 35, 45, 0.06);
  --radius:    14px;
  --maxw:      1000px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #0e1418;
  --surface:   #151d23;
  --surface-2: #1c262d;
  --border:    #27343d;
  --text:      #e8eef2;
  --muted:     #9bacb8;
  --accent:    #60a5fa;        /* blue-400 */
  --accent-ink:#93c5fd;        /* blue-300 */
  --on-accent: #0b1220;
  --shadow:    0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;        /* long tokens (URLs, emails) never overflow */
  transition: background-color 0.25s ease, color 0.25s ease;
}
img { max-width: 100%; }

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

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Skip-link lands focus on <main>; don't draw a box around the whole page */
main:focus { outline: none; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg); /* fallback for browsers without color-mix() */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav__brand {
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav__brand:hover { text-decoration: none; color: var(--accent); }
.nav__links {
  margin-left: auto;
  display: flex;
  gap: 22px;
}
.nav__links a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 4px 0;
  border-bottom: 3px solid transparent;
}
.nav__links a:hover { color: var(--text); text-decoration: none; }
.nav__links a.is-active { color: var(--text); border-bottom-color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle:active { transform: scale(0.94); }

/* ---------- Layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
  padding: 56px 0 40px;
}
.hero__eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hero__name {
  margin: 0 0 8px;
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: var(--accent);          /* name in the accent (blue) */
}
.hero__role { margin: 0 0 18px; color: var(--muted); font-size: 1.02rem; }
.hero__tagline { margin: 0 0 24px; font-size: 1.08rem; max-width: 52ch; }

.hero__photo img {
  width: 420px;
  height: 550px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ---------- Buttons ---------- */
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; transform: translateY(-1px); }
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn--primary:hover { background: var(--accent-ink); color: var(--on-accent); }

/* ---------- Tags ---------- */
.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags li {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- Sections ---------- */
.section { padding: 36px 0; border-top: 1px solid var(--border); }
.section__title {
  margin: 0 0 18px;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  position: relative;
  padding-bottom: 8px;
}
.section__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 38px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.section__note { margin: -6px 0 18px; color: var(--muted); font-size: 0.9rem; }

.prose p { margin: 0 0 16px; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Publications ---------- */
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.pub {
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.pub:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.pub__badge {
  flex: none;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 4px 9px;
  border-radius: 7px;
  margin-top: 2px;
}
.pub__body { min-width: 0; }
.pub__title { margin: 0 0 6px; font-size: 1.05rem; line-height: 1.35; font-weight: 700; }
.pub__authors { margin: 0 0 3px; font-size: 0.95rem; }
.pub__venue { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.pub__links { display: flex; flex-wrap: wrap; gap: 8px; }
.pub__links a {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 3px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
}
.pub__links a:hover { background: var(--surface-2); text-decoration: none; border-color: var(--accent); }

/* ---------- News ---------- */
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.news__item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  align-items: baseline;
}
.news__date {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.news__text { color: var(--text); }

/* ---------- Contact ---------- */
.contact__list { margin: 0; }
.contact__row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.contact__row:last-child { border-bottom: none; }
.contact__row dt { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.contact__row dd { margin: 0; }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px 24px 48px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }
.footer__copy { margin: 0; }
.footer__socials { justify-content: center; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  /* Drop the brand text to make room, keep section links reachable */
  .nav__inner { padding: 10px 16px; gap: 10px; }
  .nav__brand { display: none; }
  .nav__links {
    margin-left: 0;
    flex: 1;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 0.82rem;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 36px 0 28px;
    text-align: center;
  }
  .hero__photo { order: -1; }
  .hero__photo img { width: 160px; height: 180px; }
  .hero__actions, .tags { justify-content: center; }
  .hero__tagline { margin-left: auto; margin-right: auto; }
  .news__item, .contact__row { grid-template-columns: 1fr; gap: 2px; }
  .pub { flex-direction: column; gap: 10px; }
  .hero .socials { justify-content: center; }
}

/* =========================================================
   ADDED COMPONENTS — multi-page build
   ========================================================= */

/* ---------- active page in nav ---------- */
.nav__links a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- page headings (dedicated pages) ---------- */
.section--first { border-top: none; padding-top: 40px; }
.page-title {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
  position: relative;
  padding-bottom: 10px;
}
.page-title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 46px; height: 3px; border-radius: 3px; background: var(--accent);
}

/* ---------- social icon links ---------- */
.socials { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero__text .socials { margin: 0 0 22px; }
.social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: 50%;
  color: var(--muted); background: var(--surface);
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .1s ease;
}
.social:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.social svg { display: block; }
.social--off { opacity: .4; }              /* URL not set yet (href="#") */
.social--off:hover { transform: none; color: var(--muted); border-color: var(--border); }

/* ---------- "show all" buttons ---------- */
.more { margin-top: 20px; }

/* ---------- publication: Cite + BibTeX ---------- */
.pub__cite {
  font-size: 0.82rem; font-weight: 600; font-family: inherit;
  padding: 3px 11px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text); cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.pub__cite:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
.pub__cite.is-copied { border-color: var(--accent); color: var(--accent); }
.pub__bibtex {
  margin: 12px 0 0; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem; line-height: 1.5; color: var(--text);
  overflow-x: auto; white-space: pre;
}
.pub__bibtex[hidden] { display: none; }

/* ---------- news: year groups ---------- */
.news-year { margin-bottom: 30px; }
.news-year:last-child { margin-bottom: 0; }
.news-year__label {
  margin: 0 0 14px; font-size: 1.3rem; font-weight: 800;
  letter-spacing: -0.01em; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- experience: vertical timeline ---------- */
.timeline { position: relative; margin: 12px 0; }
.timeline::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 2px; background: var(--border); transform: translateX(-50%);
}
.tl-item { position: relative; width: 50%; padding: 14px 40px; }
.tl-item--left  { left: 0;   text-align: right; }
.tl-item--right { left: 50%; text-align: left; }
.tl-dot {
  position: absolute; top: 26px; width: 14px; height: 14px;
  background: var(--accent); border: 3px solid var(--bg);
  border-radius: 50%; z-index: 1;
}
.tl-item--left  .tl-dot { right: -7px; }
.tl-item--right .tl-dot { left: -7px; }
.tl-card {
  display: inline-block; text-align: left; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.tl-period {
  display: inline-block; margin-bottom: 6px;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent);
}
.tl-role { margin: 0 0 3px; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.tl-org { margin: 0 0 8px; color: var(--muted); font-size: 0.92rem; }
.tl-points { margin: 0; padding-left: 18px; font-size: 0.92rem; }
.tl-points li { margin-bottom: 4px; }

/* ---------- teaching: tiles ---------- */
.tiles {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tile {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .2s ease;
}
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.tile__term {
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent);
}
.tile__course { margin: 6px 0 4px; font-size: 1.02rem; font-weight: 700; line-height: 1.3; }
.tile__meta { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; }
.tile__points { margin: 0 0 12px; padding-left: 18px; font-size: 0.9rem; }
.tile__points li { margin-bottom: 4px; }
.tile__link { margin-top: auto; font-weight: 600; font-size: 0.9rem; }

/* ---------- timeline + tiles: mobile ---------- */
@media (max-width: 640px) {
  .timeline::before { left: 7px; }
  .tl-item, .tl-item--left, .tl-item--right {
    width: 100%; left: 0; text-align: left; padding: 10px 0 10px 30px;
  }
  .tl-item--left .tl-dot, .tl-item--right .tl-dot { left: 1px; right: auto; }
  .tiles { grid-template-columns: 1fr; }
}
