:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #555;
  --accent: #4f7399;
  --accent-hover: #365a7f;
  --accent-soft: rgba(79, 115, 153, 0.42);
  --accent-rail: var(--accent-soft);
  --accent-wash: rgba(79, 115, 153, 0.05);
  --border: #d9e1e8;
  --font-serif: "Crimson Pro", Georgia, serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  --max-width: 680px;
}

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

html {
  font-size: 19px;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(100%, var(--max-width));
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  font-weight: 500;
  line-height: 1.3;
  margin: 2rem 0 1rem;
  letter-spacing: 0;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.25rem;
  color: var(--text-muted);
  font-weight: 400;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1.25rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

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

main a:not(.download) {
  color: var(--accent-hover);
  padding: 0 0.06em;
  margin: 0 -0.06em;
  background-image:
    linear-gradient(var(--accent-wash), var(--accent-wash)),
    linear-gradient(var(--accent-soft), var(--accent-soft));
  background-repeat: no-repeat;
  background-position: 0 100%, 0 100%;
  background-size: 100% 0.08em, 0 100%;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: color 0.2s ease, background-size 0.24s ease;
}

main a:not(.download):hover {
  color: var(--text);
  background-size: 100% 0.08em, 100% 100%;
}

header {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  view-transition-name: site-header;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  transition: color 0.2s ease;
}

.site-title:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-muted);
  position: relative;
  padding: 0.1rem 0;
  transition: color 0.2s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.22s ease, background-color 0.22s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

.nav-links a:hover::after {
  background: var(--accent);
}

main {
  flex: 1;
  animation: page-in 0.34s ease both;
  view-transition-name: page-content;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(page-content) {
  animation: page-out 0.18s ease both;
}

::view-transition-new(page-content) {
  animation: page-in 0.34s ease both;
}

footer {
  margin-top: auto;
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}

.social-links a {
  color: var(--text-muted);
  font-size: 1.15rem;
}

.social-links a:hover {
  color: var(--accent);
}

.copyright {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.about {
  padding-bottom: 2rem;
}

.profile {
  display: flex;
  gap: 1.15rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.profile-img {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.ascii-portrait {
  width: 178px;
  height: 178px;
  margin: 0;
  overflow: hidden;
  flex-shrink: 0;
  color: var(--text);
  background: transparent;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 1.25px;
  line-height: 1.4px;
  letter-spacing: 0;
  white-space: pre;
  user-select: none;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-info h1,
.page-title {
  margin-top: 0;
}

.profile-info h1 {
  margin-bottom: 0.25rem;
  font-size: 1.6rem;
}

.subtitle {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

.affiliation {
  margin: 0 0 0.25rem;
}

.email-list {
  width: 100%;
  max-width: 29rem;
  margin: 0.7rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.email-row {
  display: grid;
  grid-template-columns: 2.65rem minmax(0, 1fr);
  align-items: center;
  gap: 0.45rem;
  min-height: 1.65rem;
  border-top: 1px solid var(--border);
}

.email-row:last-child {
  border-bottom: 1px solid var(--border);
}

.email-row dt,
.email-row dd {
  margin: 0;
}

.email-row dt {
  color: var(--accent-hover);
  font-weight: 500;
  text-transform: lowercase;
}

.email-row dd {
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.email-row dd::-webkit-scrollbar {
  display: none;
}

.bio {
  margin-bottom: 0;
}

.note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.intro {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.coursework-sections {
  display: grid;
  gap: 1.55rem;
  margin-top: 1.75rem;
}

.coursework-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-rail);
  border-radius: 5px;
  background: transparent;
  overflow: hidden;
}

.coursework-term-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.coursework-disclosure .coursework-term-head {
  cursor: pointer;
  list-style: none;
}

.coursework-disclosure .coursework-term-head::-webkit-details-marker {
  display: none;
}

.coursework-disclosure:not([open]) .coursework-term-head {
  border-bottom: 0;
}

.coursework-disclosure .coursework-term-head::after {
  content: "";
  position: relative;
  top: -0.1rem;
  width: 0.56rem;
  height: 0.56rem;
  margin-right: 0.4rem;
  border-right: 1.6px solid var(--text-muted);
  border-bottom: 1.6px solid var(--text-muted);
  flex: 0 0 auto;
  transform: rotate(45deg);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.coursework-disclosure[open] .coursework-term-head::after {
  transform: rotate(-135deg) translate(-0.08rem, -0.08rem);
}

.coursework-disclosure.is-closing .coursework-term-head::after {
  transform: rotate(45deg);
  transition-duration: 0.22s;
}

.coursework-term-title {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 600;
}

.coursework-count {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
  white-space: nowrap;
}

.course-list {
  margin: 0;
  padding: 0.28rem 0;
  list-style: none;
}

.course-item {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.1rem 1rem;
}

.course-code {
  color: var(--accent-hover);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.course-name {
  display: block;
  color: var(--text);
  line-height: 1.45;
}

.course-school {
  display: block;
  margin-top: -0.08rem;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-style: italic;
  line-height: 1.35;
}

.project-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.75rem;
}

.project-card {
  display: grid;
  grid-template-columns: 1fr;
  padding: 0.95rem 1rem 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-soft);
  border-radius: 5px;
  background: transparent;
}

.project-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.project-title {
  margin: 0 0 0.35rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.project-text {
  margin: 0;
  color: var(--text);
}

.project-outcomes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  margin-top: auto;
  padding-top: 0.9rem;
}

.project-outcomes .project-outcome {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 0.55rem;
  padding: 0;
  margin: 0;
  color: var(--accent-hover);
  background: none;
  background-image: none;
  font-size: 0.9rem;
  line-height: 1.35;
}

.project-outcomes .project-outcome:hover {
  color: var(--text);
  background: none;
  background-image: none;
}

.outcome-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  flex: 0 0 auto;
  padding: 0.06rem 0.55rem 0.12rem;
  border-radius: 4px;
  background: #e8e6e2;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 500;
}

.outcome-name {
  min-width: 0;
  color: inherit;
  font-style: italic;
  padding: 0 0.06em;
  margin: 0 -0.06em;
  background-image:
    linear-gradient(var(--accent-wash), var(--accent-wash)),
    linear-gradient(var(--accent-soft), var(--accent-soft));
  background-repeat: no-repeat;
  background-position: 0 100%, 0 100%;
  background-size: 100% 0.08em, 0 100%;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: color 0.2s ease, background-size 0.24s ease;
}

.project-outcomes .project-outcome:hover .outcome-name {
  background-size: 100% 0.08em, 100% 100%;
}

.project-links {
  margin-top: 0.85rem;
  font-size: 0.9rem;
}

.image-lightbox {
  width: min(92vw, 62rem);
  max-height: 88vh;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  box-shadow: 0 1.5rem 4rem rgba(26, 26, 26, 0.22);
  opacity: 0;
  overflow: visible;
  transform: translateY(0.5rem) scale(0.985);
  transition:
    opacity 0.24s ease,
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.image-lightbox::backdrop {
  background: rgba(26, 26, 26, 0);
  backdrop-filter: blur(0);
  transition:
    background-color 0.24s ease,
    backdrop-filter 0.24s ease;
}

.image-lightbox.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.image-lightbox.is-open::backdrop {
  background: rgba(26, 26, 26, 0.38);
  backdrop-filter: blur(2px);
}

.image-lightbox.is-closing {
  opacity: 0;
  transform: translateY(0.35rem) scale(0.99);
}

.image-lightbox img {
  display: block;
  width: 100%;
  max-height: calc(88vh - 1.7rem);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  color: var(--text);
  border-color: var(--accent-soft);
  transform: scale(1.04);
}

.cv-page {
  text-align: center;
  padding: 3rem 0;
}

.cv-page h1 {
  margin-top: 0;
  margin-bottom: 2rem;
}

.download {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  background: var(--text);
  color: var(--bg);
  border-radius: 4px;
  font-size: 0.95rem;
}

.download:hover {
  background: var(--accent);
  color: #fff;
}

@keyframes page-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes page-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .image-lightbox {
    opacity: 1;
    transform: none;
  }

  .image-lightbox::backdrop {
    background: rgba(26, 26, 26, 0.38);
    backdrop-filter: none;
  }
}

@media (max-width: 540px) {
  html {
    font-size: 17px;
  }

  nav {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.9rem;
  }

  .profile-img {
    width: 130px;
    height: 130px;
  }

  .ascii-portrait {
    width: 150px;
    height: 150px;
    font-size: 1.05px;
    line-height: 1.18px;
  }

  .email-list {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
  }

  .coursework-term-head {
    display: block;
  }

  .coursework-disclosure .coursework-term-head {
    display: flex;
  }

  .coursework-count {
    display: block;
    margin-top: 0.1rem;
  }

  .course-item {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .image-lightbox {
    width: 94vw;
    padding: 0.5rem;
  }

}
