/* =========================================================
   Suresh Murugaiyan — personal academic website
   Clean, card-based academic layout (light theme)
   ========================================================= */

:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e2e5ea;
  --text: #24292f;
  --muted: #5b6470;
  --accent: #1f5fa8;
  --accent-hover: #164a86;
  --accent-soft: #eaf1fb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 6px rgba(16, 24, 40, 0.05);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 8px;
  --maxw: 1120px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
}

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

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  color: #1a1f26;
  margin: 0 0 0.6em;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }
ul { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: 0.35em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.75rem 0; }
img { max-width: 100%; height: auto; }
small, .muted { color: var(--muted); }

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

/* ---------- Header / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}
.brand {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: #1a1f26;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.site-nav {
  display: flex;
  gap: 0.25rem;
}
.site-nav a {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.site-nav a.active { color: var(--accent); }
.site-nav a.active::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  color: var(--text);
}
.nav-toggle svg { display: block; }

/* ---------- Page layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1.75rem;
  align-items: start;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 84px;
}
.profile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
}
.profile img {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 30%;
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px var(--border), 0 6px 18px rgba(16, 24, 40, 0.12);
  margin-bottom: 1rem;
}
.profile h2 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}
.profile .role {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.1rem;
}
.profile .role strong { color: var(--text); font-weight: 600; }

.social {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.social li { margin: 0; }
.social a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.95rem;
}
.social a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.social svg { width: 18px; height: 18px; flex: 0 0 18px; fill: currentColor; color: var(--muted); }
.social a:hover svg { color: var(--accent); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.tags span {
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
}

/* ---------- Content cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2.25rem;
  margin-bottom: 1.5rem;
}
.card > h1 {
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card h2 {
  margin-top: 1.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--accent);
}
.card h2:first-of-type { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.lead { font-size: 1.05rem; }

/* ---------- Interest grid ---------- */
.interest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.interest-grid li {
  padding-left: 1.25rem;
  position: relative;
}
.interest-grid li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Timeline entries (education, experience, projects) ---------- */
.entry {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 0.5rem 1.25rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}
.entry:last-child { border-bottom: 0; padding-bottom: 0; }
.entry:first-of-type { padding-top: 0.25rem; }
.entry .when {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  padding-top: 0.25rem;
}
.entry .what h3, .entry .what h4 { margin-bottom: 0.15rem; }
.entry .what .org a { color: inherit; }
.entry .what .org a:hover { color: var(--accent); }
.entry .what .sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.4rem; }
.entry .what ul { margin: 0.5rem 0 0; }
.entry .what p { margin-bottom: 0.4rem; }
.entry .what p:last-child, .entry .what ul:last-child { margin-bottom: 0; }

/* ---------- Publications ---------- */
.pub-note {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
.year {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin: 1.5rem 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed var(--border);
}
.pub {
  padding: 0.85rem 0 0.9rem;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: 0; }
.pub .title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.4;
  margin-bottom: 0.2rem;
}
.pub .authors { font-size: 0.95rem; margin-bottom: 0.15rem; }
.pub .authors .me { font-weight: 700; color: var(--text); }
.pub .venue { color: var(--muted); font-size: 0.92rem; font-style: italic; margin-bottom: 0.4rem; }
.pub .note { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.15rem; }
.pub .links { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.btn-link {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid #c9d7ea;
  border-radius: 4px;
  padding: 0.1rem 0.55rem;
  background: #fff;
}
.btn-link:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }

/* ---------- Figures ---------- */
figure {
  margin: 0 0 2rem;
  text-align: center;
}
figure img {
  display: block;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.75rem;
  padding: 0 0.5rem;
  line-height: 1.5;
}
figure.wide img { max-width: 100%; }
figure.narrow img { max-width: 440px; }
.fig-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem;
  margin-bottom: 2rem;
}
.fig-row figure { margin: 0; }
.fig-row figure img { max-width: 100%; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: contain; }
.fig-row figure img.fit { object-fit: contain; }
@media (max-width: 640px) {
  .fig-row { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 1.75rem 0 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-social {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
}
.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--muted);
}
.footer-social a:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.footer-social svg { width: 18px; height: 18px; fill: currentColor; }
.site-footer p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 1.25rem; padding-top: 1.25rem; }
  .sidebar { position: static; }
  .profile { padding: 1.5rem 1.25rem; }
  .social {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.15rem 0.5rem;
  }
  .card { padding: 1.5rem 1.25rem; }
  .entry { grid-template-columns: 1fr; gap: 0.15rem; }
  .entry .when { padding-top: 0; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    padding: 0.5rem 0.75rem 0.75rem;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 0.75rem 0.75rem; font-size: 0.85rem; }
  .site-nav a.active::after { display: none; }
  .site-nav a.active { background: var(--accent-soft); }
  .interest-grid { grid-template-columns: 1fr; }
  .social { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .nav-toggle { display: none; }
  body { background: #fff; }
  .card, .profile { box-shadow: none; border-color: #ccc; }
  .layout { display: block; }
}
