/* =========================================================
   Colours and fonts: change the look of the whole site here
   ========================================================= */
:root {
  --bg: #0a0e1a;                          /* page background (near-black navy) */
  --surface: rgba(17, 22, 42, 0.55);      /* card background (see-through) */
  --surface-hover: rgba(24, 30, 58, 0.7);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e6e8ef;
  --muted: #9aa3b5;
  --accent: #67e8f9;                      /* links and highlights (cyan) */
  --violet: #6d28d9;
  --violet-soft: #a78bfa;
  --cyan: #0891b2;
  --pink: #db2777;
  --indigo: #4338ca;

  --radius: 16px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;   /* stops the sticky nav covering section titles */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { max-width: 100%; }

a { color: var(--accent); }

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

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* =========================================================
   Animated gradient-blob background
   ========================================================= */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #121836 0%, var(--bg) 65%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

.blob--violet {
  width: 62vmax;
  height: 62vmax;
  top: -22vmax;
  left: -18vmax;
  background: radial-gradient(circle, var(--violet) 0%, transparent 68%);
  opacity: 0.55;
  animation-name: drift-a;
  animation-duration: 32s;
}

.blob--cyan {
  width: 58vmax;
  height: 58vmax;
  bottom: -26vmax;
  right: -20vmax;
  background: radial-gradient(circle, var(--cyan) 0%, transparent 68%);
  opacity: 0.5;
  animation-name: drift-b;
  animation-duration: 38s;
}

.blob--indigo {
  width: 46vmax;
  height: 46vmax;
  top: 40%;
  left: -12vmax;
  background: radial-gradient(circle, var(--indigo) 0%, transparent 68%);
  opacity: 0.35;
  animation-name: drift-b;
  animation-duration: 46s;
  animation-direction: alternate-reverse;
}

.blob--pink {
  width: 38vmax;
  height: 38vmax;
  top: 30%;
  left: 50%;
  background: radial-gradient(circle, var(--pink) 0%, transparent 68%);
  opacity: 0.18;
  animation-name: drift-c;
  animation-duration: 27s;
}

@keyframes drift-a {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(22vw, 14vh) scale(1.15); }
  100% { transform: translate(6vw, 34vh) scale(0.92); }
}

@keyframes drift-b {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-20vw, -12vh) scale(1.12); }
  100% { transform: translate(-6vw, -30vh) scale(0.95); }
}

@keyframes drift-c {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-26vw, -18vh) scale(1.3); }
  100% { transform: translate(-10vw, 12vh) scale(1); }
}

/* Fine film grain on top of the blobs (stops the gradients looking banded) */
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.07;
  mix-blend-mode: overlay;
}

/* =========================================================
   Navigation bar
   ========================================================= */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 14, 26, 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.nav__brand {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav__links {
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__links a {
  position: relative;
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.nav__links a:hover,
.nav__links a.is-active { color: var(--text); }

.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--violet-soft), var(--accent));
}

/* =========================================================
   Intro
   ========================================================= */
.hero { padding: 104px 0 72px; }

.hero__inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 48px;
}

.hero__photo {
  width: 188px;
  height: 188px;
  padding: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-soft), var(--accent));
  box-shadow: 0 0 70px -12px rgba(109, 40, 217, 0.75);
}

.hero__photo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
}

.hero__eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero__name {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(90deg, #ffffff 0%, #c4b5fd 55%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__affil {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero__thesis { margin: 0 0 22px; }

.hero__thesis-label {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 10px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 999px;
  background: rgba(109, 40, 217, 0.18);
  color: #c4b5fd;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.hero__thesis-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 500;
}

.hero__bio {
  max-width: 60ch;
  margin: 0 0 28px;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.pill svg {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
}

.pill:hover {
  border-color: rgba(103, 232, 249, 0.45);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

/* =========================================================
   Sections and cards
   ========================================================= */
.section { padding: 72px 0; }

.section__title {
  position: relative;
  margin: 0 0 6px;
  padding-left: 18px;
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.2;
}

.section__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--violet-soft), var(--accent));
}

.section__lead {
  max-width: 60ch;
  margin: 0 0 32px;
  padding-left: 18px;
  color: var(--muted);
}

.grid { display: grid; gap: 20px; }

.grid--interests { grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); }
.grid--projects  { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); }

.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(103, 232, 249, 0.3);
  background: var(--surface-hover);
  box-shadow: 0 20px 44px -20px rgba(109, 40, 217, 0.8);
}

.card__formula {
  display: flex;
  align-items: center;
  min-height: 2.4em;
  margin-bottom: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  color: var(--accent);
  font-size: 1.02rem;
}

.card__title {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
}

.card__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.97rem;
}

/* Projects */
.card.project { padding: 0; overflow: hidden; }

.project__media {
  height: 190px;
  border-bottom: 1px solid var(--border);
  background: #10142a;
}

.project__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project__body { padding: 24px; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.tag {
  padding: 3px 11px;
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 999px;
  background: rgba(109, 40, 217, 0.18);
  color: #c4b5fd;
  font-size: 0.78rem;
  font-weight: 500;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.btn-sm {
  padding: 4px 13px;
  border: 1px solid rgba(103, 232, 249, 0.35);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.btn-sm:hover {
  border-color: var(--accent);
  background: rgba(103, 232, 249, 0.1);
}

/* Publications */
.pub-year + .pub-year { margin-top: 36px; }

.pub-year__label {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.pub + .pub { margin-top: 16px; }

.pub__title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.35;
}

.pub__authors {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.pub__authors strong {
  color: var(--text);
  font-weight: 600;
}

.pub__venue {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.98rem;
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  padding: 40px 0 56px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.footer p { margin: 0; }

/* =========================================================
   Fade-in on scroll (turned on by js/main.js)
   ========================================================= */
.reveal-on .reveal { opacity: 0; }

.reveal-on .reveal.is-visible {
  opacity: 1;
  animation: reveal-in 0.7s ease backwards;
}

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* =========================================================
   Phones and small screens
   ========================================================= */
@media (max-width: 720px) {
  .hero { padding: 56px 0 48px; }

  .hero__inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 28px;
    text-align: center;
  }

  .hero__photo { width: 156px; height: 156px; }
  .hero__thesis-label { display: table; margin: 0 auto 6px; }
  .hero__bio { margin-left: auto; margin-right: auto; }
  .links { justify-content: center; }
  .section { padding: 56px 0; }
}

@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .nav__brand { display: none; }
  .nav__inner { justify-content: center; }
  .nav__links { gap: 24px; }
  .card { padding: 20px; }
  .project__media { height: 150px; }
  .project__body { padding: 20px; }
}

/* Visitors who ask their system for less motion get a still background */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .blob { animation: none; }
  .card, .pill { transition: none; }
  .card:hover, .pill:hover { transform: none; }
}
