:root {
  color-scheme: dark;
  --page: #10131b;
  --page-raised: #151a24;
  --surface: #191f2b;
  --surface-hover: #1d2533;
  --text: #f0f3f8;
  --muted: #9ba6b7;
  --faint: #677386;
  --line: rgba(179, 197, 224, 0.13);
  --accent: #6ea8fe;
  --accent-strong: #8dbaff;
  --accent-soft: rgba(83, 146, 247, 0.13);
  --accent-border: rgba(110, 168, 254, 0.28);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  --font-sans: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f5f7fb;
  --page-raised: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f5f8fe;
  --text: #172033;
  --muted: #56647a;
  --faint: #7d899a;
  --line: rgba(54, 77, 112, 0.14);
  --accent: #286ed1;
  --accent-strong: #165dbf;
  --accent-soft: rgba(40, 110, 209, 0.09);
  --accent-border: rgba(40, 110, 209, 0.25);
  --shadow: 0 24px 70px rgba(29, 55, 96, 0.11);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --page: #f5f7fb;
    --page-raised: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f5f8fe;
    --text: #172033;
    --muted: #56647a;
    --faint: #7d899a;
    --line: rgba(54, 77, 112, 0.14);
    --accent: #286ed1;
    --accent-strong: #165dbf;
    --accent-soft: rgba(40, 110, 209, 0.09);
    --accent-border: rgba(40, 110, 209, 0.25);
    --shadow: 0 24px 70px rgba(29, 55, 96, 0.11);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 82% 4%, var(--accent-soft), transparent 31rem),
    var(--page);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  transition: background-color 220ms ease, color 220ms ease;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: radial-gradient(var(--line) 0.65px, transparent 0.65px);
  background-size: 24px 24px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 75%);
  pointer-events: none;
}

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

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.page-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(18px);
}

.site-header-inner {
  display: flex;
  width: min(1120px, calc(100% - 48px));
  min-height: inherit;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
}

.brand,
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: -0.08em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 36px);
  color: var(--muted);
  font-size: 0.84rem;
}

.site-nav a,
.back-to-top {
  transition: color 160ms ease;
}

.site-nav a:hover,
.back-to-top:hover {
  color: var(--accent-strong);
}

.theme-toggle {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--accent-border);
  color: var(--accent-strong);
}

.theme-toggle svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.hero {
  position: relative;
  display: grid;
  min-height: 590px;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  align-items: center;
  gap: 70px;
  padding: 88px 0 104px;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker,
.project-number,
.portrait-label,
.hero-index {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  color: var(--muted);
}

.status-dot,
.portrait-label span,
.project-state span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #64d5a5;
  box-shadow: 0 0 14px rgba(100, 213, 165, 0.6);
}

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

.hero h1 {
  max-width: 680px;
  margin-bottom: 12px;
  font-size: clamp(2.55rem, 5.5vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.075em;
  line-height: 1.17;
}

.hero h1 span,
.contact-copy h2 span {
  color: var(--accent-strong);
}

.hero-quote {
  margin-bottom: 18px;
  color: var(--accent-strong);
  font-size: clamp(1.02rem, 2vw, 1.24rem);
  font-weight: 600;
}

.hero-summary {
  max-width: 510px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 0.98rem;
}

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

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

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

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

.button-secondary:hover {
  border-color: var(--accent-border);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 0.8rem;
}

.hero-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.meta-icon {
  color: var(--accent);
  font-size: 1rem;
}

.hero-portrait {
  position: relative;
  display: grid;
  min-height: 350px;
  place-items: center;
}

.portrait-frame {
  position: relative;
  z-index: 1;
  width: min(300px, 78%);
  aspect-ratio: 1;
  overflow: hidden;
  border: 8px solid var(--page-raised);
  border-radius: 32px;
  background: #fff;
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
  transform: rotate(2deg);
}

.portrait-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait-orbit {
  position: absolute;
  width: 340px;
  height: 340px;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  transform: rotate(-24deg) scaleY(0.42);
}

.orbit-two {
  width: 400px;
  height: 400px;
  border-color: var(--line);
  transform: rotate(57deg) scaleY(0.46);
}

.portrait-label {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 32px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page-raised);
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.11em;
}

.portrait-label span {
  width: 6px;
  height: 6px;
}

.hero-index {
  position: absolute;
  bottom: 32px;
  left: 0;
  color: var(--faint);
}

.content-section {
  padding: 92px 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  margin-bottom: 34px;
}

.section-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.section-kicker {
  margin-bottom: 10px;
  color: var(--accent);
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3.2vw, 2.45rem);
  font-weight: 800;
  letter-spacing: -0.06em;
}

.section-aside,
.section-note {
  color: var(--muted);
  font-size: 0.78rem;
}

.section-aside {
  margin: 0 0 6px;
}

.section-aside span {
  color: var(--accent);
}

.about-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.72fr);
  gap: 54px;
  align-items: start;
}

.about-content p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.about-content .about-lead {
  color: var(--text);
  font-size: clamp(1.12rem, 2vw, 1.4rem);
  font-weight: 600;
  line-height: 1.85;
}

.about-lead strong {
  color: var(--accent-strong);
  font-weight: 700;
}

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

.project-card {
  display: flex;
  min-height: 320px;
  flex-direction: column;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface) 72%, var(--page)));
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.07);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-border);
  background: var(--surface-hover);
}

.project-card-featured {
  grid-row: span 2;
  min-height: 100%;
  padding: 30px;
  border-color: var(--accent-border);
  background:
    radial-gradient(ellipse at 100% 0, var(--accent-soft), transparent 50%),
    var(--surface);
}

.project-card-top,
.project-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-number {
  color: var(--faint);
  font-size: 0.62rem;
}

.project-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.68rem;
}

.project-state span {
  width: 6px;
  height: 6px;
}

.project-glyph {
  color: var(--accent);
  font-size: 1.15rem;
}

.project-card h3 {
  margin: 24px 0 11px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.project-description {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.85;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-bottom: 22px;
}

.tag-list span {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.61rem;
}

.project-card-bottom {
  min-height: 43px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.repo-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.repo-stats > span:not(.stats-status) {
  white-space: nowrap;
}

.stat-icon {
  color: #e8b65b;
}

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

.stats-status {
  color: var(--faint);
  font-family: var(--font-sans);
  font-size: 0.64rem;
}

.project-link {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.project-link span {
  display: inline-block;
  transition: transform 160ms ease;
}

.project-link:hover span {
  transform: translate(2px, -2px);
}

.section-note {
  margin: 18px 0 0;
}

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

.skill-group {
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.skill-group-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.skill-symbol {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.skill-group h3 {
  margin: 0;
  font-size: 0.96rem;
}

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

.skill-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 0.8rem;
}

.skill-level {
  padding: 3px 8px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 0.64rem;
  white-space: nowrap;
}

.skill-note {
  margin: 16px 0 0;
  color: var(--faint);
  font-size: 0.7rem;
  line-height: 1.7;
}

.experience-intro {
  margin: -18px 0 32px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.timeline::before {
  position: absolute;
  top: 9px;
  bottom: 16px;
  left: 151px;
  width: 1px;
  background: var(--line);
  content: "";
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 48px;
  padding-bottom: 27px;
}

.timeline-item::before {
  position: absolute;
  top: 8px;
  left: 147px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--page);
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 1px var(--line);
  content: "";
}

.timeline-current::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-date {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding-top: 1px;
  text-align: right;
}

.timeline-item h3 {
  margin: 0 0 5px;
  font-size: 0.96rem;
}

.timeline-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.81rem;
}

.contact-section {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 0.85fr);
  gap: 50px;
  align-items: center;
  margin: 18px 0 76px;
  padding: clamp(28px, 6vw, 58px);
  overflow: hidden;
  border: 1px solid var(--accent-border);
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 0 100%, var(--accent-soft), transparent 55%),
    var(--surface);
}

.contact-copy h2 {
  margin: 0 0 15px;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 1.3;
}

.contact-copy > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.contact-links {
  display: grid;
  gap: 9px;
}

.contact-link {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--page) 48%, transparent);
  transition: border-color 160ms ease, transform 160ms ease;
}

.contact-link:hover {
  transform: translateX(3px);
  border-color: var(--accent-border);
}

.contact-link-icon {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
}

.contact-link > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.contact-link strong {
  font-size: 0.76rem;
}

.contact-link small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.69rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-arrow {
  margin-left: auto;
  color: var(--faint);
}

.site-footer {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.73rem;
}

.footer-brand {
  color: var(--text);
  font-size: 0.78rem;
}

.footer-brand span {
  color: var(--accent);
}

.site-footer p {
  margin: 0;
}

.back-to-top {
  white-space: nowrap;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .project-card {
    box-shadow: 0 10px 36px rgba(29, 55, 96, 0.045);
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 36px, 680px);
  }

  .site-header {
    min-height: 68px;
  }

  .site-header-inner {
    width: min(680px, calc(100% - 36px));
  }

  .site-nav {
    gap: 16px;
    font-size: 0.76rem;
  }

  .theme-toggle {
    width: 38px;
    justify-content: center;
    padding: 0;
  }

  .theme-toggle span {
    display: none;
  }

  .hero {
    min-height: 530px;
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.7fr);
    gap: 18px;
    padding: 76px 0 92px;
  }

  .hero h1 {
    font-size: clamp(2.4rem, 6.5vw, 3.6rem);
  }

  .portrait-frame {
    width: min(250px, 90%);
  }

  .portrait-orbit {
    width: 280px;
    height: 280px;
  }

  .orbit-two {
    width: 330px;
    height: 330px;
  }

  .portrait-label {
    right: -5px;
    bottom: 54px;
    font-size: 0.5rem;
  }

  .about-content {
    gap: 28px;
  }

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

  .contact-section {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

@media (max-width: 600px) {
  .page-shell {
    width: calc(100% - 32px);
  }

  .site-header {
    min-height: 64px;
  }

  .site-header-inner {
    width: calc(100% - 32px);
    gap: 12px;
  }

  .brand {
    gap: 7px;
    font-size: 0.82rem;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 0.68rem;
  }

  .site-nav {
    flex: 1;
    justify-content: flex-end;
    gap: clamp(10px, 3vw, 17px);
    overflow-x: auto;
    font-size: 0.68rem;
    scrollbar-width: none;
  }

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

  .site-nav a {
    flex: 0 0 auto;
  }

  .theme-toggle {
    width: 34px;
    min-height: 34px;
  }

  .hero {
    min-height: unset;
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 66px 0 78px;
  }

  .hero-copy {
    order: 1;
  }

  .hero-portrait {
    min-height: 230px;
    grid-row: 1;
  }

  .portrait-frame {
    width: 190px;
    border-width: 6px;
    border-radius: 25px;
  }

  .portrait-orbit {
    width: 225px;
    height: 225px;
  }

  .orbit-two {
    width: 265px;
    height: 265px;
  }

  .portrait-label {
    right: calc(50% - 130px);
    bottom: 4px;
  }

  .hero h1 {
    font-size: clamp(2.45rem, 12vw, 3.7rem);
  }

  .hero-summary {
    font-size: 0.9rem;
  }

  .hero-index {
    bottom: 22px;
  }

  .content-section {
    padding: 68px 0;
  }

  .section-heading {
    margin-bottom: 25px;
  }

  .section-heading-row {
    align-items: start;
    gap: 12px;
  }

  .section-aside {
    margin-top: 24px;
    text-align: right;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .about-content .about-lead {
    font-size: 1.08rem;
  }

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

  .project-card,
  .project-card-featured {
    min-height: 0;
    grid-row: auto;
    padding: 22px;
  }

  .project-card h3 {
    margin-top: 18px;
  }

  .repo-stats {
    gap: 9px;
    font-size: 0.62rem;
  }

  .project-link {
    font-size: 0.66rem;
  }

  .timeline::before {
    left: 7px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 0 0 24px 29px;
  }

  .timeline-item::before {
    left: 3px;
  }

  .timeline-date {
    text-align: left;
  }

  .contact-section {
    gap: 25px;
    margin: 0 0 52px;
    padding: 27px 20px;
  }

  .contact-copy h2 {
    font-size: 2rem;
  }

  .site-footer {
    min-height: 76px;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    padding: 15px 0;
  }

  .site-footer p {
    order: 1;
    width: 100%;
    font-size: 0.66rem;
  }
}

@media (max-width: 380px) {
  .site-nav {
    gap: 9px;
    font-size: 0.63rem;
  }

  .brand {
    font-size: 0.74rem;
  }

  .hero-actions .button {
    flex: 1;
  }
}

@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;
  }
}
