/* =====================================================================
   Anirudh Wodeyar — academic website
   Plain CSS, no frameworks. Edit the variables below to restyle quickly.
   ===================================================================== */

:root {
  --accent: #2f6fb0;          /* main accent color (links, buttons) */
  --accent-dark: #245a91;
  --bg: #ffffff;              /* page background */
  --surface: #f6f8fa;         /* cards / subtle panels */
  --text: #1f2328;            /* main text */
  --muted: #5b6570;           /* secondary text */
  --border: #e3e7eb;
  --max-width: 820px;         /* content column width */
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
}

/* Dark mode: applied automatically if the visitor's system prefers dark. */
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #6ba8e0;
    --accent-dark: #8bbcec;
    --bg: #15181c;
    --surface: #1d2127;
    --text: #e6e9ed;
    --muted: #9aa3ad;
    --border: #2a2f36;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

/* ----------------------------- Header / nav ----------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  list-style: none;
  display: flex;
  gap: 22px;
  margin: 0;
  padding: 0;
}
.nav-links a { color: var(--muted); font-size: 0.96rem; font-weight: 500; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

/* Mobile menu toggle (pure CSS, no JS needed to open it) */
.nav-toggle, .nav-toggle-label { display: none; }

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

section { padding: 48px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

h1 { font-size: 2.1rem; margin: 0 0 6px; line-height: 1.2; }
h2 {
  font-size: 1.4rem;
  margin: 0 0 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
h3 { font-size: 1.08rem; margin: 0 0 8px; }

.section-lead { color: var(--text); margin-top: 0; }
.muted { color: var(--muted); font-size: 0.92em; }

/* ----------------------------- Hero ----------------------------- */
.hero {
  display: flex;
  gap: 32px;
  align-items: center;
  padding-top: 56px;
  flex-wrap: wrap;
}

.avatar {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
/* Shown only if profile.jpg is missing — displays the initials "AW". */
.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.6rem;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-color: var(--surface);
}

.intro { flex: 1; min-width: 260px; }
.tagline { font-size: 1.12rem; font-weight: 600; margin: 0 0 2px; color: var(--text); }
.affil { margin: 0 0 6px; color: var(--muted); }
.areas { margin: 6px 0 18px; color: var(--accent); font-weight: 600; letter-spacing: 0.2px; }

/* Pill links */
.links { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  display: inline-block;
  padding: 7px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ----------------------------- Research cards ----------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card p { margin: 0; color: var(--muted); font-size: 0.96rem; }

/* ----------------------------- Publications ----------------------------- */
.pub-list { list-style: none; counter-reset: pub; margin: 24px 0 0; padding: 0; }
.pub-list li {
  counter-increment: pub;
  position: relative;
  padding: 0 0 18px 38px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.pub-list li:last-child { border-bottom: none; }
.pub-list li::before {
  content: counter(pub);
  position: absolute;
  left: 0;
  top: 1px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pub-title { display: block; font-weight: 600; }
.pub-authors { display: block; color: var(--text); font-size: 0.95rem; }
.pub-venue { display: block; color: var(--muted); font-size: 0.92rem; font-style: italic; }

.pub-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  margin-bottom: 5px;
}
.pub-badge.preprint { color: var(--accent); border-color: var(--accent); }

/* ----------------------------- Contact ----------------------------- */
.contact-list { list-style: none; margin: 22px 0 0; padding: 0; }
.contact-list li {
  display: flex;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.contact-list li:last-child { border-bottom: none; }
.contact-label {
  flex: 0 0 120px;
  font-weight: 600;
  color: var(--muted);
}

/* ----------------------------- Footer ----------------------------- */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 20px 48px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { justify-content: center; text-align: center; padding-top: 40px; }
  .links { justify-content: center; }
  h1 { font-size: 1.8rem; }

  /* Collapse nav into a tap-to-open menu */
  .nav-toggle-label {
    display: block;
    cursor: pointer;
    width: 26px;
    height: 22px;
    position: relative;
  }
  .nav-toggle-label span,
  .nav-toggle-label span::before,
  .nav-toggle-label span::after {
    content: "";
    position: absolute;
    left: 0;
    width: 26px;
    height: 2.5px;
    background: var(--text);
    border-radius: 2px;
    transition: 0.2s;
  }
  .nav-toggle-label span { top: 10px; }
  .nav-toggle-label span::before { top: -8px; }
  .nav-toggle-label span::after { top: 8px; }

  .nav-links {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 13px 20px; border-top: 1px solid var(--border); }
  .nav-toggle:checked ~ .nav-links { max-height: 320px; }
  .contact-label { flex-basis: 100%; }
}

/* ----------------------------- Blog ----------------------------- */
.blog-index .section-lead { margin-bottom: 8px; }

.post-list { display: grid; gap: 16px; margin-top: 24px; }

.post-card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.post-card-date {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.post-card-title { display: block; font-size: 1.12rem; font-weight: 600; margin: 4px 0 6px; }
.post-card:hover .post-card-title { color: var(--accent); }
.post-card-summary { display: block; color: var(--muted); font-size: 0.96rem; }

/* A single post */
.post { padding-top: 48px; }
.post-header h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 6px; }
.post-meta { color: var(--muted); margin: 0 0 8px; }

.post-body { font-size: 1.02rem; }
.post-body h1, .post-body h2, .post-body h3 {
  line-height: 1.25;
  margin: 1.6em 0 0.5em;
  border: none;
  padding: 0;
  display: block;
}
.post-body h2 { font-size: 1.35rem; }
.post-body h3 { font-size: 1.12rem; }
.post-body p { margin: 0 0 1.1em; }
.post-body ul, .post-body ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.post-body li { margin: 0.3em 0; }
.post-body a { word-break: break-word; }
.post-body img,
.post-body video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 1.4em auto;
}
.post-body blockquote {
  margin: 1.2em 0;
  padding: 0.4em 1.1em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
}
.post-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  overflow: auto;
  font-size: 0.9rem;
}
.post-body code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.08em 0.4em;
  font-size: 0.92em;
}
.post-body pre code { background: none; border: none; padding: 0; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

.back-link { margin: 32px 0 8px; }
.back-link a { font-weight: 500; }

.notice {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.6;
}
.notice strong { color: var(--text); }
.notice code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  font-size: 0.92em;
}
