/* 八桂同根 · 云展厅 — 终端入口
   Light "research terminal" shell that hands off to the dark 3D hall. */

:root {
  --paper: #e8e5e1;
  --paper-2: #dedad4;
  --ink: #101114;
  --ink-soft: #3a3b3f;
  --dim: #75746f;
  --line: rgba(16, 17, 20, 0.16);
  --line-strong: rgba(16, 17, 20, 0.34);
  --accent: #22304a;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", monospace;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans SC",
    "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --pad: clamp(1.25rem, 4vw, 4.5rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: var(--pad);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* paper grain + faint vignette */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(16, 17, 20, 0.055) 0.5px, transparent 0.6px),
    radial-gradient(rgba(16, 17, 20, 0.035) 0.5px, transparent 0.6px);
  background-size: 3px 3px, 5px 5px;
  background-position: 0 0, 1px 2px;
  mix-blend-mode: multiply;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 40%, rgba(16, 17, 20, 0.09) 100%);
}

/* page wipe used when handing off to the hall */
.wip {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #06070a;
  transform: translateY(100%);
  transition: transform 0.72s cubic-bezier(0.76, 0, 0.24, 1);
  pointer-events: none;
}
.wip.on {
  transform: translateY(0);
}

.top,
.stage,
.foot {
  position: relative;
  z-index: 1;
}

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: clamp(0.95rem, 1.1vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.16em;
}

.brand span {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.34em;
  color: var(--dim);
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--dim);
  text-transform: uppercase;
}

.dot {
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 50%;
  display: inline-block;
  opacity: 0.6;
}

/* ---------- stage ---------- */
.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: clamp(2rem, 6vh, 5rem) 0;
}

.stage-index {
  position: absolute;
  right: 0;
  top: clamp(1rem, 4vh, 3rem);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  color: var(--dim);
}

.hero {
  max-width: 46rem;
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1.4rem);
  }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 clamp(1rem, 2.5vh, 1.8rem);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.26em;
  color: var(--dim);
}

.tick {
  width: 1.6rem;
  height: 1px;
  background: var(--line-strong);
  display: inline-block;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7.4vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.98;
}

h1 em {
  display: block;
  margin-top: 0.28em;
  font-size: 0.47em;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.lede {
  margin: clamp(1rem, 2.4vh, 1.6rem) 0 0;
  font-size: clamp(0.9rem, 1.15vw, 1.05rem);
  color: var(--dim);
  letter-spacing: 0.03em;
}

/* ---------- boot log ---------- */
.boot {
  margin: clamp(1.4rem, 3.4vh, 2.4rem) 0 0;
  min-height: 5.6rem;
  font-family: var(--mono);
  font-size: clamp(0.6rem, 0.78vw, 0.7rem);
  line-height: 1.85;
  letter-spacing: 0.04em;
  color: var(--dim);
  max-width: 34rem;
}

.boot i {
  color: var(--ink);
  font-style: normal;
}

.boot b {
  color: var(--accent);
  font-weight: 600;
}

.boot .ln {
  display: block;
  opacity: 0;
  transform: translateY(2px);
  animation: ln 0.32s ease forwards;
}

@keyframes ln {
  to {
    opacity: 1;
    transform: none;
  }
}

.boot .ok {
  color: #2f6b45;
}

/* ---------- actions ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
  margin-top: clamp(1.6rem, 4vh, 2.8rem);
  opacity: 0;
  transform: translateY(0.6rem);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.actions.ready {
  opacity: 1;
  transform: none;
}

.enter {
  position: relative;
  display: inline-grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 1.4rem;
  align-items: center;
  padding: 1rem 1.5rem;
  border: 1px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  transition: color 0.45s ease, border-color 0.45s ease;
}

.enter::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: translateY(101%);
  transition: transform 0.45s cubic-bezier(0.6, 0, 0.3, 1);
}

.enter:hover::before,
.enter:focus-visible::before {
  transform: translateY(0);
}

.enter:hover,
.enter:focus-visible {
  color: var(--paper);
}

.enter-label {
  position: relative;
  z-index: 1;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.enter-sub {
  position: relative;
  z-index: 1;
  grid-column: 1;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.3em;
  opacity: 0.6;
}

.enter-arrow {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 1.1rem;
  transition: transform 0.45s cubic-bezier(0.6, 0, 0.3, 1);
}

.enter:hover .enter-arrow {
  transform: translateX(0.35rem);
}

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 0.2rem;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.ghost:hover,
.ghost:focus-visible {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* ---------- facts ---------- */
.facts {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vh, 2rem);
  padding-left: clamp(1rem, 2vw, 2rem);
  border-left: 1px solid var(--line);
  align-self: end;
  padding-bottom: 0.4rem;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 5.5rem;
}

.fact-k {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.26em;
  color: var(--dim);
}

.fact-v {
  font-size: clamp(1rem, 1.4vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.foot .grow {
  flex: 1;
}

.foot .fine {
  letter-spacing: 0.06em;
  opacity: 0.8;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .stage {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 2rem;
  }

  .facts {
    flex-direction: row;
    gap: 2rem;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 1rem 0 0;
    align-self: stretch;
  }

  .stage-index {
    display: none;
  }

  .boot {
    min-height: 4.6rem;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: clamp(2.3rem, 12vw, 3.2rem);
  }

  .enter {
    width: 100%;
    justify-content: space-between;
  }

  .foot .fine {
    flex-basis: 100%;
    margin-top: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
