/* Theme from the original patelneer.com (Once UI's Magic Portfolio): Geist, gray/cyan/red Once UI colors,
   light theme, the dotted glow, and the profile column on the side.
   Page layout and content flow inspired by Nicklas Hansen and Kevin Yuanbo Wu. */

/* Geist (SIL OFL 1.1, see fonts/OFL.txt), self-hosted: one variable font file per subset, as Google Fonts serves it */
@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/geist-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/geist-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --page-bg: #ffffff;
  --text-strong: #0a0a0a;
  --text-medium: #595959;
  --text-weak: #707070;
  --brand-weak: #0279be;
  --brand-tint: rgba(2, 121, 190, 0.07);
  --brand-border: rgba(2, 121, 190, 0.25);
  --link-strong: #3f3f3f;
  --accent-weak: #e90507;
  --border-medium: #e0e0e0;
  --border-strong: #d2d2d2;
  --alpha-faint: rgba(149, 149, 149, 0.04);
  --alpha-weak: rgba(149, 149, 149, 0.1);
  --alpha-medium: rgba(149, 149, 149, 0.3);
  --surface: rgba(255, 255, 255, 0.3);
  --dots: #60e4fc;
  --code-bg: #f3f3f3;
  color-scheme: light;
}

/* Dark colors, used only if data-theme="dark" is set on <html> (light is the default) */
:root[data-theme="dark"] {
  --page-bg: #0a0a0a;
  --text-strong: #ffffff;
  --text-medium: #e0e0e0;
  --text-weak: #b2b2b2;
  --brand-weak: #17c0fd;
  --brand-tint: rgba(23, 192, 253, 0.12);
  --brand-border: rgba(23, 192, 253, 0.35);
  --link-strong: #ededed;
  --accent-weak: #ff9689;
  --border-medium: #3f3f3f;
  --border-strong: #595959;
  --surface: rgba(0, 0, 0, 0.3);
  --dots: #094074;
  --code-bg: #151515;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; font-size: 16px; scroll-padding-top: 24px; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-strong);
  font-family: Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--alpha-medium);
  text-underline-offset: 0.2em;
  transition: color 0.2s, text-decoration-color 0.2s;
}
a:hover, a:focus { color: var(--brand-weak); text-decoration-color: var(--brand-weak); }

h1, h2 { color: var(--text-strong); font-weight: 600; }
h2 {
  margin: 3rem 0 1.5rem;
  font-size: 2.5rem;
  line-height: 3rem;
  letter-spacing: -0.02em;
}
p { margin: 0 0 1rem; }
img, video { display: block; }
sup { font-size: 0.7em; line-height: 0; vertical-align: super; }
.muted { color: var(--text-weak); }
.todo { background: #fff3cd; color: #7a5b00; border-radius: 4px; padding: 0 4px; font-weight: 400; }

/* Dotted glow at the top of the viewport */
.background {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(100vh at 50% 0%, #000 0, transparent 100%);
  mask-image: radial-gradient(100vh at 50% 0%, #000 0, transparent 100%);
}
.background-dots {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 2px 2px;
}

/* Section navigator on the left edge (wide screens only): a line per section, longer and darker for the one in view */
.section-nav { display: none; }
@media (min-width: 1100px) {
  .section-nav {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    position: fixed;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
  }
  .section-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 1.25rem;
    color: var(--text-weak);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s;
  }
  .section-nav a::before {
    content: "";
    flex: none;
    width: 1rem;
    height: 1px;
    background: currentColor;
    transition: width 0.2s, background-color 0.2s;
  }
  .section-nav a:hover, .section-nav a:focus-visible { color: var(--text-strong); }
  .section-nav a.active { color: var(--text-strong); }
  .section-nav a.active::before { width: 1.75rem; height: 2px; background: var(--brand-weak); }
  .section-nav span { display: none; }
}
@media (min-width: 1280px) {
  .section-nav span { display: inline; }
}

/* Layout: profile column on the side, the page beside it */
.layout {
  display: flex;
  max-width: 64rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 0;
}
.profile {
  flex: 3;
  min-width: 10rem;
  position: sticky;
  top: 4rem;
  height: fit-content;
  padding: 0 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.page { flex: 9; max-width: 40rem; min-width: 0; }

.profile-pic {
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}
.location { display: flex; align-items: center; gap: 0.5rem; }
.globe { width: 1.5rem; height: 1.5rem; color: var(--accent-weak); }

.profile-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--alpha-weak);
  border-radius: 0.75rem;
  background: none;
  color: var(--text-strong);
  font: inherit;
  font-size: 0.825rem;
  line-height: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.button:hover, .button:focus { color: var(--text-strong); background: var(--alpha-weak); border-color: var(--alpha-medium); }
.button svg { width: 1rem; height: 1rem; fill: currentColor; flex-shrink: 0; }
.button svg.stroke-icon { fill: none; }
.profile-buttons .button { width: 2.5rem; height: 2.5rem; padding: 0; justify-content: center; }
.profile-buttons .button svg { width: 1.25rem; height: 1.25rem; }

/* Icon links (sticky bar) */
.icon-links { display: inline-flex; align-items: center; gap: 1rem; }
.icon-links a { display: inline-flex; color: var(--text-strong); }
.icon-links a:hover, .icon-links a:focus { color: var(--brand-weak); }
.icon-links svg { width: 22px; height: 22px; fill: currentColor; }

/* Sticky bar: only on phones, where the profile column is not pinned */
.sticky-nav { display: none; }

/* Name, subtitle and email under the photo */
.profile-id { text-align: center; }
.profile-name { margin: 0; font-size: 2.25rem; line-height: 2.5rem; letter-spacing: -0.03em; }
.profile-subtitle { margin: 0.375rem 0 0.25rem; color: var(--text-weak); font-size: 1.125rem; line-height: 1.5rem; font-weight: 300; }
.profile-email { margin: 0; color: var(--text-weak); font-size: 0.95rem; }

/* Skill tags */
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.tag {
  padding: 0.25rem 1rem;
  border: 1px solid var(--border-medium);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--text-medium);
  font-size: 0.825rem;
  line-height: 1rem;
}

.first-heading { margin-top: 0; }
.bio { font-size: 1.125rem; line-height: 1.6; }
.bio p { margin-bottom: 1.5rem; }
/* Research interests: blue pills, so they stand apart from the grey skill tags in the profile */
.interests { display: flex; flex-wrap: wrap; align-items: center; gap: 0.625rem 0.75rem; margin-bottom: 1.5rem; }
.interests-label { font-weight: 600; }
.interest-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.interest-tags li {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--brand-border);
  border-radius: 1rem;
  background: var(--brand-tint);
  color: #026fad;
  font-size: 0.95rem;
  line-height: 1.25rem;
  white-space: nowrap;
}

/* News */
.news-section { margin-top: 0.5rem; }
.news-card {
  padding: 0.75rem 1.25rem 1rem;
  border: 1px solid var(--border-medium);
  border-radius: 0.75rem;
  background: var(--alpha-faint);
}
.news-wrap { position: relative; }
/* --news-cut is the bottom of the third update, set by the script; the fourth fades out below it */
.news-wrap.collapsed {
  --news-cut: 9rem;
  max-height: calc(var(--news-cut) + 2.5rem);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 var(--news-cut), transparent);
  mask-image: linear-gradient(to bottom, #000 var(--news-cut), transparent);
}
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: flex; gap: 1.5rem; padding: 0.25rem 0; }
.news .date { flex-shrink: 0; width: 5rem; color: var(--text-weak); font-variant-numeric: tabular-nums; }
.news-role, .news-accent { color: var(--brand-weak); }
.news-toggle {
  display: block;
  margin: 0.5rem auto 0;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--alpha-weak);
  border-radius: 0.75rem;
  background: none;
  color: var(--text-strong);
  font: inherit;
  font-size: 0.825rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.news-toggle:hover { background: var(--alpha-weak); border-color: var(--alpha-medium); }
.news-toggle[hidden] { display: none; }

/* Research, publication and project items */
.item {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1rem;
  margin: 0 -1rem;
  border-radius: 0.75rem;
  transition: background-color 0.2s;
}
.item:hover { background: var(--alpha-weak); }
.item-media {
  flex-shrink: 0;
  width: 13.75rem;
  aspect-ratio: 16 / 9;
  margin-top: 0.25rem;
  object-fit: cover;
  border: 1px solid var(--border-medium);
  border-radius: 0.75rem;
  background: var(--surface);
}
.item-media.natural { aspect-ratio: auto; height: auto; }
.item-body { flex: 1; min-width: 0; }
/* Research items: title and meta across the full width, then the media beside the description */
.item.stacked { display: block; }
.item-row { display: flex; align-items: flex-start; gap: 1.25rem; margin-top: 0.5rem; }
.item-row .item-media { margin-top: 0; }
.item-row .item-desc { flex: 1; min-width: 0; margin: 0; }
/* Meta and venue lines with the dates or equal-contribution note at the right end of the first line */
.item-meta-row { display: flex; align-items: flex-start; column-gap: 1rem; }
.item-meta-row > :first-child { flex: 1; min-width: 0; }
.item-date, .eq-note { flex: none; white-space: nowrap; }
.item-title { margin: 0; font-size: 1.2rem; line-height: 1.6rem; font-weight: 600; color: var(--text-strong); }
.item-title a { text-decoration: none; }
.item-title a:hover { color: var(--link-strong); text-decoration: underline; text-decoration-color: var(--link-strong); }
.item-meta, .item-venue { margin: 0.25rem 0; color: var(--brand-weak); font-size: 0.875rem; line-height: 1.25rem; }
.item-meta { font-size: 0.9375rem; line-height: 1.375rem; }
.item-authors { margin: 0.25rem 0; color: var(--text-weak); font-size: 0.875rem; line-height: 1.25rem; }
.item-authors .me { color: var(--text-strong); font-weight: 600; white-space: nowrap; }
.eq-note { color: var(--text-weak); }
.item-desc { margin: 0.375rem 0 0.5rem; color: var(--text-weak); }
.item-links { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; font-size: 0.875rem; }
.item-links a, .bib-toggle {
  color: var(--link-strong);
  text-decoration: underline;
  text-decoration-color: var(--link-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: opacity 0.2s;
}
.item-links a:hover, .bib-toggle:hover { color: var(--link-strong); opacity: 0.8; }
.bib-toggle { border: none; background: none; padding: 0; font: inherit; cursor: pointer; }
.bibtex {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--code-bg);
  border: 1px solid var(--border-medium);
  border-radius: 0.75rem;
  color: var(--text-strong);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-x: auto;
}
.bibtex[hidden] { display: none; }

/* Footer and toast */
.footer {
  margin-top: 3.5rem;
  padding: 1rem 0 2rem;
  border-top: 1px solid var(--alpha-medium);
  color: var(--text-weak);
  font-size: 0.875rem;
}
.toast {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 200;
  transform: translate(-50%, 0.75rem);
  max-width: calc(100% - 2rem);
  padding: 0.5rem 1rem;
  border: 1px solid var(--alpha-weak);
  border-radius: 0.75rem;
  background: var(--page-bg);
  color: var(--text-strong);
  font-size: 0.875rem;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 8px 12px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Phones: the profile column stacks above the page, as on the original site */
@media (max-width: 768px) {
  html { font-size: 15px; scroll-padding-top: 3.5rem; }
  .layout { flex-direction: column; padding: 1.5rem 1rem 0; }
  .profile { position: static; padding: 0 0 1.5rem; gap: 1rem; }
  .profile-pic { width: 150px; height: 150px; }
  .profile-name { font-size: 2.25rem; line-height: 2.5rem; }
  h2 { font-size: 2rem; line-height: 2.5rem; }

  .sticky-nav {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--page-bg) 85%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--alpha-medium);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
  }
  .sticky-nav.visible { transform: translateY(0); }
  .sticky-inner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 1rem; }
  .sticky-name { font-weight: 600; color: var(--text-strong); text-decoration: none; white-space: nowrap; }
  .sticky-nav .icon-links { gap: 0.875rem; }
  .sticky-nav .icon-links svg { width: 19px; height: 19px; }

  .item, .item-row { flex-direction: column; gap: 0.75rem; }
  .item-media { width: 100%; max-width: 25rem; margin: 0 auto; }
  .news li { flex-direction: column; gap: 0; padding: 0.3rem 0; }
  .news .date { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .sticky-nav, .toast, .item, .button, .news-toggle, .section-nav a, .section-nav a::before { transition: none; }
}
