:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f4f4f5;
  --text: #3f3f46;
  --heading: #27272a;
  --muted: #71717a;
  --line: #e4e4e7;
  --green: #15803d;
  --green-soft: #dcfce7;
}

:root.dark {
  color-scheme: dark;
  --bg: #18181b;
  --surface: #1f1f23;
  --surface-2: #27272a;
  --text: #e4e4e7;
  --heading: #fafafa;
  --muted: #a1a1aa;
  --line: #3f3f46;
  --green: #86efac;
  --green-soft: #14532d;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: url("../assets/noise.png");
  background-size: 200px 200px;
  color: var(--text);
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", "PingFang SC", sans-serif;
}

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

img {
  display: block;
  max-width: 100%;
}

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--line);
  background-color: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--heading);
  font-weight: 700;
}

.brand img {
  width: 35px;
  height: 35px;
}

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

.nav-links a:hover,
.nav-links a.active {
  color: var(--heading);
}

.theme-toggle {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--heading);
  cursor: pointer;
  font: inherit;
}

.site-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 96px 24px 0;
}

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

h1,
h2,
h3 {
  color: var(--heading);
  letter-spacing: 0;
}

h1 {
  margin-bottom: 24px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.12;
  font-weight: 760;
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.15;
}

h3 {
  margin-bottom: 6px;
  font-size: 20px;
}

p {
  color: var(--muted);
  line-height: 1.8;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 450px;
  align-items: center;
  gap: 60px;
  margin-bottom: 64px;
}

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

.hero-copy p {
  max-width: 680px;
  font-size: 17px;
}

.hero-art {
  width: 100%;
  height: auto;
}

.hero-path {
  stroke-dasharray: 500px 100px;
  animation: pathMove 100s linear infinite alternate-reverse;
}

@keyframes pathMove {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: 12433;
  }
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 28px;
}

.social-row a,
.back-link,
.section-heading a,
.project-row:hover strong,
.post-row h3 a:hover,
.email-link {
  color: var(--green);
}

.section {
  margin-top: 92px;
}

.section.narrow {
  max-width: 760px;
}

.contribution-wrap {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.contribution-grid {
  display: grid;
  grid-template-columns: repeat(24, 13px);
  gap: 4px;
  width: max-content;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 28px;
}

.contribution-grid span {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: var(--surface-2);
}

.contribution-grid .heat-1 {
  background: #bbf7d0;
}
.contribution-grid .heat-2 {
  background: #86efac;
}
.contribution-grid .heat-3 {
  background: #22c55e;
}
.contribution-grid .heat-4 {
  background: #15803d;
}

.year-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.year-list button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 13px;
  font: inherit;
}

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

.job-item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 20px;
  position: relative;
}

.job-item::before {
  content: "";
  position: absolute;
  left: 39px;
  top: 86px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.job-item img {
  width: 80px;
  height: 80px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 14px;
}

.job-role {
  margin-bottom: 8px;
  color: var(--text);
}

.job-item time,
.meta-line,
.post-row time {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.page-heading {
  max-width: 920px;
  margin-bottom: 44px;
}

.page-heading p {
  max-width: 860px;
}

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

.project-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 94px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.project-row:hover {
  border-color: var(--line);
}

.project-row img {
  width: 56px;
  height: 56px;
  border-radius: 7px;
  background: var(--surface-2);
  padding: 9px;
  object-fit: contain;
}

.project-row span {
  display: grid;
  gap: 5px;
}

.project-row small {
  color: var(--muted);
  line-height: 1.45;
}

.section-title {
  margin: 0 0 24px;
  color: var(--heading);
  font-size: 22px;
  font-weight: 760;
}

.post-list {
  display: grid;
  max-width: 960px;
  gap: 28px;
}

.post-row {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  align-items: center;
  gap: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
}

.post-image {
  overflow: hidden;
  border-radius: 6px;
}

.post-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.post-row:hover .post-image img {
  transform: scale(1.06);
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 56px;
}

.profile-aside {
  position: sticky;
  top: 32px;
}

.profile-aside > img {
  width: 100%;
  aspect-ratio: 1 / 1.08;
  border-radius: 14px;
  object-fit: cover;
  margin-bottom: 16px;
}

.resume-row,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--heading);
  padding: 0 15px;
  font-weight: 700;
}

.button.primary {
  flex: 1;
}

.email-link {
  display: block;
  margin-top: 14px;
}

.prose {
  max-width: 760px;
}

.usage-list {
  display: grid;
  gap: 26px;
  margin-top: 28px;
}

.usage-list ul,
.heroes-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.usage-list li {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  color: var(--muted);
}

.usage-list strong {
  color: var(--heading);
}

.heroes-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.heroes-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 9px 10px;
}

.heroes-list span {
  color: var(--green);
}

.detail-page {
  max-width: 860px;
  margin: 0 auto;
}

.detail-title {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-top: 22px;
}

.detail-page > img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 22px 0 26px;
}

.lead {
  color: var(--text);
  font-size: 18px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 26px;
}

.tag-list span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--heading);
  padding: 6px 9px;
  font-size: 13px;
}

.photo-grid {
  columns: 4 220px;
  column-gap: 18px;
}

.photo-grid figure {
  break-inside: avoid;
  margin: 0 0 18px;
}

.photo-grid img {
  width: 100%;
  border-radius: 8px;
}

.photo-grid figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer {
  max-width: 1180px;
  margin: 120px auto 0;
  padding: 44px 24px;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

@media (max-width: 960px) {
  .hero,
  .about-layout,
  .post-row {
    grid-template-columns: 1fr;
  }

  .hero-art {
    max-width: 520px;
  }

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

  .contribution-wrap {
    flex-direction: column;
  }

  .year-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 16px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    overflow-x: auto;
  }

  .site-main {
    padding-top: 52px;
  }

  .project-grid,
  .job-grid,
  .heroes-list,
  .usage-list li {
    grid-template-columns: 1fr;
  }

  .contribution-grid {
    grid-template-columns: repeat(15, 13px);
    padding: 18px;
  }

  .job-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .job-item img {
    width: 64px;
    height: 64px;
  }

  .job-item::before {
    left: 31px;
    top: 70px;
  }
}
