:root {
  color-scheme: dark;
  --ink: #0c0c0c;
  --ink-soft: #141414;
  --paper: #f3f5f2;
  --mist: #d7e2ea;
  --muted-dark: rgba(12, 12, 12, 0.58);
  --muted-light: rgba(215, 226, 234, 0.62);
  --line-dark: rgba(12, 12, 12, 0.18);
  --line-light: rgba(215, 226, 234, 0.2);
  --radius: clamp(20px, 3vw, 44px);
  --page-pad: clamp(20px, 3.2vw, 56px);
}

body.light {
  color-scheme: light;
  --ink: #f1f3ef;
  --ink-soft: #e7eae5;
  --paper: #111310;
  --mist: #242824;
  --muted-dark: rgba(241, 243, 239, 0.58);
  --muted-light: rgba(36, 40, 36, 0.62);
  --line-dark: rgba(241, 243, 239, 0.18);
  --line-light: rgba(36, 40, 36, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  background: var(--ink);
}

body {
  min-width: 320px;
  overflow-x: clip;
  background: var(--ink);
  color: var(--mist);
  font-family: "Kanit", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
  transition: background-color 0.35s ease, color 0.35s ease;
}

body.menu-open {
  overflow: hidden;
}

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

button {
  color: inherit;
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  mix-blend-mode: difference;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: 0 var(--page-pad);
  color: #f3f5f2;
  text-transform: uppercase;
}

.brand {
  font-size: clamp(0.9rem, 1.25vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 48px);
  font-size: clamp(0.78rem, 1vw, 1rem);
  font-weight: 500;
}

.nav-menu a,
.theme-toggle {
  position: relative;
  border: 0;
  background: none;
  cursor: pointer;
}

.nav-menu a::after,
.theme-toggle::after {
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.25s ease;
}

.nav-menu a:hover::after,
.theme-toggle:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 17px;
  height: 1px;
  margin: 5px auto;
  background: currentColor;
  transition: transform 0.25s ease;
}

.menu-toggle.active span:first-child {
  transform: translateY(3px) rotate(45deg);
}

.menu-toggle.active span:last-child {
  transform: translateY(-3px) rotate(-45deg);
}

.hero {
  position: relative;
  min-height: 100svh;
  overflow: visible;
  background: var(--ink);
}

.hero-stage {
  position: relative;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(96px, 10vh, 132px) var(--page-pad) clamp(34px, 5vh, 64px);
}

.hero-heading-wrap {
  position: relative;
  z-index: 2;
  overflow: visible;
}

.hero-heading,
.display-heading {
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-heading {
  width: 100%;
  background: linear-gradient(180deg, #656b74 0%, #d7e2ea 100%);
  background-clip: text;
  color: transparent;
  font-size: clamp(3.8rem, 13vw, 11rem);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-orbit {
  position: absolute;
  z-index: 1;
  border: 1px solid rgba(215, 226, 234, 0.24);
  border-radius: 50%;
  pointer-events: none;
  transform-origin: center;
  will-change: transform;
}

.hero-orbit::before {
  position: absolute;
  width: clamp(18px, 2.2vw, 34px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #c5ff4a;
  box-shadow: 0 0 36px rgba(197, 255, 74, 0.35);
  content: "";
}

.hero-orbit-one {
  top: 13%;
  left: 48%;
  width: clamp(320px, 48vw, 820px);
  aspect-ratio: 1;
  animation: orbit-green 14s linear infinite;
}

.hero-orbit-one::before {
  top: 18%;
  left: 5%;
}

.hero-orbit-two {
  right: 0;
  bottom: -20%;
  width: clamp(300px, 42vw, 600px);
  aspect-ratio: 1;
  animation: orbit-red 18s linear infinite;
}

.hero-orbit-two::before {
  top: 7%;
  left: 30%;
  background: #ff7a59;
  box-shadow: 0 0 36px rgba(255, 122, 89, 0.35);
}

@keyframes orbit-green {
  from { transform: rotate(-24deg); }
  to { transform: rotate(336deg); }
}

@keyframes orbit-red {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

.hero-bottom {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

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

.eyebrow {
  margin-bottom: 10px;
  font-size: clamp(0.72rem, 0.85vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-eyebrow {
  color: #c5ff4a;
}

.hero-text {
  max-width: 340px;
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  font-weight: 300;
}

.button {
  display: inline-flex;
  min-width: 132px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 25px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  text-transform: uppercase;
  transition: color 0.25s ease, background-color 0.25s ease, transform 0.25s ease;
}

.contact-button {
  background: var(--mist);
  color: var(--ink);
}

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

.contact-button:hover {
  background: #c5ff4a;
  color: #0c0c0c;
}

.section-dark {
  background: var(--ink);
  color: var(--mist);
}

.projects-section,
.skills-section,
.contact-section {
  position: relative;
  padding: clamp(100px, 12vw, 180px) var(--page-pad);
}

.projects-section {
  background: transparent;
}

.section-title-row {
  margin-bottom: clamp(54px, 8vw, 112px);
}

.section-title-row .eyebrow {
  color: #c5ff4a;
}

.display-heading {
  font-size: clamp(4rem, 13vw, 13rem);
  font-weight: 900;
  line-height: 0.82;
}

.section-dark .display-heading {
  background: linear-gradient(180deg, #656b74 0%, #d7e2ea 100%);
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.projects-section .display-heading {
  font-size: clamp(3.2rem, 9vw, 8rem);
  line-height: 1;
}

.contact-heading .display-heading {
  font-size: clamp(3.2rem, 9vw, 8rem);
  line-height: 1;
}

.project-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 24px);
  align-items: stretch;
  width: min(100%, 1320px);
  margin: 0 auto;
}

.project-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: clamp(14px, 1.5vw, 22px);
  overflow: hidden;
  border: 1px solid rgba(215, 226, 234, 0.42);
  border-radius: clamp(16px, 2vw, 28px);
  background: var(--ink-soft);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14);
}

.project-card::before {
  position: absolute;
  inset: 0;
  border-top: 3px solid var(--accent);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.project-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(10px, 1.2vw, 16px);
  align-items: center;
  padding-bottom: clamp(12px, 1.5vw, 18px);
}

.project-number,
.skill-number {
  font-size: clamp(3.7rem, 8vw, 8.5rem);
  font-weight: 900;
  line-height: 0.72;
}

.project-number {
  font-size: clamp(2.5rem, 4vw, 4.5rem);
  line-height: 1;
}

.project-title h3 {
  font-size: clamp(1rem, 1.6vw, 1.5rem);
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
}

.project-title h3 a {
  transition: color 0.25s ease;
}

.project-title h3 a:hover {
  color: var(--accent);
}

.project-body {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: clamp(12px, 1.5vw, 18px);
}

.project-cover {
  position: relative;
  display: grid;
  min-height: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  place-items: center;
  border-radius: clamp(10px, 1.4vw, 18px);
  background: #202320;
  isolation: isolate;
}

.project-cover span {
  position: relative;
  z-index: 3;
  color: #0c0c0c;
  font-size: clamp(1.5rem, 4vw, 3.5rem);
  font-weight: 900;
  line-height: 1;
  mix-blend-mode: multiply;
}

.project-cover::before,
.project-cover::after,
.project-cover i {
  position: absolute;
  content: "";
}

.project-cover-one {
  background: #c5ff4a;
}

.project-cover-image {
  background: #f7f1e8;
}

.project-cover-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
}

.project-cover-image:hover img {
  transform: scale(1.015);
}

.project-cover-image::before,
.project-cover-image::after {
  display: none;
}

.project-cover-one::before {
  width: 55%;
  aspect-ratio: 1;
  border: clamp(20px, 4vw, 60px) solid #0c0c0c;
  border-radius: 50%;
  transform: translate(-33%, -22%);
}

.project-cover-one::after {
  width: 36%;
  height: 150%;
  background: #f3f5f2;
  transform: rotate(28deg) translate(105%, -5%);
}

.project-cover-two {
  background: #ff7a59;
}

.project-cover-two::before {
  inset: 14% 9%;
  border: clamp(14px, 2.5vw, 40px) solid #0c0c0c;
  transform: rotate(-8deg);
}

.project-cover-two::after {
  width: 44%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f3f5f2;
  transform: translate(63%, 42%);
}

.project-cover-three {
  background: #74b9ff;
}

.project-cover-three::before {
  width: 120%;
  height: 34%;
  background: #0c0c0c;
  transform: rotate(-12deg);
}

.project-cover-three::after {
  width: 22%;
  height: 120%;
  background: #f3f5f2;
  transform: rotate(32deg);
}

.project-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0;
  background: transparent;
  color: var(--mist);
}

.project-info > p {
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  font-weight: 400;
  line-height: 1.6;
}

.skills-section {
  z-index: 5;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--paper);
  color: var(--ink);
}

.skills-section .eyebrow {
  color: #5c7300;
}

.skill-list {
  width: min(100%, 1120px);
  margin: 0 auto;
  border-top: 1px solid var(--line-dark);
}

.skill-card {
  display: grid;
  grid-template-columns: clamp(100px, 20vw, 260px) minmax(0, 1fr);
  gap: clamp(16px, 3vw, 54px);
  align-items: center;
  padding: clamp(34px, 5vw, 72px) 0;
  border-bottom: 1px solid var(--line-dark);
}

.skill-card h3 {
  margin-bottom: 12px;
  font-size: clamp(1.45rem, 3vw, 3.2rem);
  font-weight: 500;
  text-transform: uppercase;
}

.skill-card p {
  max-width: 680px;
  color: var(--muted-dark);
  font-size: clamp(0.95rem, 1.4vw, 1.18rem);
  font-weight: 300;
}

.contact-section {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: clamp(48px, 9vw, 150px);
  align-items: end;
}

.contact-heading .eyebrow {
  color: #c5ff4a;
}

.contact-heading > p:last-child {
  max-width: 620px;
  margin-top: clamp(32px, 4vw, 64px);
  color: var(--muted-light);
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  font-weight: 300;
}

.contact-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 30px;
}

.qr-card {
  width: min(100%, 330px);
}

.qr-image-wrap {
  padding: clamp(12px, 1.5vw, 20px);
  border-radius: calc(var(--radius) * 0.72);
  background: var(--paper);
}

.qr-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
}

.qr-card figcaption {
  margin-top: 14px;
  color: var(--muted-light);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.site-footer {
  padding: 26px var(--page-pad);
  border-top: 1px solid var(--line-light);
  background: var(--ink);
  color: var(--muted-light);
  font-size: 0.8rem;
  text-align: center;
  text-transform: uppercase;
}

.reveal {
  opacity: 0;
  transform: translateY(38px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.skill-card:nth-child(2) {
  transition-delay: 0.08s;
}

.skill-card:nth-child(3) {
  transition-delay: 0.16s;
}

@media (max-width: 900px) {
  .menu-toggle {
    position: relative;
    z-index: 2;
    display: block;
  }

  .nav-menu {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    padding: 96px var(--page-pad) 40px;
    background: #0c0c0c;
    color: #f3f5f2;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

  .nav-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-menu a,
  .theme-toggle {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 700;
    line-height: 1.1;
  }

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

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

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

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

  .hero-stage {
    padding-top: 104px;
  }

  .hero-heading {
    font-size: clamp(3.6rem, 18vw, 6.2rem);
    line-height: 1;
  }

  .hero-bottom {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-card {
    min-height: 0;
    margin: 0;
    scroll-snap-align: start;
  }

  .project-head {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .project-number {
    font-size: clamp(2.4rem, 13vw, 3.4rem);
  }

  .skill-number {
    font-size: clamp(3.4rem, 17vw, 5.6rem);
  }

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

  .project-stack {
    grid-template-columns: none;
    grid-auto-columns: minmax(260px, 82vw);
    grid-auto-flow: column;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
  }

  .skill-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .contact-content,
  .qr-card,
  .contact-content .button {
    width: 100%;
  }

  .display-heading {
    font-size: clamp(3.7rem, 20vw, 7rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

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