:root {
  color-scheme: dark;
  --ink: #f5f1ff;
  --muted: rgba(224, 218, 244, .64);
  --faint: rgba(232, 226, 255, .14);
  --glass: rgba(15, 13, 34, .46);
  --lavender: #b9a7ff;
  --warm: #f2d8bd;
  font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #080716;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #080716;
}

body {
  color: var(--ink);
  letter-spacing: .02em;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

#space {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#space:active {
  cursor: grabbing;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 68% 50%, transparent 0 31%, rgba(8, 7, 22, .08) 52%, rgba(8, 7, 22, .48) 100%),
    linear-gradient(90deg, rgba(8, 7, 22, .9) 0%, rgba(8, 7, 22, .38) 34%, transparent 66%);
}

.site-header {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: clamp(24px, 4vw, 58px) clamp(22px, 5vw, 72px);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  pointer-events: auto;
}

.journal-link {
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .18em;
  text-decoration: none;
}

.journal-link:hover,
.journal-link:focus-visible {
  color: var(--warm);
  outline: none;
}

.identity {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.eyebrow,
.chapter,
.caption-number,
.counter,
.orbit-label,
.lightbox-toolbar span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.title {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(22px, 2vw, 29px);
  letter-spacing: .12em;
}

.counter {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  font-variant-numeric: tabular-nums;
}

.counter-line {
  width: 54px;
  height: 1px;
  background: rgba(255, 255, 255, .34);
}

main {
  pointer-events: none;
}

.intro {
  position: fixed;
  z-index: 4;
  top: 50%;
  left: clamp(22px, 5vw, 72px);
  width: min(370px, 38vw);
  transform: translateY(-48%);
}

.chapter {
  margin: 0 0 24px;
}

h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(48px, 6.4vw, 94px);
  font-weight: 400;
  line-height: 1.03;
  letter-spacing: -.03em;
  text-shadow: 0 10px 42px rgba(0, 0, 0, .35);
}

.intro-copy {
  max-width: 300px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: .08em;
}

.active-caption {
  position: fixed;
  z-index: 5;
  right: clamp(22px, 5vw, 72px);
  bottom: clamp(92px, 13vh, 150px);
  width: min(250px, 28vw);
  padding-left: 20px;
  border-left: 1px solid rgba(231, 222, 255, .3);
  pointer-events: auto;
}

.caption-number {
  display: block;
  margin-bottom: 14px;
}

.active-caption h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(21px, 2.2vw, 30px);
  font-weight: 400;
  letter-spacing: .08em;
}

.active-caption p {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: .08em;
}

.text-button,
.photo-nav button,
.lightbox button {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.text-button {
  min-height: 34px;
  border-bottom: 1px solid rgba(255, 255, 255, .38);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: .12em;
}

.text-button:hover,
.text-button:focus-visible,
.photo-nav button:hover,
.photo-nav button:focus-visible,
.lightbox button:hover,
.lightbox button:focus-visible {
  color: var(--warm);
  outline: none;
}

.orbit-label {
  position: fixed;
  z-index: 3;
  top: 50%;
  right: -54px;
  transform: rotate(90deg);
  transform-origin: center;
  pointer-events: none;
}

.controls {
  position: fixed;
  z-index: 5;
  left: clamp(22px, 5vw, 72px);
  bottom: clamp(24px, 4vw, 54px);
  display: flex;
  align-items: center;
  gap: 13px;
  pointer-events: none;
}

.control-dot {
  width: 7px;
  height: 7px;
  border: 1px solid var(--lavender);
  border-radius: 50%;
  box-shadow: 0 0 18px var(--lavender);
}

.controls p {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.controls strong {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
}

.controls span:last-child {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .1em;
}

.photo-nav {
  position: fixed;
  z-index: 6;
  right: clamp(22px, 5vw, 72px);
  bottom: clamp(28px, 4vw, 58px);
  display: flex;
  align-items: center;
  gap: 14px;
}

.photo-nav button {
  min-width: 48px;
  min-height: 36px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .14em;
}

.nav-divider {
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, .22);
}

.loading,
.webgl-error {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 15px;
  border: 1px solid var(--faint);
  border-radius: 999px;
  background: rgba(8, 7, 22, .74);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .12em;
  backdrop-filter: blur(14px);
  transition: opacity .5s ease;
}

.loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.webgl-error {
  width: min(90vw, 520px);
  text-align: center;
}

.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: clamp(22px, 4vw, 56px);
  border: 0;
  background: rgba(5, 4, 15, .93);
  color: var(--ink);
  backdrop-filter: blur(24px);
}

.lightbox::backdrop {
  background: rgba(3, 2, 10, .78);
}

.lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
}

.lightbox-toolbar > div {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.lightbox-toolbar strong {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 400;
  letter-spacing: .08em;
}

.lightbox button {
  min-width: 72px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .12em;
}

.lightbox figure {
  display: grid;
  min-height: 0;
  margin: 0;
}

.lightbox img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.lightbox figcaption {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 760px) {
  .atmosphere {
    background:
      radial-gradient(circle at 58% 48%, transparent 0 28%, rgba(8, 7, 22, .12) 55%, rgba(8, 7, 22, .72) 100%),
      linear-gradient(180deg, rgba(8, 7, 22, .44), transparent 42%, rgba(8, 7, 22, .88));
  }

  .site-header {
    padding: 22px;
  }

  .eyebrow {
    font-size: 8px;
  }

  .title {
    font-size: 20px;
  }

  .counter-line {
    width: 28px;
  }

  .intro {
    top: 104px;
    left: 22px;
    width: calc(100% - 44px);
    transform: none;
  }

  .chapter {
    margin-bottom: 12px;
    font-size: 8px;
  }

  h1 {
    font-size: clamp(42px, 13vw, 64px);
    line-height: .98;
  }

  .intro-copy {
    display: none;
  }

  .active-caption {
    right: auto;
    bottom: 96px;
    left: 22px;
    width: calc(100% - 44px);
  }

  .active-caption h2 {
    font-size: 22px;
  }

  .orbit-label,
  .controls {
    display: none;
  }

  .photo-nav {
    right: 22px;
    bottom: 26px;
  }

  .lightbox {
    padding: 20px;
  }

  .lightbox-toolbar > div {
    flex-direction: column;
    gap: 6px;
  }
}

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