:root {
  color-scheme: dark;
  --paper: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.58);
  --line: rgba(244, 241, 234, 0.2);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@font-face {
  font-family: "Safiro Noon";
  src: url("./safiro-regular-i.woff2") format("woff2");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

* { box-sizing: border-box; }

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

body {
  color: var(--paper);
  font-family: Inter, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }

.ambient-fallback,
.ambient-canvas,
.ambient-vignette,
.ambient-grain,
.trail-layer {
  position: fixed;
  inset: 0;
}

.ambient-fallback {
  background:
    radial-gradient(ellipse 66% 76% at 48% 52%, rgba(139, 45, 81, 0.78), transparent 70%),
    radial-gradient(ellipse 72% 68% at 90% 8%, rgba(244, 176, 132, 0.92), transparent 72%),
    radial-gradient(ellipse 62% 70% at 3% 92%, rgba(232, 143, 145, 0.82), transparent 72%),
    #d87875;
}

.ambient-canvas {
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ambient-vignette {
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 22%, transparent 78%, rgba(73, 18, 46, 0.035));
}

.ambient-grain {
  z-index: 2;
  opacity: 0;
  pointer-events: none;
}

.trail-layer {
  z-index: 7;
  pointer-events: none;
  overflow: hidden;
}

.trail-sprite {
  position: absolute;
  width: clamp(119px, 12.15vw, 200px);
  aspect-ratio: 1;
  object-fit: contain;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0) rotate(var(--rotation)) scale(0.15);
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.35));
  will-change: transform, opacity;
  animation: trail-pop 900ms var(--ease-out) forwards;
}

@keyframes trail-pop {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -50%, 0) rotate(var(--rotation)) scale(0.15);
  }
  16% {
    opacity: 0.94;
    transform: translate3d(-50%, -50%, 0) rotate(var(--rotation)) scale(1);
  }
  58% {
    opacity: 0.78;
    transform: translate3d(-50%, -54%, 0) rotate(var(--rotation)) scale(0.92);
  }
  100% {
    opacity: 0;
    transform: translate3d(-50%, -72%, 0) rotate(var(--rotation)) scale(0.22);
  }
}

.landing-shell {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  transition: opacity 400ms ease, transform 700ms var(--ease-out), filter 700ms ease;
}

.landing-shell.is-leaving {
  opacity: 0;
  transform: scale(1.055);
  filter: blur(14px);
}

.site-header,
.site-footer {
  position: absolute;
  left: 0;
  z-index: 20;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-inline: clamp(22px, 4.2vw, 74px);
}

.site-header { top: 0; padding-top: clamp(22px, 3.5vw, 48px); }
.site-footer { bottom: 0; padding-bottom: clamp(20px, 3vw, 40px); }

.brand {
  width: clamp(82px, 8.8vw, 132px);
  display: inline-flex;
}

.brand img {
  width: 100%;
  height: auto;
  filter: brightness(0) invert(1);
}

.header-meta,
.header-enter,
.footer-note {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #98d8df;
  box-shadow: 0 0 18px rgba(152, 216, 223, 0.9);
  animation: breathe 2.6s ease-in-out infinite;
}

@keyframes breathe {
  50% { opacity: 0.35; transform: scale(0.75); }
}

.header-enter {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(3, 5, 9, 0.13);
  backdrop-filter: blur(10px);
  transition: color 300ms ease, background 300ms ease, border-color 300ms ease;
}

.header-enter:hover {
  color: #071016;
  background: var(--paper);
  border-color: var(--paper);
}

.swap-label {
  display: inline-flex;
  overflow: hidden;
}

.button-char {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  white-space: pre;
}

.button-char > span {
  display: block;
  transition: transform 520ms cubic-bezier(.215, .61, .355, 1);
  transition-delay: calc(var(--char-index) * 24ms);
}

.button-char-secondary {
  position: absolute;
  inset: 0;
  transform: translateY(110%);
}

.header-enter.is-hovering .button-char-primary {
  transform: translateY(-110%);
}

.header-enter.is-hovering .button-char-secondary {
  transform: translateY(0);
}

.header-arrow {
  position: relative;
  display: inline-flex;
  width: 12px;
  height: 12px;
  overflow: hidden;
}

.header-arrow span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: transform 520ms cubic-bezier(.215, .61, .355, 1);
}

.header-arrow span:last-child {
  transform: translate(-120%, 120%);
}

.header-enter.is-hovering .header-arrow span:first-child {
  transform: translate(120%, -120%);
}

.header-enter.is-hovering .header-arrow span:last-child {
  transform: translate(0, 0);
}

.stage { position: relative; width: 100%; height: 100%; }

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(100px, 12vh, 145px) clamp(22px, 8vw, 150px) clamp(100px, 12vh, 130px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.scene.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.scene > * {
  opacity: 0;
  transform: translate3d(0, 42px, 0);
}

.scene.is-active > * {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition: opacity 700ms ease var(--delay, 80ms), transform 850ms var(--ease-out) var(--delay, 80ms);
}

.scene.is-exiting > * {
  opacity: 0;
  transform: translate3d(0, -38px, 0);
  transition: opacity 360ms ease, transform 520ms ease;
}

.scene-kicker {
  --delay: 60ms;
  display: flex;
  justify-content: space-between;
  width: min(100%, 1120px);
  margin: 0 auto clamp(25px, 5vh, 56px);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.2em;
}

.feature-lockup {
  position: relative;
  width: min(100%, 1120px);
  margin-inline: auto;
  text-align: center;
}

.hero-lockup,
.capability-lockup { --delay: 130ms; }
.open-lockup { --delay: 110ms; }

.scene[data-scene="2"].is-active .open-lockup {
  transform: translate3d(0, -3vh, 0);
}

.feature-title {
  margin: 0;
  font-family: "Safiro Noon", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(4.1rem, 8vw, 7.7rem);
  font-style: normal;
  font-weight: 400;
  line-height: 0.8;
  letter-spacing: -0.05em;
  text-transform: lowercase;
  white-space: nowrap;
  cursor: default;
  transform: translateZ(0);
}

.title-char {
  display: inline-block;
  pointer-events: auto;
  will-change: transform, clip-path;
  transform-origin: 0 50%;
}

.feature-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.5vw, 22px);
  margin-top: clamp(24px, 4vh, 42px);
  color: var(--muted);
  font-size: clamp(9px, 0.8vw, 11px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.feature-meta i {
  color: rgba(244, 241, 234, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 400;
}

.scene-foot {
  --delay: 220ms;
  width: min(100%, 690px);
  margin: clamp(34px, 6vh, 62px) auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.scene-foot p {
  max-width: 390px;
  margin: 0;
  color: rgba(244, 241, 234, 0.72);
  font-size: clamp(12px, 1.15vw, 15px);
  line-height: 1.8;
}

.round-action {
  width: 90px;
  height: 90px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(6, 9, 14, 0.16);
  cursor: pointer;
  backdrop-filter: blur(10px);
  font-size: 9px;
  letter-spacing: 0.16em;
  transition: background 350ms ease, color 350ms ease, transform 350ms var(--ease-out);
}

.round-action:hover {
  color: #061015;
  background: var(--paper);
  transform: rotate(7deg) scale(1.04);
}

.round-arrow { font-size: 19px; }

.capability-grid {
  --delay: 210ms;
  width: min(100%, 900px);
  margin: clamp(42px, 8vh, 86px) auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.capability-grid article { min-height: 132px; padding: 18px 26px 8px 0; }
.capability-grid article + article { padding-left: 26px; border-left: 1px solid var(--line); }
.capability-grid span { color: var(--muted); font-size: 10px; }

.capability-grid h3 {
  margin: 30px 0 8px;
  font-size: clamp(15px, 1.4vw, 20px);
  font-weight: 500;
}

.capability-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.scene-next {
  --delay: 270ms;
  position: absolute;
  right: clamp(22px, 5vw, 80px);
  bottom: clamp(85px, 10vh, 120px);
}

.open-lockup > p {
  margin: 0 0 clamp(20px, 3vh, 32px);
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: clamp(13px, 1.4vw, 18px);
  font-style: italic;
}

.open-portal {
  --delay: 220ms;
  position: absolute;
  right: clamp(30px, 11vw, 190px);
  bottom: clamp(85px, 12vh, 150px);
  width: clamp(190px, 20vw, 270px);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(5, 8, 14, 0.18);
  backdrop-filter: blur(12px);
  transition: background 500ms ease, color 500ms ease, transform 500ms var(--ease-out);
}

.open-portal:hover {
  color: #061015;
  background: var(--paper);
  transform: scale(1.035);
}

.portal-orbit {
  position: absolute;
  inset: 11px;
  border: 1px dashed currentColor;
  border-radius: 50%;
  opacity: 0.3;
  animation: orbit 16s linear infinite;
}

@keyframes orbit { to { transform: rotate(360deg); } }

.portal-copy { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.portal-copy strong { font-size: clamp(16px, 1.6vw, 22px); font-weight: 500; }
.portal-copy small { font-size: 8px; letter-spacing: 0.18em; }
.portal-arrow { position: absolute; right: 24%; top: 23%; font-size: 22px; }

.scene-counter {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
}

.counter-current { color: var(--paper); font-size: 19px; }
.counter-line { width: 36px; height: 1px; background: var(--line); }
.scene-dots { display: flex; gap: 12px; }

.scene-dots button {
  width: 30px;
  height: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.scene-dots button::before {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background: rgba(244, 241, 234, 0.25);
  transform: scaleX(0.38);
  transition: transform 400ms var(--ease-out), background 400ms ease;
}

.scene-dots button.is-active::before { background: var(--paper); transform: scaleX(1); }
.footer-note { justify-self: end; margin: 0; color: var(--muted); }

.exit-transition {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  visibility: hidden;
  opacity: 0;
  background: #05070c;
  transition: opacity 450ms ease, visibility 0s linear 450ms;
}

.exit-transition.is-active {
  visibility: visible;
  opacity: 1;
  transition: opacity 450ms ease;
}

.exit-transition img {
  position: relative;
  z-index: 2;
  width: 80px;
  filter: brightness(0) invert(1);
  transform: scale(0.7);
  opacity: 0;
}

.exit-transition.is-active img { animation: exit-mascot 700ms var(--ease-out) 180ms forwards; }

.exit-transition > span {
  position: relative;
  z-index: 2;
  font-size: 9px;
  letter-spacing: 0.24em;
  opacity: 0;
}

.exit-transition.is-active > span { animation: exit-copy 450ms ease 380ms forwards; }

.exit-ring {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #172b3b, #100c1b 58%, #05070c 72%);
  box-shadow: 0 0 80px rgba(90, 126, 166, 0.25);
}

.exit-transition.is-active .exit-ring { animation: exit-ring 950ms var(--ease-out) forwards; }

@keyframes exit-ring { to { transform: scale(22); } }
@keyframes exit-mascot { to { opacity: 1; transform: scale(1); } }
@keyframes exit-copy { to { opacity: 0.65; } }

@media (max-width: 760px) {
  .site-header,
  .site-footer { grid-template-columns: 1fr auto; }
  .header-meta,
  .footer-note { display: none; }
  .header-enter { grid-column: 2; }
  .site-footer .scene-dots { justify-self: end; }
  .scene { padding-inline: 22px; }
  .scene-kicker span:last-child { display: none; }
  .feature-title {
    font-size: clamp(3.3rem, 15.5vw, 5.7rem);
    white-space: normal;
  }
  .feature-meta {
    margin-top: 22px;
    gap: 8px;
    font-size: 8px;
  }
  .scene-foot { align-items: flex-end; }
  .scene-foot p { max-width: 230px; }
  .round-action { width: 76px; height: 76px; }
  .capability-grid { grid-template-columns: 1fr; margin-top: 40px; }
  .capability-grid article {
    min-height: auto;
    padding: 14px 0;
    display: grid;
    grid-template-columns: 30px 100px 1fr;
    align-items: center;
    border-bottom: 1px solid var(--line);
  }
  .capability-grid article + article { padding-left: 0; border-left: 0; }
  .capability-grid h3,
  .capability-grid p { margin: 0; }
  .scene-next { display: none; }
  .scene[data-scene="2"].is-active .open-lockup {
    transform: translate3d(0, -3.5vh, 0);
  }
  .open-portal {
    right: 50%;
    bottom: 90px;
    width: 150px;
    transform: translateX(50%);
  }
  .open-portal:hover { transform: translateX(50%) scale(1.03); }
  .trail-sprite { width: 124px; }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-grain,
  .live-dot,
  .portal-orbit { animation: none; }
  .trail-sprite { animation-duration: 400ms; }
  .scene > *,
  .scene.is-active > * { transition-duration: 1ms; }
}
