:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --bg-elevated: #fffaf1;
  --text: #181a1f;
  --muted: #65605a;
  --line: rgba(24, 26, 31, 0.14);
  --primary: #0c7a71;
  --primary-strong: #075f59;
  --accent: #e84d2f;
  --accent-soft: #ffd9c8;
  --ink: #101216;
  --card: rgba(255, 250, 241, 0.78);
  --shadow: 0 24px 70px rgba(34, 25, 12, 0.14);
  --radius: 8px;
  --max-width: 1120px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121416;
  --bg-elevated: #1b1f22;
  --text: #f4efe7;
  --muted: #bbb1a4;
  --line: rgba(244, 239, 231, 0.16);
  --primary: #4fd0bb;
  --primary-strong: #75dfd0;
  --accent: #ff8d62;
  --accent-soft: rgba(255, 141, 98, 0.16);
  --ink: #f7f3ea;
  --card: rgba(27, 31, 34, 0.78);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(12, 122, 113, 0.12), transparent 32rem),
    linear-gradient(315deg, rgba(232, 77, 47, 0.14), transparent 30rem),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  line-height: 1.6;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(24, 26, 31, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 26, 31, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

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

button {
  font: inherit;
}

svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
  flex: 0 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(var(--max-width), calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  padding: 12px 0;
  backdrop-filter: blur(18px);
}

.brand,
.nav-links,
.icon-button,
.button,
.contact-line {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 12px 30px rgba(24, 26, 31, 0.06);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 12px 8px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-size: 0.75rem;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 999px;
}

.nav-links a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  background: rgba(12, 122, 113, 0.12);
  outline: none;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover,
.button:hover,
.contact-line:hover {
  transform: translateY(-2px);
}

.section-shell {
  width: min(var(--max-width), calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  align-items: center;
  min-height: calc(100vh - 72px);
  gap: 56px;
  padding: 56px 0 72px;
}

.hero-copy,
.hero-visual {
  min-width: 0;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 9em;
  margin: 0;
  font-size: clamp(3.2rem, 11vw, 7.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.role {
  display: inline-flex;
  margin: 24px 0 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.32);
  font-weight: 700;
}

.hero-text {
  max-width: 560px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.18rem;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 180ms ease, background 180ms ease;
}

.button.primary {
  border-color: transparent;
  color: #fff;
  background: var(--ink);
}

.button.secondary {
  color: var(--text);
}

.hero-visual {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 520px;
}

.portrait-card {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 35% 28%, var(--accent-soft), transparent 32%),
    linear-gradient(145deg, rgba(12, 122, 113, 0.18), rgba(255, 250, 241, 0.28));
  box-shadow: var(--shadow);
}

.portrait-card::before,
.portrait-card::after {
  position: absolute;
  content: "";
  border: 1px solid var(--line);
  transform: rotate(-12deg);
}

.portrait-card::before {
  inset: 52px;
  border-radius: 28px;
}

.portrait-card::after {
  inset: 96px;
  border-radius: 50%;
  transform: rotate(18deg);
}

.portrait-orbit {
  position: absolute;
  width: 72%;
  aspect-ratio: 1;
  border: 2px dashed rgba(12, 122, 113, 0.34);
  border-radius: 50%;
  animation: rotate 28s linear infinite;
}

.portrait {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 46%;
  aspect-ratio: 1;
  border: 10px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(16, 18, 22, 0.12), rgba(16, 18, 22, 0.36)),
    linear-gradient(135deg, var(--primary), var(--accent));
  font-weight: 900;
  box-shadow: 0 26px 60px rgba(12, 122, 113, 0.28);
  overflow: hidden;
}

.portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait span {
  position: relative;
  z-index: -1;
}

.signal-card {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 0;
  min-width: 112px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.signal-card strong {
  font-size: 1.5rem;
  line-height: 1;
}

.signal-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.signal-card.top {
  top: 52px;
  right: 28px;
}

.signal-card.bottom {
  bottom: 52px;
  left: 28px;
}

.ticker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: min(var(--max-width), calc(100% - 32px));
  margin: -26px auto 96px;
}

.ticker span {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--card);
}

.split-section,
.contact-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 44px;
  padding: 72px 0;
}

.content-panel,
.contact-card,
.skill-card,
.project-card,
.timeline article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 18px 46px rgba(24, 26, 31, 0.07);
}

.content-panel {
  padding: 28px;
}

.content-panel p,
.project-card p,
.skill-card p,
.timeline p,
.contact-section p {
  margin: 0;
  color: var(--muted);
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.fact-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.fact-grid span,
.project-meta,
.contact-line span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.fact-grid strong,
.contact-line strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.skill-grid,
.project-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.skill-card,
.project-card {
  padding: 22px;
}

.card-index {
  display: inline-block;
  margin-bottom: 34px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
}

.timeline-section {
  padding: 96px 0;
}

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

.timeline article {
  display: grid;
  grid-template-columns: 92px minmax(0, 0.45fr) minmax(0, 1fr);
  gap: 20px;
  align-items: baseline;
  padding: 18px 22px;
}

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

.timeline h3 {
  margin: 0;
}

.project-grid {
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
}

.project-card {
  display: flex;
  min-height: 280px;
  flex-direction: column;
  justify-content: space-between;
}

.project-card.featured {
  color: #fff;
  background:
    linear-gradient(135deg, rgba(232, 77, 47, 0.2), transparent),
    var(--ink);
}

.project-card.featured p,
.project-card.featured .project-meta {
  color: rgba(255, 255, 255, 0.74);
}

.project-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.project-card a {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 28px;
  color: var(--primary-strong);
  font-weight: 900;
}

.project-card.featured a {
  color: #fff;
}

.contact-section {
  align-items: start;
}

.contact-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.contact-line {
  display: block;
  width: 100%;
  min-height: 70px;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease;
}

.contact-line:hover,
.contact-line:focus-visible {
  border-color: rgba(12, 122, 113, 0.45);
  outline: none;
}

.copy-status {
  min-height: 24px;
  padding: 0 6px;
  color: var(--primary-strong);
  font-size: 0.9rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(var(--max-width), calc(100% - 32px));
  margin: 24px auto 0;
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

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

@media (max-width: 900px) {
  .site-header {
    flex-wrap: wrap;
  }

  .nav-links {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: stretch;
  }

  .nav-links a {
    text-align: center;
  }

  .hero,
  .split-section,
  .contact-section {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 36px;
  }

  .hero-visual {
    min-height: auto;
  }

  .portrait-card {
    max-width: 100%;
  }

  .skill-grid,
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-card.featured {
    grid-column: 1 / -1;
  }

  .timeline article {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .timeline p {
    grid-column: 2;
  }
}

@media (max-width: 620px) {
  .site-header,
  .section-shell,
  .ticker,
  .site-footer {
    width: calc(100vw - 22px);
    max-width: var(--max-width);
  }

  .brand {
    max-width: calc(100% - 60px);
  }

  .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-links a {
    padding: 7px 9px;
    font-size: 0.86rem;
  }

  h1 {
    font-size: clamp(3rem, 21vw, 5.4rem);
  }

  .hero-text {
    font-size: 1rem;
  }

  .hero-actions,
  .button {
    width: 100%;
  }

  .portrait-card {
    border-radius: 20px;
  }

  .signal-card {
    min-width: 94px;
    padding: 12px;
  }

  .signal-card.top {
    top: 22px;
    right: 14px;
  }

  .signal-card.bottom {
    bottom: 22px;
    left: 14px;
  }

  .ticker {
    margin-bottom: 64px;
  }

  .split-section,
  .contact-section,
  .timeline-section {
    padding: 54px 0;
  }

  .fact-grid,
  .skill-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: block;
  }

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

  .timeline p {
    grid-column: auto;
  }

  .site-footer {
    flex-direction: column;
  }
}
