:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #dfd6c8;
  --primary: #136f63;
  --primary-dark: #0d4f47;
  --accent: #c65f2e;
  --shadow: 0 18px 48px rgba(31, 41, 51, 0.12);
  --header-bg: rgba(247, 244, 238, 0.86);
  --header-line: rgba(223, 214, 200, 0.8);
  --tinted: #edf7f4;
  --panel-line: #cfe1dc;
  --translucent-surface: rgba(255, 255, 255, 0.5);
  --soft-green: #f3faf8;
  --avatar-ring: rgba(255, 255, 255, 0.9);
  --avatar-shadow: 0 10px 26px rgba(31, 41, 51, 0.18);
  --primary-contrast: #ffffff;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111816;
  --surface: #17211e;
  --surface-strong: #1c2824;
  --text: #edf4f1;
  --muted: #aab8b3;
  --line: #34453f;
  --primary: #72cbb8;
  --primary-dark: #a1e0d1;
  --accent: #f0a27a;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --header-bg: rgba(17, 24, 22, 0.88);
  --header-line: rgba(52, 69, 63, 0.9);
  --tinted: #14231f;
  --panel-line: #3a544c;
  --translucent-surface: rgba(255, 255, 255, 0.05);
  --soft-green: #20312c;
  --avatar-ring: rgba(237, 244, 241, 0.8);
  --avatar-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
  --primary-contrast: #10201b;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  border-radius: 4px;
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 100;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--primary-dark);
  color: var(--surface-strong);
  padding: 10px 14px;
  font-weight: 800;
}

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

main[id],
section[id] {
  scroll-margin-top: 92px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--header-line);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}

.brand {
  font-size: 1rem;
  font-weight: 800;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 20px;
  color: var(--muted);
  font-size: 0.94rem;
  margin-left: auto;
}

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

.site-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--translucent-surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.icon-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.theme-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.language-toggle {
  min-width: 50px;
  padding-inline: 10px;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.hero,
.section,
.footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  align-items: center;
  gap: clamp(32px, 6vw, 72px);
  padding: 72px 0;
}

.hero__content {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero__title {
  font-size: clamp(2rem, 4.6vw, 4.2rem);
}

h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.3;
}

.hero__summary,
.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
}

.hero__summary {
  margin: 24px 0 0;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
}

.button--primary:hover {
  background: var(--primary-dark);
}

.button--ghost {
  background: var(--translucent-surface);
}

.button--ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.profile-panel {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.avatar-frame {
  width: 148px;
  height: 148px;
  margin-bottom: 28px;
  border: 3px solid var(--avatar-ring);
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-strong);
  box-shadow: var(--avatar-shadow);
  flex: 0 0 148px;
}

.avatar {
  width: 100%;
  height: 100%;
  max-width: none;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.facts {
  display: grid;
  gap: 18px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.facts dd {
  margin: 0;
  font-weight: 800;
}

.section {
  padding: 78px 0;
}

.section--tinted {
  width: 100%;
  max-width: none;
  padding: 78px max(20px, calc((100% - 1120px) / 2));
  border-block: 1px solid var(--line);
  background: var(--tinted);
}

.section__heading {
  margin-bottom: 24px;
}

.section__intro {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
}

.skill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.skill-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--translucent-surface);
  padding: 8px 12px;
  color: var(--primary-dark);
  font-weight: 800;
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  gap: 18px;
}

.project-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 24px;
}

.project-card p {
  color: var(--muted);
}

.project-card__responsibilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 24px;
  padding: 0;
  list-style: none;
}

.project-card__responsibilities li {
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  background: var(--soft-green);
  padding: 6px 11px;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.project-card__tag {
  margin: 0 0 18px;
  color: var(--accent) !important;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.project-card a {
  margin-top: auto;
  color: var(--primary);
  font-weight: 900;
}

.reading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.reading-section {
  border-top: 1px solid var(--line);
}

.reading-card {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 24px;
}

.reading-card__tag {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reading-card__meta {
  margin: 12px 0 0;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.reading-card__summary {
  margin: 16px 0 0;
  color: var(--muted);
}

.reading-card__link {
  width: fit-content;
  color: var(--primary);
  font-weight: 900;
}

.reading-card__link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.timeline {
  display: grid;
  gap: 20px;
}

.timeline article {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 22px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.timeline time {
  color: var(--accent);
  font-weight: 900;
}

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

.contact-section,
.friend-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  border-top: 1px solid var(--line);
}

.contact-section p {
  max-width: 640px;
  color: var(--muted);
}

.contact-links,
.friend-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.contact-links a,
.friend-links a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--translucent-surface);
  padding: 10px 14px;
  font-weight: 800;
}

.contact-links a:hover,
.friend-links a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.footer {
  padding: 26px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.footer p {
  margin: 0;
}

.beian-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.beian-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.beian-links a:hover {
  color: var(--primary);
}

.beian-links img {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  object-fit: contain;
}

@media (max-width: 820px) {
  .site-header {
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
  }

  .brand {
    flex: 0 0 auto;
  }

  .nav {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 2px 3px 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin-left: 0;
  }

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

  .nav a {
    min-height: 44px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    border-radius: 8px;
    padding: 0 9px;
  }

  main[id],
  section[id] {
    scroll-margin-top: 72px;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 54px 0;
  }

  .profile-panel {
    width: 100%;
  }

  .project-grid,
  .reading-grid,
  .contact-section,
  .friend-section {
    grid-template-columns: 1fr;
  }

  .contact-links,
  .friend-links {
    justify-content: flex-start;
  }
}

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

  .skip-link {
    transition: none;
  }
}

@media (max-width: 520px) {
  .hero,
  .section,
  .footer {
    width: min(100% - 28px, 1120px);
  }

  h1 {
    font-size: 2.4rem;
  }

  .hero__title {
    font-size: 2.05rem;
  }

  .facts div,
  .timeline article {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .button {
    width: 100%;
  }
}
