/* Lean academic homepage — inspired by EricLee / MrSecant / AcadHomepage */

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

html, body, div, span, h1, h2, h3, p, a, img, section, footer {
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  vertical-align: baseline;
}

html {
  scroll-behavior: smooth;
}

/* —— Design tokens —— */
:root {
  --color-bg: #ffffff;
  --color-text: #222222;
  --color-text-secondary: #444444;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-accent: #111111;
  --color-accent-hover: #000000;
  --color-link: #111111;
  --content-max: 960px;
  --page-gutter: 1.125rem;
  --nav-height: 3.75rem;
  --radius-sm: 6px;
  --shadow-nav: 0 1px 0 rgba(17, 24, 39, 0.04), 0 4px 12px rgba(17, 24, 39, 0.03);
  --font-sans: "Asap", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* Type scale (philipflyg-aligned, 16px base) */
  --fs-xs: 0.875rem;   /* 14px — footer */
  --fs-sm: 0.9375rem;  /* 15px — notes */
  --fs-base: 1rem;     /* 16px — body copy */
  --fs-title: 1.05rem; /* paper titles */
  --fs-h2: 1.55rem;    /* section headings */
  --fs-h1: 2.1rem;     /* profile name */
  --fs-nav-brand: 1.2rem;
  --lh-tight: 1.25;
  --lh-body: 1.55;
  --lh-heading: 1.25;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-text-size-adjust: 100%;
}

/* —— Top nav (masthead: philipflyg-style hierarchy, light UI) —— */
#topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-nav);
}

.topnav-inner {
  max-width: var(--content-max);
  width: calc(100% - 2 * var(--page-gutter));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  min-height: var(--nav-height);
  padding: 0.625rem 0;
}

.topnav-brand {
  color: var(--color-accent);
  font-size: var(--fs-nav-brand);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
  padding: 0.5rem 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.topnav-brand:hover {
  color: var(--color-accent-hover);
  text-decoration: none;
}

.topnav-brand:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.topnav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.125rem;
}

.topnav-links a {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: var(--lh-tight);
  padding: 0.625rem 0.875rem;
  min-height: 2.75rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.15s var(--ease-out), background-color 0.15s var(--ease-out);
}

.topnav-links a::after {
  content: "";
  position: absolute;
  left: 0.875rem;
  right: 0.875rem;
  bottom: 0.375rem;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s var(--ease-out);
}

.topnav-links a:hover {
  color: var(--color-accent);
  background: rgba(17, 17, 17, 0.04);
  text-decoration: none;
}

.topnav-links a:hover::after {
  transform: scaleX(1);
}

.topnav-links a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  .topnav-links a,
  .topnav-links a::after {
    transition: none;
  }
}

#main {
  max-width: var(--content-max);
  width: calc(100% - 2 * var(--page-gutter));
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
  padding-bottom: 4rem;
}

a,
a:link,
a:visited {
  color: var(--color-link);
  text-decoration: none;
}

a:hover,
a:active {
  color: var(--color-accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

b, strong { font-weight: 700; }
i, em { font-style: italic; }

/* —— Personal Profile: photo left, text right; equal-height columns —— */
#profile {
  padding-top: 2.5rem;
  display: flex;
  align-items: stretch;
  gap: 2rem;
  scroll-margin-top: 5rem;
}

.profile-aside {
  flex: 0 0 12.75rem;
  width: 12.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.profile-photo {
  width: 12rem;
  height: 14rem;
  overflow: hidden;
  border-radius: 0.75rem;
  background: #f0f2f5;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
  flex-shrink: 0;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.profile-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  margin-top: 0.55rem;
  width: 100%;
  text-align: center;
}

.profile-links a,
.profile-links a:link,
.profile-links a:visited {
  color: var(--color-link);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.35;
}

.profile-links a:hover,
.profile-links a:active {
  color: #f09228;
  text-decoration: none;
}

.profile-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-text h1 {
  margin: 0;
  font-size: var(--fs-h1);
  line-height: var(--lh-heading);
  font-weight: 600;
  color: var(--color-text);
}

.profile-bio {
  margin-top: 0.75rem;
  color: var(--color-text);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
  word-break: normal;
}

.profile-bio a {
  white-space: normal;
}

.profile-bio p + p {
  margin-top: 0.75em;
}

/* —— Sections —— */
.content {
  padding-top: 2rem;
  border-top: 1px solid #eef1f4;
  margin-top: 2.25rem;
}

h2.section-heading {
  display: inline-block;
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  margin-top: 2.35rem;
  margin-bottom: 0.75rem;
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-bottom: 0.5rem;
  position: relative;
}

h2.section-heading::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--color-accent);
  border-radius: 999px;
}

.content > section:first-of-type > .section-heading {
  margin-top: 0;
}

section[id] {
  scroll-margin-top: 5rem;
}

.section-note {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin: 0 0 0.9rem;
  line-height: var(--lh-body);
}

/* —— Publications —— */
.publication {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding-bottom: 0.35rem;
}

.thumbnail {
  flex: 0 0 20rem;
  width: 20rem;
  display: block;
}

.thumbnail:hover { text-decoration: none; }

.thumbnail img,
.thumbnail video,
.thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  display: block;
  object-fit: cover;
}

.thumb-placeholder {
  background: linear-gradient(135deg, #eef1f5 0%, #dde3ea 100%);
  border: 1px dashed #c8d0d8;
}

.project-description { flex: 1 1 auto; min-width: 0; }

.project-description h3 {
  font-size: var(--fs-title);
  line-height: var(--lh-body);
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--color-text);
}

.project-description h3 a { color: var(--color-text); }

.project-description h3 a:hover { color: var(--color-link); }

.project-description .pub-meta {
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--color-text-secondary);
  margin: 0;
}

.venue-status {
  color: #f07c6a;
  font-style: normal;
  font-weight: 600;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-top: 0.55rem;
}

.pub-links .pub-link,
.pub-links .pub-link:link,
.pub-links .pub-link:visited {
  color: var(--color-link);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: var(--lh-tight);
  text-decoration: none;
}

.pub-links .pub-link:hover,
.pub-links .pub-link:active {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* —— Experience (EricLee-style) —— */
.experience-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.7rem;
}

.list-item.experience {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  line-height: var(--lh-body);
}

.exp-logo {
  flex: 0 0 3.75rem;
  width: 3.75rem;
  height: 3.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.exp-logo:hover {
  text-decoration: none;
}

.exp-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.exp-description {
  flex: 1 1 auto;
  min-width: 0;
}

.exp-description h3 {
  font-size: var(--fs-title);
  font-weight: 600;
  line-height: var(--lh-heading);
  margin-bottom: 0.12rem;
  color: var(--color-text);
}

.exp-description h3 a {
  color: inherit;
  text-decoration: none;
}

.exp-description h3 a:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.exp-description p {
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--color-text-secondary);
}

.exp-description p.exp-pi {
  margin-top: 0.1rem;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

.exp-description p.exp-pi a,
.exp-description p.exp-pi a:link,
.exp-description p.exp-pi a:visited {
  color: var(--color-link);
  text-decoration: none;
}

.exp-description p.exp-pi a:hover,
.exp-description p.exp-pi a:active {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.exp-description p.exp-date {
  margin-top: 0.18rem;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

/* —— Awards (title left, year right) —— */
.award-list {
  list-style: none;
  margin-top: 0.55rem;
}

.award-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0;
  line-height: var(--lh-body);
  font-size: var(--fs-base);
  color: var(--color-text);
}

.award-list .award-what {
  flex: 1 1 auto;
  min-width: 0;
}

.award-list .award-when {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* —— Footer —— */
#footer {
  margin-top: 2.5rem;
  color: var(--color-text-muted);
  font-size: var(--fs-xs);
  line-height: 1.8;
}

/* —— Mobile —— */
@media screen and (max-width: 768px) {
  :root {
    --page-gutter: 0.625rem;
    --nav-height: 3.5rem;
  }

  #main { width: calc(100% - 2 * var(--page-gutter)); }

  #profile {
    padding-top: 1.75rem;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
  }

  .topnav-inner {
    flex-wrap: wrap;
    align-items: center;
    padding: 0.5rem 0;
    gap: 0.25rem 1rem;
  }

  .topnav-brand {
    font-size: 1.1rem;
    padding: 0.35rem 0;
  }

  .topnav-links {
    width: 100%;
    justify-content: flex-start;
    margin-left: -0.25rem;
  }

  .topnav-links a {
    font-size: var(--fs-sm);
    padding: 0.5rem 0.65rem;
    min-height: 2.5rem;
  }

  .topnav-links a::after {
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.3rem;
  }

  .profile-aside {
    width: auto;
    flex: none;
  }

  .profile-photo {
    width: min(12rem, 48vw);
    height: min(14rem, 56vw);
  }

  .profile-text {
    width: 100%;
    max-width: none;
  }

  .profile-text h1 {
    text-align: center;
    font-size: 1.75rem;
  }

  .profile-bio {
    text-align: left;
    hyphens: manual;
  }

  .publication { flex-direction: column; gap: 0.65rem; }

  .thumbnail {
    flex: none;
    width: 100%;
    max-width: 28rem;
  }

  .list-item.experience {
    align-items: flex-start;
  }

  .exp-logo {
    flex-basis: 3.25rem;
    width: 3.25rem;
    height: 3.25rem;
  }

  .award-list li {
    gap: 0.75rem;
  }
}
