:root {
  --paper: #f7f6f1;
  --ink: #151515;
  --muted: #78756f;
  --line: rgba(21, 21, 21, 0.1);
  --line-strong: rgba(21, 21, 21, 0.18);
  --surface: rgba(255, 255, 255, 0.52);
  --accent: #e8efe6;
  --accent-ink: #315b37;
  --mono: "SF Mono", "JetBrains Mono", "IBM Plex Mono", "Menlo", monospace;
  --sans: "SF Pro Display", "Geist Sans", "Helvetica Neue", sans-serif;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg width='96' height='96' viewBox='0 0 96 96' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 .5H96M.5 0V96' fill='none' stroke='%23151515' stroke-opacity='.11'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 .5H24M.5 0V24' fill='none' stroke='%23151515' stroke-opacity='.035'/%3E%3C/svg%3E");
  background-size: 96px 96px, 24px 24px;
  font-family: var(--sans);
  letter-spacing: 0;
}

.zh-page {
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", var(--sans);
}

.zh-page h2,
.zh-page .system-card h3,
.zh-page .project-card h3,
.zh-page .art-caption h3 {
  font-family:
    "Songti SC", "Noto Serif CJK SC", "STSong", var(--serif);
}

.zh-page .dek,
.zh-page .section-body > p,
.zh-page .list-row span:last-child,
.zh-page .system-card p,
.zh-page .project-card p {
  line-height: 1.62;
}

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

::selection {
  color: var(--ink);
  background: #fbf3db;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg width='6' height='6' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='1' cy='1' r='.55' fill='%23151515' fill-opacity='.06'/%3E%3C/svg%3E");
  background-size: 6px 6px;
  mix-blend-mode: multiply;
}

.frame {
  position: fixed;
  inset: 16px;
  z-index: 1;
  pointer-events: none;
  border: 1px solid var(--line-strong);
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 2;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  width: min(100% - 48px, 1180px);
  margin: 0 auto;
  padding: 32px 0 0;
}

.wordmark {
  display: grid;
  gap: 4px;
  font-size: 14px;
  font-weight: 620;
  line-height: 1.1;
}

.domain {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
}

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

.nav a,
.site-footer a {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.nav a:hover,
.site-footer a:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

.hero {
  display: grid;
  align-content: center;
  min-height: clamp(610px, 86vh, 900px);
  width: min(100% - 48px, 1180px);
  margin: 0 auto;
  padding: 72px 0 56px;
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(32px, 8vw, 96px);
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(10px, 1.6vw, 12px);
  text-transform: uppercase;
}

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

.eyebrow {
  width: fit-content;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--accent-ink);
  background: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 11ch;
  font-family: var(--serif);
  font-size: clamp(84px, 17vw, 228px);
  font-weight: 430;
  letter-spacing: 0;
  line-height: 0.82;
}

.dek {
  max-width: 560px;
  margin-top: clamp(22px, 4vw, 38px);
  color: #34322f;
  font-size: clamp(18px, 2.7vw, 26px);
  font-weight: 420;
  line-height: 1.32;
}

.code-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin-top: clamp(44px, 8vw, 84px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 13px 15px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.48);
  color: #2f3430;
  font-family: var(--mono);
  font-size: clamp(12px, 2vw, 14px);
  line-height: 1.2;
  white-space: nowrap;
}

.caret {
  width: 8px;
  height: 1.25em;
  background: var(--ink);
  transform-origin: center;
  animation: blink 1.1s steps(2, start) infinite;
}

.control-plane {
  display: grid;
  grid-template-columns: auto minmax(128px, 240px);
  align-items: end;
  gap: 18px;
  width: min(100%, 640px);
  margin-top: 18px;
}

.pixel-field {
  display: grid;
  grid-template-columns: repeat(12, 10px);
  gap: 4px;
  width: fit-content;
  border: 1px solid var(--line);
  padding: 8px;
  background: rgba(255, 255, 255, 0.28);
}

.pixel-field span {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(21, 21, 21, 0.18);
  background: rgba(255, 255, 255, 0.24);
}

.pixel-field span:nth-child(2),
.pixel-field span:nth-child(5),
.pixel-field span:nth-child(9),
.pixel-field span:nth-child(14),
.pixel-field span:nth-child(18),
.pixel-field span:nth-child(23) {
  background: var(--ink);
}

.bit-rail {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 8px;
}

.bit-rail span {
  display: block;
  height: 18px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.32);
}

.bit-rail span:nth-child(2n),
.bit-rail span:nth-child(5) {
  background: var(--ink);
}

.section {
  display: grid;
  grid-template-columns: minmax(96px, 180px) minmax(0, 1fr);
  gap: clamp(24px, 6vw, 96px);
  width: min(100% - 48px, 1180px);
  margin: 0 auto;
  border-top: 1px solid var(--line-strong);
  padding: clamp(56px, 9vw, 96px) 0;
}

.section-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  text-transform: uppercase;
}

.section-body {
  max-width: 820px;
}

h2 {
  max-width: 780px;
  font-family: var(--serif);
  font-size: clamp(38px, 7vw, 76px);
  font-weight: 430;
  letter-spacing: 0;
  line-height: 0.96;
}

.section-body > p {
  max-width: 620px;
  margin-top: 24px;
  color: #3b3833;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.45;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: clamp(32px, 6vw, 56px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.34);
}

.stat {
  display: grid;
  align-content: space-between;
  min-height: 132px;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.stat:last-child {
  border-right: 0;
}

.stat span:first-child {
  font-family: var(--mono);
  font-size: clamp(18px, 2.6vw, 28px);
  line-height: 1;
  text-transform: uppercase;
}

.stat span:last-child {
  max-width: 19ch;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  text-transform: uppercase;
}

.list {
  display: grid;
  margin-top: clamp(32px, 6vw, 56px);
  border-top: 1px solid var(--line);
}

.list-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.42fr) minmax(0, 1fr);
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}

.list-row span:first-child {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  text-transform: uppercase;
}

.list-row span:last-child {
  color: #4c4842;
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.45;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: clamp(32px, 6vw, 56px);
}

.system-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 13px;
  min-height: 286px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 .5H16M.5 0V16' fill='none' stroke='%23151515' stroke-opacity='.05'/%3E%3C/svg%3E"),
    rgba(255, 255, 255, 0.36);
  background-size: 16px 16px, auto;
}

.system-card::before {
  content: attr(data-code);
  position: absolute;
  top: 16px;
  right: 16px;
  border: 1px solid var(--line-strong);
  padding: 5px 7px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
}

.system-card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 100%;
  background:
    url("data:image/svg+xml,%3Csvg width='6' height='48' viewBox='0 0 6 48' xmlns='http://www.w3.org/2000/svg'%3E%3Crect y='0' width='6' height='6' fill='%23151515' fill-opacity='.75'/%3E%3Crect y='12' width='6' height='6' fill='%23151515' fill-opacity='.16'/%3E%3Crect y='24' width='6' height='6' fill='%23151515' fill-opacity='.75'/%3E%3Crect y='36' width='6' height='6' fill='%23151515' fill-opacity='.16'/%3E%3C/svg%3E");
}

.system-card > span:first-child {
  padding-right: 48px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.25;
  text-transform: uppercase;
}

.system-card h3 {
  margin: 0;
  max-width: 16ch;
  font-family: var(--serif);
  font-size: clamp(27px, 3.8vw, 38px);
  font-weight: 430;
  line-height: 0.98;
}

.system-card p {
  color: #4c4842;
  font-size: 16px;
  line-height: 1.46;
}

.art-section {
  position: relative;
  min-height: 320svh;
  margin: clamp(32px, 6vw, 72px) 0 0;
}

.art-stage {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: minmax(96px, 180px) minmax(0, 1fr);
  gap: clamp(24px, 6vw, 96px);
  align-items: stretch;
  width: min(100% - 48px, 1180px);
  height: 100svh;
  margin: 0 auto;
  border-top: 1px solid var(--line-strong);
  padding: clamp(34px, 6svh, 64px) 0;
}

.art-section .section-label {
  align-self: start;
}

.art-section .section-body {
  display: grid;
  align-content: center;
  max-width: none;
  min-height: 0;
}

.art-section .section-body > p {
  max-width: 600px;
  margin-top: 18px;
}

.art-board {
  display: grid;
  grid-template-columns: minmax(220px, 0.62fr) minmax(220px, 0.38fr);
  gap: 0;
  height: clamp(390px, 50svh, 600px);
  margin-top: clamp(22px, 4svh, 34px);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.38);
}

.art-media {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #111;
}

.art-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.art-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.36), transparent 28%, transparent 62%, rgba(0, 0, 0, 0.38)),
    url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 .5H18M.5 0V18' fill='none' stroke='%23f7f6f1' stroke-opacity='.08'/%3E%3C/svg%3E");
  mix-blend-mode: normal;
}

.art-overlay {
  position: absolute;
  inset: 14px;
  display: grid;
  align-content: space-between;
  pointer-events: none;
  color: rgba(247, 246, 241, 0.86);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
}

.art-axis {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(247, 246, 241, 0.22);
  padding: 8px 9px;
  background: rgba(21, 21, 21, 0.22);
  backdrop-filter: blur(10px);
}

.art-scan {
  display: grid;
  gap: 8px;
  width: min(54%, 320px);
}

.art-scan span {
  display: block;
  height: 2px;
  background: rgba(247, 246, 241, 0.78);
  transform: scaleX(var(--draw, 0));
  transform-origin: left;
}

.art-scan span:nth-child(2) {
  width: 76%;
}

.art-scan span:nth-child(3) {
  width: 58%;
}

.art-scan span:nth-child(4) {
  width: 88%;
}

.art-pin {
  position: absolute;
  border: 1px solid rgba(247, 246, 241, 0.3);
  padding: 7px 9px;
  background: rgba(21, 21, 21, 0.28);
  opacity: var(--draw, 0);
  transform: translateY(var(--draw-y, 10px));
  backdrop-filter: blur(10px);
}

.art-pin-a {
  top: 26%;
  left: 18px;
}

.art-pin-b {
  right: 20px;
  bottom: 24%;
}

.art-caption {
  display: grid;
  align-content: start;
  gap: 11px;
  overflow: hidden;
  padding: clamp(22px, 4vw, 34px);
  border-left: 1px solid var(--line-strong);
}

.art-caption > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.25;
  text-transform: uppercase;
}

.art-caption h3 {
  max-width: 15ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 3.7vw, 44px);
  font-weight: 430;
  line-height: 0.96;
}

.art-caption p {
  max-width: 28ch;
  color: #4c4842;
  font-size: 15px;
  line-height: 1.38;
}

.mdx-stack {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.mdx-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  padding: 7px 10px 8px;
  background: rgba(247, 246, 241, 0.52);
  opacity: var(--draw-opacity, 0.2);
  transform: translateY(var(--draw-y, 10px));
}

.mdx-card span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.2;
}

.mdx-card strong {
  color: #2f3430;
  font-size: 12px;
  font-weight: 560;
  line-height: 1.2;
}

.mdx-card i {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--line);
}

.mdx-card i::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ink);
  transform: scaleX(var(--draw, 0));
  transform-origin: left;
}

.art-meter {
  height: 2px;
  margin-top: 2px;
  background: var(--line);
}

.art-meter span {
  display: block;
  width: calc(var(--art-progress, 0) * 100%);
  height: 100%;
  background: var(--ink);
}

#artReadout {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.25;
  text-align: left;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: clamp(32px, 6vw, 56px);
}

.project-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 272px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.42);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.project-card::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 26px;
  height: 26px;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  background-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='2' y='2' width='4' height='4' fill='%23151515' fill-opacity='.75'/%3E%3Crect x='10' y='2' width='4' height='4' fill='%23151515' fill-opacity='.18'/%3E%3Crect x='18' y='2' width='4' height='4' fill='%23151515' fill-opacity='.75'/%3E%3Crect x='2' y='10' width='4' height='4' fill='%23151515' fill-opacity='.18'/%3E%3Crect x='10' y='10' width='4' height='4' fill='%23151515' fill-opacity='.75'/%3E%3Crect x='18' y='10' width='4' height='4' fill='%23151515' fill-opacity='.18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
}

.project-card:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.58);
  transform: translateY(-2px);
}

.quiet-link {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.25;
  text-transform: uppercase;
}

.project-card h3 {
  margin: 0;
  padding-right: 48px;
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 430;
  line-height: 0.98;
}

.project-card p {
  color: #4c4842;
  font-size: 16px;
  line-height: 1.46;
}

.project-card a {
  width: fit-content;
  margin-top: auto;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(100% - 48px, 1180px);
  margin: 0 auto;
  border-top: 1px solid var(--line-strong);
  padding: 24px 0 32px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.site-footer a {
  text-transform: none;
}

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 680ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 680ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--delay, 0ms);
}

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

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

@media (max-width: 740px) {
  .frame {
    inset: 10px;
  }

  .site-header {
    width: min(100% - 32px, 1180px);
    padding-top: 24px;
  }

  .nav {
    gap: 0;
  }

  .nav a {
    padding-inline: 7px;
  }

  .zh-page .nav a {
    padding-inline: 5px;
  }

  .hero {
    min-height: 78vh;
    width: min(100% - 32px, 1180px);
    padding: 64px 0 48px;
  }

  .hero-meta {
    display: grid;
    gap: 8px;
    margin-bottom: 52px;
  }

  h1 {
    font-size: clamp(74px, 26vw, 132px);
  }

  .dek {
    max-width: 30ch;
  }

  .code-mark {
    width: 100%;
    white-space: normal;
  }

  .control-plane {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .pixel-field {
    grid-template-columns: repeat(8, 10px);
  }

  .section {
    grid-template-columns: 1fr;
    width: min(100% - 32px, 1180px);
  }

  .list-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

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

  .art-section {
    min-height: 300svh;
    margin-top: 24px;
  }

  .art-stage {
    grid-template-columns: 1fr;
    gap: 16px;
    width: min(100% - 32px, 1180px);
    min-height: 0;
    padding: 26px 0;
  }

  .art-section .section-body {
    align-content: center;
  }

  .art-section .section-body > p {
    margin-top: 14px;
    font-size: 16px;
    line-height: 1.45;
  }

  .art-board {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    height: clamp(440px, 64svh, 580px);
    margin-top: 18px;
  }

  .art-media {
    min-height: 0;
  }

  .art-caption {
    gap: 10px;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
    padding: 18px;
  }

  .art-caption h3 {
    max-width: 16ch;
    font-size: clamp(25px, 8vw, 36px);
  }

  .art-caption p {
    display: none;
  }

  .stat {
    min-height: 112px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stat:last-child {
    border-bottom: 0;
  }

  .project-card {
    min-height: 232px;
  }

  .system-card {
    min-height: 248px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    width: min(100% - 32px, 1180px);
  }
}

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

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