:root {
  color-scheme: light;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #a8bdff;
  color: #fff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

.site {
  --accent: #9bb4ff;
  --accent-ink: #3f5fd0;
  --copy-body: rgba(255, 255, 255, 0.96);
  --wash: rgba(186, 202, 255, 0.22);
  --ink-shadow: rgba(38, 30, 78, 0.22);
  isolation: isolate;
  min-height: 100svh;
  overflow: hidden;
  position: relative;
  touch-action: none;
  background: var(--accent);
  color: #fff;
  transition: background-color 450ms ease;
}

.site[data-theme='pink'] {
  --accent: #f7ae9c;
  --accent-ink: #c05a4c;
  --wash: rgba(255, 214, 201, 0.25);
  --ink-shadow: rgba(96, 38, 28, 0.2);
}

.site[data-theme='purple'] {
  --accent: #b7a7e5;
  --accent-ink: #6f5cbd;
  --copy-body: rgba(255, 255, 255, 0.96);
  --wash: rgba(222, 208, 255, 0.24);
  --ink-shadow: rgba(44, 32, 84, 0.22);
}

.scene,
.scene__frame,
.scene__eyes,
.scene__veil {
  inset: 0;
  position: absolute;
}

.scene {
  z-index: -2;
  overflow: hidden;
  background: var(--accent);
}

.scene__frame {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.scene__eyes {
  display: block;
  height: 100%;
  width: 100%;
}

.scene--fallback .scene__eyes {
  display: none;
}

.scene__veil {
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--wash) 0%, transparent 30%, transparent 72%, rgba(31, 25, 64, 0.08) 100%);
  mix-blend-mode: soft-light;
}

.scene__veil::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 42%, transparent 55%, rgba(24, 20, 52, 0.13) 100%);
}

/* ---------- top bar ---------- */

.topbar,
.footer {
  align-items: flex-start;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  padding: 1.9rem 2.2rem;
  position: relative;
  z-index: 2;
}

.topbar {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
}

.wordmark,
.topbar__note,
.topbar__index,
.hero__nameplate,
.footer {
  text-shadow: 0 1px 18px var(--ink-shadow);
}

.wordmark {
  align-items: center;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 800;
  gap: 0.5rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark__eyes {
  display: inline-flex;
  gap: 0.22rem;
}

.wordmark__eyes i {
  background: var(--accent-ink);
  border-radius: 50%;
  display: inline-block;
  height: 0.32rem;
  transition: transform 90ms ease;
  width: 0.32rem;
}

.wordmark__eyes.is-blinking i {
  transform: scaleY(0.12);
}

.topbar__note,
.topbar__index {
  margin: 0;
  opacity: 0.85;
}

.topbar__note {
  justify-self: center;
}

.topbar__index {
  font-variant-numeric: tabular-nums;
  justify-self: end;
}

/* ---------- hero ---------- */

.hero {
  max-width: 40rem;
  padding: 9.5vh 2.2rem 0;
  position: relative;
  z-index: 2;
}

.hero__nameplate {
  align-items: baseline;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.7rem;
  font-weight: 700;
  gap: 0.55rem;
  letter-spacing: 0.14em;
  margin: 0 0 1.1rem;
  outline-offset: 0.35rem;
}

.nameplate__greet {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  letter-spacing: 0.06em;
  opacity: 0.9;
  text-transform: none;
}

.nameplate__name {
  font-size: 1.06em;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 18px var(--ink-shadow);
}

.nameplate__name [lang='zh'] {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.82em;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.2em;
  margin-left: 0.15rem;
  opacity: 0.92;
}

.nameplate__tag {
  border-left: 1px solid rgba(255, 255, 255, 0.55);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  letter-spacing: 0.1em;
  opacity: 0.92;
  padding-left: 0.55rem;
}

.hero__title {
  font-size: clamp(4.2rem, 9.5vw, 8.8rem);
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 0.78;
  margin: 0;
  text-shadow: 0 2px 30px var(--ink-shadow);
  text-wrap: balance;
}

.hero__rule {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 85%);
  height: 1px;
  margin: 1.7rem 0 0;
  transform-origin: left center;
  width: min(34vw, 26rem);
}

.hero__summary {
  color: var(--copy-body);
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 1.1rem 0 0;
  max-width: 19rem;
  text-shadow: none;
}

/* ---------- copy swap ---------- */

.hero__nameplate,
.hero__title,
.hero__rule,
.hero__summary {
  transition: opacity 180ms ease;
}

.site.is-swapping .hero__nameplate,
.site.is-swapping .hero__title,
.site.is-swapping .hero__rule,
.site.is-swapping .hero__summary {
  opacity: 0;
}

/* ---------- scene nav ---------- */

.scene-nav {
  bottom: 9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  left: 2.2rem;
  position: absolute;
  z-index: 3;
}

.scene-nav__item {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  padding: 0.12rem 0;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: color 180ms ease, transform 180ms ease;
}

.scene-nav__head {
  display: flex;
  gap: 0.55rem;
}

.scene-nav__no {
  font-variant-numeric: tabular-nums;
  opacity: 0.72;
  width: 1.15rem;
}

.scene-nav__name [lang='zh'] {
  font-weight: 600;
  letter-spacing: 0.18em;
  margin-left: 0.1rem;
  opacity: 0.85;
}

.scene-nav__line {
  background: rgba(255, 255, 255, 0.26);
  display: block;
  height: 1px;
  width: 4.6rem;
}

.scene-nav__line i {
  background: #fff;
  display: block;
  height: 100%;
  transition: width 220ms ease;
  width: 0;
}

.scene-nav__item.is-active {
  color: #fff;
}

.scene-nav__item.is-active .scene-nav__line i {
  width: 100%;
}

.scene-nav__item:not(.is-active):hover .scene-nav__line i {
  width: 22%;
}

.scene-nav__item.is-active.is-charging .scene-nav__line i {
  animation: charge 5s linear forwards;
}

@keyframes charge {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.scene-nav__item:hover,
.scene-nav__item:focus-visible,
.scene-nav__item.is-active {
  color: #fff;
}

.scene-nav__item:hover {
  transform: translateX(0.25rem);
}

.scene-nav__item:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.92);
  outline-offset: 0.3rem;
}

/* ---------- footer ---------- */

.footer {
  align-items: end;
  bottom: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
  padding-top: 0;
  position: absolute;
  width: 100%;
  z-index: 3;
}

.footer__hint,
.footer__link {
  margin: 0;
}

.footer__hint {
  opacity: 0.85;
}

.footer__sep {
  font-style: normal;
  margin: 0 0.45rem;
  opacity: 0.6;
}

.footer__link {
  grid-column: 3;
  justify-self: end;
  text-underline-offset: 0.2rem;
  transition: transform 180ms ease;
}

.footer__link:hover {
  transform: translateX(3px);
}

/* ---------- narrow screens ---------- */

@media (max-width: 680px) {
  .topbar,
  .footer {
    gap: 0.8rem;
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  .site .topbar__sign {
    display: none;
  }

  .hero {
    padding: 7.5vh 1.1rem 0;
  }

  .hero__title {
    font-size: clamp(3.6rem, 16.5vw, 5.6rem);
  }

  .hero__summary {
    max-width: 15rem;
  }

  .scene-nav {
    bottom: 5.6rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    background: rgba(28, 26, 56, 0.24);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 999px;
    flex-direction: row;
    gap: 0.25rem;
    padding: 0.4rem 0.55rem;
  }

  .scene-nav__item {
    border-radius: 999px;
    flex-direction: row;
    gap: 0.4rem;
    padding: 0.32rem 0.6rem;
    white-space: nowrap;
  }

  .scene-nav__name {
    white-space: nowrap;
  }

  .scene-nav__item.is-active {
    background: rgba(255, 255, 255, 0.22);
  }

  .scene-nav__item:hover {
    transform: none;
  }

  .scene-nav__head {
    align-items: baseline;
    display: flex;
    gap: 0.35rem;
  }

  .scene-nav__line {
    display: none;
  }

  .footer {
    font-size: 0.54rem;
    bottom: 1rem;
  }

  .footer__hint {
    max-width: 12rem;
  }

  .footer__blink-hint,
  .footer__colophon,
  #visitor-line {
    display: none;
  }
}

@media (max-width: 430px) {
  .scene-nav {
    padding: 0.32rem 0.4rem;
  }

  .scene-nav__item {
    font-size: 0.6rem;
    gap: 0.25rem;
    padding: 0.28rem 0.45rem;
  }

  .scene-nav__no {
    width: auto;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .site,
  .scene-nav__item,
  .scene-nav__line i,
  .footer__link,
  .wordmark__eyes i,
  .hero__nameplate,
  .hero__title,
  .hero__rule,
  .hero__summary {
    transition: none;
  }

  .scene-nav__item.is-active.is-charging .scene-nav__line i {
    animation: none;
    width: 100%;
  }
}

/* ---------- entrance choreography ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js .topbar,
  .js .hero > *,
  .js .scene-nav__item,
  .js .footer {
    opacity: 0;
  }

  .js.is-entered .topbar {
    animation: enter-fade 0.5s 0.05s backwards;
    opacity: 1;
  }

  .js.is-entered .hero__nameplate {
    animation: enter-rise 0.5s 0.18s backwards;
    opacity: 1;
  }

  .js.is-entered .hero__title {
    animation: enter-rise 0.6s 0.3s backwards;
    opacity: 1;
  }

  .js.is-entered .hero__rule {
    animation: enter-grow 0.55s 0.55s backwards;
    opacity: 1;
  }

  .js.is-entered .hero__summary {
    animation: enter-rise 0.5s 0.62s backwards;
    opacity: 1;
  }

  .js.is-entered .scene-nav__item:nth-child(1) {
    animation: enter-rise 0.45s 0.78s backwards;
    opacity: 1;
  }

  .js.is-entered .scene-nav__item:nth-child(2) {
    animation: enter-rise 0.45s 0.84s backwards;
    opacity: 1;
  }

  .js.is-entered .scene-nav__item:nth-child(3) {
    animation: enter-rise 0.45s 0.9s backwards;
    opacity: 1;
  }

  .js.is-entered .footer {
    animation: enter-fade 0.5s 0.95s backwards;
    opacity: 1;
  }
}

@keyframes enter-fade {
  from {
    opacity: 0;
  }
}

@keyframes enter-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes enter-grow {
  from {
    transform: scaleX(0);
  }
}

/* ---------- poetic voice & film grain ---------- */

.split-c {
  display: inline-block;
  transition: opacity 180ms ease, transform 220ms ease, filter 220ms ease;
}

.split-c.pre {
  opacity: 0;
  transform: translateY(8px);
  filter: blur(3px);
}

.site.is-swapping .split-c {
  opacity: 0;
  transform: translateY(-8px);
  filter: blur(3px);
}

.grain {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
  inset: 0;
  opacity: 0.05;
  pointer-events: none;
  position: fixed;
  z-index: 60;
}

/* ---------- specimen card ---------- */

.specimen {
  align-items: center;
  background: rgba(18, 15, 38, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 200ms ease;
  z-index: 50;
}

.specimen.is-open {
  opacity: 1;
  pointer-events: auto;
}

.specimen__panel {
  color: #fff;
  margin-left: auto;
  margin-right: 9vw;
  padding: 2rem 2.2rem 1.6rem;
  position: relative;
  width: min(26rem, calc(100vw - 3rem));
}

.specimen__no {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  margin: 0 0 0.5rem;
  color: rgba(255, 255, 255, 0.62);
}

.specimen__name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  text-shadow: 0 2px 24px rgba(10, 8, 24, 0.55);
}

.specimen__name [lang='zh'] {
  font-size: 0.7em;
  margin-left: 0.25rem;
}

.specimen__tag {
  color: rgba(255, 255, 255, 0.8);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.95rem;
  font-style: italic;
  margin: 0.3rem 0 0;
}

.specimen__poem {
  color: rgba(255, 255, 255, 0.92);
  font-family: Georgia, 'Songti SC', 'SimSun', serif;
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.55;
  margin: 1.1rem 0 0;
}

.specimen__rule {
  background: rgba(255, 255, 255, 0.35);
  height: 1px;
  margin: 1.2rem 0;
  width: 100%;
}

.specimen__label {
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  margin: 0 0 0.6rem;
  color: rgba(255, 255, 255, 0.62);
}

.specimen__notes {
  font-size: 0.85rem;
  line-height: 1.75;
  list-style: none;
  margin: 0;
  padding: 0;
}

.specimen__notes li::before {
  content: '·';
  margin-right: 0.5rem;
}

.specimen__meta {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  margin: 1.2rem 0 0;
  color: rgba(255, 255, 255, 0.62);
}

.specimen__close {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  padding: 0.35rem 0.7rem;
  position: absolute;
  right: 0.9rem;
  top: 0.9rem;
}

.specimen__close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.specimen__close:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 0.25rem;
}

/* ---------- colophon ---------- */

.footer__colophon {
  font-size: 0.52rem;
  grid-column: 3;
  justify-self: end;
  letter-spacing: 0.14em;
  margin: 0.4rem 0 0;
  opacity: 0.55;
}

.topbar__sign {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  justify-self: center;
}

.footer__status {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.6rem;
  font-style: italic;
  letter-spacing: 0.06em;
  margin: 0;
  opacity: 0.78;
  text-align: center;
}

.specimen__thought-label {
  color: rgba(255, 255, 255, 0.62);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.62rem;
  font-style: italic;
  letter-spacing: 0.1em;
  margin: 1rem 0 0.3rem;
}

.specimen__thought {
  color: rgba(255, 255, 255, 0.92);
  font-family: Georgia, 'Songti SC', 'SimSun', serif;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.5;
  margin: 0;
}

/* hour tint: the light changes with the day */
.site[data-hour='morning'] .scene__veil {
  background: linear-gradient(180deg, rgba(255, 228, 196, 0.2) 0%, transparent 30%, transparent 72%, rgba(31, 25, 64, 0.08) 100%);
}

.site[data-hour='dusk'] .scene__veil {
  background: linear-gradient(180deg, rgba(255, 196, 160, 0.2) 0%, transparent 30%, transparent 72%, rgba(31, 25, 64, 0.1) 100%);
}

.site[data-hour='night'] .scene__veil {
  background: linear-gradient(180deg, rgba(56, 56, 110, 0.18) 0%, transparent 30%, transparent 72%, rgba(10, 8, 30, 0.22) 100%);
}

@keyframes enter-grow {
  from {
    transform: scaleX(0);
  }
}
