/* 1. Shared colors, typography, links, and keyboard focus. */
:root {
  color-scheme: dark;
  --bg: #101722;
  --surface: rgb(25 35 51 / 96%);
  --surface-strong: rgb(18 27 40 / 97%);
  --ink: #f0f4fa;
  --heading: #dce6f3;
  --text: #c3cede;
  --muted: #a0aec2;
  --link: #8cbfff;
  --link-hover: #b6d6ff;
  --border: #334156;
  --border-strong: #455570;
  --shadow: #00000040;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font:
    400 16px/1.7 "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 4px;
}
a:hover {
  text-decoration: underline;
}
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 5px;
  border-radius: 3px;
}
button {
  font: inherit;
}
[hidden] {
  display: none !important;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  padding: 10px 18px;
  background: var(--surface-strong);
  z-index: 20;
  transform: translateY(-150%);
}
.skip-link:focus {
  transform: translateY(0);
}
#life-background {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}
/* 2. Sticky section navigation. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface-strong);
  box-shadow: 0 1px 5px var(--shadow);
  backdrop-filter: blur(12px);
}
.navigation {
  max-width: 1264px;
  min-height: 66px;
  padding: 12px 32px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-size: 20px;
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--heading);
}
.nav-links a[aria-current] {
  color: var(--link);
}
/* 3. Homepage layout and portrait. */
main {
  max-width: 1028px;
  padding: 0 32px;
  margin: auto;
}
.panel {
  background: var(--surface);
  border-radius: 9px;
}
.introduction {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding-top: 34px;
  margin-bottom: 64px;
}
.portrait {
  padding: 16px;
  margin: 0;
}
.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 7px;
}
.portrait figcaption {
  margin-top: 15px;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.bio {
  padding: 32px;
}
h1,
h2,
h3 {
  color: var(--ink);
}
h1 {
  margin: 0 0 24px;
  font-size: clamp(29px, 3vw, 36px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.035em;
}
.biography p {
  font-size: 15px;
  line-height: 1.8;
  margin: 0 0 17px;
}
.biography .bio-note {
  margin-top: 26px;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 23px;
  margin-top: 24px;
}
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.contact-links svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 4. News, research, and project sections. */
.content-section {
  padding: 32px;
  margin-bottom: 40px;
}
h2 {
  margin: 0 0 25px;
  font-size: 27px;
  letter-spacing: -0.025em;
  line-height: 1.3;
  font-weight: 600;
}
.news-list {
  padding: 0;
  margin: 0;
  list-style: none;
}
.news-list li {
  display: grid;
  grid-template-columns: 102px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 16px;
  font-size: 14px;
}
.news-list li:last-child {
  margin-bottom: 0;
}
.news-list time {
  font-weight: 600;
  color: var(--heading);
}
.news-list p {
  margin: 0;
}
.entry {
  border-bottom: 1px solid var(--border);
  padding: 0 0 24px;
  margin: 0 0 24px;
}
.entry:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}
h3 {
  font-size: 16px;
  line-height: 1.55;
  font-weight: 600;
  margin: 0 0 8px;
}
.entry p {
  font-size: 14px;
  margin: 8px 0 0;
}
.entry .entry-meta {
  color: var(--muted);
  font-size: 13px;
}
.topics {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.topic {
  border: 1px solid;
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
}
.purple {
  color: #d6b7ff;
  background: #302440;
  border-color: #604779;
}
.green {
  color: #a1dfb6;
  background: #1c362c;
  border-color: #3e6652;
}
.blue {
  color: #a4d8f5;
  background: #1d3246;
  border-color: #3e607b;
}
.pink {
  color: #f0b7d5;
  background: #3b2739;
  border-color: #74516a;
}
.entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
}
.entry-header h3 {
  margin-bottom: 0;
}
.project-links {
  display: flex;
  gap: 12px;
  font-size: 12px;
}
/* 5. Footer and optional background-animation control. */
.site-footer {
  max-width: 1028px;
  margin: auto;
  padding: 4px 32px 32px;
  font-size: 11px;
  color: var(--muted);
}
.footer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}
.site-footer p {
  margin: 4px 0;
}
.motion-toggle {
  padding: 4px 10px;
  margin-top: 12px;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
}

/* 6. Separate CV page with a keyboard-accessible, two-page scroll preview. */
.cv-page {
  padding-top: 34px;
}
.cv-summary h2 {
  font-size: 16px;
  margin: 0 0 8px;
}
.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.cv-intro {
  margin: -10px 0 28px;
  font-size: 14px;
}
.cv-summary {
  border-block: 1px solid var(--border);
  padding: 25px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.cv-summary p {
  margin: 5px 0;
  font-size: 13px;
}
.cv-summary .document-meta {
  font-size: 12px;
  color: var(--muted);
}
.cv-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-shrink: 0;
}
.download-button {
  display: inline-flex;
  gap: 24px;
  align-items: center;
  padding: 12px 20px;
  border-radius: 5px;
  color: var(--bg);
  background: var(--link);
  font-weight: 500;
}
.download-button:hover {
  background: var(--link-hover);
  text-decoration: none;
}
.cv-preview {
  margin: 28px 0 0;
}
.cv-pdf-frame {
  position: relative;
  height: 75vh;
  height: 75svh;
  border: 1px solid var(--border-strong);
  background: var(--border);
}
/* Keep the PDF document in its original colors inside the dark page. */
.cv-pdf {
  color-scheme: light;
  color: #1a202c;
  position: absolute;
  inset: 0;
  overflow: auto;
}
.cv-pdf:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
}
.cv-preview figcaption {
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.get-in-touch {
  display: inline-block;
  margin-left: auto;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
}
.project-details {
  font-size: 13px;
  margin-top: 12px;
}
.project-details summary {
  color: var(--link);
  cursor: pointer;
  width: fit-content;
}
.project-details summary:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 5px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 760px) {
  .cv-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .cv-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 18px;
  }
}

/* 7. Responsive layout: portrait and bio stack on smaller screens. */
@media (max-width: 760px) {
  html {
    scroll-padding-top: 115px;
  }
  .navigation {
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .nav-links {
    gap: 22px;
  }
  .nav-links a {
    font-size: 13px;
  }
  main {
    padding: 0 20px;
  }
  .cv-page {
    padding-top: 28px;
  }
  .site-footer {
    padding-inline: 20px;
  }
  .introduction {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 28px;
    margin-bottom: 28px;
  }
  .portrait {
    width: 200px;
    justify-self: center;
  }
  .bio,
  .content-section {
    padding: 26px;
  }
  h1 br {
    display: none;
  }
  h1 {
    font-size: 29px;
  }
  h2 {
    font-size: 24px;
  }
  .content-section {
    margin-bottom: 24px;
  }
}
@media (max-width: 400px) {
  .navigation {
    gap: 6px;
  }
  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }
  main {
    padding: 0 14px;
  }
  .cv-page {
    padding-top: 28px;
  }
  .site-footer {
    padding-inline: 14px;
  }
  .bio,
  .content-section {
    padding: 22px;
  }
  .news-list li {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
/* 8. Honor accessibility preferences and simplify printing. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
@media print {
  body {
    background: white;
  }
  .site-header,
  #life-background,
  .motion-toggle,
  .skip-link {
    display: none;
  }
  main {
    max-width: none;
    padding: 0;
  }
  .introduction {
    padding-top: 0;
    margin-bottom: 24px;
  }
  .content-section {
    margin-bottom: 20px;
  }
  .entry {
    break-inside: avoid;
  }
  .cv-scroll {
    height: auto;
    overflow: visible;
    border: 0;
  }
}
