:root {
  color-scheme: light;
  --ink: #441910;
  --muted: #684238;
  --paper: #FAF6ED;
  --surface: #fffdfb;
  --accent: #68002C;
  --sea-pink: #E098AC;
  --soft-pink: rgba(224, 152, 172, .22);
  --hero-band: #F2E4DF;
  --hero-band-light: #F8F0EB;
  --section-rose: #F5E9E8;
  --line: rgba(68, 25, 16, .14);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

a { color: var(--accent); }
a:focus-visible { outline: 3px solid var(--sea-pink); outline-offset: 3px; }

.page {
  width: min(100% - 40px, 1080px);
  margin: 0 auto;
}

/* Header */
.site-header {
  display: grid;
  grid-template-columns: minmax(210px, 270px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 24px 0 16px;
}
.brand-block { grid-column: 1; grid-row: 1; }
.identity {
  display: block;
  color: inherit;
  text-decoration: none;
}
.identity strong, .identity small { display: block; }
.identity strong {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.04em;
}
.identity small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .1em;
  line-height: 1.45;
  text-transform: uppercase;
}
.language-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 1px;
  margin-top: 6px;
}
nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 8px;
  border-radius: 999px;
  color: var(--ink);
  font-size: .84rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .18s ease, color .18s ease;
}
.language-nav a { padding: 3px 7px; font-size: .76rem; }
nav a:hover, nav a:active, nav a.current {
  background: var(--accent);
  color: var(--paper);
}
.section-nav {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1px;
}
.section-nav a {
  padding: 7px 8px;
  border-radius: 3px;
  border-bottom: 1px solid transparent;
  font-size: .8rem;
}
.section-nav a:hover, .section-nav a:active {
  border-bottom-color: var(--sea-pink);
  background: transparent;
  color: var(--accent);
}
.private-nav-link {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  padding: 4px 0;
  border-bottom: 1px solid var(--sea-pink);
  color: var(--accent);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.private-nav-link:hover { border-bottom-color: var(--accent); color: var(--ink); }
/* Introduction */
.intro {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: calc(100vh - 125px);
  min-height: calc(100svh - 125px);
  padding: 64px 0;
}
.intro::before {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: calc(50% - 50vw);
  right: calc(50% - 50vw);
  background: repeating-linear-gradient(90deg, var(--hero-band) 0 42px, var(--hero-band-light) 42px 84px);
  content: "";
}
.intro-sheet {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 174px;
  gap: 36px;
  align-items: start;
  width: 100%;
  min-height: 520px;
  padding: 36px 36px 78px;
  border: 1px solid rgba(68, 25, 16, .08);
  background: rgba(255, 253, 251, .91);
  box-shadow: 0 12px 32px rgba(68, 25, 16, .07);
}
.intro-copy { min-width: 0; }
.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 5vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -.035em;
  line-height: 1.08;
}
.lead { margin: 18px 0 22px; font-size: 1.12rem; font-weight: 700; }
.intro-copy > p:not(.eyebrow):not(.lead) { max-width: 700px; margin: 0 0 22px; color: var(--muted); line-height: 1.75; }
.contact-links { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 36px; }
.contact-links .contact-cta {
  display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 9px;
  padding: 8px 16px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent);
  color: var(--paper); font-size: .92rem; font-weight: 700; text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease;
}
.contact-links .contact-cta:hover { border-color: var(--ink); background: var(--ink); }
.contact-icon { width: 19px; height: 19px; }
.linkedin-icon {
  display: inline-grid; width: 20px; height: 20px; place-items: center;
  border: 1.5px solid currentColor; border-radius: 3px; color: currentColor;
  font-family: Arial, sans-serif; font-size: .75rem; font-weight: 700; letter-spacing: -.04em; line-height: 1;
}
/* Profile photo */
.profile-card {
  align-self: start;
  justify-self: end;
  width: 150px;
  padding: 0;
  text-align: center;
}
.profile-card h2 {
  position: absolute;
  right: 36px;
  bottom: 28px;
  display: inline-block;
  margin: 0;
  color: var(--ink);
  font-family: "Segoe Script", "Bradley Hand", "Apple Chancery", cursive;
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.2;
  transform: rotate(-4deg);
}
.portrait {
  display: block;
  width: 120px;
  height: 150px;
  margin: 0 auto;
  border: 0;
  object-fit: cover;
  box-shadow: 0 5px 14px rgba(68, 25, 16, .16);
}

/* CV sections */
.cv-section {
  position: relative;
  isolation: isolate;
  display: flex;
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  justify-content: center;
  padding: 76px 0;
}
#education {
  min-height: min(76vh, 720px);
  min-height: min(76svh, 720px);
  padding-top: 62px;
  padding-bottom: 62px;
}
.cv-section::before {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: calc(50% - 50vw);
  right: calc(50% - 50vw);
  background: var(--surface);
  content: "";
}
main > .cv-section:nth-of-type(odd)::before { background: var(--section-rose); }

.entry { margin: 0 0 24px; }
.entry:last-child { margin-bottom: 0; }
.experience-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  margin-top: 16px;
}
.experience-grid .entry {
  margin: 0;
  min-height: 0;
  padding: 16px;
  min-width: 0;
  border: 1px solid rgba(68, 25, 16, .28);
  border-top: 4px solid var(--accent);
  border-radius: 4px;
  background: rgba(255, 253, 251, .97);
  box-shadow: 0 5px 16px rgba(68, 25, 16, .08), inset 0 0 0 1px rgba(68, 25, 16, .04);
}
.experience-grid .entry-heading { display: block; }
.experience-grid .entry-heading span { display: inline-block; margin-top: 5px; }
#experience {
  width: 100%;
  left: auto;
  transform: none;
  justify-content: flex-start;
  min-height: 0;
  padding-block: clamp(20px, 3vh, 34px);
}
#experience::before {
  background: var(--section-rose);
}
#experience > h2 {
  align-self: flex-start;
  margin-bottom: 0;
  padding: 0;
  font-size: clamp(2rem, 3.4vw, 2.6rem);
  line-height: 1.08;
}
#experience .entry ul { margin-top: 10px; padding-left: 18px; }
#experience li { margin-bottom: 8px; }
#experience li:last-child { margin-bottom: 0; }
#activities {
  min-height: 0;
  justify-content: flex-start;
  padding-block: clamp(20px, 3vh, 32px);
}
#activities > h2 {
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 4vw, 2.9rem);
}
.activity-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  align-items: stretch;
  gap: 24px;
  margin-top: 8px;
}
.activity-feature { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
.activity-copy {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(68, 25, 16, .07);
}
.activity-copy h3 {
  margin: 5px 0 8px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.3;
}
.activity-copy p { margin: 6px 0 0; color: var(--muted); }
.activity-copy .institution { font-style: italic; }
.activity-date {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  font-size: .82rem;
  font-weight: 700;
}
.activity-photo { overflow: hidden; aspect-ratio: 16 / 9; margin: 0; border-radius: 10px; background: var(--section-rose); }
.activity-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.activity-photo-event { overflow: visible; aspect-ratio: auto; background: transparent; }
.activity-photo-event img { height: auto; aspect-ratio: 16 / 9; border-radius: 10px; }
.activity-photo-credit { margin-top: 8px; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.activity-photo-nature img { object-position: center 72%; }
.activity-photo-event img { object-position: center 58%; }
#projects {
  min-height: 0;
  justify-content: flex-start;
  padding-block: clamp(20px, 3vh, 34px);
}
.timeline {
  position: relative;
  margin-top: 10px;
  padding-left: 30px;
}
.timeline .entry {
  position: relative;
  margin-bottom: 24px;
}
.timeline .entry::before {
  position: absolute;
  top: 7px;
  left: -30px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #211c1a;
  box-shadow: 0 0 0 4px var(--surface);
  content: "";
}
.timeline .entry:not(:last-child)::after {
  position: absolute;
  top: 14px;
  bottom: -38px;
  left: -24px;
  width: 2px;
  background: #211c1a;
  content: "";
}
.entry-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}
.entry-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.04rem;
  line-height: 1.45;
}
.entry-heading span {
  flex: 0 0 auto;
  padding: 3px 9px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .82rem;
}
.institution { margin: 3px 0 6px; color: var(--muted); font-style: italic; }
.entry p { margin: 5px 0; }
.entry ul, .two-columns ul { margin: 6px 0 0; padding-left: 22px; }
.entry li::marker, #interests li::marker { color: var(--accent); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  max-width: 980px;
  margin-inline: auto;
  gap: 14px;
}
.project-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(68, 25, 16, .14);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(68, 25, 16, .06);
}
.project-media {
  display: block;
  width: 100%;
  height: 155px;
  background: #f4ead6;
  object-fit: cover;
}
.project-card video.project-media {
  height: 155px;
  aspect-ratio: auto;
  background: #000;
  object-fit: contain;
}
.project-card img.project-media-cover { height: 155px; aspect-ratio: auto; object-fit: cover; }
.project-media-contain { padding: 12px; object-fit: contain; }
.project-card-body { padding: 12px 14px 14px; }
.project-meta {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
#projects > h2 {
  margin-bottom: 16px;
  font-size: clamp(2rem, 3.4vw, 2.6rem);
}
.project-card h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  font-weight: 400;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.project-card-body > p:not(.project-meta) { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.project-link { display: inline-block; margin-top: 8px; font-weight: 700; }

/* Skills */
#skills {
  min-height: 50vh;
  min-height: 50svh;
  justify-content: center;
  padding-block: clamp(18px, 2.5vh, 30px);
}
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  max-width: 1040px;
  margin: 18px auto 0;
  gap: 18px;
}
.skill-card {
  min-width: 0;
  padding: 22px 16px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  box-shadow: 0 5px 16px rgba(68, 25, 16, .05);
}
.skill-icon {
  display: grid;
  width: 76px;
  height: 76px;
  margin: 0 auto 15px;
  place-items: center;
  border-radius: 22px;
  background: var(--soft-pink);
  color: var(--accent);
  transform: none;
}
.skill-card:nth-child(even) .skill-icon { background: #e5edf1; color: #527186; }
.skill-card:nth-child(3) .skill-icon { background: #f5e8d7; color: #9a674d; }
.skill-icon svg { width: 38px; height: 38px; }
.skill-card h3 { margin: 0 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 1.2rem; font-weight: 400; }
.skill-card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }

/* Interest carousel */
#interests {
  min-height: 50vh;
  min-height: 50svh;
  justify-content: center;
  padding-block: clamp(18px, 2.5vh, 30px);
}
#skills > h2,
#interests .interest-carousel-header {
  width: min(100%, 1040px);
  margin-inline: auto;
}
.interest-carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}
.cv-section > h2, .two-columns h2, .interest-carousel-header h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 2.5vw, 1.8rem);
  font-weight: 400;
  letter-spacing: -.02em;
}
#education > h2 {
  margin-bottom: 22px;
  font-size: clamp(2rem, 3.8vw, 2.55rem);
}
.interest-carousel {
  width: min(100%, 820px);
  margin: 0 auto;
}
.gallery-controls { display: flex; flex: 0 0 auto; gap: 8px; }
.gallery-control {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(104, 0, 44, .35);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font: 1.3rem/1 Arial, sans-serif;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.gallery-control:hover { background: var(--accent); color: var(--paper); }
.gallery-control:focus-visible { outline: 3px solid var(--sea-pink); outline-offset: 3px; }
.interest-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 9px;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--sea-pink) transparent;
  scrollbar-width: thin;
}
.interest-slide {
  flex: 0 0 46%;
  min-width: 0;
  margin: 0;
  scroll-snap-align: start;
}
.interest-image-slot {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--paper), rgba(224, 152, 172, .12));
  object-fit: cover;
  scroll-snap-align: start;
  border-radius: 10px;
}
.interest-slide figcaption {
  margin-top: 9px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
  text-align: center;
}

/* Footer */
footer {
  padding: 26px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}
.footer-contact { margin: 0 0 10px; }
.validation-links { margin: 8px 0 0; }
.validation-links a { margin: 0 5px; }
.back-to-top { margin: 12px 0 0; }
.back-to-top a {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  text-decoration: none;
}
.back-to-top a:hover { background: var(--sea-pink); color: var(--ink); }

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

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 16px;
    padding-top: 18px;
  }
  .brand-block { grid-column: 1; grid-row: 1; }
  .private-nav-link { grid-column: 2; grid-row: 1; align-self: start; }
  .section-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    padding: 9px 0;
    border-top: 1px solid var(--line);
  }
  .page { width: min(100% - 28px, 700px); }
  .intro { min-height: 86vh; min-height: 86svh; padding: 38px 0 34px; }
  .intro-sheet { grid-template-columns: minmax(0, 1fr) 150px; gap: 20px; min-height: 0; padding: 28px 28px 76px; }
  .experience-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .experience-grid .entry { min-height: 0; padding: 16px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .project-media { height: 145px; }
  .project-card video.project-media,
  .project-card img.project-media-cover { height: 145px; }
  .activity-layout { gap: 18px; }
  .activity-copy { padding: 20px; }
  .two-columns { grid-template-columns: 1fr; gap: 24px; }
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  #experience { width: 100%; left: auto; transform: none; }
  .experience-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .experience-grid .entry { min-height: 0; padding: 16px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  #experience { min-height: 0; justify-content: flex-start; padding-block: clamp(20px, 3vh, 34px); }
  .intro-sheet { grid-template-columns: 1fr; gap: 22px; padding: 24px 24px 74px; }
  .profile-card { grid-row: 1; justify-self: end; width: 140px; }
  .intro-copy { grid-row: 2; }
  .experience-grid { grid-template-columns: 1fr; gap: 16px; }
  .experience-grid .entry { min-height: 0; padding: 16px; }
  .project-grid { grid-template-columns: 1fr; }
  .activity-layout { grid-template-columns: 1fr; }
  .activity-feature { gap: 14px; }
}

@media (max-width: 520px) {
  .page { width: min(100% - 26px, 480px); }
  .identity small { max-width: 250px; }
  .language-nav a { padding: 3px 5px; font-size: .72rem; }
  .private-nav-link { padding: 7px 9px; font-size: .76rem; }
  .section-nav { gap: 0; padding: 8px 0; }
  .section-nav a { padding: 6px 7px; font-size: .78rem; }
  .intro { min-height: 82vh; min-height: 82svh; padding: 30px 0; }
  .intro-sheet { gap: 18px; padding: 22px 22px 72px; }
  .profile-card h2 { right: 22px; bottom: 22px; }
  #education { min-height: min(72vh, 680px); min-height: min(72svh, 680px); padding: 42px 0; }
  #experience { padding-block: 24px; }
  #experience > h2 { font-size: clamp(2rem, 8vw, 2.5rem); }
  .lead { font-size: 1.05rem; }
  .contact-links { flex-direction: column; align-items: flex-start; }
  .profile-card .portrait { margin: 0 auto; }
  .cv-section { min-height: 82vh; min-height: 82svh; padding: 38px 0; }
  .entry-heading { display: block; }
  .entry-heading span { display: inline-block; margin-top: 5px; }
  .project-grid { grid-template-columns: 1fr; }
  .project-media { height: 145px; }
  .project-card video.project-media,
  .project-card img.project-media-cover { height: 145px; }
  .interest-carousel-header { gap: 10px; margin-bottom: 13px; }
  .interest-carousel-header h2 { font-size: 1.32rem; }
  .interest-track { gap: 11px; }
  .interest-slide { flex-basis: 84%; }
  .interest-image-slot { aspect-ratio: 4 / 3; }
  .gallery-control { width: 34px; height: 34px; }
}

@media (max-width: 360px) {
  .site-header { column-gap: 8px; }
  .identity strong { font-size: 1.32rem; }
  .identity small { max-width: 220px; font-size: .64rem; }
  .private-nav-link { padding-inline: 7px; }
  .skills-grid { grid-template-columns: 1fr; }
}
