/* XH design system — tokens, nav, cursor, buttons, reveal, split text, curtain. */
:root {
  --bg: #04060d;
  --ink: #eef3fb;
  --dim: rgba(238, 243, 251, .68);
  --faint: rgba(238, 243, 251, .38);
  --line: rgba(238, 243, 251, .12);
  --accent: rgb(87, 215, 232);
  --accent-rgb: 87, 215, 232;
  --serif: "Noto Serif SC", "Playfair Display", "Songti SC", STSong, SimSun, serif;
  --sans: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Space Grotesk", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --pad: clamp(20px, 6vw, 110px);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; background: var(--bg); }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans);
  overflow-x: hidden; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
::selection { background: rgba(var(--accent-rgb), .35); color: #fff; }
.xh-arriving body::before { content: ""; position: fixed; inset: 0; background: var(--bg); z-index: 10000; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }

/* ---------- cursor ---------- */
html.has-cursor, html.has-cursor * { cursor: none !important; }
.xh-cursor-dot, .xh-cursor-ring, .xh-trail { position: fixed; pointer-events: none; }
.xh-trail { left: 0; top: 0; width: 100%; height: 100%; z-index: 9990; }
.xh-cursor-dot {
  left: 0; top: 0; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 12px 2px rgba(var(--accent-rgb), .9); z-index: 9999; transition: opacity .3s;
}
.xh-cursor-ring {
  left: 0; top: 0; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  border: 1px solid rgba(var(--accent-rgb), .75); z-index: 9998; display: grid; place-items: center;
  transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), background .3s, opacity .3s;
}
.xh-cursor-ring span { font: 500 11px var(--mono); letter-spacing: .12em; color: #fff; opacity: 0; transition: opacity .25s; }
.xh-cursor-ring.is-hover { width: 70px; height: 70px; margin: -35px 0 0 -35px; background: rgba(var(--accent-rgb), .14); }
.xh-cursor-ring.has-label { width: 96px; height: 96px; margin: -48px 0 0 -48px; background: rgba(var(--accent-rgb), .2); }
.xh-cursor-ring.has-label span { opacity: 1; }
.xh-cursor-ring.is-down { width: 24px; height: 24px; margin: -12px 0 0 -12px; }

/* ---------- nav ---------- */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(18px, 3.4vw, 52px);
  transition: transform .6s var(--ease);
}
#nav::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .4s;
  background: linear-gradient(180deg, rgba(4, 6, 13, .78), rgba(4, 6, 13, .42));
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
#nav.scrolled::before { opacity: 1; }
#nav.hide { transform: translateY(-110%); }
.brand { position: relative; display: inline-flex; align-items: center; z-index: 2; }
.brand img { height: 52px; width: auto; display: block; filter: drop-shadow(0 0 14px rgba(var(--accent-rgb), .35)); transition: transform .6s var(--ease), filter .4s; }
.brand:hover img { transform: scale(1.06) rotate(-2deg); filter: drop-shadow(0 0 22px rgba(var(--accent-rgb), .8)); }
.links {
  position: relative; display: flex; align-items: center; gap: 4px; padding: 5px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(10, 14, 28, .42);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.links a { position: relative; z-index: 1; padding: 9px 20px; font-size: 14px; letter-spacing: .08em; color: var(--dim); border-radius: 999px; transition: color .3s; white-space: nowrap; }
.links a:hover, .links a.active { color: #fff; }
.nav-pill {
  position: absolute; left: 0; top: 5px; bottom: 5px; width: 0; border-radius: 999px; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .3), rgba(var(--accent-rgb), .1));
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .5), 0 0 26px rgba(var(--accent-rgb), .28);
  transition: transform .55s var(--ease), width .55s var(--ease), opacity .3s;
}
.menu-toggle { display: none; }
.xh-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 101; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, transparent, var(--accent)); box-shadow: 0 0 12px var(--accent);
}

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 14px; padding: 17px 34px;
  border: 0; border-radius: 999px; font: 600 14px var(--sans); letter-spacing: .14em; color: #06101a; background: #eef8ff;
  overflow: hidden; isolation: isolate; cursor: pointer; white-space: nowrap;
  box-shadow: 0 0 34px rgba(var(--accent-rgb), .42), 0 0 90px rgba(var(--accent-rgb), .2);
  transition: transform .5s var(--ease), box-shadow .5s, background .4s, color .4s;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; transform: translateX(-130%) skewX(-18deg);
  background: linear-gradient(110deg, transparent 25%, rgba(var(--accent-rgb), .55) 50%, transparent 75%);
  transition: transform .9s var(--ease);
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 0 46px rgba(var(--accent-rgb), .7), 0 0 130px rgba(var(--accent-rgb), .35); }
.btn:hover::before { transform: translateX(130%) skewX(-18deg); }
.btn .arr { width: 18px; height: 18px; flex: none; transition: transform .5s var(--ease); }
.btn:hover .arr { transform: translateX(6px); }
.btn-ghost { color: #fff; background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .26); backdrop-filter: blur(10px); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), .9), 0 0 40px rgba(var(--accent-rgb), .35); }
.btn-ghost::before { background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, .18) 50%, transparent 75%); }

/* ---------- type atoms ---------- */
.kicker {
  display: inline-flex; align-items: center; gap: 14px; font: 500 12px var(--mono); letter-spacing: .34em;
  text-transform: uppercase; color: rgba(var(--accent-rgb), 1);
}
.kicker::before { content: ""; width: 38px; height: 1px; background: currentColor; box-shadow: 0 0 10px currentColor; }
.kdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); animation: kpulse 2s ease-in-out infinite; }
@keyframes kpulse { 50% { transform: scale(1.6); opacity: .5; } }
.rule { width: 84px; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); box-shadow: 0 0 14px var(--accent); margin: 28px 0; }

/* ---------- reveal + split text ----------
   Hidden start states only apply under html.xh-js (set by the inline <head> script).
   If ui.js never boots, that script removes xh-js after 4s and content shows as-is. */
.xh-js [data-reveal] {
  opacity: 0; translate: 0 36px; filter: blur(10px);
  transition: opacity 1.1s var(--ease), translate 1.1s var(--ease), filter 1.1s var(--ease);
}
.xh-js [data-reveal].in { opacity: 1; translate: 0 0; filter: none; }
.xh-js .rule[data-reveal] { translate: 0 0; transform: scaleX(0); transform-origin: 0 50%; filter: none; transition: opacity .6s, transform 1.2s var(--ease); }
.xh-js .rule[data-reveal].in { transform: scaleX(1); }
.chm { display: inline-block; perspective: 600px; }
.word { display: inline-block; white-space: nowrap; }
.ch { display: inline-block; }
.xh-js .ch {
  opacity: 0; filter: blur(12px); transform-origin: 50% 100%;
  transform: translateY(.7em) rotateX(-80deg) scale(.92);
  transition: opacity .9s var(--ease) calc(var(--i) * var(--step, 32ms)), filter .9s var(--ease) calc(var(--i) * var(--step, 32ms)), transform 1.1s var(--ease) calc(var(--i) * var(--step, 32ms));
}
.xh-js [data-split].in .ch { opacity: 1; filter: none; transform: none; }

/* ---------- marquee ---------- */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-track { display: flex; width: max-content; animation: marq 46s linear infinite; }
.marquee-track span { font: 700 clamp(44px, 7vw, 110px)/1.2 var(--serif); padding-right: .6em; color: transparent; -webkit-text-stroke: 1px rgba(238, 243, 251, .3); white-space: nowrap; }
.marquee-track span:nth-child(even) { color: rgba(238, 243, 251, .9); -webkit-text-stroke: 0; }
.marquee-track span i { font-style: normal; color: var(--accent); -webkit-text-stroke: 0; padding-left: .6em; }
@keyframes marq { to { transform: translateX(-50%); } }

/* ---------- page curtain ---------- */
.xh-curtain {
  position: fixed; inset: 0; z-index: 10000; visibility: hidden; pointer-events: none; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, #0b1428 0, #04060d 70%);
}
.xh-curtain-mark { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.xh-curtain-mark b { font: 700 22px var(--mono); letter-spacing: .18em; text-indent: .18em; color: #fff; }
.xh-curtain-mark i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(var(--accent-rgb), .25); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

h1, h2, h3, .title { text-wrap: balance; }
p, .desc { text-wrap: pretty; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  #nav { padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-left: calc(18px + env(safe-area-inset-left, 0px)); padding-right: calc(18px + env(safe-area-inset-right, 0px)); }
  /* no hard-edged bar on phones: a dark fade that melts into the page */
  #nav::before { inset: 0 0 -26px; background: linear-gradient(180deg, rgba(4, 6, 13, .88) 0, rgba(4, 6, 13, .6) 60%, rgba(4, 6, 13, 0)); backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; }
  .brand img { height: 44px; }
  .menu-toggle {
    position: relative; z-index: 3; display: inline-flex; width: 46px; height: 46px; align-items: center; justify-content: center;
    flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 50%; color: #fff; background: rgba(10, 14, 28, .5); cursor: pointer;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  .menu-toggle span { width: 18px; height: 1.5px; background: currentColor; transition: transform .4s var(--ease), opacity .2s; }
  .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(7.5px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-7.5px) rotate(-45deg); }
  .links {
    position: fixed; inset: 0; z-index: 2; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px;
    padding: 0 9vw; border: 0; border-radius: 0; background: radial-gradient(circle at 80% 10%, rgba(var(--accent-rgb), .18), transparent 50%), rgba(4, 6, 13, .96);
    backdrop-filter: none; -webkit-backdrop-filter: none;
    clip-path: circle(0 at calc(100% - 41px) 39px); transition: clip-path .8s var(--ease); pointer-events: none;
  }
  .links.is-open { clip-path: circle(150% at calc(100% - 41px) 39px); pointer-events: auto; }
  .links a { font: 600 clamp(28px, 8vw, 40px)/1.5 var(--serif); padding: 6px 0; color: var(--dim); opacity: 0; translate: 0 24px; transition: opacity .6s var(--ease), translate .7s var(--ease), color .3s; }
  .links.is-open a { opacity: 1; translate: 0 0; }
  .links.is-open a:nth-child(2) { transition-delay: .12s; } .links.is-open a:nth-child(3) { transition-delay: .18s; }
  .links.is-open a:nth-child(4) { transition-delay: .24s; } .links.is-open a:nth-child(5) { transition-delay: .3s; } .links.is-open a:nth-child(6) { transition-delay: .36s; }
  .links a.active { color: var(--accent); }
  .nav-pill { display: none; }
}
@media (max-width: 900px) and (max-height: 560px) {
  .links { padding-top: 56px; gap: 0; }
  .links a { font-size: clamp(20px, 6vh, 28px); padding: 2px 0; }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal], .ch { transition-duration: .01s !important; transition-delay: 0s !important; }
  .marquee-track { animation: none; }
}
