:root {
  --bg: #070809;
  --panel: rgba(18, 20, 21, 0.72);
  --panel-soft: rgba(255, 235, 210, 0.055);
  --line: rgba(242, 205, 163, 0.16);
  --line-strong: rgba(242, 205, 163, 0.34);
  --text: #fff1e1;
  --muted: #c6b5a4;
  --dim: #776e65;
  --warm: #f2cda3;
  --copper: #d9824b;
  --amber: #ffc85c;
  --cyan: #69d7ff;
  --mint: #8fffc9;
  --rose: #ff7a8a;
  --shadow: rgba(0, 0, 0, 0.5);
  --cn-display: "上图东观体", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(120deg, rgba(216, 130, 75, 0.08), transparent 34%),
    radial-gradient(circle at 50% 36%, rgba(242, 205, 163, 0.13), transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(105, 215, 255, 0.08), transparent 32%),
    #070809;
}

body[data-theme="light"] {
  --bg: #f4f0e8;
  --panel: rgba(255, 252, 246, 0.84);
  --panel-soft: rgba(170, 109, 54, 0.08);
  --line: rgba(83, 62, 45, 0.15);
  --line-strong: rgba(83, 62, 45, 0.28);
  --text: #211915;
  --muted: #6c6158;
  --dim: #9b9085;
  --warm: #84552f;
  --copper: #b86232;
  --amber: #ad7427;
  --cyan: #176f86;
  --mint: #26725a;
  --rose: #a94e5b;
  --shadow: rgba(88, 66, 44, 0.16);
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(184, 98, 50, 0.12), transparent 34%),
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.92), transparent 34%),
    radial-gradient(circle at 84% 12%, rgba(23, 111, 134, 0.11), transparent 30%),
    linear-gradient(180deg, #fbf8f2, #eee8df 68%, #e8e1d8),
    var(--bg);
}

body[data-theme="light"] #circuitCanvas {
  opacity: 0.16;
  filter: sepia(0.22) saturate(0.72) brightness(1.18);
}

body[data-theme="light"] .site-nav {
  background: rgba(255, 252, 246, 0.78);
  color: rgba(33, 25, 21, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(83, 62, 45, 0.1),
    0 16px 36px rgba(88, 66, 44, 0.12);
}

body[data-theme="light"].nav-scrolled .site-nav,
body.project-detail-page[data-theme="light"] .site-nav {
  background: rgba(255, 252, 246, 0.92);
  color: rgba(33, 25, 21, 0.84);
}

body[data-theme="light"] .site-nav a:hover {
  color: var(--warm);
  background: rgba(184, 98, 50, 0.09);
  text-shadow: none;
}

body[data-theme="light"] .ambient-card {
  border-color: rgba(83, 62, 45, 0.17);
  background: rgba(255, 252, 246, 0.48);
  box-shadow: 0 16px 36px rgba(88, 66, 44, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  opacity: 0.46;
  filter: saturate(0.78) brightness(1.08);
}

body[data-theme="light"] .ambient-schematic {
  --sch-alpha: 0.86;
  --sch-brightness: 1;
  --sch-line-alpha: 0.58;
  --sch-pwm-alpha: 0.48;
  --sch-glow-size: 0;
  --sch-glow-alpha: 0;
}

body[data-theme="light"] .module-title {
  border-bottom-color: rgba(83, 62, 45, 0.12);
  color: rgba(33, 25, 21, 0.48);
}

body[data-theme="light"] .module-title strong,
body[data-theme="light"] .rail-row b {
  color: rgba(33, 25, 21, 0.72);
}

body[data-theme="light"] .schematic-svg {
  background: rgba(255, 252, 246, 0.7);
}

body[data-theme="light"] .sch-grid {
  stroke: rgba(83, 62, 45, 0.08);
}

body[data-theme="light"] .sch-main,
body[data-theme="light"] .capacitor-plate {
  stroke: rgba(138, 90, 50, var(--sch-line-alpha));
}

body[data-theme="light"] .switch-contact,
body[data-theme="light"] .sch-node,
body[data-theme="light"] .sch-pulse {
  fill: rgba(138, 90, 50, var(--sch-line-alpha));
}

body[data-theme="light"] .pwm-trace {
  stroke: rgba(23, 111, 134, var(--sch-pwm-alpha));
}

body[data-theme="light"] .sch-terminal {
  fill: rgba(255, 252, 246, 0.86);
  stroke: rgba(138, 90, 50, var(--sch-line-alpha));
}

body[data-theme="light"] .sch-main text {
  fill: rgba(33, 25, 21, 0.62);
}

body[data-theme="light"] .avatar-img {
  border-color: rgba(132, 85, 47, 0.28);
  box-shadow: 0 18px 42px rgba(88, 66, 44, 0.2), 0 0 0 8px rgba(255, 252, 246, 0.72);
}

body[data-theme="light"] h1,
body[data-theme="light"] .section-heading h2,
body[data-theme="light"] .project-card-body h3,
body[data-theme="light"] .contact-methods h3,
body[data-theme="light"] .contact-method b,
body[data-theme="light"] .detail-copy h1,
body[data-theme="light"] .markdown-body h1,
body[data-theme="light"] .markdown-body h2,
body[data-theme="light"] .markdown-body h3 {
  color: #211915;
  text-shadow: none;
}

body[data-theme="light"] .intro,
body[data-theme="light"] .section-heading p,
body[data-theme="light"] .project-card-body p,
body[data-theme="light"] .about-copy,
body[data-theme="light"] .contact-heading p,
body[data-theme="light"] .detail-copy p,
body[data-theme="light"] .markdown-body {
  color: rgba(33, 25, 21, 0.68);
}

body[data-theme="light"] .contact-line a,
body[data-theme="light"] .replay-boot,
body[data-theme="light"] .detail-back {
  border-color: rgba(83, 62, 45, 0.15);
  background: rgba(255, 252, 246, 0.7);
  color: var(--warm);
  box-shadow: 0 10px 24px rgba(88, 66, 44, 0.09);
}

body[data-theme="light"] .project-card,
body[data-theme="light"] .contact-methods,
body[data-theme="light"] .contact-method,
body[data-theme="light"] .detail-copy,
body[data-theme="light"] .detail-article {
  border-color: rgba(83, 62, 45, 0.13);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.7), transparent 56%),
    rgba(255, 252, 246, 0.72);
  color: var(--text);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 18px 44px rgba(88, 66, 44, 0.11);
}

body[data-theme="light"] .detail-hero {
  background: transparent;
  box-shadow: none;
}

body[data-theme="light"] .center-profile {
  background: transparent;
  box-shadow: none;
}

body[data-theme="light"] .project-card:hover {
  border-color: rgba(184, 98, 50, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), transparent 56%),
    rgba(255, 252, 246, 0.92);
}

body[data-theme="light"] .project-card::after {
  border-color: rgba(184, 98, 50, 0.72);
}

body[data-theme="light"] .project-cover {
  border-bottom-color: rgba(83, 62, 45, 0.12);
}

body[data-theme="light"] .project-card-body span,
body[data-theme="light"] .detail-copy > span,
body[data-theme="light"] .contact-heading span,
body[data-theme="light"] .section-heading span {
  color: var(--copper);
}

body[data-theme="light"] .project-tags span {
  border-color: rgba(38, 114, 90, 0.2);
  color: rgba(38, 114, 90, 0.78);
  background: rgba(38, 114, 90, 0.055);
}

body[data-theme="light"] .projects-more-link {
  border-color: rgba(184, 98, 50, 0.24);
  color: #70411f;
  background: rgba(184, 98, 50, 0.075);
}

body[data-theme="light"] .projects-more-link:hover {
  border-color: rgba(38, 114, 90, 0.34);
  color: var(--mint);
  background: rgba(38, 114, 90, 0.075);
}

body[data-theme="light"] .contact-logo {
  background: rgba(255, 255, 255, 0.68);
  box-shadow:
    inset 0 0 0 1px rgba(83, 62, 45, 0.12),
    0 12px 24px rgba(88, 66, 44, 0.11);
}

body[data-theme="light"] .contact-github .contact-logo img,
body[data-theme="light"] .contact-x .contact-logo img {
  filter: invert(1);
}

body[data-theme="light"] .contact-method small {
  color: rgba(33, 25, 21, 0.52);
}

body[data-theme="light"] .markdown-body blockquote {
  border-left-color: rgba(184, 98, 50, 0.34);
  color: rgba(33, 25, 21, 0.62);
}

body[data-theme="light"] .markdown-body pre {
  border-color: rgba(83, 62, 45, 0.14);
  background: rgba(255, 252, 246, 0.76);
}

body.project-detail-page[data-theme="light"] {
  background:
    radial-gradient(circle at 12% 10%, rgba(184, 98, 50, 0.12), transparent 28%),
    radial-gradient(circle at 85% 6%, rgba(23, 111, 134, 0.1), transparent 30%),
    linear-gradient(180deg, #fbf8f2, #eee8df);
}

body.project-detail-page[data-theme="light"]::before {
  background:
    linear-gradient(rgba(83, 62, 45, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83, 62, 45, 0.04) 1px, transparent 1px);
}

body[data-theme="light"] .boot-stage {
  background:
    radial-gradient(circle at center, rgba(184, 98, 50, 0.09), transparent 34%),
    rgba(246, 241, 233, 0.88);
  backdrop-filter: blur(8px);
}

body[data-theme="light"].boot-running .boot-stage {
  background:
    radial-gradient(circle at center, rgba(184, 98, 50, 0.08), transparent 34%),
    #f4f0e8;
}

body[data-theme="light"] .boot-scope {
  background: #f7f2ea;
  border-color: rgba(83, 62, 45, 0.16);
  box-shadow: 0 28px 90px rgba(88, 66, 44, 0.22);
}

body[data-theme="light"] .brand-row {
  color: rgba(33, 25, 21, 0.46);
}

body[data-theme="light"] .boot-screen {
  background: #fbf8f2;
  box-shadow: inset 0 0 52px rgba(88, 66, 44, 0.12);
}

body[data-theme="light"] .post-layer,
body[data-theme="light"] .terminal-layer {
  background: #fbf8f2;
  color: rgba(33, 25, 21, 0.72);
}

body[data-theme="light"] .terminal-line {
  color: rgba(33, 25, 21, 0.7);
}

body[data-theme="light"] .scanlines {
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(83, 62, 45, 0.035) 2px 4px);
}

body[data-theme="light"] .vignette {
  background: radial-gradient(ellipse at center, transparent 62%, rgba(88, 66, 44, 0.12));
}

body[data-page-mode="single"] .page-section {
  display: none;
}

body[data-page-mode="home-about"] .projects-section,
body[data-page-mode="home-about"] .projects-nav-link {
  display: none;
}

button,
a {
  font: inherit;
}

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

#circuitCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0.42;
  transition: opacity 0.35s ease;
}

body:not(.home-view) #circuitCanvas {
  opacity: 0;
}

.site-nav {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 18;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 5px;
  border: 0;
  border-radius: 999px;
  background: rgba(7, 8, 9, 0.24);
  color: rgba(244, 234, 220, 0.64);
  transform: translateX(-50%);
  backdrop-filter: blur(12px) saturate(1.18);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.045),
    0 14px 32px rgba(0, 0, 0, 0.1);
  font: 700 13px/1 "SFMono-Regular", Consolas, monospace;
  transition: background 0.22s ease, box-shadow 0.22s ease, color 0.22s ease;
}

body.nav-scrolled .site-nav,
.project-detail-page .site-nav {
  background: rgba(7, 8, 9, 0.72);
  color: rgba(244, 234, 220, 0.78);
  box-shadow:
    inset 0 0 0 1px rgba(242, 205, 163, 0.08),
    0 16px 36px rgba(0, 0, 0, 0.26);
}

body[data-page-mode="single"] .site-nav {
  display: none;
}

.site-nav nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  min-width: 58px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.site-nav a:hover {
  color: var(--warm);
  background: rgba(242, 205, 163, 0.075);
  text-shadow: 0 0 14px rgba(242, 205, 163, 0.22);
}

@media (hover: none) {
  .site-nav a:hover,
  body[data-theme="light"] .site-nav a:hover {
    color: inherit;
    background: transparent;
    text-shadow: none;
  }

  .site-nav a:active {
    color: var(--warm);
    background: rgba(242, 205, 163, 0.075);
  }
}

.home-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  scroll-margin-top: 84px;
  display: grid;
  place-items: center;
  padding: 56px 22px;
  transition: opacity 1.15s ease, transform 1.15s cubic-bezier(0.2, 0.9, 0.3, 1), filter 1.15s ease;
}

body.boot-pending #circuitCanvas,
body.boot-pending .site-nav,
body.boot-pending .home-shell,
body.boot-pending .ambient-layer,
body.boot-pending .replay-boot,
body.boot-pending .page-section,
body.boot-running #circuitCanvas,
body.boot-running .site-nav,
body.boot-running .home-shell {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.boot-running .ambient-layer,
body.boot-running .replay-boot,
body.boot-running .page-section {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.boot-running .home-shell {
  transform: translateY(22px) scale(0.985);
  filter: blur(10px);
}

body.boot-revealing .home-shell {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.ambient-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.ambient-stack {
  position: absolute;
  top: 92px;
  bottom: 64px;
  width: clamp(320px, 26vw, 390px);
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.ambient-stack-left {
  left: 4vw;
}

.ambient-stack-right {
  right: 4vw;
}

.ambient-card {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(242, 205, 163, 0.26);
  background: rgba(12, 15, 16, 0.74);
  box-shadow: 0 22px 58px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(16px);
  opacity: 0.62;
  overflow: hidden;
  filter: saturate(1.05) brightness(1.08);
}

.ambient-schematic {
  --sch-alpha: 0.68;
  --sch-brightness: 0.9;
  --sch-line-alpha: 0.66;
  --sch-pwm-alpha: 0.42;
  --sch-glow-size: 2.5px;
  --sch-glow-alpha: 0.1;
}

.ambient-scope,
.ambient-logic {
  order: 1;
}

.ambient-schematic,
.ambient-eye {
  order: 2;
}

.ambient-power,
.ambient-board {
  order: 3;
}

.module-title {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(242, 205, 163, 0.12);
  color: rgba(244, 234, 220, 0.42);
  font: 700 10px/1 "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
}

.ambient-stack-left .module-title {
  justify-content: flex-start;
}

.ambient-stack-right .module-title {
  justify-content: flex-end;
}

.module-title strong {
  color: rgba(242, 205, 163, 0.82);
  font-size: 10px;
  text-transform: none;
}

.ambient-stack-left .module-title strong {
  margin-left: 10px;
}

.ambient-stack-right .module-title strong {
  order: 1;
  margin-right: 10px;
}

.ambient-stack-right .module-title span {
  order: 2;
}

#scopeCanvas,
#logicCanvas,
#boardCanvas,
#eyeCanvas,
#bootScopeCanvas {
  display: block;
  width: 100%;
  height: calc(100% - 42px);
}

.schematic-svg {
  display: block;
  width: 100%;
  height: calc(100% - 42px);
  background: rgba(2, 6, 5, 0.42);
  opacity: var(--sch-alpha);
  filter: brightness(var(--sch-brightness));
}

.sch-grid {
  fill: none;
  stroke: rgba(143, 255, 201, 0.055);
  stroke-width: 1;
}

.sch-main {
  fill: none;
  stroke: rgba(255, 198, 86, var(--sch-line-alpha));
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  font: 700 13px Georgia, "Times New Roman", serif;
  filter: drop-shadow(0 0 var(--sch-glow-size) rgba(255, 202, 91, var(--sch-glow-alpha)));
}

.sch-main text {
  stroke: none;
  fill: rgba(185, 204, 255, 0.76);
}

.buck-wire,
.switch-blade,
.inductor,
.load,
.diode-bar,
.capacitor-lead,
.pwm-trace,
.resistor,
.capacitor-plate,
.ground {
  fill: none;
}

.switch-contact {
  fill: rgba(255, 203, 94, var(--sch-line-alpha));
  stroke: none;
}

.pwm-trace {
  stroke: rgba(108, 236, 205, var(--sch-pwm-alpha));
  stroke-width: 1.7;
  stroke-linecap: square;
}

.sch-terminal {
  fill: rgba(2, 6, 5, 0.78);
  stroke: rgba(255, 202, 91, var(--sch-line-alpha));
  stroke-width: 2;
}

.sch-node {
  fill: rgba(255, 202, 91, var(--sch-line-alpha));
  stroke: none;
}

.diode-body {
  fill: rgba(255, 202, 91, 0.18);
}

.diode-bar {
  stroke-width: 2.5;
  stroke-linecap: butt;
}

.capacitor-plate {
  stroke: rgba(255, 202, 91, var(--sch-line-alpha));
  stroke-width: 2.4;
  stroke-linecap: butt;
}

.sch-pulse {
  fill: rgba(255, 221, 132, 0.96);
  filter: url(#schGlow);
  transform-box: fill-box;
  transform-origin: center;
  animation: schPulse 2.8s linear infinite;
}

@keyframes schPulse {
  0% {
    transform: translateX(0);
    opacity: 0.14;
  }

  14%,
  86% {
    opacity: 0.9;
  }

  100% {
    transform: translateX(124px);
    opacity: 0.14;
  }
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 16px;
}

.rail-row {
  display: grid;
  grid-template-columns: 42px 1fr 52px;
  align-items: center;
  gap: 10px;
  color: rgba(244, 234, 220, 0.56);
  font: 700 10px/1 "SFMono-Regular", Consolas, monospace;
}

.rail-row i {
  height: 7px;
  width: 62%;
  display: block;
  background: linear-gradient(90deg, var(--copper), var(--amber), var(--mint));
  box-shadow: 0 0 16px rgba(255, 200, 92, 0.36);
  transition: opacity 0.25s ease, filter 0.25s ease, box-shadow 0.25s ease, width 0.25s ease;
}

.rail-row b {
  color: rgba(255, 241, 225, 0.72);
  text-align: right;
}

.center-profile {
  position: relative;
  z-index: 3;
  width: min(720px, 100%);
  max-width: calc(100vw - 28px);
  text-align: center;
  padding: clamp(28px, 5vw, 54px);
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
}

.center-profile::before {
  display: none;
}

.portrait-cluster {
  position: relative;
  width: clamp(112px, 16vw, 156px);
  aspect-ratio: 1;
  margin: 0 auto 24px;
}

.portrait-orbit {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background:
    conic-gradient(from 160deg, rgba(105, 215, 255, 0.74), transparent 20%, rgba(216, 130, 75, 0.78), transparent 64%, rgba(143, 255, 201, 0.72));
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%);
  mask: radial-gradient(circle, transparent 62%, #000 63%);
  animation: slowSpin 11s linear infinite;
}

.avatar-img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(242, 205, 163, 0.44);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42), 0 0 0 8px rgba(242, 205, 163, 0.055);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--copper);
  font: 800 12px/1 "SFMono-Regular", Consolas, monospace;
}

h1 {
  margin: 0;
  color: #fff4e6;
  font-family: var(--cn-display);
  font-size: clamp(42px, 6.4vw, 72px);
  line-height: 1;
  font-weight: 800;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.48), 0 0 14px rgba(242, 205, 163, 0.12);
}

.intro {
  width: min(100%, 560px);
  margin: 24px auto 0;
  color: #e0d0be;
  font-family: var(--cn-display);
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.9;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.contact-line {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.contact-line a,
.replay-boot {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(242, 205, 163, 0.18);
  background: rgba(0, 0, 0, 0.22);
}

.contact-line a {
  color: var(--warm);
}

.replay-boot {
  position: fixed;
  right: 22px;
  bottom: 20px;
  z-index: 6;
  color: rgba(244, 234, 220, 0.62);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: opacity 0.25s ease, color 0.2s ease, border-color 0.2s ease;
}

body:not(.home-view) .replay-boot {
  opacity: 0;
  pointer-events: none;
}

.replay-boot:hover {
  color: var(--warm);
  border-color: rgba(242, 205, 163, 0.36);
}

.page-section {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  scroll-margin-top: 0;
  padding: 78px clamp(22px, 5vw, 72px) 72px;
  display: flex;
  align-items: flex-start;
  color: var(--text);
}

.projects-section {
  align-items: flex-start;
}

.about-section {
  align-items: flex-start;
}

.section-inner {
  width: min(980px, 100%);
  margin: 0 auto;
}

.section-heading {
  width: min(680px, 100%);
  margin-bottom: 28px;
}

.projects-heading {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.projects-heading > div {
  width: min(680px, 100%);
}

.section-heading span {
  color: var(--copper);
  font: 800 11px/1 "SFMono-Regular", Consolas, monospace;
}

.section-heading h2 {
  margin: 10px 0 12px;
  color: #fff4e6;
  font-family: var(--cn-display);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
}

.section-heading p {
  margin: 0;
  color: rgba(224, 208, 190, 0.72);
  font-family: var(--cn-display);
  font-size: 14px;
  line-height: 1.8;
}

.section-heading code,
.markdown-body code {
  color: var(--amber);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.projects-layout {
  display: block;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  align-items: stretch;
  gap: 18px;
}

.project-grid > * {
  max-width: 460px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  padding: 0;
  border: 1px solid rgba(242, 205, 163, 0.18);
  background: rgba(10, 12, 13, 0.62);
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: rgba(255, 200, 92, 0.42);
  background: rgba(18, 20, 21, 0.76);
  transform: translateY(-1px);
}

.project-card::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 16px;
  width: 7px;
  height: 7px;
  border-top: 1px solid rgba(255, 200, 92, 0.78);
  border-right: 1px solid rgba(255, 200, 92, 0.78);
  opacity: 0.45;
  transform: rotate(45deg);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.project-card:hover::after {
  opacity: 1;
  transform: translateX(2px) rotate(45deg);
}

.project-card.is-loading {
  cursor: progress;
}

.project-card.is-loading::after {
  display: none;
}

.project-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  background:
    linear-gradient(135deg, rgba(255, 200, 92, 0.22), rgba(105, 215, 255, 0.12)),
    rgba(2, 6, 5, 0.64);
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(242, 205, 163, 0.12);
}

.project-card-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 15px 14px 14px;
}

.project-card-body span {
  color: rgba(242, 205, 163, 0.55);
  font: 800 10px/1 "SFMono-Regular", Consolas, monospace;
}

.project-card-body h3 {
  margin: 9px 0 8px;
  color: #fff4e6;
  font-family: var(--cn-display);
  font-size: 17px;
  line-height: 1.35;
}

.project-card-body p {
  margin: 0;
  color: rgba(224, 208, 190, 0.68);
  font-family: var(--cn-display);
  font-size: 13px;
  line-height: 1.65;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
}

.project-tags span {
  padding: 5px 7px;
  border: 1px solid rgba(143, 255, 201, 0.16);
  color: rgba(143, 255, 201, 0.72);
  font-size: 10px;
}

.projects-more-link {
  width: fit-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-bottom: 3px;
  padding: 0 12px;
  border: 1px solid rgba(255, 200, 92, 0.28);
  border-radius: 999px;
  color: rgba(255, 236, 206, 0.88);
  background: rgba(255, 200, 92, 0.08);
  font: 800 12px/1 "SFMono-Regular", Consolas, monospace;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.projects-more-link:hover {
  border-color: rgba(143, 255, 201, 0.42);
  color: var(--mint);
  background: rgba(143, 255, 201, 0.08);
}

.markdown-body {
  max-height: 600px;
  padding: 24px;
  overflow: auto;
  color: rgba(244, 234, 220, 0.82);
  font-family: var(--cn-display);
  font-size: 15px;
  line-height: 1.85;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: #fff4e6;
  line-height: 1.25;
}

.markdown-body h1 {
  margin: 0 0 18px;
  font-size: 30px;
}

.markdown-body h2 {
  margin: 28px 0 10px;
  font-size: 22px;
}

.markdown-body h3 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.markdown-body p,
.markdown-body ul,
.markdown-body blockquote,
.markdown-body pre,
.markdown-body figure {
  margin: 0 0 18px;
}

.markdown-body ul {
  padding-left: 20px;
}

.markdown-body blockquote {
  padding-left: 14px;
  border-left: 2px solid rgba(255, 200, 92, 0.42);
  color: rgba(242, 205, 163, 0.74);
}

.markdown-body pre {
  padding: 14px;
  overflow: auto;
  background: rgba(2, 6, 5, 0.72);
  border: 1px solid rgba(242, 205, 163, 0.12);
}

.markdown-body img {
  max-width: 100%;
  display: block;
  border: 1px solid rgba(242, 205, 163, 0.14);
}

.markdown-body a {
  color: var(--mint);
}

.project-detail-page {
  min-height: 100svh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 200, 92, 0.1), transparent 28%),
    radial-gradient(circle at 85% 6%, rgba(105, 215, 255, 0.1), transparent 30%),
    var(--bg);
}

.project-detail-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(242, 205, 163, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 205, 163, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 88%);
}

.project-detail-main {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  padding: 98px clamp(18px, 5vw, 72px) 72px;
  color: var(--text);
}

.detail-shell {
  width: min(920px, 100%);
  margin: 0 auto;
}

.detail-actions {
  position: sticky;
  top: 74px;
  z-index: 4;
  width: fit-content;
  margin-bottom: 18px;
}

.detail-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid rgba(255, 200, 92, 0.22);
  border-radius: 999px;
  color: rgba(255, 236, 206, 0.9);
  background:
    linear-gradient(135deg, rgba(255, 200, 92, 0.12), transparent 58%),
    rgba(7, 8, 9, 0.78);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
  font: 800 12px/1 "SFMono-Regular", Consolas, monospace;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.detail-back span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 200, 92, 0.12);
}

.detail-back:hover {
  color: var(--warm);
  border-color: rgba(255, 200, 92, 0.42);
  transform: translateX(-2px);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  margin-bottom: 22px;
}

.detail-copy,
.detail-article {
  border: 1px solid rgba(242, 205, 163, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 46%),
    rgba(8, 11, 11, 0.68);
}

.detail-copy {
  min-height: 260px;
  padding: clamp(22px, 4vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.detail-copy > span {
  color: rgba(217, 130, 75, 0.9);
  font: 800 11px/1 "SFMono-Regular", Consolas, monospace;
}

.detail-copy h1 {
  margin: 14px 0 14px;
  color: #fff4e6;
  font-family: var(--cn-display);
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.06;
}

.detail-copy p {
  max-width: 680px;
  margin: 0 0 18px;
  color: rgba(224, 208, 190, 0.72);
  font-family: var(--cn-display);
  line-height: 1.8;
}

.detail-article {
  max-height: none;
  overflow: visible;
  padding: clamp(22px, 4vw, 42px);
}

.about-inner {
  max-width: 980px;
}

.about-copy {
  display: grid;
  gap: 18px;
  color: rgba(244, 234, 220, 0.78);
  font-family: var(--cn-display);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 2;
}

.about-copy p {
  margin: 0;
}

.contact-methods {
  margin-top: 32px;
  padding: 26px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 45%),
    radial-gradient(circle at 78% 10%, rgba(105, 215, 255, 0.08), transparent 30%),
    rgba(6, 9, 9, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(242, 205, 163, 0.105),
    0 18px 44px rgba(0, 0, 0, 0.16);
}

.contact-heading {
  max-width: 560px;
  margin-bottom: 20px;
}

.contact-heading span {
  color: rgba(217, 130, 75, 0.9);
  font: 800 11px/1 "SFMono-Regular", Consolas, monospace;
}

.contact-methods h3 {
  margin: 10px 0 10px;
  color: #fff4e6;
  font-family: var(--cn-display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}

.contact-heading p {
  margin: 0;
  color: rgba(224, 208, 190, 0.66);
  font-family: var(--cn-display);
  font-size: 14px;
  line-height: 1.8;
}

.contact-method-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.contact-method-grid > li {
  min-width: 0;
}

.contact-method {
  --contact-glow: rgba(255, 200, 92, 0.14);
  position: relative;
  height: 100%;
  min-height: 112px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 48px auto;
  align-items: center;
  justify-items: center;
  gap: 12px;
  padding: 14px 10px;
  border: 1px solid rgba(242, 205, 163, 0.16);
  border-radius: 8px;
  color: rgba(244, 234, 220, 0.9);
  background:
    radial-gradient(circle at 16% 50%, var(--contact-glow), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 58%),
    rgba(7, 10, 10, 0.52);
  overflow: hidden;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.contact-method::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  opacity: 0;
  transform: translateX(-60%);
  transition: opacity 180ms ease, transform 320ms ease;
}

.contact-method:not(.is-placeholder):hover {
  transform: translateY(-2px);
  border-color: rgba(143, 255, 201, 0.32);
}

.contact-method:not(.is-placeholder):focus-visible {
  outline: 2px solid rgba(143, 255, 201, 0.72);
  outline-offset: 3px;
}

.contact-method:not(.is-placeholder):hover::after {
  opacity: 1;
  transform: translateX(60%);
}

.contact-method.is-placeholder {
  cursor: default;
  opacity: 0.9;
  pointer-events: none;
}

.contact-email {
  --contact-glow: rgba(255, 200, 92, 0.22);
}

.contact-github {
  --contact-glow: rgba(255, 255, 255, 0.12);
}

.contact-telegram {
  --contact-glow: rgba(38, 165, 228, 0.2);
}

.contact-x {
  --contact-glow: rgba(255, 255, 255, 0.13);
}

.contact-linkedin {
  --contact-glow: rgba(0, 126, 187, 0.22);
}

.contact-wechat {
  --contact-glow: rgba(7, 193, 96, 0.22);
}

.contact-qq {
  --contact-glow: rgba(235, 25, 35, 0.18);
}

.contact-logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 14px 28px rgba(0, 0, 0, 0.24);
}

.contact-logo img {
  width: 26px;
  height: 26px;
  display: block;
  object-fit: contain;
}

.contact-text {
  min-width: 0;
  width: 100%;
  text-align: center;
}

.contact-method b {
  display: block;
  margin-bottom: 5px;
  color: #fff4e6;
  font-family: var(--cn-display);
  font-size: 16px;
  line-height: 1.2;
}

.contact-method small {
  display: block;
  color: rgba(244, 234, 220, 0.56);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boot-stage {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at center, rgba(242, 205, 163, 0.08), transparent 34%),
    rgba(7, 8, 9, 0.74);
  backdrop-filter: blur(8px);
  transition: opacity 1.15s ease, visibility 1.15s ease, backdrop-filter 1.15s ease;
}

body.boot-running .boot-stage {
  background:
    radial-gradient(circle at center, rgba(242, 205, 163, 0.06), transparent 34%),
    #070809;
  backdrop-filter: none;
  transition: none;
}

.boot-stage.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-stage.closing {
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(0);
}

.boot-scope {
  width: min(920px, 92vw);
  padding: 10px 10px 14px;
  border-radius: 18px;
  background: #181b1d;
  border: 1px solid rgba(242, 205, 163, 0.18);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.68);
  transform-origin: center;
  animation: bootArrive 0.85s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.boot-stage.closing .boot-scope {
  animation: bootLeave 1.15s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.led-strip {
  display: flex;
  gap: 6px;
  padding: 4px 12px 8px;
}

.led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2c342d;
}

.led.on {
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
}

.led.warn {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.led.blue {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.brand-row {
  display: flex;
  justify-content: space-between;
  padding: 0 12px 5px;
  color: rgba(244, 234, 220, 0.42);
  font: 700 9px/1 "SFMono-Regular", Consolas, monospace;
  letter-spacing: 1.5px;
}

.boot-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9.5;
  overflow: hidden;
  border-radius: 8px;
  background: #020504;
  box-shadow: inset 0 0 52px rgba(0, 0, 0, 0.9);
}

.scanlines,
.vignette {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.scanlines {
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.16) 2px 4px);
}

.vignette {
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, 0.58));
}

.post-layer,
.terminal-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020302;
  color: #a8b8a2;
  text-align: center;
  white-space: pre-wrap;
  font: 700 15px/1.7 "SFMono-Regular", Consolas, monospace;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.terminal-layer {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px clamp(18px, 4vw, 54px);
  color: #c7d5bf;
}

.post-layer.fade-out,
.terminal-layer.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.terminal-line {
  opacity: 0;
  transform: translateY(6px);
  color: rgba(244, 234, 220, 0.74);
  font-size: clamp(11px, 1.8vw, 15px);
  width: 100%;
  text-align: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.terminal-line.show {
  opacity: 1;
  transform: translateY(0);
}

.prompt,
.output-success {
  color: var(--mint);
}

.output-highlight {
  color: var(--amber);
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  margin-left: 2px;
  background: var(--mint);
  vertical-align: bottom;
  animation: blink 0.7s step-end infinite;
}

#bootScopeCanvas {
  height: 100%;
}

@keyframes bootArrive {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bootLeave {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.93);
    filter: blur(8px);
  }
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

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

@media (max-width: 980px) {
  .ambient-stack {
    width: 300px;
    top: 92px;
    bottom: 64px;
    gap: 14px;
  }

  .ambient-stack-left {
    left: -120px;
  }

  .ambient-stack-right {
    right: -120px;
  }

  .ambient-card {
    opacity: 0.34;
  }
}

@media (max-width: 680px) {
  html,
  body {
    min-height: 100%;
  }

  body {
    min-height: 100svh;
    overflow: hidden;
  }

  body[data-page-mode="three"] {
    overflow-y: auto;
  }

  .site-nav {
    top: max(10px, env(safe-area-inset-top));
    width: auto;
    max-width: calc(100vw - 20px);
    min-height: 36px;
    justify-content: center;
    padding: 4px;
    font-size: 12px;
  }

  .site-nav nav {
    gap: 2px;
  }

  .site-nav a {
    min-width: 52px;
    min-height: 30px;
    padding: 0 10px;
  }

  .home-shell {
    min-height: 100svh;
    height: 100svh;
    width: 100vw;
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
  }

  #circuitCanvas,
  .ambient-layer,
  .replay-boot {
    display: none;
  }

  .center-profile {
    width: 100vw;
    max-width: none;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding:
      max(22px, env(safe-area-inset-top))
      20px
      max(22px, env(safe-area-inset-bottom));
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 24%),
      rgba(10, 12, 13, 0.48);
    box-shadow: none;
  }

  .portrait-cluster {
    width: clamp(104px, 34vw, 142px);
    margin-bottom: clamp(18px, 4svh, 26px);
  }

  .eyebrow {
    margin-bottom: 10px;
  }

  h1 {
    font-size: clamp(28px, 9.2vw, 36px);
  }

  .intro {
    margin-top: clamp(20px, 4svh, 28px);
    font-size: clamp(15px, 4.1vw, 17px);
    line-height: 1.85;
    width: min(100%, 310px);
  }

  .contact-line {
    margin-top: clamp(22px, 5svh, 32px);
  }

  .boot-scope {
    position: absolute;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    top: 50%;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 32px);
    border-radius: 14px;
    transform: translateY(-50%);
    animation-name: bootArriveMobile;
  }

  .boot-stage.closing .boot-scope {
    animation-name: bootLeaveMobile;
  }

  .boot-stage {
    display: block;
    height: 100dvh;
    min-height: 100svh;
    padding: 0;
  }

  .boot-screen {
    aspect-ratio: 4 / 3;
  }

  @keyframes bootArriveMobile {
    from {
      opacity: 0;
      transform: translateY(calc(-50% + 18px)) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translateY(-50%) scale(1);
    }
  }

  @keyframes bootLeaveMobile {
    to {
      opacity: 0;
      transform: translateY(calc(-50% - 10px)) scale(0.93);
      filter: blur(8px);
    }
  }

  .page-section {
    min-height: 100svh;
    padding: 64px 16px 42px;
    align-items: flex-start;
  }

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

  .projects-heading {
    display: block;
  }

  .projects-more-link {
    margin-top: 16px;
  }

  .section-heading h2 {
    font-size: 34px;
  }

  .section-heading p {
    font-size: 13px;
  }

  .projects-layout {
    display: block;
  }

  .project-card {
    min-height: 0;
  }

  .project-cover {
    aspect-ratio: 16 / 10;
  }

  .markdown-body {
    max-height: none;
    padding: 18px;
    font-size: 14px;
  }

  .markdown-body h1 {
    font-size: 24px;
  }

  .project-detail-main {
    padding: 76px 16px 42px;
  }

  .detail-hero {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .detail-copy {
    min-height: 220px;
    padding: 22px 18px;
  }

  .detail-copy h1 {
    font-size: 32px;
  }

  .about-copy {
    font-size: 16px;
    line-height: 1.9;
  }

  .contact-method-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .contact-method {
    min-height: 64px;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: 1fr;
    justify-items: stretch;
    gap: 12px;
    padding: 10px 12px;
    text-align: left;
  }

  .contact-logo {
    width: 42px;
    height: 42px;
  }

  .contact-logo img {
    width: 24px;
    height: 24px;
  }

  .contact-text {
    align-self: center;
    text-align: left;
  }

  .contact-method b {
    margin-bottom: 4px;
    font-size: 15px;
  }

  .contact-method small {
    font-size: 12px;
  }
}

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