:root {
  color-scheme: light;
  --paper: #fffaf2;
  --paper-deep: #f6eadb;
  --ink: #263238;
  --muted: #6d7a81;
  --line: #2d3a40;
  --mint: #98d8c1;
  --mint-dark: #337f6b;
  --peach: #ffbf9a;
  --lavender: #c9b7ff;
  --butter: #ffe08a;
  --sky: #b9e7f5;
  --rose: #f28fa2;
  --shadow: 8px 8px 0 #263238;
  --soft-shadow: 5px 5px 0 rgba(38, 50, 56, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(rgba(38, 50, 56, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 50, 56, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 20% 10%, #fff4bd 0 12%, transparent 28%),
    radial-gradient(circle at 90% 4%, #d7f3ed 0 10%, transparent 28%),
    var(--paper);
  background-size: 24px 24px, 24px 24px, 100% 100%, 100% 100%, auto;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
}

html:lang(zh) body {
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

html:lang(zh) .eyebrow,
html:lang(zh) .project-type,
html:lang(zh) .marquee,
html:lang(zh) .loader-card {
  font-family: Inter, "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow:
    1px 0 0 currentColor,
    0 1px 0 rgba(38, 50, 56, 0.28);
}

html:lang(zh) h1,
html:lang(zh) h2 {
  font-weight: 900;
  letter-spacing: 0.01em;
  word-break: keep-all;
  overflow-wrap: normal;
  text-shadow:
    3px 0 0 rgba(38, 50, 56, 0.08),
    0 3px 0 rgba(38, 50, 56, 0.08);
}

a {
  color: inherit;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #d6ff00;
  animation: loaderExit 650ms var(--ease, cubic-bezier(0.65, 0.05, 0, 1)) 450ms forwards;
}

.loader-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 4px solid var(--line);
  padding: 14px 18px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Press Start 2P", Inter, sans-serif;
  font-size: 0.68rem;
  box-shadow: 7px 7px 0 var(--line);
  animation: loaderPop 800ms steps(5, end) both;
}

.loader-dot {
  width: 12px;
  height: 12px;
  background: var(--mint-dark);
  box-shadow:
    18px 0 0 var(--peach),
    36px 0 0 var(--lavender);
  animation: pixelBlink 650ms steps(2, end) infinite;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  background: rgba(255, 250, 242, 0.86);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  background:
    linear-gradient(90deg, var(--mint) 0 50%, transparent 50%),
    linear-gradient(var(--peach) 0 50%, var(--butter) 50%);
  box-shadow: 4px 4px 0 var(--line);
  image-rendering: pixelated;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.nav a {
  min-height: 38px;
  padding: 7px 12px;
  border: 2px solid transparent;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 800;
  text-decoration: none;
}

.nav a:hover {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--line);
}

.language-toggle {
  min-width: 44px;
  min-height: 32px;
  border: 2px solid var(--line);
  padding: 5px 9px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 2px 2px 0 var(--line);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.language-toggle:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--line);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.8fr);
  gap: 36px;
  align-items: center;
  min-height: calc(100vh - 90px);
  padding: 40px 0 72px;
}

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

.eyebrow {
  margin: 0 0 14px;
  color: var(--mint-dark);
  font-family: "Press Start 2P", Inter, sans-serif;
  font-size: 0.68rem;
  line-height: 1.8;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 22px;
  font-size: clamp(3.4rem, 8vw, 7.2rem);
  line-height: 0.93;
  letter-spacing: 0;
  animation: titleSettle 900ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4.6vw, 4.15rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.18rem;
  line-height: 1.25;
}

.lead {
  max-width: 660px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: clamp(1.08rem, 1.6vw, 1.28rem);
}

.hero-actions,
.contact-links,
.tags,
.quick-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button,
.contact-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 3px solid var(--line);
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 5px 5px 0 var(--line);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.button:hover,
.contact-links a:hover {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--line);
}

.button {
  padding: 0 18px;
}

.primary {
  background: var(--mint);
}

.secondary {
  background: #ffffff;
}

.quick-facts {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.quick-facts li {
  padding: 8px 12px;
  border: 2px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: var(--soft-shadow);
}

.hero-visual {
  position: relative;
  border: 4px solid var(--line);
  background: #dff5f6;
  box-shadow: var(--shadow);
  overflow: hidden;
  image-rendering: pixelated;
  transform-style: preserve-3d;
  will-change: transform;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 38%),
    radial-gradient(circle at 20% 20%, rgba(255, 224, 138, 0.36), transparent 24%);
  pointer-events: none;
  z-index: 2;
}

.hero-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  filter: saturate(1.04) contrast(1.02);
  transform: scale(1.015);
  animation: imageDrift 9s ease-in-out infinite alternate;
}

.scanline {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.08) 0 2px,
    rgba(38, 50, 56, 0.08) 2px 4px
  );
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.hero-chip,
.spark {
  position: absolute;
  z-index: 4;
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 rgba(38, 50, 56, 0.36);
}

.hero-chip {
  display: grid;
  place-items: center;
  min-width: 56px;
  height: 42px;
  background: var(--paper);
  font-family: "Press Start 2P", Inter, sans-serif;
  font-size: 0.62rem;
  animation: floaty 4.8s ease-in-out infinite;
}

.chip-one {
  top: 8%;
  left: 8%;
  background: var(--mint);
}

.chip-two {
  top: 15%;
  right: 10%;
  background: var(--butter);
  animation-delay: -1.4s;
}

.chip-three {
  right: 8%;
  bottom: 12%;
  background: var(--peach);
  animation-delay: -2.7s;
}

.spark {
  width: 15px;
  height: 15px;
  background: #ffffff;
  animation: sparkle 1.8s steps(2, end) infinite;
}

.spark-one {
  left: 28%;
  top: 18%;
}

.spark-two {
  right: 25%;
  top: 46%;
  animation-delay: -0.6s;
}

.spark-three {
  left: 18%;
  bottom: 20%;
  animation-delay: -1.1s;
}

.section {
  padding: 70px 0;
  scroll-margin-top: 112px;
}

.motion-strip {
  position: relative;
  margin: -18px 0 18px;
  border-block: 4px solid var(--line);
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  box-shadow: var(--soft-shadow);
  scroll-margin-top: 112px;
}

.marquee {
  display: flex;
  width: max-content;
  gap: 34px;
  padding: 14px 0;
  font-family: "Press Start 2P", Inter, sans-serif;
  font-size: 0.68rem;
  animation: marquee 24s linear infinite;
}

.marquee span {
  white-space: nowrap;
}

.intro-panel,
.contact-section,
.project-card,
.skill-board {
  border: 4px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.intro-panel {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 32px;
  align-items: end;
  padding: clamp(28px, 5vw, 50px);
}

.intro-panel p:last-child,
.contact-section p,
.project-card p,
.skill-board p {
  color: var(--muted);
}

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

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

.project-card {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  padding: 22px;
  will-change: transform;
}

.project-card:hover {
  transform: translate(-4px, -4px);
  box-shadow: 12px 12px 0 var(--line);
}

.project-preview {
  position: relative;
  height: 132px;
  margin-bottom: 22px;
  border: 3px solid var(--line);
  background: var(--mint);
  overflow: hidden;
}

.project-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-120%);
  animation: previewSweep 4.8s ease-in-out infinite;
}

.project-preview span {
  position: absolute;
  display: block;
  border: 3px solid var(--line);
  background: #ffffff;
}

.project-preview span:nth-child(1) {
  top: 18px;
  left: 18px;
  width: 80px;
  height: 24px;
}

.project-preview span:nth-child(2) {
  left: 18px;
  bottom: 20px;
  width: 128px;
  height: 44px;
}

.project-preview span:nth-child(3) {
  right: 18px;
  bottom: 20px;
  width: 52px;
  height: 72px;
}

.dashboard {
  background: var(--peach);
}

.terminal {
  background: var(--lavender);
}

.project-type {
  margin-bottom: 8px;
  color: var(--mint-dark);
  font-family: "Press Start 2P", Inter, sans-serif;
  font-size: 0.62rem;
  line-height: 1.6;
}

.tags {
  margin-top: auto;
  padding-top: 18px;
}

.tags span {
  padding: 6px 9px;
  border: 2px solid var(--line);
  background: var(--paper);
  font-size: 0.8rem;
  font-weight: 900;
}

.skills-section {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 30px;
  align-items: start;
}

.skill-board {
  display: grid;
  gap: 0;
}

.skill-board div {
  padding: 24px;
  border-bottom: 3px solid var(--line);
  transition: background 180ms ease, padding-left 180ms ease;
}

.skill-board div:hover {
  background: var(--paper);
  padding-left: 32px;
}

.skill-board div:last-child {
  border-bottom: 0;
}

.contact-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 30px;
  align-items: center;
  margin: 72px 0 46px;
  padding: clamp(28px, 5vw, 48px);
  background: var(--paper-deep);
}

.contact-links {
  justify-content: flex-end;
}

.contact-links a {
  min-width: 104px;
  padding: 0 15px;
  background: #ffffff;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.project-card.reveal:nth-child(2) {
  transition-delay: 120ms;
}

.project-card.reveal:nth-child(3) {
  transition-delay: 240ms;
}

@keyframes loaderPop {
  0% {
    transform: translateY(16px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes loaderExit {
  0% {
    opacity: 1;
    visibility: visible;
  }
  99% {
    opacity: 0;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@keyframes pixelBlink {
  0%,
  40% {
    opacity: 1;
  }
  41%,
  100% {
    opacity: 0.35;
  }
}

@keyframes titleSettle {
  0% {
    transform: translateY(24px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes imageDrift {
  0% {
    transform: scale(1.015) translate3d(0, 0, 0);
  }
  100% {
    transform: scale(1.045) translate3d(-8px, -6px, 0);
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.55);
  }
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes previewSweep {
  0%,
  40% {
    transform: translateX(-120%);
  }
  70%,
  100% {
    transform: translateX(120%);
  }
}

@media (max-width: 920px) {
  .hero,
  .intro-panel,
  .skills-section,
  .contact-section {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: 500px;
  }

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

  .contact-links {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  h1 {
    font-size: 3.15rem;
  }

  html:lang(zh) h1 {
    font-size: 2.82rem;
  }

  .hero {
    padding-top: 22px;
  }

  .hero-visual {
    box-shadow: 5px 5px 0 var(--line);
  }

  .hero-visual img {
    aspect-ratio: 4 / 5;
  }

  .section {
    padding: 48px 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .intro-panel,
  .contact-section,
  .project-card,
  .skill-board {
    box-shadow: 5px 5px 0 var(--line);
  }
}

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

  .loader {
    display: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
