/* ==========================================================================
   Aneesh Krishna — portfolio
   ========================================================================== */

/* ----- Theme tokens ----- */
:root {
  --bg: #fcfbf9;
  --bg-alt: #f4f2ec;
  --surface: #ffffff;
  --text: #201f1d;
  --muted: #6c6960;
  --faint: #94908a;
  --border: #e7e2d8;
  --border-strong: #d8d2c6;
  --accent: #2f5d8a;
  --accent-soft: #eaf0f6;
  --accent-contrast: #ffffff;
  --shadow: 0 1px 2px rgba(30, 28, 24, .04), 0 8px 28px rgba(30, 28, 24, .06);
  --shadow-lift: 0 2px 6px rgba(30, 28, 24, .06), 0 18px 44px rgba(30, 28, 24, .10);
  --radius: 16px;
  --radius-sm: 10px;
  --wrap: 1080px;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #15151a;
  --bg-alt: #1b1b22;
  --surface: #1e1e26;
  --text: #eceae6;
  --muted: #a6a29a;
  --faint: #767268;
  --border: #2c2c35;
  --border-strong: #3a3a45;
  --accent: #86b3e0;
  --accent-soft: #22303f;
  --accent-contrast: #12121a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .35);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .35), 0 20px 46px rgba(0, 0, 0, .5);
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }
::selection { background: var(--accent); color: var(--accent-contrast); }

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

/* ----- Layout helpers ----- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.section { padding: 84px 0; border-top: 1px solid var(--border); }
.section.alt { background: var(--bg-alt); }
.icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle; flex: none; }

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

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

/* ----- Header ----- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .3s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 20px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-contrast);
  font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: .01em;
}
.brand-name { font-family: var(--serif); font-size: 18px; }

.nav { display: flex; align-items: center; gap: 26px; }
.nav a { color: var(--muted); font-size: 15px; font-weight: 500; position: relative; padding: 4px 0; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1.5px;
  background: var(--accent); transition: right .25s ease;
}
.nav a:hover::after, .nav a.active::after { right: 0; }
.nav a.active { color: var(--text); }
.nav-cv {
  color: var(--text) !important; border: 1px solid var(--border-strong);
  padding: 6px 14px !important; border-radius: 999px;
}
.nav-cv::after { display: none; }
.nav-cv:hover { border-color: var(--accent); color: var(--accent) !important; }

.header-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--bg-alt); }
:root[data-theme="dark"] .icon-btn:hover { background: var(--surface); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline-block; }

.menu-toggle { display: none; flex-direction: column; gap: 4px; }
.menu-toggle span { width: 18px; height: 1.8px; background: currentColor; border-radius: 2px; transition: .25s ease; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.8px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.8px) rotate(-45deg); }

.mobile-nav { display: none; flex-direction: column; padding: 8px 28px 20px; border-bottom: 1px solid var(--border); }
.mobile-nav a { padding: 12px 0; color: var(--text); border-bottom: 1px solid var(--border); font-size: 16px; }
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav.open { display: flex; }

/* ----- Hero ----- */
.hero { padding: 68px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 56px; align-items: center; }

.eyebrow {
  margin: 0 0 14px; font-size: 12.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent);
}
.hero-name { font-size: clamp(2.6rem, 6vw, 3.9rem); margin: 0 0 18px; letter-spacing: -0.02em; }
.hero-affil { font-size: 1.15rem; color: var(--text); margin: 0 0 20px; line-height: 1.55; }
.hero-bio p { color: var(--muted); margin: 0 0 14px; }
.hero-bio strong, .hero-affil a { color: var(--text); font-weight: 600; }
.hero-affil a { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.hero-affil a:hover { text-decoration-color: var(--accent); color: var(--accent); }

.interests {
  list-style: none; padding: 0; margin: 22px 0 26px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.interests li {
  font-size: 13px; color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); padding: 5px 12px; border-radius: 999px;
}

.contact-row { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-row a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 500;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.contact-row a:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.contact-row .icon { color: var(--muted); }
.contact-row a:hover .icon { color: var(--accent); }

.hero-photo {
  position: relative; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-lift); border: 1px solid var(--border);
  aspect-ratio: 4 / 5; background: var(--bg-alt);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }

/* ----- Section heads ----- */
.section-head { max-width: 760px; margin-bottom: 40px; }
.section-head.sub { margin-top: 52px; margin-bottom: 22px; }
.section-label {
  margin: 0 0 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent);
}
.section-head h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin: 0; }
.h2-sub { font-size: 1.4rem !important; }
.section-intro { color: var(--muted); font-size: 1.08rem; margin: 16px 0 0; }

/* ----- News ----- */
.news-list { list-style: none; margin: 0; padding: 0; max-width: 820px; }
.news-list li {
  display: grid; grid-template-columns: 108px 1fr; gap: 20px;
  padding: 18px 0; border-top: 1px solid var(--border);
}
.news-list li:first-child { border-top: none; }
.news-date { color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.news-body { color: var(--text); }
.news-body strong { font-weight: 600; }
.news-tag {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: 2px 8px; border-radius: 5px; margin-right: 8px; position: relative; top: -1px;
}

/* ----- Research features ----- */
.feature {
  display: grid; grid-template-columns: 0.92fr 1.08fr; gap: 40px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 26px; box-shadow: var(--shadow);
}
.feature-textonly { grid-template-columns: 1fr; padding: 34px 38px; }
.feature-stacked { grid-template-columns: 1fr; padding: 12px; }
.feature-stacked .feature-media { aspect-ratio: 16 / 9; max-height: 440px; }
.feature-stacked .feature-body { padding: 12px 26px 26px; max-width: none; }
.feature-media { border-radius: 12px; overflow: hidden; align-self: stretch; background: var(--bg-alt); }
.feature-media img { width: 100%; height: 100%; object-fit: cover; min-height: 220px; }
.feature-body { padding: 22px 24px 26px; }
.feature-textonly .feature-body { padding: 0; max-width: 820px; }
.feature-body h3 { font-size: 1.5rem; margin: 12px 0 14px; }
.feature-body p { color: var(--muted); margin: 0 0 14px; }
.feature-body em { font-style: italic; color: var(--text); }
.feature-body strong { color: var(--text); font-weight: 600; }

.tag {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
  background: var(--bg-alt); border: 1px solid var(--border); padding: 4px 10px; border-radius: 6px;
}
.tag-current { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 20px; }
.chips span {
  font-size: 12.5px; color: var(--muted); background: var(--bg-alt);
  border: 1px solid var(--border); padding: 4px 11px; border-radius: 999px;
}
.feature-links { display: flex; flex-wrap: wrap; gap: 18px; }
.link-arrow { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 15px; }
.link-arrow .icon { width: 17px; height: 17px; }
.link-arrow:hover { text-decoration: none; }
.link-arrow:hover span, .link-arrow:hover { color: var(--accent); }

.field-photo {
  margin: 34px 0 0; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface);
}
.field-photo img { width: 100%; max-height: 460px; object-fit: cover; object-position: center 35%; }
.field-photo figcaption { padding: 14px 20px; font-size: 14px; color: var(--muted); }

/* ----- Publications ----- */
.pub-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.pub {
  display: grid; grid-template-columns: 76px 1fr; gap: 24px;
  padding: 26px 0; border-top: 1px solid var(--border);
}
.pub:first-child { border-top: none; }
.pub-year { font-family: var(--serif); font-size: 1.25rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.pub-type {
  display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.pub-main h3 { font-size: 1.24rem; font-weight: 500; margin: 0 0 8px; line-height: 1.3; }
.pub-authors { margin: 0 0 4px; color: var(--text); font-size: .98rem; }
.pub-authors strong { font-weight: 600; }
.pub-venue { margin: 0 0 12px; color: var(--muted); font-size: .95rem; }
.pub-links { display: flex; flex-wrap: wrap; gap: 16px; }
.pub-links a { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 500; }
.pub-links .icon { width: 15px; height: 15px; }

/* ----- Timeline ----- */
.timeline { position: relative; }
.tl-item {
  display: grid; grid-template-columns: 190px 1fr; gap: 30px;
  padding: 24px 0; border-top: 1px solid var(--border);
}
.tl-item:first-child { border-top: none; }
.tl-date { color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 4px; }
.tl-content h3 { font-size: 1.24rem; font-weight: 500; margin: 0 0 3px; }
.tl-org { color: var(--accent); font-size: .92rem; font-weight: 500; margin: 0 0 9px; }
.tl-org a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.tl-content p:last-child { color: var(--muted); margin: 0; }

/* ----- Education ----- */
.edu-list { list-style: none; margin: 0; padding: 0; }
.edu {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 20px; align-items: center;
  padding: 20px 0; border-top: 1px solid var(--border);
}
.edu:first-child { border-top: none; }
.edu-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; }
:root[data-theme="dark"] .edu-logo { background: #fff; padding: 4px; }
.edu-main h3 { font-size: 1.16rem; font-weight: 500; margin: 0 0 3px; }
.edu-org { margin: 0; color: var(--muted); font-size: .95rem; }
.edu-date { color: var(--faint); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }

/* ----- Footer ----- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding-top: 72px; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; padding-bottom: 52px; }
.footer-lead h2 { font-size: 2rem; margin: 0 0 14px; }
.footer-lead p { color: var(--muted); margin: 0 0 22px; max-width: 460px; }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-contrast);
  padding: 12px 22px; border-radius: 10px; font-weight: 500; font-size: 15px;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lift); opacity: .95; }
.footer-side { justify-self: end; text-align: right; }
.footer-social { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 14px; }
.footer-social a {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  color: var(--muted); border: 1px solid var(--border); background: var(--surface);
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.footer-social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.footer-meta { color: var(--faint); font-size: 14px; margin: 0; }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px; border-top: 1px solid var(--border);
}
.footer-bottom p { margin: 0; color: var(--faint); font-size: 14px; }
.to-top { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.to-top .icon { width: 16px; height: 16px; }
.to-top:hover { color: var(--accent); text-decoration: none; }

/* ----- Reveal animation (only when JS is active, so no-JS still shows content) ----- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ----- Responsive ----- */
@media (max-width: 900px) {
  .nav { display: none; }
  .menu-toggle { display: flex; }
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-photo { max-width: 340px; order: -1; }
  .feature { grid-template-columns: 1fr; }
  .feature-media img { min-height: 220px; max-height: 320px; }
  .feature-body { padding: 6px 14px 18px; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .section { padding: 60px 0; }
  .wrap { padding: 0 20px; }
  .hero { padding: 44px 0 24px; }
  .brand-name { display: none; }
  .news-list li { grid-template-columns: 1fr; gap: 4px; }
  .news-date { padding-top: 0; }
  .pub { grid-template-columns: 1fr; gap: 8px; }
  .pub-year { font-size: 1rem; }
  .tl-item { grid-template-columns: 1fr; gap: 6px; }
  .edu { grid-template-columns: 36px 1fr; row-gap: 4px; }
  .edu-logo { width: 36px; height: 36px; }
  .edu-date { grid-column: 2; text-align: left; }
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }
  .footer-side { justify-self: start; text-align: left; }
  .footer-social { justify-content: flex-start; }
  .feature-textonly { padding: 24px 22px; }
}
