/* ---------- Theme ---------- */
/* Warm light theme. Change these to restyle the whole site. */
:root {
  color-scheme: light;
  --bg: #fdfaf5;            /* warm paper */
  --surface: #ffffff;
  --text: #2b2735;
  --muted: #6c6578;
  --accent: #5a3fd1;        /* violet */
  --accent-soft: #f0ebff;
  --coral: #e5604a;
  --coral-soft: #fff0eb;
  --teal: #0e8a7d;
  --teal-soft: #e3f6f3;
  --border: #ebe5dc;
  --banner-from: #2e1f74;
  --banner-mid: #6a35c9;
  --banner-to: #d2557a;
  --radius: 12px;
  --max: 960px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
}

h1, h2, h3 {
  font-family: "Source Serif 4", Georgia, serif;
  line-height: 1.25;
  font-weight: 600;
}

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

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

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

/* ---------- Banner ---------- */
.banner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, var(--banner-from), var(--banner-mid) 55%, var(--banner-to));
  color: #fff;
  padding: 44px 0 36px;
}
.banner .container { position: relative; z-index: 1; }
/* Drifting brain-wave lines behind the name */
.banner .waves {
  position: absolute;
  inset: 0;
  width: 200%;
  height: 100%;
  opacity: 0.35;
  animation: drift 40s linear infinite;
}
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .banner .waves { animation: none; } }
.banner .name {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0;
  color: #fff;
}
.banner .name a { color: inherit; }
.banner .name a:hover { text-decoration: none; }
.banner .role {
  margin: 4px 0 0;
  opacity: 0.85;
  font-size: 1.05rem;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}
.nav a {
  display: block;
  padding: 14px 12px;
  color: var(--text);
  font-weight: 500;
}
.nav a:hover { color: var(--accent); text-decoration: none; }
.nav a.active {
  color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
  padding: 6px 12px;
  margin: 8px 0;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav .container { flex-wrap: wrap; }
  .nav ul {
    display: none;
    flex-direction: column;
    width: 100%;
    padding-bottom: 8px;
  }
  .nav ul.open { display: flex; }
  .nav a { padding: 10px 4px; }
  .nav a.active { box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
}

/* ---------- Main ---------- */
main.container { padding-top: 40px; padding-bottom: 64px; }
main h1 { font-size: 2rem; margin-top: 0; }
main h2 {
  font-size: 1.4rem;
  margin-top: 2.2em;
  padding-bottom: 8px;
  position: relative;
}
main h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--coral));
}

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

/* Home intro: photo + text */
.intro {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}
.intro img,
.photo-placeholder {
  width: 220px;
  height: 260px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 12px;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.links a {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.95rem;
}
.links a:hover { border-color: var(--accent); text-decoration: none; }

@media (max-width: 640px) {
  .intro { grid-template-columns: 1fr; }
  .intro img, .photo-placeholder { width: 180px; height: 210px; }
}

/* Cards (research projects, courses) */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h3 { margin: 0 0 6px; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); }
.tag {
  display: inline-block;
  font-size: 0.8rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 8px;
  margin: 8px 6px 0 0;
}

/* News / timeline lists */
.news { list-style: none; padding: 0; }
.news li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.news .date { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Publications */
.pubs { padding-left: 1.4em; }
.pubs li { margin-bottom: 14px; }
.pubs .title { font-weight: 600; }
.pubs .venue { font-style: italic; color: var(--muted); }
.pubs .me { font-weight: 600; }
.pubs .note { font-size: 0.9rem; color: var(--muted); }
.pub-links a {
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 6px;
  margin-right: 4px;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.gallery figure { margin: 0; }
.gallery img,
.gallery .photo-placeholder {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: zoom-in;
}
.gallery figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 4px; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-height: 90vh; border-radius: var(--radius); }

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 640px) { .contact-grid { grid-template-columns: 1fr; } }
.map {
  width: 100%;
  height: 280px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Colour accents ---------- */
.card {
  border-top: 3px solid var(--accent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:nth-child(3n+2) { border-top-color: var(--coral); }
.card:nth-child(3n+3) { border-top-color: var(--teal); }
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(60, 40, 120, 0.08);
}
.tag:nth-of-type(3n+2) { background: var(--coral-soft); color: var(--coral); }
.tag:nth-of-type(3n+3) { background: var(--teal-soft); color: var(--teal); }
.intro img { box-shadow: 0 10px 30px rgba(60, 40, 120, 0.15); }

/* ---------- Lab Notes ---------- */
.note-list { list-style: none; padding: 0; margin: 0; }
.note-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.note-list .date { color: var(--muted); font-variant-numeric: tabular-nums; }
.note-list h3 { margin: 0 0 4px; font-size: 1.2rem; }
.note-list p { margin: 0; color: var(--muted); }
@media (max-width: 560px) {
  .note-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* A single note (post) */
.post { max-width: 720px; }
.post-meta { color: var(--muted); margin-top: -8px; }
.post pre {
  background: #1e1a2e;
  color: #ede9fe;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
}
.post code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.post :not(pre) > code {
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}
.callout {
  background: var(--teal-soft);
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 20px 0;
}

/* Interactive simulation box: dark canvas so colours glow */
.sim {
  background: #120f22;
  color: #e9e5ff;
  border-radius: var(--radius);
  padding: 16px;
  margin: 24px 0;
  box-shadow: 0 12px 32px rgba(30, 15, 70, 0.25);
}
.sim canvas { width: 100%; display: block; border-radius: 8px; }
.sim .controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  margin-top: 12px;
  font-size: 0.95rem;
}
.sim label { display: flex; align-items: center; gap: 8px; }
.sim input[type="range"] { accent-color: #f08aa8; width: 160px; }
.sim button {
  background: linear-gradient(90deg, #7c5cff, #e5604a);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 16px;
  font: inherit;
  cursor: pointer;
}
.sim .readout { font-variant-numeric: tabular-nums; color: #f8c6d6; }
.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px;
}
@media (max-width: 640px) { .sim-grid { grid-template-columns: 1fr; } }
.sim-caption { font-size: 0.85rem; color: #b9b2d9; margin: 6px 0 0; }
