:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-strong: #14213d;
  --text: #172033;
  --muted: #657084;
  --line: #d9dfeb;
  --accent: #e85d04;
  --accent-contrast: #ffffff;
  --accent-2: #2a9d8f;
  --accent-soft: #fff0e5;
  --contact-muted: rgba(247, 244, 238, 0.72);
  --contact-border: rgba(255, 255, 255, 0.24);
  --shadow: 0 24px 70px rgba(30, 38, 55, 0.14);
  --radius: 8px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(232, 93, 4, 0.08), transparent 28%),
    linear-gradient(315deg, rgba(42, 157, 143, 0.1), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

body.dark {
  --bg: #101419;
  --surface: #181e26;
  --surface-strong: #f6f2ea;
  --text: #f2f5f8;
  --muted: #a9b3c1;
  --line: #2a3443;
  --accent: #ffb703;
  --accent-contrast: #101419;
  --accent-2: #4cc9a6;
  --accent-soft: rgba(255, 183, 3, 0.12);
  --contact-muted: rgba(16, 20, 25, 0.68);
  --contact-border: rgba(16, 20, 25, 0.22);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 244, 238, 0.82);
  border-bottom: 1px solid rgba(217, 223, 235, 0.75);
  backdrop-filter: blur(18px);
}

body.dark .site-header {
  background: rgba(16, 20, 25, 0.82);
  border-bottom-color: rgba(42, 52, 67, 0.75);
}

.nav {
  width: min(var(--max), calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--bg);
  font-size: 13px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: 15px;
}

.nav-links a {
  transition: color 0.2s ease;
}

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

.nav-toggle,
.theme-toggle,
.filter-button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 9px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.nav-toggle span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: var(--text);
  border-radius: 999px;
}

.theme-toggle {
  background: transparent;
  padding: 0;
}

.theme-toggle-track {
  width: 48px;
  height: 28px;
  padding: 3px;
  display: block;
  border-radius: 999px;
  background: var(--line);
}

.theme-toggle-thumb {
  width: 22px;
  height: 22px;
  display: block;
  border-radius: 50%;
  background: var(--surface-strong);
  transition: transform 0.2s ease;
}

body.dark .theme-toggle-thumb {
  transform: translateX(20px);
}

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

.hero {
  min-height: calc(100vh - 72px);
  padding: 78px 0 54px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.75fr);
  align-items: center;
  gap: 48px;
}

.hero-content {
  max-width: 720px;
}

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

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(44px, 8vw, 86px);
  max-width: 820px;
}

h2 {
  font-size: clamp(30px, 5vw, 54px);
}

h3 {
  font-size: 20px;
}

.accent {
  color: var(--accent);
}

.hero-copy {
  max-width: 640px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.button:hover,
.button:focus-visible,
.project-card:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: var(--surface-strong);
  color: var(--bg);
  box-shadow: 0 14px 34px rgba(20, 33, 61, 0.18);
}

.button.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.profile-panel {
  min-height: 430px;
  padding: 30px;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 45%),
    var(--surface-strong);
  color: var(--bg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.profile-panel::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  pointer-events: none;
}

.avatar {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}

.profile-name {
  margin: 26px 0 4px;
  font-size: 30px;
  font-weight: 900;
}

.profile-role {
  margin: 0;
  color: rgba(247, 244, 238, 0.72);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 34px 0;
}

.profile-stats div {
  padding: 16px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.profile-stats dt {
  color: rgba(247, 244, 238, 0.66);
  font-size: 12px;
}

.profile-stats dd {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 900;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(247, 244, 238, 0.78);
  font-size: 14px;
}

.status-line span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 8px rgba(42, 157, 143, 0.14);
}

.section {
  padding: 72px 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 30px;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.7fr);
  gap: 36px;
  align-items: start;
}

.about-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 20px;
}

.about-list,
.skill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.about-list span,
.skill-chip {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.filter-button {
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.filter-button.active,
.filter-button:hover,
.filter-button:focus-visible {
  background: var(--surface-strong);
  border-color: var(--surface-strong);
  color: var(--bg);
}

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

.project-card {
  min-height: 260px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.project-card:hover {
  border-color: rgba(232, 93, 4, 0.55);
  box-shadow: var(--shadow);
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.language-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  background: var(--accent-2);
  margin-right: 7px;
}

.project-card p {
  color: var(--muted);
  margin: 14px 0 20px;
}

.project-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.project-footer a {
  color: var(--accent);
  font-weight: 900;
}

.skills {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.skill-chip {
  background: var(--accent-soft);
  color: var(--text);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.timeline li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

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

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

.contact-panel {
  padding: clamp(28px, 6vw, 58px);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--bg);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
}

.contact-panel .eyebrow {
  color: var(--accent);
}

.contact-panel p:not(.eyebrow) {
  max-width: 620px;
  color: var(--contact-muted);
}

.contact-panel .button.primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.contact-panel .button.secondary {
  background: transparent;
  border-color: var(--contact-border);
  color: var(--bg);
}

.footer {
  padding: 26px 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.footer code {
  color: var(--text);
}

.footer a {
  font-weight: 800;
  color: var(--accent);
}

@media (max-width: 900px) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-top: 56px;
  }

  .profile-panel {
    min-height: 360px;
  }

  .about-grid,
  .contact-panel {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .nav {
    min-height: 64px;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 64px;
    left: 16px;
    right: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 9px 4px;
  }

  .theme-toggle {
    align-self: flex-start;
  }

  .hero,
  .section {
    width: min(100% - 24px, var(--max));
  }

  .hero {
    padding: 46px 0 34px;
    gap: 30px;
  }

  h1 {
    font-size: clamp(38px, 16vw, 58px);
  }

  h2 {
    font-size: clamp(28px, 10vw, 40px);
  }

  .profile-stats {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 52px 0;
  }

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

  .timeline li {
    grid-template-columns: 1fr;
  }

  .contact-actions,
  .hero-actions,
  .footer {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
