@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  src: url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Moon Serif SC";
  font-weight: 200;
  src: url("/fonts/noto-serif-sc-200-subset.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Moon Serif SC";
  font-weight: 300;
  src: url("/fonts/noto-serif-sc-300-subset.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-latin-400-normal.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-display: swap;
}

:root {
  --void: #05070d;
  --line: rgba(236, 230, 216, 0.17);
  --text: #f0ebdf;
  --muted: #a9aaa2;
  --gold: #e3bd78;
  --serif: "Instrument Serif", "Moon Serif SC", "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "PingFang SC", "Microsoft YaHei", monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--void);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Both languages are in the HTML. Without JavaScript, English shows. */
html:not([data-lang="zh"]) body [lang="zh-Hans"],
html[data-lang="zh"] body [lang="en"] {
  display: none !important;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.wrap {
  width: min(1320px, 100% - clamp(32px, 7vw, 112px));
  margin-inline: auto;
}

.skip {
  position: fixed;
  left: -999px;
  top: 8px;
  padding: 8px 14px;
  background: var(--text);
  color: var(--void);
  z-index: 30;
}

.skip:focus {
  left: 16px;
}

/* The stage stays fixed; the page scrolls over it and steers the camera. */
#sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.gl-ready #sky {
  opacity: 1;
}

.no-webgl #sky {
  display: none;
}

/* Shown without JavaScript or WebGL, and until the first frame is ready. */
.fallback-moon {
  position: fixed;
  z-index: -2;
  top: 50%;
  right: -6vw;
  width: min(62vh, 56vw);
  aspect-ratio: 1;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 74% 36%, #f3ead6 0, #c9bc9c 26%, #4b4a48 50%, #0d0f16 68%);
  transition: opacity 1.2s ease;
}

.gl-ready .fallback-moon {
  opacity: 0;
}

/* Header */
.site-head {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 3.5vw, 56px);
  background: linear-gradient(to bottom, rgba(5, 7, 13, 0.82), rgba(5, 7, 13, 0));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.2;
  text-decoration: none;
}

.mark {
  width: 24px;
  height: 24px;
  flex: none;
}

.mark-ring {
  fill: none;
  stroke: var(--text);
  stroke-opacity: 0.55;
}

.mark-lit {
  fill: var(--text);
}

.head-right {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
}

.head-link {
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
  opacity: 0.8;
}

.head-link:hover {
  opacity: 1;
}

.lang-switch {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: rgba(5, 7, 13, 0.4);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--text);
  color: var(--void);
}

/* Live moon phase, follows the scroll */
.phase-tag {
  position: fixed;
  z-index: 15;
  right: clamp(16px, 3.5vw, 56px);
  bottom: 24px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(5, 7, 13, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #d8d5ca;
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.phase-tag [lang="zh-Hans"] {
  font-family: var(--sans);
  letter-spacing: 0.04em;
}

.no-webgl .phase-tag {
  display: none;
}

/* Panels */
.panel {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: clamp(96px, 14vh, 150px);
}

.eyebrow {
  margin: 0 0 clamp(28px, 5vh, 52px);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow[lang="zh-Hans"] {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.28em;
}

/* Hero */
.hero h1 {
  margin: 0 0 clamp(22px, 4vh, 38px);
  font-family: var(--serif);
  font-size: clamp(50px, 7.7vw, 124px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.015em;
}

.hero h1[lang="zh-Hans"] {
  font-size: clamp(48px, 7vw, 112px);
  font-weight: 200;
  line-height: 1.26;
  letter-spacing: 0.06em;
}

.hero em {
  color: var(--gold);
}

.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

.line > span {
  display: block;
}

.js .line > span {
  animation: rise 1.5s var(--ease) both;
}

.js .line + .line > span {
  animation-delay: 0.14s;
}

.intro {
  max-width: 34em;
  margin: 0;
  color: #d8d5ca;
  font-size: clamp(16px, 1.45vw, 20px);
}

.js .intro {
  animation: fade 1.6s ease 0.55s both;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  display: block;
  width: 24px;
  height: 58px;
  transform: translateX(-50%);
}

.cue-line {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  overflow: hidden;
  background: var(--line);
}

.cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--text);
  animation: cue 2.4s var(--ease) infinite;
}

/* What we build */
.caps {
  max-width: 620px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.caps li {
  display: grid;
  grid-template-columns: 58px 1fr;
  padding-block: clamp(22px, 3.6vh, 36px);
  border-top: 1px solid var(--line);
}

.caps li:last-child {
  border-bottom: 1px solid var(--line);
}

.num {
  padding-top: 11px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.caps h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 400;
  line-height: 1.15;
}

.caps h2[lang="zh-Hans"] {
  margin-bottom: 10px;
  font-size: clamp(26px, 2.8vw, 38px);
  font-weight: 300;
  letter-spacing: 0.08em;
}

.caps p {
  margin: 0;
  color: #b9b7ad;
  font-size: 16px;
}

/* The name: the moon's horizon sits below this text */
.name {
  align-items: flex-start;
  padding-top: clamp(120px, 20vh, 200px);
}

.statement {
  max-width: 21em;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(30px, 4.5vw, 66px);
  line-height: 1.16;
}

.statement[lang="zh-Hans"] {
  max-width: 17em;
  font-size: clamp(25px, 3.5vw, 50px);
  font-weight: 300;
  line-height: 1.55;
  letter-spacing: 0.05em;
}

/* Contact */
.mail {
  display: inline-block;
  font-family: var(--serif);
  font-size: clamp(36px, 7.4vw, 116px);
  line-height: 1.1;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.7s var(--ease), color 0.3s;
}

.mail:hover {
  color: var(--gold);
  background-size: 100% 1px;
}

.live {
  margin-top: clamp(48px, 9vh, 92px);
  max-width: 660px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.live p {
  margin: 0 0 18px;
}

.live dl {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 8px clamp(24px, 5vw, 56px);
  margin: 0;
}

.live dt {
  font-size: 12px;
}

.live dd {
  margin: 0;
  color: var(--text);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.no-webgl .live {
  display: none;
}

/* Monospace is for Latin labels; Chinese in these spots reads better in the text face. */
.head-link [lang="zh-Hans"],
.live [lang="zh-Hans"] {
  font-family: var(--sans);
  letter-spacing: 0.04em;
}

/* Scroll reveal */
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1.1s ease, transform 1.3s var(--ease);
}

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

/* Footer */
.site-foot {
  padding-block: 26px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

/* Stays clear of the phase tag fixed at the bottom right. */
.foot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  padding-right: 150px;
}

.foot-row a {
  text-underline-offset: 3px;
}

/* 404 */
.doc {
  padding-block: 30vh;
}

.doc h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 300;
  line-height: 1.15;
}

.doc a {
  color: var(--gold);
}

@keyframes rise {
  from {
    transform: translateY(112%);
  }
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes cue {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

/* Tall screens: the moon moves above the copy, so text needs its own quiet ground. */
@media (max-aspect-ratio: 5/4) {
  .hero {
    align-items: flex-end;
    padding-bottom: 104px;
  }

  .build {
    align-items: flex-end;
  }

  .caps {
    max-width: none;
  }

  .caps li {
    grid-template-columns: 44px 1fr;
  }

  .caps h2,
  .caps p,
  .num {
    text-shadow: 0 0 22px var(--void), 0 0 8px var(--void);
  }

  .scroll-cue {
    height: 44px;
    bottom: 22px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }

  .site-head {
    padding-block: 16px;
  }

  .brand {
    font-size: 18px;
  }

  .live dl {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .js .line > span,
  .js .intro,
  .cue-line::after {
    animation: none;
  }

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