/* ==========================================================================
   Dharani Nadendla — personal research website
   Light, cream background; color is reserved for links and highlights.
   ========================================================================== */

:root {
  --bg: #fbf9f4;            /* page: warm cream */
  --surface: #ffffff;       /* cards */
  --surface-alt: #f4efe5;   /* tags, code, subtle fills */
  --ink: #1f1d1a;           /* body text */
  --ink-2: #45413a;         /* secondary text */
  --muted: #5f5a51;         /* dates, captions */
  --rule: #e4ddd0;          /* borders */
  --accent: #1d4e89;        /* links */
  --accent-strong: #123a68; /* link hover */
  --accent-soft: #e8eef6;   /* link-pill hover fill */
  --highlight: #9c3510;     /* my name in author lists */
  --ok: #2f6b3f;            /* "Accepted" tag text */
  --focus: #c2410c;         /* keyboard focus ring */

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 12px;
  --max: 1000px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5.5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;      /* 17px */
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 {
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.25;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.1rem, 4.5vw, 2.8rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }

p { margin: 0 0 1em; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }

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

.container { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  z-index: 100;
  background: var(--surface);
  color: var(--accent);
  padding: 0.6rem 1rem;
  border: 2px solid var(--accent);
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header & navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 249, 244, 0.96);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: saturate(1.2) blur(6px);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.site-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
}
.site-name:hover { color: var(--accent); text-decoration: none; }

.site-nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
}
.site-nav a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.98rem;
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ---------- Sections ---------- */
main { display: block; }
.section { padding-top: 2.25rem; padding-bottom: 0; }
.section > h2, .section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.4rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.section-head h2 { margin: 0; border: 0; padding: 0; }
.section-head a { margin-left: auto; font-size: 0.98rem; font-weight: 500; font-family: var(--sans); }

.page-intro { padding-top: 2.5rem; padding-bottom: 0; }
.page-intro + .section { padding-top: 1rem; }
.page-intro .note { margin-bottom: 0; }
.pub-list > .pub:last-child, .entries > .entry:last-child { margin-bottom: 0; }
.page-intro .lead { max-width: 46rem; }

.lead { font-size: 1.15rem; color: var(--ink-2); }

/* ---------- Hero (home) ---------- */
.hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.75rem;
  align-items: center;
  padding-top: 3.25rem;
  padding-bottom: 1rem;
}
.portrait {
  width: 240px; height: 240px;
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid var(--surface);
  box-shadow: 0 0 0 1px var(--rule), 0 10px 30px rgba(60, 45, 20, 0.12);
}
.hero h1 { margin-bottom: 0.15em; }
.role {
  margin: 0 0 0.5rem;
  color: var(--ink-2);
  font-size: 1.08rem;
}
.role strong { color: var(--ink); font-weight: 600; }
.affil {
  margin: 0 0 1.1rem;
  color: var(--ink-2);
  font-size: 1.02rem;
}
.statement {
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 1.4rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}
.statement strong { font-weight: 700; }

/* Labeled profile links (icon + visible text: no mystery icons) */
.profile-links {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  min-height: 44px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 500;
  font-size: 0.97rem;
  text-decoration: none;
}
.pill:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.pill svg { width: 18px; height: 18px; flex: none; fill: currentColor; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.5rem;
  align-items: start;
}
.about-grid p { max-width: 40rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}
.glance h3 {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.6rem;
}
.glance h3:not(:first-child) { margin-top: 1.25rem; }
.glance ol, .glance ul { list-style: none; margin: 0; padding: 0; }
.glance li { margin-bottom: 0.7rem; line-height: 1.4; }
.glance li:last-child { margin-bottom: 0; }
.glance .what { display: block; font-weight: 600; }
.glance .where { display: block; color: var(--ink-2); font-size: 0.95rem; }
.glance p { margin: 0; line-height: 1.45; }

/* ---------- Research interests (own section, beside Education) ---------- */
.interests { margin-top: 2rem; }
.interest-list {
  list-style: none;
  margin: 0; padding: 0;
  max-width: 40rem;
}
.interest-list li {
  border-left: 3px solid var(--accent);
  padding: 0.15rem 0 0.15rem 1rem;
  margin-bottom: 1.1rem;
}
.interest-list li:last-child { margin-bottom: 0; }
.interest-list h3 { font-size: 1.12rem; margin: 0 0 0.2rem; }
.interest-list p { margin: 0; color: var(--ink-2); }

/* ---------- News ---------- */
.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--rule);
}
.news li:last-child { border-bottom: 0; }
.news time {
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.news p { margin: 0; }

/* ---------- Publications ---------- */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  margin-bottom: 1rem;
}
.pub-title {
  font-size: 1.12rem;
  margin: 0 0 0.35rem;
  line-height: 1.4;
}
.pub-authors, .pub-venue { margin: 0 0 0.2rem; color: var(--ink-2); }
.pub-venue em { color: var(--ink); }
.pub-summary { margin: 0.6rem 0 0; }
.me { color: var(--highlight); font-weight: 700; }
.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--ink-2);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.6;
}
.tag.accepted { color: var(--ok); background: #e9f2ea; }
.tag.review { color: #7a4a00; background: #fbf0d9; }
.tag.preprint { color: var(--accent); background: var(--accent-soft); }

.pub-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  background: var(--surface);
}
.pub-link:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }

details.bibtex { flex-basis: 100%; }
details.bibtex summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  background: var(--surface);
}
details.bibtex summary:hover { border-color: var(--accent); background: var(--accent-soft); }
details.bibtex[open] summary { margin-bottom: 0.6rem; }
details.bibtex pre {
  margin: 0;
  padding: 0.9rem 1rem;
  background: var(--surface-alt);
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ink);
}
.pub-meta details.bibtex { flex-basis: auto; }
.pub-meta details.bibtex[open] { flex-basis: 100%; }

.note { color: var(--muted); font-size: 0.97rem; }

/* ---------- Research page ---------- */
.focus {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.6rem 1.6rem 1.2rem;
}
.focus .kicker {
  display: inline-block;
  margin-bottom: 0.6rem;
}
.focus p { max-width: 46rem; }

.steps {
  list-style: none;
  margin: 1.5rem 0 0.5rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  counter-reset: step;
}
.steps li {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.15rem;
}
.steps .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.55rem;
}
.steps h3 { margin-bottom: 0.25rem; }
.steps .q { font-style: italic; color: var(--ink); margin-bottom: 0.4rem; }
.steps p { margin: 0; color: var(--ink-2); font-size: 0.99rem; }
/* decorative arrows between steps on wide screens */
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 2.05rem;
  right: -0.85rem;
  width: 0.7rem; height: 0.7rem;
  border-top: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  transform: rotate(45deg);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.work-grid .card h3 { margin-bottom: 0.35rem; }
.work-grid .card p { color: var(--ink-2); }
.work-grid .card ul { margin: 0; padding-left: 1.1rem; }
.work-grid .card li { margin-bottom: 0.35rem; }

.toolbox { display: grid; grid-template-columns: 9rem 1fr; gap: 0.5rem 1.25rem; margin: 0; }
.toolbox dt { font-weight: 600; }
.toolbox dd { margin: 0; color: var(--ink-2); }

/* ---------- Teaching & service ---------- */
.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 0.85rem;
}
.entry h3 { margin: 0; font-size: 1.08rem; }
.entry .org { margin: 0; color: var(--ink-2); }
.entry .when {
  margin: 0;
  grid-row: 1;
  grid-column: 2;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.entry .desc { grid-column: 1 / -1; margin: 0.35rem 0 0; color: var(--ink-2); }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.contact-grid h3 {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.contact-grid address { font-style: normal; line-height: 1.5; }
.contact-grid p { margin: 0 0 0.3rem; }
.contact-grid ul { list-style: none; margin: 0; padding: 0; }
.contact-grid li { margin-bottom: 0.3rem; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.97rem;
}
.footer-inner { padding-top: 1.75rem; padding-bottom: 2rem; }
.footer-inner p { margin: 0 0 0.35rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; list-style: none; margin: 0.5rem 0 0.75rem; padding: 0; }
.updated { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .steps li:not(:last-child)::after {
    top: auto; bottom: -0.85rem; right: auto; left: 2rem;
    transform: rotate(135deg);
  }
}

@media (max-width: 720px) {
  body { font-size: 1rem; }
  .hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-top: 2rem;
    justify-items: start;
  }
  .portrait { width: 168px; height: 168px; }
  .statement { font-size: 1.15rem; }
  .work-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .news li { grid-template-columns: 1fr; gap: 0.1rem; }
  .entry { grid-template-columns: 1fr; }
  .entry .when { grid-row: auto; grid-column: 1; }
  .toolbox { grid-template-columns: 1fr; }
  .toolbox dd { margin-bottom: 0.6rem; }
  .section-head { flex-wrap: wrap; }
  .section-head a { margin-left: 0; }
  .site-header { position: static; }
  html { scroll-padding-top: 1rem; }
}

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

@media print {
  .site-header, .skip-link, .site-footer { display: none; }
  body { background: #fff; }
  .pub, .card, .entry, .focus { border-color: #ccc; box-shadow: none; }
  a { color: #000; }
}
.focus .focus-title { font-size: 1.4rem; }
.pub-list + .note { margin-top: 0.75rem; }
