:root {
  --background: #f6f8fa;
  --surface: #ebf0f5;
  --surface-strong: #dde5ed;
  --text: #1e2933;
  --muted: #64717e;
  --forest: #19344f;
  --forest-light: #496a89;
  --ocean: #376f9e;
  --ocean-dark: #29577e;
  --border: #d2dce5;
  --redwood: #986044;
  --shadow: 0 16px 38px rgba(25, 52, 79, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--ocean);
  text-decoration: none;
  text-underline-offset: 0.2em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

a:hover {
  color: var(--forest);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

a:focus-visible {
  border-radius: 2px;
  outline: 3px solid rgba(53, 109, 130, 0.28);
  outline-offset: 4px;
}

/* Accessibility */

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--forest);
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Top navigation */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(246, 248, 250, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.section-nav {
  display: flex;
  width: min(100% - 44px, 880px);
  margin: 0 auto;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
  display: none;
}

.section-nav a {
  flex: 0 0 auto;
  padding: 13px 0;
  color: var(--forest-light);
  font-size: 0.88rem;
  font-weight: 650;
  white-space: nowrap;
}

.section-nav a:hover {
  color: var(--forest);
}

/* Main layout */

main {
  width: min(100% - 44px, 880px);
  margin: 0 auto;
  padding: 62px 0 42px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: center;
  gap: 56px;
  margin-bottom: 84px;
  scroll-margin-top: 72px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  color: var(--forest);
  font-size: clamp(2.35rem, 6vw, 3rem);
  font-weight: 730;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.subtitle {
  margin-bottom: 18px;
  color: var(--ocean-dark);
  font-size: 1.08rem;
  font-weight: 600;
}

.intro-description {
  max-width: 590px;
  margin-bottom: 0;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 21px;
  margin-top: 23px;
}

.profile-links a,
.paper-links a {
  font-weight: 650;
}

/* Portrait */

.portrait-frame {
  width: 230px;
  height: 300px;
  padding: 5px;
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.portrait-frame img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 13px;
  object-fit: cover;
}

/* Sections */

section {
  margin-bottom: 62px;
  scroll-margin-top: 72px;
}

section > h2 {
  margin-bottom: 25px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--forest);
  font-size: 1.38rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

/* Education, experience, and awards */

.timeline-item {
  margin-bottom: 27px;
}

.timeline-item:last-child,
.publication:last-child {
  margin-bottom: 0;
}

.item-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.item-heading strong {
  color: var(--forest);
}

.item-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.93rem;
  white-space: nowrap;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

/* Compact timeline spacing */

#education > h2,
#experience > h2,
#awards > h2 {
  margin-bottom: 12px;
}

#education .timeline-item,
#experience .timeline-item,
#awards .timeline-item {
  margin-bottom: 7px;
}

#education .timeline-item p,
#experience .timeline-item p,
#awards .timeline-item p {
  margin: 0;
  line-height: 1.4;
}

/* Publications and patents */

.year-heading {
  margin: 32px 0 18px;
  color: var(--forest-light);
  font-size: 0.9rem;
  font-weight: 750;
  letter-spacing: 0.08em;
}

#publications > .year-heading:first-of-type,
#patents > .year-heading:first-of-type {
  margin-top: 0;
}

.publication {
  margin-bottom: 29px;
}

.publication h3 {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
}

.publication p {
  margin-bottom: 2px;
}

.authors {
  color: var(--muted);
}

.my-name {
  color: inherit;
  font-weight: inherit;
  text-decoration: underline;
  text-decoration-color: var(--ocean);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.venue {
  color: var(--redwood);
  font-style: italic;
}

.publication-meta {
  color: var(--muted);
  font-size: 0.93rem;
}

.publication-award {
  margin: 6px 0 4px;
}

.publication-award a {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--redwood);
  color: #ffffff;
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.publication-award a:hover {
  background: var(--forest);
  color: #ffffff;
  text-decoration: none;
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 5px;
  font-size: 0.9rem;
}

/* Compact publication spacing */
#publications > h2 {
  margin-bottom: 12px;
}

#publications .year-heading {
  margin-top: 20px;
  margin-bottom: 10px;
}

#publications > .year-heading:first-of-type {
  margin-top: 0;
}

#publications .publication {
  margin-bottom: 16px;
}

#publications .publication p {
  margin-bottom: 0;
}

#publications .paper-links {
  margin-top: 3px;
}

/* Highlighted award */

#awards .featured-award {
  padding: 8px 12px;
  border-left: 3px solid var(--redwood);
  border-radius: 0 8px 8px 0;
  background: var(--surface);
}

#awards .featured-award strong {
  color: var(--redwood);
}

/* Professional service */

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 19px;
}

.service-group {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.service-group h3 {
  margin-bottom: 11px;
  color: var(--forest);
  font-size: 0.97rem;
}

.service-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-group li {
  position: relative;
  margin: 6px 0;
  padding-left: 15px;
  color: var(--muted);
}

.service-group li::before {
  position: absolute;
  top: 0.68em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--forest-light);
  content: "";
}

/* Footer */

footer {
  margin-top: 76px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.86rem;
}

footer p {
  margin-bottom: 0;
}

/* Mobile */

@media (max-width: 720px) {
  .section-nav {
    width: 100%;
    gap: 18px;
    padding: 0 19px;
  }

  .section-nav a {
    padding: 11px 0;
    font-size: 0.84rem;
  }

  main {
    width: min(100% - 38px, 880px);
    padding-top: 40px;
  }

  .intro {
    grid-template-columns: 1fr;
    gap: 34px;
    margin-bottom: 68px;
  }

  .portrait-frame {
    grid-row: 1;
    width: 185px;
    height: 238px;
  }

  .service-grid {
    grid-template-columns: 1fr;
  }

  .item-heading {
    display: block;
  }

  .item-heading span {
    display: block;
    margin-top: 2px;
    white-space: normal;
  }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}

/* Printing */

@media print {
  :root {
    --background: #fff;
  }

  body {
    color: #111;
  }

  main {
    width: 100%;
    padding: 0;
  }

  .skip-link,
  .site-header,
  .portrait-frame,
  .paper-links {
    display: none;
  }

  .intro {
    display: block;
    margin-bottom: 36px;
  }

  section {
    margin-bottom: 34px;
  }

  article,
  .service-group {
    break-inside: avoid;
  }

  a {
    color: inherit;
  }
}