/* EXSCOR web-ui components. Needs tokens.css first. Behaviour: motion.js (data-* hooks). */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--night); color: var(--text); font-family: var(--font);
  line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.eyebrow { font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--text-2); }
.h1, .h2 { font-weight: 600; letter-spacing: -.02em; line-height: 1.08; margin: 0; }
.h1 { font-size: var(--h1); }
.h2 { font-size: var(--h2); }
.key { color: var(--accent); }
.spark { color: var(--spark); }

/* 1. aurora: blurred light from outside the frame */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(110px); opacity: .32; animation: drift 60s var(--ease) infinite alternate;
}
.aurora i:nth-child(1) { background: var(--accent-2); left: -30vmax; top: -20vmax; }
.aurora i:nth-child(2) { background: var(--accent); right: -32vmax; top: 30vh; opacity: .2; animation-duration: 80s; }
.aurora i:nth-child(3) { background: #4A3AFF; left: 20vw; bottom: -45vmax; opacity: .16; animation-duration: 70s; }
@keyframes drift { to { transform: translate3d(6vmax, -4vmax, 0) scale(1.08); } }

/* 2. orbit geometry */
.orbit { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; overflow: hidden; }
.orbit span {
  position: absolute; border: 1px solid var(--line); border-radius: 50%;
  aspect-ratio: 1; animation: spin 90s linear infinite;
}
.orbit span:nth-child(1) { width: 22%; }
.orbit span:nth-child(2) { width: 42%; border-style: dashed; animation-direction: reverse; }
.orbit span:nth-child(3) { width: 64%; }
.orbit span:nth-child(4) { width: 90%; border-color: rgba(255,255,255,.05); }
@keyframes spin { to { transform: rotate(360deg); } }
.flow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.flow path { fill: none; stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 4 6; }
.flow .draw { stroke: var(--accent); stroke-dasharray: var(--len, 1000); stroke-dashoffset: var(--len, 1000); transition: stroke-dashoffset 1600ms var(--ease); }
.flow .draw.in { stroke-dashoffset: 0; }
.node {
  position: absolute; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--accent); font-size: .8rem;
  box-shadow: 0 0 0 6px rgba(13,17,23,.8);
}

/* 3. screen frame */
.frame {
  position: relative; border-radius: var(--r-lg); padding: clamp(16px, 3vw, 32px);
  background: linear-gradient(180deg, rgba(23,30,44,.85), rgba(13,17,23,.92));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.08);
  isolation: isolate; overflow: hidden;
}
.frame::before { /* 1px gradient border */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; z-index: 1; pointer-events: none;
  background: linear-gradient(160deg, rgba(0,178,255,.5), rgba(255,255,255,.06) 40%, rgba(0,87,255,.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* 4. glass card */
.glass {
  position: relative; background: var(--glass); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 20px; backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast);
}
.glass::after { content: ""; position: absolute; left: 12%; right: 12%; top: -1px; height: 1px; background: var(--highlight); }
.glass[data-glow] { background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), rgba(0,178,255,.10), transparent 70%), var(--glass); }
.glass:hover { transform: translateY(-4px); border-color: var(--line-2); }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
.cards.stepped > :nth-child(even) { margin-top: 48px; } /* staggered heights */

/* 12. glass navigation */
.nav {
  display: flex; align-items: center; gap: 24px; padding: 10px 12px 10px 18px;
  border-radius: var(--r-md); background: rgba(17,24,35,.7); border: 1px solid var(--line);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
}
.nav .brand { display: flex; gap: 10px; align-items: center; font-weight: 600; text-decoration: none; }
.nav .brand img { width: 28px; height: 28px; }
.nav .links { display: flex; gap: 22px; margin-left: auto; font-size: .92rem; color: var(--text-2); }
.nav .links a { text-decoration: none; }
.nav .links a:hover { color: var(--text); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: var(--r-sm);
  font: 600 .92rem var(--font); text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast), background var(--t-fast);
}
.btn-solid { background: var(--accent); color: #031019; }
.btn-solid:hover { box-shadow: var(--glow); transform: translateY(-1px); }
.btn-line { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn-line:hover { background: rgba(0,178,255,.08); }
.btn:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 6. segmented audience control */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--line); }
.seg button {
  position: relative; border: 0; background: none; color: var(--text-2); font: 500 .85rem var(--font);
  padding: 8px 16px; border-radius: var(--r-pill); cursor: pointer; overflow: hidden;
}
.seg button[aria-selected="true"] { color: var(--text); background: rgba(0,178,255,.14); box-shadow: inset 0 0 0 1px rgba(0,178,255,.4); }
.seg button[aria-selected="true"]::after { /* auto-advance progress */
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent);
  transform-origin: left; animation: progress var(--seg-ms, 6s) linear forwards;
}
.seg.held button::after { animation: none; transform: scaleX(0); }
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
[data-panel] { transition: opacity var(--t-swap) var(--ease), transform var(--t-swap) var(--ease); }
[data-panel][hidden] { display: block; position: absolute; visibility: hidden; opacity: 0; transform: translateY(12px); }
.swap { position: relative; }

/* 5. live data widgets */
.ring { --p: 0; --size: 56px; width: var(--size); height: var(--size); flex: none; }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: rgba(255,255,255,.08); }
.ring .bar { stroke: url(#g-accent); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1400ms var(--ease); transform: rotate(-90deg); transform-origin: center; }
.ring.in .bar { stroke-dashoffset: calc(100 - var(--p)); }
.stat { display: flex; gap: 14px; align-items: center; }
.stat b { font-size: 1.05rem; font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; position: relative; }
.bars i {
  flex: 1; height: var(--h); border-radius: 4px 4px 1px 1px; transform: scaleY(0); transform-origin: bottom;
  background: linear-gradient(180deg, var(--accent), rgba(0,87,255,.35));
  transition: transform 600ms var(--ease); transition-delay: calc(var(--i) * 90ms);
}
.bars.in i { transform: scaleY(1); }
.toggle { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--text-2); padding: 8px 0; }
.toggle s { width: 30px; height: 18px; border-radius: 9px; background: rgba(255,255,255,.12); position: relative; transition: background var(--t-fast); flex: none; }
.toggle s::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--silver); transition: transform var(--t-fast) var(--ease); }
.toggle.on { color: var(--text); }
.toggle.on s { background: var(--accent); }
.toggle.on s::after { transform: translateX(12px); background: #fff; }
.chip { display: inline-block; font-size: .72rem; padding: 3px 8px; border-radius: var(--r-pill); background: rgba(61,220,151,.12); color: var(--ok); }
.label-example { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }

/* 8. with / without */
.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.versus .without { opacity: .55; filter: saturate(.2); }
.skeleton { height: 10px; border-radius: 5px; background: rgba(255,255,255,.07); margin: 10px 0; }

/* 9. stacked cards */
.stack { position: relative; padding-bottom: 28px; }
.stack > * { transition: transform var(--t-swap) var(--ease), opacity var(--t-swap) var(--ease); }
.stack > :not(.front) { position: absolute; inset: 0 0 28px 0; }
.stack > :not(.front) > * { visibility: hidden; } /* shells only behind the front card */
.stack > .back-1 { transform: translateY(14px) scale(.96); opacity: .5; z-index: -1; }
.stack > .back-2 { transform: translateY(28px) scale(.92); opacity: .25; z-index: -2; }
.stack > .gone { transform: translateX(-40px); opacity: 0; }

/* 10. call to action panel */
.cta { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 24px; overflow: hidden; }
.cta .peek { margin-right: -60px; margin-bottom: -60px; transform: rotate(-2deg); }

/* 7. kinetic interlude */
.kinetic { position: relative; isolation: isolate; min-height: min(70vh, 640px); display: grid; place-items: center; text-align: center; overflow: hidden; }
.kinetic h2 { font-size: var(--kinetic); font-weight: 600; letter-spacing: -.03em; line-height: 1; margin: 0; }
.kinetic .orbit span { border-color: rgba(0,178,255,.18); }

/* 13. brand film backgrounds (assets/video): muted, looped, poster first */
.film { position: absolute; inset: 0; overflow: hidden; z-index: -1; border-radius: inherit; }
.film video, .film img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: var(--film-o, .6); }
.film::after { /* scrim keeps text AA over moving light */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(13,17,23,.35), rgba(13,17,23,.8) 80%);
}
.film.soft video, .film.soft img { --film-o: .5; }
.film.clear::after { display: none; }
.film.clear video, .film.clear img { --film-o: 1; }
.kinetic .film, .film.fade {
  -webkit-mask-image: radial-gradient(ellipse at center, #000 45%, transparent 78%);
  mask-image: radial-gradient(ellipse at center, #000 45%, transparent 78%);
}

/* reveal */
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity var(--t-reveal) var(--ease), transform var(--t-reveal) var(--ease); transition-delay: calc(var(--i, 0) * var(--stagger)); }
[data-reveal].in { opacity: 1; transform: none; }

section { padding: clamp(64px, 10vw, 120px) 0; position: relative; }

@media (max-width: 760px) {
  .nav .links { display: none; }
  .versus, .cta { grid-template-columns: 1fr; }
  .cards.stepped > :nth-child(even) { margin-top: 0; }
  .cta .peek { margin: 0; transform: none; }
  .node { display: none; }
}
@media (hover: none) { .glass[data-glow] { background: var(--glass); } .glass:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
  .bars i { transform: none; }
  .ring .bar { stroke-dashoffset: calc(100 - var(--p)); }
  .flow .draw { stroke-dashoffset: 0; }
}
