@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: vtOut 0.32s cubic-bezier(0.76, 0, 0.24, 1) both;
}
::view-transition-new(root) {
  animation: vtIn 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

html { background: var(--bg); }
body { background: transparent; }
main, .foot { position: relative; z-index: 1; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 42% at 12% 8%, rgba(227, 161, 74, 0.11), transparent 58%),
    radial-gradient(ellipse 42% 36% at 88% 4%, rgba(108, 227, 210, 0.08), transparent 52%),
    radial-gradient(ellipse 48% 40% at 78% 92%, rgba(155, 140, 255, 0.07), transparent 56%),
    radial-gradient(ellipse 30% 24% at 48% 48%, rgba(227, 161, 74, 0.04), transparent 62%);
  animation: meshDrift 26s ease-in-out infinite alternate;
}

.ambient {
  position: fixed;
  top: 0;
  left: 0;
  width: 560px;
  height: 560px;
  margin: -280px 0 0 -280px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(circle, rgba(227, 161, 74, 0.11), rgba(108, 227, 210, 0.05) 42%, transparent 68%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.ambient.is-on { opacity: 1; }

.accent {
  background: linear-gradient(120deg, #f6e2b3 0%, #e3a14a 42%, #6ce3d2 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar {
  background: rgba(7, 8, 12, 0.55);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}
.topbar.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.btn {
  position: relative;
  overflow: hidden;
  transition: transform var(--ease), background var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.btn--solid {
  background: linear-gradient(180deg, #fff8ee, #efe6d6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(227, 161, 74, 0.08);
}
.btn--solid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 48%, transparent 64%);
  transform: translateX(-120%);
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.btn--solid:hover::after { transform: translateX(120%); }
.btn--solid:hover {
  box-shadow: 0 12px 36px rgba(227, 161, 74, 0.28);
}
.btn--ghost {
  background: rgba(22, 24, 31, 0.7);
  backdrop-filter: blur(10px);
}
.btn--ghost:hover {
  border-color: rgba(227, 161, 74, 0.4);
  box-shadow: 0 0 24px rgba(227, 161, 74, 0.12);
}

.glass,
.card,
.cloud-item,
.stage,
.panel,
.flow__box,
.code {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border: 1px solid rgba(246, 241, 232, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(246, 241, 232, 0.06),
    0 18px 48px rgba(0, 0, 0, 0.22);
}

.glow {
  position: relative;
  isolation: isolate;
  --mx: 50%;
  --my: 40%;
}
.glow::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(200px circle at var(--mx) var(--my), rgba(227, 161, 74, 0.16), rgba(108, 227, 210, 0.06) 36%, transparent 58%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.glow:hover::after { opacity: 1; }

.stage {
  border-radius: 28px;
  box-shadow:
    inset 0 1px 0 rgba(246, 241, 232, 0.07),
    0 0 0 1px rgba(227, 161, 74, 0.08),
    0 30px 80px rgba(0, 0, 0, 0.35);
}
.stage::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(227, 161, 74, 0.45), rgba(108, 227, 210, 0.12), rgba(155, 140, 255, 0.28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 3;
}

.hero__net {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
}

.intro {
  background:
    radial-gradient(circle at 50% 46%, rgba(227, 161, 74, 0.14), transparent 34%),
    #04050a;
}
.intro__net {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.intro__center {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 1.1rem;
}
.intro__code {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #c9c2b5;
  min-height: 1.2em;
  letter-spacing: 0.02em;
}
.intro__code .caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 2px;
  background: var(--teal);
  vertical-align: text-bottom;
  animation: caret 0.7s steps(1) infinite;
}
.intro__mark {
  filter: drop-shadow(0 0 18px rgba(227, 161, 74, 0.55)) drop-shadow(0 0 32px rgba(108, 227, 210, 0.2));
}
.intro__word {
  position: static;
  top: auto;
}

.demo {
  position: relative;
  z-index: 2;
  width: min(100%, 360px);
  border-radius: 18px;
  background: rgba(8, 10, 14, 0.72);
  border: 1px solid rgba(246, 241, 232, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.demo__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-mute);
}
.demo__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal);
}
.demo__cap {
  margin-left: auto;
  color: var(--copper);
}
.demo__thread {
  min-height: 210px;
  padding: 0.9rem;
  display: grid;
  align-content: start;
  gap: 0.65rem;
}
.demo__msg {
  max-width: 92%;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.45;
  animation: msgIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.demo__msg--user {
  justify-self: end;
  background: rgba(227, 161, 74, 0.14);
  color: #f6e8c8;
}
.demo__msg--agent {
  justify-self: start;
  background: rgba(108, 227, 210, 0.1);
  color: var(--text);
}
.demo__msg--sys {
  justify-self: start;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-mute);
  background: transparent;
  padding: 0.15rem 0;
}
.demo__composer {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--text-mute);
  font-size: 0.78rem;
}
.demo__spark {
  color: var(--copper);
  filter: drop-shadow(0 0 8px rgba(227, 161, 74, 0.6));
  animation: spark 1.8s ease-in-out infinite;
}

.feat {
  position: relative;
  padding-left: 0.1rem;
}
.feat h3::before {
  content: "✦";
  display: inline-block;
  margin-right: 0.4rem;
  color: var(--copper);
  font-size: 0.7em;
  vertical-align: 0.05em;
}

.metric span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 560;
}

.spark polyline {
  stroke-dasharray: 520;
  stroke-dashoffset: 520;
  filter: drop-shadow(0 0 6px currentColor);
}
.card.is-in .spark polyline,
.spark.is-drawn polyline {
  animation: drawLine 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.pin i {
  box-shadow: 0 0 10px currentColor;
}

.log div {
  animation: msgIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.log div:nth-child(2) { animation-delay: 0.08s; }
.log div:nth-child(3) { animation-delay: 0.16s; }
.log div:nth-child(4) { animation-delay: 0.24s; }

.field input,
.field select,
.field textarea {
  background: rgba(12, 14, 20, 0.7);
  backdrop-filter: blur(8px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(227, 161, 74, 0.45);
  box-shadow: 0 0 0 4px rgba(227, 161, 74, 0.1);
}

.acc {
  transition: background 0.3s ease;
}
.acc.is-open {
  background: linear-gradient(90deg, rgba(227, 161, 74, 0.05), transparent 40%);
}

.reveal {
  opacity: 0;
  filter: blur(14px);
  transform: translateY(28px);
  transition:
    opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.is-in {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

.cursor {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  background: radial-gradient(circle, rgba(246, 226, 176, 0.95), rgba(227, 161, 74, 0.35) 38%, transparent 70%);
  box-shadow: 0 0 24px rgba(227, 161, 74, 0.35);
}

@keyframes meshDrift {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(-2%, 1.5%, 0); }
}
@keyframes caret {
  50% { opacity: 0; }
}
@keyframes spark {
  0%, 100% { transform: rotate(0deg) scale(1); opacity: 0.7; }
  50% { transform: rotate(18deg) scale(1.15); opacity: 1; }
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}
@keyframes vtOut {
  to { opacity: 0; filter: blur(8px); }
}
@keyframes vtIn {
  from { opacity: 0; filter: blur(10px); }
  to { opacity: 1; filter: none; }
}

@media (max-width: 900px) {
  .ambient { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; filter: none; transform: none; }
  .spark polyline { stroke-dashoffset: 0; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}
