/* ==========================================================================
   Components: navigation, aurora hero, the automation hub window
   ========================================================================== */

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; border-bottom: 1px solid transparent; transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease); }
.nav.is-scrolled, .nav.is-open { background: rgba(8, 6, 12, 0.72); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); border-bottom-color: var(--line); }
/* Reading progress */
.nav::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--grad); transform: scaleX(var(--progress, 0)); transform-origin: 0 50%; opacity: 0; transition: opacity 0.35s var(--ease); }
.nav.is-scrolled::after { opacity: 1; }
.nav__inner { position: relative; display: flex; align-items: center; gap: 28px; min-height: var(--nav-h); }

.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.035em; line-height: 1; color: var(--ink); }
.brand__mark { width: 32px; height: 31px; flex: none; transition: transform 0.6s var(--ease), filter 0.6s var(--ease); }
.brand:hover .brand__mark { transform: scale(1.08) rotate(-4deg); filter: drop-shadow(0 0 12px rgba(226, 75, 255, 0.7)); }
.brand__ai { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav__menu { display: flex; flex: 1; justify-content: center; }
.nav__list { display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.nav__link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); font-size: 14.5px; font-weight: 500; color: var(--muted); transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.nav__link:hover { color: var(--ink); background: rgba(255, 255, 255, 0.07); }
.nav__link.is-current { color: var(--ink); background: rgba(255, 255, 255, 0.1); }
.nav__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav__toggle { display: none; }
.nav__mobile-actions { display: none; }

@media (max-width: 1023px) {
  .nav__menu { flex: none; }
  .nav__toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r); color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-2); }
  .nav__toggle .icon--close { display: none; }
  .nav.is-open .nav__toggle .icon--menu { display: none; }
  .nav.is-open .nav__toggle .icon--close { display: block; }
  /* The fixed header is the containing block, so the drawer hangs off it */
  .nav__menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 99; display: none; flex-direction: column; justify-content: flex-start; height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h)); padding: 16px var(--gutter) 40px; overflow-y: auto; background: var(--bg); border-top: 1px solid var(--line); }
  .nav.is-open .nav__menu { display: flex; }
  body.nav-open { overflow: hidden; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; padding: 0; border: 0; border-radius: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav__link { display: flex; width: 100%; min-height: 56px; padding: 0 4px; border-radius: 0; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-size: 20px; color: var(--ink); }
  .nav__link.is-current, .nav__link:hover { background: none; }
  .nav__mobile-actions { display: grid; margin-top: 24px; }
}

/* --------------------------------------------------------------------------
   Aurora and starfield canvases (drawn by js/aurora.js)
   -------------------------------------------------------------------------- */
.aurora, .stars, .glitter { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* In the hero they cover about the first screen and a third, not the whole demo
   below it: less to draw, and they stop as soon as you scroll on. The aurora
   already fades to the page colour at its bottom edge. */
.hero > .aurora, .hero > .stars, .hero > .glitter { bottom: auto; height: min(100%, 135vh); }
.aurora { z-index: -3; }
.stars { z-index: -2; }
/* No z-index: painted in page order, so above the veil and below the hero's words */
.no-js .glitter { display: none; }
/* Without WebGL or JS, a still aurora made of gradients */
.no-js .aurora, .aurora.is-static {
  background:
    radial-gradient(60% 70% at 8% 28%, rgba(214, 28, 240, 0.85), transparent 62%),
    radial-gradient(45% 55% at 96% 0%, rgba(150, 20, 210, 0.55), transparent 65%),
    radial-gradient(70% 60% at 40% 0%, rgba(90, 10, 130, 0.7), transparent 70%),
    #12061a;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { position: relative; isolation: isolate; overflow: hidden; padding-top: calc(var(--nav-h) + clamp(56px, 10vh, 120px)); }
/* Keeps the words readable over the light and melts the hero into the page */
.hero__veil { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(56% 42% at 50% 30%, rgba(8, 6, 12, 0.66), transparent 72%), linear-gradient(180deg, transparent 52%, var(--bg) 96%); }
.hero__inner { position: relative; display: grid; justify-items: center; gap: 24px; text-align: center; }
.hero__title { position: relative; max-width: 12em; }
.hero__title .grad { font-weight: 600; }

.hero__lead { max-width: 46ch; font-size: clamp(17px, 1.5vw, 20.5px); line-height: 1.5; color: var(--ink-2); text-wrap: balance; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; }
.js .hero [data-split] { --delay: 160ms; }

.hero__stage { position: relative; margin-top: clamp(48px, 7vw, 88px); padding-bottom: clamp(56px, 8vw, 110px); perspective: 1800px; scroll-margin-top: calc(var(--nav-h) + 12px); }
.demo__caption { margin-top: 16px; text-align: center; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; color: var(--muted-2); }

/* --------------------------------------------------------------------------
   Window chrome: a glass app window that flattens as it scrolls up
   -------------------------------------------------------------------------- */
.demo {
  --tilt: 0;
  position: relative; max-width: 1080px; margin-inline: auto; overflow: hidden;
  border-radius: var(--r-xl); border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(24, 17, 36, 0.95), rgba(12, 9, 18, 0.97));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 60px 140px -50px rgba(140, 50, 220, 0.75), 0 30px 60px -30px rgba(0, 0, 0, 0.9);
  transform: rotateX(calc(var(--tilt) * 1deg)) scale(calc(1 - var(--tilt) * 0.004));
  transform-origin: 50% 0%;
  will-change: transform;
  text-align: left;
}
/* A hairline of light along the top edge */
.demo::before { content: ""; position: absolute; top: 0; left: 10%; right: 10%; height: 1px; background: linear-gradient(90deg, transparent, rgba(232, 140, 255, 0.9), rgba(120, 150, 255, 0.8), transparent); }
.demo__bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.demo__dots { display: inline-flex; gap: 6px; }
.demo__dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.demo__status { justify-self: end; display: inline-flex; align-items: center; }
.demo__status i { width: 7px; height: 7px; border-radius: 50%; background: var(--yes); box-shadow: 0 0 10px var(--yes); animation: pulse 1.8s ease-in-out infinite; }
.js .demo:not(.is-onscreen) .demo__status i { animation-play-state: paused; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* --------------------------------------------------------------------------
   The automation hub
   -------------------------------------------------------------------------- */
.hub__name { display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.hub__name .icon { width: 14px; height: 14px; color: #e9b8ff; }
.hub__body { display: grid; grid-template-columns: 58px minmax(0, 1.38fr) minmax(0, 1fr); }

.hub__rail { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 0; border-right: 1px solid var(--line); background: rgba(255, 255, 255, 0.015); }
.hub__rail i { width: 22px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.hub__rail i.is-active { background: var(--grad); box-shadow: 0 0 10px rgba(226, 75, 255, 0.6); }
.hub__logo { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 8px; border-radius: 10px; background: linear-gradient(160deg, #1d1230, #0d0916); border: 1px solid rgba(226, 75, 255, 0.45); box-shadow: 0 0 22px -6px rgba(200, 70, 255, 0.8); }
.hub__logo svg { width: 22px; height: auto; }

.hub__main { min-width: 0; padding: 14px 16px 18px; border-right: 1px solid var(--line); }
.hub__top { display: flex; align-items: center; gap: 16px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.hub__title { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.hub__tabs { display: flex; gap: 4px; font-size: 12.5px; }
.hub__tabs span { padding: 5px 10px; border-radius: var(--r-pill); color: var(--muted); white-space: nowrap; }
.hub__tabs b { margin-left: 5px; padding: 1px 7px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.08); font-size: 11px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hub__tabs .is-active { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.hub__tabs .is-active b { background: var(--grad-btn); color: #fff; }
.hub__avatars { display: flex; margin-left: auto; padding-left: 6px; }
.hub__avatars .avatar { width: 28px; height: 28px; margin-left: -4px; font-size: 9px; box-shadow: 0 0 0 2px #140f1e; }
.hub__filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.hub__filters span { padding: 4px 9px; border-radius: var(--r-sm); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.hub__group { margin: 12px 8px 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.hub__runs { display: grid; }

.run { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 8px; border-radius: var(--r-sm); transition: background-color var(--dur) var(--ease); }
.run:hover { background: rgba(255, 255, 255, 0.04); }
.run__text { min-width: 0; }
.run__text strong { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.run__text small { display: block; overflow: hidden; font-size: 12.5px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.run.is-new { animation: run-in 0.9s var(--ease) both; }
.run.is-leaving { animation: run-out 0.35s ease-in both; }
@keyframes run-in { from { opacity: 0; transform: translateY(-10px); background-color: rgba(226, 75, 255, 0.16); } 60% { background-color: rgba(226, 75, 255, 0.1); } to { opacity: 1; transform: none; background-color: transparent; } }
@keyframes run-out { to { opacity: 0; transform: translateY(8px); } }

.hub__side { display: grid; grid-template-rows: 1fr auto; min-width: 0; }
.convo { display: grid; align-content: start; gap: 10px; padding: 14px 16px 16px; }
.convo__head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.convo__head strong { display: block; font-size: 13.5px; line-height: 1.3; }
.convo__head small { display: block; font-size: 12px; color: var(--muted); }
.convo__head .chip { margin-left: auto; }
.bubble { position: relative; max-width: 90%; padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.45; }
.bubble--user { justify-self: start; border-bottom-left-radius: 4px; background: rgba(255, 255, 255, 0.08); color: var(--ink-2); }
.bubble--bot { justify-self: end; border-bottom-right-radius: 4px; background: linear-gradient(135deg, rgba(181, 47, 214, 0.42), rgba(124, 58, 237, 0.42) 55%, rgba(47, 111, 224, 0.42)); border: 1px solid rgba(214, 140, 255, 0.35); color: #fff; }
.bubble__meta { justify-self: end; font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.convo__input { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 10px 13px; border-radius: var(--r); background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted-2); }
.convo__input .icon { width: 15px; height: 15px; margin-left: auto; color: #d9b3ff; }
.hub__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.hub__stats div { padding: 12px 14px; border-right: 1px solid var(--line); }
.hub__stats div:last-child { border-right: 0; }
.hub__stats b { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.15; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hub__stats small { display: block; font-size: 11.5px; line-height: 1.35; color: var(--muted); }

/* The chat plays out: every bubble keeps its place, so nothing below moves.
   A reply shows a typing pill in its spot before the words arrive. */
.js [data-convo].is-armed [data-step] { opacity: 0; transform: translateY(6px); transition: opacity 0.45s var(--ease), transform 0.45s var(--ease); }
.js [data-convo].is-armed [data-step].is-shown { opacity: 1; transform: none; }
.js [data-convo].is-armed .bubble.is-typing { opacity: 1; transform: none; background: transparent; border-color: transparent; color: transparent; }
.bubble.is-typing::after {
  content: ""; position: absolute; top: 0; right: 0; width: 58px; height: 32px; border-radius: 14px 14px 4px 14px;
  background: radial-gradient(circle at 18px 50%, #f3d6ff 2.6px, transparent 3.3px), radial-gradient(circle at 29px 50%, #f3d6ff 2.6px, transparent 3.3px), radial-gradient(circle at 40px 50%, #f3d6ff 2.6px, transparent 3.3px), rgba(155, 92, 255, 0.28);
  border: 1px solid rgba(214, 140, 255, 0.35); animation: typing-pill 1.1s ease-in-out infinite;
}
@keyframes typing-pill { 50% { opacity: 0.55; } }

@media (max-width: 960px) {
  .hub__body { grid-template-columns: minmax(0, 1fr); }
  .hub__rail { display: none; }
  .hub__main { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .demo__bar { padding: 10px 14px; }
  .hub__main { padding: 10px 10px 12px; }
  .hub__top { flex-wrap: wrap; gap: 10px; }
  .hub__tabs { order: 3; width: 100%; }
  .hub__filters { display: none; }
  .hub__group { margin-top: 6px; }
  .run { gap: 10px; padding: 8px 6px; }
  .run .avatar { width: 30px; height: 30px; font-size: 10px; }
  /* Two lines at most, with room kept for both, so rotating rows never shift the page */
  .run__text small { display: -webkit-box; min-height: 2.8em; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .m-hide { display: none !important; }
  .convo { gap: 8px; padding: 12px; }
  .bubble { max-width: 94%; }
  .hub__stats div { padding: 10px; }
  .hub__stats b { font-size: 19px; }
  .hub__stats small { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .demo { transform: none; }
  .demo__status i, .bubble.is-typing::after { animation: none; }
  .run.is-new, .run.is-leaving { animation: none; }
  .brand__mark { transition: none; }
}
