:root {
  --gutter: #ffffff;
  --card: #ffffff;
  --text: #111114;
  --muted: #686b73;
  --soft: #3b3b42;
  --rule: #e4e4e7;
  --underline: #c4c4cc;
  --chip: #f4f4f5;
  --dot: #f2a516;
  --ascii: #f2f3f5;
  --ascii-flash: #d6d8dc;
  --ascii-hover: rgba(0, 0, 0, .45);
  --link: #1d6283;
  --link-line: rgba(29, 98, 131, .4);
  --on-link: #ffffff;
  --proj-bg: #fdf3e1; --proj-fg: #8a5a00; --proj-line: #f0d39c;
  --now-bg: #e7f6e9; --now-fg: #23803a; --now-line: #a9dcb2;
  --event-bg: #f1ecfd; --event-fg: #5b3fb5; --event-line: #cfc2f3;
  --banner: linear-gradient(100deg, #3e7b92, #66a9c6);
  --uni-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9.5 12 4l9 5.5M5 10v8M9.5 10v8M14.5 10v8M19 10v8M3 20h18'/%3E%3C/svg%3E");
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --gutter: #1a1b1f;
  --card: #1a1b1f;
  --text: #ececee;
  --muted: #7d8088;
  --soft: #b4b6bc;
  --rule: #2e3036;
  --underline: #454850;
  --chip: #2a2c32;
  --ascii: #26282d;
  --ascii-flash: #464a53;
  --ascii-hover: rgba(255, 255, 255, .5);
  --link: #7cc0de;
  --link-line: rgba(124, 192, 222, .4);
  --on-link: #1a1b1f;
  --proj-bg: #3a2f1a; --proj-fg: #f2c46d; --proj-line: #5c4823;
  --now-bg: #1d3524; --now-fg: #84d993; --now-line: #2f5a3a;
  --event-bg: #2b2442; --event-fg: #b9a6f5; --event-line: #45397a;
  --banner: linear-gradient(100deg, #24566a, #3b7f9c);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--gutter); }
body {
  margin: 0; background: var(--gutter); color: var(--text);
  font: 17.5px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
  min-height: 100vh; padding: 0;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--text); color: var(--card); }

/* ASCII background. Rows are laid out explicitly so layout.js can map the
   pointer position to a cell; the hover glow is driven from there. */
#ascii {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  font: 16px/24px var(--mono); color: var(--ascii);
  white-space: pre; user-select: none; pointer-events: none;
  opacity: 0; animation: fadeIn 1.5s ease .6s forwards;
}
#ascii span { transition: color .8s; }
#ascii span.hot { color: var(--ascii-hover); transition-duration: 0s; }
@keyframes fadeIn { to { opacity: 1; } }

/* Text gets the page colour directly behind its glyphs, so the ASCII field
   shows through every empty space, including between lines. */
.tb { background: var(--gutter); -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 2px 0; }
.pill { background: var(--gutter); }

/* fixed full-width top bar: nav centred, email + theme right */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: 68px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 0 32px;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--gutter) 72%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.me { font-size: 20px; font-weight: 600; letter-spacing: -.01em; color: var(--text); justify-self: start; }
.nav { grid-column: 2; display: flex; align-items: center; gap: 28px; font-size: 18px; }
.nav a.cv { background: var(--link); color: var(--on-link); font-weight: 500; padding: 3px 14px; border-radius: 6px; transition: opacity .15s; }
.nav a.cv:hover { opacity: .85; }
.nav a.cv { display: inline-flex; align-items: center; gap: 6px; }
.nav a.cv svg { width: 15px; height: 15px; }
.u { border-bottom: 1px solid var(--underline); padding-bottom: 1px; transition: border-color .15s; }
.u:hover { border-color: var(--text); }
.nav a.on { border-color: transparent; }
.nav a.on .tb { background: var(--chip); padding: 3px 10px; margin: 0 -10px; border-radius: 6px; }
.right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 16px; font-size: 18px; }
.icon { background: none; border: 0; padding: 4px; cursor: pointer; color: var(--muted); display: grid; }
.icon:hover { color: var(--text); }
.icon svg { width: 20px; height: 20px; }
.menu { display: none; }

/* fixed side panel: photo and contact details */
.side {
  position: fixed; top: 68px; bottom: 0; left: 0; z-index: 25; width: 300px;
  display: flex; flex-direction: column; padding: 36px 24px 28px; overflow-y: auto;
  border-right: 1px solid var(--rule);
}
/* round photo with a thin ring, separated by a gap in the page colour */
.side .avatar { width: 196px; height: 196px; border-radius: 50%; object-fit: cover; margin: 0 0 18px 12px; flex: none;
  padding: 6px; background: var(--gutter); border: 1.5px solid var(--underline); }
.side .lbl, .interests .lbl { font: 500 13px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 12px 10px; }
.interests > .lbl { padding: 0 6px 14px; font-size: 13.5px; color: var(--soft); }
.side .bio { margin: 0 0 20px; padding: 0 12px; font-size: 14.5px; line-height: 1.5; color: var(--soft); }
.contact { list-style: none; margin: 0; padding: 0 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; font-size: 15.5px; }
.contact li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact a, .contact li > span:last-child { overflow-wrap: anywhere; }
.contact .ic { display: grid; padding: 3px; border-radius: 5px; background: var(--gutter); color: var(--muted); }
.contact svg { width: 20px; height: 20px; }
.contact a .tb { border-bottom: 1px solid var(--underline); transition: border-color .15s; }
.contact a:hover .tb { border-color: var(--text); }
.contact li:hover .ic { color: var(--text); }
/* the page menu lives in the top bar; it only shows in the mobile drawer */
.side .mnav { display: none; }
.side nav { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.side nav a { padding: 5px 12px; border-radius: 8px; font-size: 19px; color: var(--text); }
.side nav a.on, .side nav a.on .tb { background: var(--chip); }

/* research interests, fixed on the right */
.interests {
  position: fixed; top: 68px; bottom: 0; right: 0; z-index: 25; width: 300px;
  padding: 40px 18px 28px; overflow-y: auto; border-left: 1px solid var(--rule);
}
.interests ul { list-style: none; margin: 0; padding: 0 6px; display: flex; flex-direction: column; gap: 10px; }
.interests:not(.custom) li { position: relative; padding-left: 18px; font-size: 16.5px; line-height: 1.4; color: var(--text); }
.interests:not(.custom) li::before { content: ""; position: absolute; left: 0; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--link); }

/* content column sits between the two panels, centred on the window */
body { padding: 0 300px; }
.card { position: relative; z-index: 1; width: auto; max-width: 880px; margin: 0 auto; padding: 108px 40px 64px; }
/* home is kept to roughly one screen */
.home h2 { margin-top: 36px; }
.home .name { font-size: 46px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 18px; }
.home.card { padding-top: 124px; padding-bottom: 24px; }
.home .name { margin-bottom: 4px; }
.home .sub { font-size: 18px; color: var(--muted); margin: 0 0 22px; }
.home .dotsep { margin: 0 6px; }
.banner { position: relative; max-width: 800px; margin: 0 0 24px; padding: 20px 24px 20px 54px;
  border-radius: 10px; background: var(--banner); color: #fff; font-size: 16.5px; line-height: 1.55; }
.banner p { margin: 0; }
.banner b { font-weight: 600; }
.banner a { text-decoration: underline; text-decoration-color: rgba(255,255,255,.6); text-underline-offset: 3px; }
.banner a:hover { text-decoration-color: #fff; }
.live { position: absolute; left: 24px; top: 26px; width: 12px; height: 12px; border-radius: 50%;
  background: #7ed36b; box-shadow: 0 0 0 4px rgba(126, 211, 107, .3); animation: live 2s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 7px rgba(126, 211, 107, .08); } }
.home .intro { max-width: 800px; font-size: 19px; }
.home .intro.soft { font-size: 17px; line-height: 1.65; margin-bottom: 16px; }
.home .intro b { font-weight: 600; color: var(--text); }
.home .intro a, .home .intro a b { color: var(--link); }
.home .intro a .tb { text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.home .intro a:hover .tb { text-decoration-color: var(--link); }

/* text */
.intro { font-size: 22px; line-height: 1.5; max-width: 640px; margin: 0 0 14px; }
.intro.soft { color: var(--soft); font-size: 18.5px; }
.pill { display: inline-flex; align-items: center; gap: 10px; margin-top: 12px;
  border: 1px solid var(--rule); border-radius: 999px; padding: 4px 13px;
  font: 12.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }

h1 { font-size: 36px; font-weight: 500; letter-spacing: -.01em; line-height: 1.25; margin: 0 0 10px; }
h2 { font-size: 24px; font-weight: 500; margin: 60px 0 14px; }
.head { display: flex; justify-content: space-between; align-items: baseline; }
.head .mono { color: var(--muted); }
p { margin: 0 0 14px; }
.lede { color: var(--soft); max-width: 680px; font-size: 18.5px; }
.mono { font-family: var(--sans); font-size: 15.5px; }
.muted { color: var(--muted); }

/* rows: articles, papers, jobs, projects */
.rows { border-top: 1px solid var(--rule); }
.r { display: grid; grid-template-columns: 130px 1fr auto; gap: 16px; align-items: baseline;
  padding: 15px 0; border-bottom: 1px solid var(--rule); }
.r .d { font: 15.5px var(--sans); color: var(--muted); }
.r .t { font-size: 19px; }
.r .s { color: var(--soft); font-size: 16.5px; margin-top: 4px; line-height: 1.55; }
.r .x { color: var(--muted); font: 15.5px var(--sans); text-align: right; }
a.r:hover .t { text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 3px; }
.chev { color: var(--muted); transition: transform .15s; }
a.r:hover .chev { transform: translateX(2px); color: var(--text); }
.tag { font: 12px var(--sans); color: var(--muted); border: 1px solid var(--rule); border-radius: 5px;
  padding: 0 5px; margin-left: 8px; vertical-align: 2px; }

/* collaboration note at the end of the home page */
.collab { max-width: 800px; margin: 22px 0 0; padding: 12px 18px; border-left: 3px solid var(--link);
  border-radius: 0 8px 8px 0; background: color-mix(in srgb, var(--link) 9%, var(--gutter)); font-size: 16px; line-height: 1.6; }
.collab b { font-weight: 600; color: var(--text); }
.collab a { color: var(--link); text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }

/* project list (research page), kept to one screen */
.proj.card { padding-top: 88px; padding-bottom: 24px; }
.plist { border-top: 1px solid var(--rule); margin-top: 14px; }
.p { display: grid; grid-template-columns: 108px 1fr; gap: 14px; align-items: start;
  padding: 9px 0; border-bottom: 1px solid var(--rule); }
.pd { font-size: 14px; color: var(--muted); padding-top: 2px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.type { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; }
.type.research { background: var(--link); color: var(--on-link); }
.type.project { background: var(--proj-bg); color: var(--proj-fg); border: 1px solid var(--proj-line); }
.pm { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 6px; }
.pt { font-size: 16.5px; font-weight: 600; margin-right: 6px; letter-spacing: -.005em; }
/* flairs look like highlighter strokes in a notebook: a soft, uneven band of colour behind the words */
.flair { --hl: 255, 214, 0; display: inline-block; font-size: 12.5px; font-weight: 500; line-height: 1.3; color: var(--text);
  padding: 1px 7px; border-radius: .8em .3em; white-space: nowrap;
  background-image: linear-gradient(100deg, rgba(var(--hl), .12), rgba(var(--hl), var(--hl-a, .55)) 6%, rgba(var(--hl), calc(var(--hl-a, .55) * .6)) 94%, rgba(var(--hl), .1));
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.flair.iiit { --hl: 120, 185, 235; }
.flair.now { --hl: 120, 215, 130; }
.flair.now::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%;
  background: #2f9a46; vertical-align: 1px; animation: live 2s ease-in-out infinite; }
.flair.event { --hl: 210, 160, 255; }
.flair.topic { --hl: 255, 176, 128; --hl-a: .32; }
:root[data-theme="dark"] .flair { --hl-a: .3; }
:root[data-theme="dark"] .flair.now::before { background: #84d993; }
.ps { font-size: 14.5px; color: var(--soft); line-height: 1.45; }
.prow { flex-basis: 100%; display: flex; align-items: baseline; gap: 12px; margin-top: 3px; }
.pl { display: flex; gap: 6px; margin-left: auto; flex: none; }
.lk { font-size: 12.5px; font-weight: 500; padding: 3px 9px; border-radius: 6px; white-space: nowrap; color: var(--link);
  border: 1px solid var(--link-line); background: var(--gutter); transition: background .15s, color .15s; }
.lk:hover { background: var(--link); color: var(--on-link); }

/* collaboration note (research page) */
.collab { margin: 0 6px; padding: 14px 16px; border-left: 3px solid var(--link);
  border-radius: 0 8px 8px 0; background: color-mix(in srgb, var(--link) 9%, var(--gutter)); font-size: 15px; line-height: 1.55; }
.collab b { display: block; margin-bottom: 4px; }
.collab b { font-weight: 600; color: var(--text); }
.collab a { color: var(--link); text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }

/* right panel variant: highlighted paper */
.interests.custom .lbl { padding: 0 6px 12px; font-size: 13.5px; color: var(--soft); }
.interests.custom .lbl.gap { margin-top: 28px; }
.paper { display: flex; flex-direction: column; gap: 8px; margin: 0 6px; padding: 16px; border-radius: 10px;
  background: color-mix(in srgb, var(--link) 10%, var(--gutter)); border: 1px solid color-mix(in srgb, var(--link) 35%, var(--gutter)); }
.paper .pbadge { align-self: flex-start; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px; background: var(--link); color: var(--on-link); }
.paper .pt2 { font-size: 17px; font-weight: 600; line-height: 1.4; }
.paper .pa { font-size: 14px; color: var(--soft); }

/* experience: vertical timeline with blue dots */
.exp.card { padding-top: 88px; padding-bottom: 24px; }
.tl { list-style: none; margin: 18px 0 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 167px; top: 8px; bottom: 8px; width: 2px; background: color-mix(in srgb, var(--link) 30%, var(--gutter)); }
.tl > li { display: grid; grid-template-columns: 148px 1fr; gap: 0 38px; position: relative; padding: 0 0 16px; line-height: 1.5; }
.tl > li::before { content: ""; position: absolute; left: 162px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--link); box-shadow: 0 0 0 4px var(--gutter); }
.tl-date { font-size: 14px; color: var(--muted); text-align: right; padding-top: 2px; white-space: nowrap; }
.tl-title { font-size: 17px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tl-org { font-size: 15px; color: var(--soft); margin-top: 1px; }
.tl-org a, .tl-desc a { color: var(--link); text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; }
.tl-desc { font-size: 14.5px; color: var(--soft); margin-top: 3px; line-height: 1.5; }
.tl-pts { margin: 4px 0 0; padding-left: 18px; font-size: 14.5px; color: var(--soft); line-height: 1.5; }
.tl-pts li { margin-bottom: 2px; }
.tl-pts li::marker { color: var(--link); }
.tl-pts b, .tl-desc b { color: var(--text); font-weight: 600; }
.interests .kit { list-style: none; margin: 0; padding: 0 6px; display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; }
.kit li { font-size: 13px; padding: 3px 10px; border: 1px solid var(--underline); border-radius: 999px; background: var(--gutter); }
.interests .comm { list-style: none; margin: 0; padding: 0 6px; display: flex; flex-direction: column; gap: 14px; }
.comm b { display: block; font-size: 15px; font-weight: 600; }
.comm span a { color: var(--link); text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 3px; font-weight: 500; }
.comm span { display: block; font-size: 13.5px; color: var(--soft); line-height: 1.45; margin-top: 2px; }

/* entrance */
.fade > * { animation: textFade .4s ease both; }
@keyframes textFade { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .fade > *, #ascii { animation: none; opacity: 1; } }

/* blog posts */
.article { max-width: 720px; }
.article .meta { font: 15.5px var(--sans); color: var(--muted); margin-bottom: 36px; }
.article h2 { margin-top: 40px; font-size: 23px; }
.article p, .article li { color: var(--soft); }
.article b, .article strong { color: var(--text); font-weight: 500; }
.article ul, .article ol { padding-left: 20px; }
.article li { margin-bottom: 6px; }
.article a { border-bottom: 1px solid var(--underline); }
code { font: .88em var(--mono); background: var(--chip); padding: 1px 5px; border-radius: 4px; color: var(--text); }
pre { background: var(--chip); padding: 14px 16px; border-radius: 10px; overflow-x: auto; font: 14.5px/1.6 var(--mono); }
pre code { background: none; padding: 0; }
table { border-collapse: collapse; margin: 14px 0 22px; font-size: 16.5px; }
th, td { text-align: left; padding: 7px 22px 7px 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 500; }
td { color: var(--soft); }

/* smaller laptop windows: scale the bar, panels and content (not the ASCII field)
   so each page still fits on one screen instead of scrolling */
:root { --z: 1; }
@media (min-width: 1181px) and (max-width: 1440px), (min-width: 1181px) and (max-height: 820px) { :root { --z: .95; } }
@media (min-width: 1181px) and (max-width: 1365px), (min-width: 1181px) and (max-height: 780px) { :root { --z: .9; } }
@media (min-width: 1181px) and (max-width: 1290px), (min-width: 1181px) and (max-height: 735px) { :root { --z: .85; } }
@media (min-width: 1181px) and (max-width: 1215px), (min-width: 1181px) and (max-height: 690px) { :root { --z: .8; } }
@media (min-width: 1181px) and (max-height: 645px) { :root { --z: .75; } }
.top, .side, .card, .interests { zoom: var(--z); }
body { padding: 0 calc(300px * var(--z)); }

/* narrower screens: interests drop below the page as chips */
@media (max-width: 1180px) {
  body { padding-right: 0; }
  .nav { gap: 20px; font-size: 17px; }
  .interests { position: relative; top: auto; bottom: auto; right: auto; z-index: 1; width: auto; max-width: 880px;
    margin: 0 auto; padding: 0 40px 56px; border: 0; overflow: visible; }
  .interests .lbl { padding: 0 0 12px; }
  .interests ul { flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 0; }
  .interests:not(.custom) li { padding: 4px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--gutter); font-size: 15.5px; }
  .interests li::before { display: none; }
  .interests.custom .lbl { padding: 0 0 10px; }
  .paper, .collab { margin: 0; }
}

@media (max-width: 820px) {
  body { padding: 0; }
  .side .mnav { display: block; margin-top: 28px; }
  .interests { padding: 0 16px 40px; }
  .top { padding: 0 12px 0 16px; }
  .nav { display: none; }
  .menu { display: grid; }
  .right .mail { display: none; }
  .side { width: 280px; background: var(--gutter); transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.18); }
  .card { margin: 0; padding: 88px 16px 40px; }
  .home .name { font-size: 36px; }
  .r { grid-template-columns: 1fr auto; gap: 2px 12px; }
  .r .d { grid-column: 1 / -1; }
  .p { grid-template-columns: 1fr; gap: 6px; }
  .pd { flex-direction: row; align-items: center; }
  .tl::before { left: 5px; } .tl > li { grid-template-columns: 1fr; padding-left: 28px; } .tl > li::before { left: 0; }
  .tl-date { text-align: left; }
  .prow { flex-direction: column; gap: 6px; }
  .pl { margin-left: 0; }
  .intro { font-size: 19.5px; }
  h2 { margin-top: 48px; }
}

/* writing page: newsletter sign-up and empty state */
.writing .lede b { color: var(--text); font-weight: 600; }
.news { margin: 28px 0 0; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--link) 35%, var(--gutter));
  border-radius: 10px; background: color-mix(in srgb, var(--link) 8%, var(--gutter)); display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.news-t { flex: 1 1 260px; }
.news-t b { display: block; font-size: 17px; font-weight: 600; }
.news-t span { display: block; font-size: 14.5px; color: var(--soft); margin-top: 2px; }
.news-b { flex: none; font: 600 15px var(--sans); color: var(--on-link); background: var(--link); border-radius: 7px; padding: 10px 18px; }
.news-b:hover { filter: brightness(1.08); }
.empty { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--rule); }
.empty p { margin: 10px 0 0; color: var(--soft); font-size: 16.5px; }
