:root {
  color-scheme: dark;
  --background: #121016;
  --panel: #1a1720;
  --ink: #f6f2fb;
  --muted: #b7acbf;
  --violet: #d7bbff;
  --line: #353040;
  --sans: "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", system-ui, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  background: var(--background);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  scroll-behavior: smooth;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
img, canvas { display: block; width: 100%; }
figure, h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
::selection { color: var(--background); background: var(--violet); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 5px; }
[id] { scroll-margin-top: 5.5rem; }

.wrap { width: min(1200px, 100% - 6rem); margin-inline: auto; }
.skip-link {
  position: fixed;
  top: .75rem;
  left: 1rem;
  z-index: 5;
  transform: translateY(-160%);
  background: var(--violet);
  color: var(--background);
  padding: .5rem .85rem;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 1px solid var(--line);
  background: rgb(18 16 22 / .94);
  backdrop-filter: blur(18px);
}
.navigation, .footer, .nav-links, .wordmark, .hero-actions,
.hero-greeting, .button, .text-link, .slider-heading {
  display: flex;
  align-items: center;
}
.navigation { min-height: 72px; justify-content: space-between; gap: 1rem; }
.wordmark { width: max-content; gap: .64rem; font: 1.72rem/.95 var(--serif); letter-spacing: -.065em; }
.mark { width: .65rem; height: .65rem; margin: .1rem .08rem 0; border: 1px solid var(--violet); transform: rotate(45deg); }
.nav-links { gap: clamp(1rem, 3.4vw, 2.6rem); color: var(--muted); font-size: .84rem; white-space: nowrap; }
.nav-links a { padding-block: .55rem; transition: color .18s ease; }
.nav-links a:hover, .text-link:hover, .reset-button:hover { color: var(--violet); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  gap: clamp(2rem, 5vw, 5.1rem);
  align-items: center;
  padding-block: clamp(3.8rem, 7vw, 6.5rem) clamp(3.3rem, 6vw, 5.6rem);
}
.hero-copy { padding-bottom: 1.1rem; }
.hero-greeting { gap: .75rem; color: var(--violet); font: .85rem/1.4 var(--mono); letter-spacing: .085em; }
.hero-greeting span { width: 1.6rem; height: 1px; background: var(--violet); }
.hero h1 {
  margin-top: 1.12rem;
  font-size: clamp(2.8rem, 5.25vw, 5.15rem);
  font-weight: 650;
  line-height: 1.19;
  letter-spacing: -.062em;
}
.hero h1 em { color: var(--violet); font-style: normal; }
.hero-description { color: var(--muted); margin-top: 1.35rem; max-width: 28ch; font-size: clamp(.91rem, 1.55vw, 1.08rem); }
.hero-actions { flex-wrap: wrap; gap: .95rem 1.55rem; margin-top: 2rem; }
.button, .text-link { width: fit-content; gap: .6rem; font-size: .82rem; font-weight: 650; }
.button { min-height: 46px; padding: .68rem .91rem; border-radius: .21rem; }
.button-primary { background: var(--violet); color: #1d1528; transition: background .18s ease, transform .18s ease; }
.button-primary:hover { background: #ead9ff; transform: translateY(-2px); }
.text-link { min-height: 40px; color: var(--muted); transition: color .18s ease; }
.button span, .text-link span { font-size: 1rem; line-height: 1; }
.hero-figure { min-width: 0; }
.hero-image {
  position: relative;
  isolation: isolate;
  border: 1px solid #473e52;
  overflow: hidden;
  aspect-ratio: 1.43;
  background: radial-gradient(ellipse at 58% 43%, #332549, #0d0b11 72%);
}
.hero-image img { height: 100%; object-fit: cover; object-position: 51% 50%; }
.image-cross { width: .8rem; height: .8rem; position: absolute; color: #e5d8f6; opacity: .65; }
.image-cross::before, .image-cross::after { content: ""; position: absolute; background: currentColor; }
.image-cross::before { width: .8rem; height: 1px; top: calc(50% - .5px); }
.image-cross::after { width: 1px; height: .8rem; left: calc(50% - .5px); }
.top-cross { top: 1rem; left: 1rem; }
.bottom-cross { bottom: 1rem; right: 1rem; }
.hero-figure figcaption { display: flex; justify-content: space-between; color: var(--muted); padding-top: .63rem; font-size: .74rem; letter-spacing: .1em; }

.section { padding-block: clamp(3.6rem, 7vw, 6.6rem); }
.work { border-top: 1px solid var(--line); }
.section-heading { margin-bottom: clamp(1.5rem, 3.5vw, 2.6rem); }
.section-heading h2::before, .about h2::before {
  display: block;
  width: 1.65rem;
  height: 1px;
  margin-bottom: .76rem;
  background: var(--violet);
  content: "";
}
h2 { font-size: clamp(2rem, 4.3vw, 3.65rem); font-weight: 630; line-height: 1.24; letter-spacing: -.052em; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.9rem, 2.7vw, 1.8rem); }
.project { min-width: 0; border: 1px solid var(--line); background: var(--panel); }
.project-figure { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.project-figure canvas { height: clamp(10rem, 20vw, 15.75rem); }
.mesh-figure { background: #1c1728; }
.phase-figure { background: #191424; }
.project-figure figcaption { position: absolute; bottom: .72rem; left: .86rem; color: #e2d4ef; background: #15111c; padding: .12rem .43rem; font-size: .7rem; }
.project-content { padding: clamp(1.35rem, 3vw, 2.15rem); }
.project-field { color: var(--violet); font-size: .77rem; letter-spacing: .075em; }
.project h3 { margin: .12rem 0 .42rem; font: 400 clamp(2rem, 4vw, 3rem)/1.2 var(--serif); letter-spacing: -.052em; }
.project-content > p:last-child { color: var(--muted); font-size: .91rem; }

.lab { border-block: 1px solid var(--line); background: #17131d; }
.lab-panel { display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr); border: 1px solid var(--line); }
.ray-figure { min-width: 0; background: #100e16; }
.ray-figure canvas { height: clamp(15.8rem, 28vw, 22rem); }
.ray-legend { display: flex; flex-wrap: wrap; gap: .55rem 1.3rem; padding: .68rem 1rem .85rem; color: var(--muted); font-size: .73rem; }
.ray-legend span { display: inline-flex; align-items: center; gap: .38rem; }
.ray-legend i { display: inline-block; width: .85rem; border-top: 2px solid; }
.ray-legend .incident { color: #bda1ff; }
.ray-legend .reflected { color: #f2bbee; }
.ray-legend .normal { color: #a2a9c3; border-top-style: dashed; }
.lab-controls { padding: clamp(1.2rem, 3.6vw, 2.75rem); background: var(--panel); border-left: 1px solid var(--line); }
.lab-controls h3 { margin-bottom: 1.35rem; font-size: 1.3rem; letter-spacing: -.04em; }
.slider-heading { justify-content: space-between; gap: .5rem; font-size: .85rem; }
.slider-heading output { color: var(--violet); font: 1.15rem/1.3 var(--mono); }
input[type="range"] { display: block; width: 100%; margin: .54rem 0 0; height: 30px; accent-color: var(--violet); cursor: pointer; }
.slider-scale { display: flex; justify-content: space-between; color: var(--muted); font: .68rem/1.3 var(--mono); }
.results { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; margin: 1.25rem 0 .8rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.results div { display: grid; gap: .25rem; }
.results span { color: var(--muted); font-size: .73rem; }
.results output { color: var(--ink); font: 1.1rem/1.35 var(--mono); }
.reset-button { min-height: 38px; padding: .2rem .4rem .2rem 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .75rem; }
.reset-button span { margin-left: .23rem; }
.about { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: end; gap: 1.5rem; }
.about-copy { color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); max-width: 33ch; }
.footer { min-height: 92px; justify-content: space-between; border-top: 1px solid var(--line); }
.footer .wordmark { font-size: 1.42rem; }

@media (max-width: 900px) {
  .wrap { width: calc(100% - 3.5rem); }
  .hero { gap: 2.1rem; }
}

@media (max-width: 680px) {
  .wrap { width: calc(100% - 2rem); }
  .navigation { min-height: 61px; }
  .nav-links { gap: .85rem; font-size: .75rem; }
  .wordmark { font-size: 1.45rem; gap: .48rem; }
  .hero { grid-template-columns: 1fr; padding-block: 3.25rem 2.85rem; gap: 1.9rem; }
  .hero-copy { padding-bottom: 0; }
  .hero h1 { font-size: clamp(3rem, 11vw, 4.25rem); }
  .hero-actions { margin-top: 1.35rem; }
  .hero-image { aspect-ratio: 1.45; }
  .project-grid, .lab-panel, .about { grid-template-columns: 1fr; }
  .project-figure canvas { height: clamp(9.8rem, 44vw, 14rem); }
  .lab-controls { border-left: 0; border-top: 1px solid var(--line); }
  .about { gap: .85rem; }
  .footer { min-height: 74px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
