/* Homepage intro (templates/_intro.html): four products arrive, merge into one, Optanik appears.
   Phases are classes set by static/js/site.js: is-play (0s), is-merge (8.5s), is-one (8.95s), is-leave. */

.ix {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.7, 0, 0.3, 1);
  background: #000;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
.ix *, .ix *::before, .ix *::after { box-sizing: border-box; }

/* ---------------- background ---------------- */
.ix-bg { position: absolute; inset: 0; overflow: hidden; opacity: 0; }
.ix.is-play .ix-bg { animation: ix-fade 1.2s ease forwards; }
.ix-glow {
  position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(70px); opacity: 0.32;
  mix-blend-mode: screen;
}
.ix-glow-1 { left: -25vmax; top: -30vmax; background: radial-gradient(circle, #3aa0ff, transparent 62%); animation: ix-drift 9s ease-in-out infinite alternate; }
.ix-glow-2 { right: -28vmax; top: -10vmax; background: radial-gradient(circle, #8b5cf6, transparent 62%); animation: ix-drift 11s ease-in-out infinite alternate-reverse; }
.ix-glow-3 { left: 10vmax; bottom: -42vmax; background: radial-gradient(circle, #e2b93b, transparent 60%); opacity: 0.16; animation: ix-drift 10s ease-in-out infinite alternate; }
.ix-floor {
  position: absolute; left: -50%; right: -50%; bottom: -10%; height: 70%;
  background-image:
    linear-gradient(rgba(126, 200, 255, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 200, 255, 0.13) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(520px) rotateX(64deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%);
  mask-image: linear-gradient(to top, #000 10%, transparent 85%);
  animation: ix-floor 6s linear infinite;
}

/* ---------------- stage ---------------- */
.ix-stage {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 72px 24px;
}
.ix-stage > * { grid-area: 1 / 1; }
.ix-kicker {
  margin: 0; font: 600 12px/1 var(--mono, monospace); letter-spacing: 0.32em; text-transform: uppercase;
  color: #7ec8ff; padding: 8px 14px 8px 18px; border: 1px solid rgba(126, 200, 255, 0.35); border-radius: 999px;
  background: rgba(10, 18, 34, 0.6);
}
.ix-set { display: flex; flex-direction: column; align-items: center; gap: clamp(14px, 3vh, 28px); width: 100%; }
.ix-set > .ix-kicker { opacity: 0; }
.ix.is-play .ix-set > .ix-kicker { animation: ix-up 0.7s var(--ease-out) 0.15s forwards; }
.ix.is-merge .ix-set > .ix-kicker { animation: ix-out 0.35s ease forwards; }

/* ---------------- the four cards ---------------- */
.ix-cards {
  display: grid; grid-template-columns: repeat(4, minmax(0, 276px)); gap: 22px; width: 100%; justify-content: center;
}
.ix-slot { transition: transform 0.55s var(--ease-in-out), opacity 0.35s ease 0.2s, filter 0.5s ease; }
.ix.is-merge .ix-slot { transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.14); opacity: 0; filter: blur(2px); }

.ix-card {
  position: relative; height: 100%; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 20px; padding: 18px; color: #f4f7fb;
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(20, 28, 44, 0.92), rgba(8, 12, 22, 0.96));
  border: 1px solid color-mix(in srgb, var(--c) 45%, rgba(255, 255, 255, 0.08));
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.03) inset,
              0 0 40px -12px color-mix(in srgb, var(--c) 70%, transparent);
  opacity: 0; transform: translateY(60px) rotateX(18deg) scale(0.92); filter: blur(6px);
}
.ix.is-play .ix-card { animation: ix-card 0.9s var(--ease-out) calc(0.3s + var(--i) * 0.14s) forwards; }
/* a sheen passes over each card once it has landed */
.ix-card::after {
  content: ""; position: absolute; inset: -40% -60%; pointer-events: none;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.14) 50%, transparent 58%);
  transform: translateX(-70%);
}
.ix.is-play .ix-card::after { animation: ix-sheen 1.1s ease calc(1.25s + var(--i) * 0.14s) forwards; }

.ix-copy h3 { margin: 16px 0 5px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.ix-copy h3 sup { font-size: 0.45em; margin-left: 1px; opacity: 0.7; vertical-align: 0.9em; }
.ix-copy p { margin: 0; font-size: 14.5px; line-height: 1.4; color: #9aa6ba; }

.ix-viz {
  position: relative; height: 132px; border-radius: 12px; overflow: hidden;
  background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Optanik: devices come online */
.ix-fleet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px; }
.ix-fleet i {
  border-radius: 6px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07); position: relative;
}
.ix-fleet i::after {
  content: ""; position: absolute; right: 4px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 8px #34d399; opacity: 0;
}
.ix.is-play .ix-fleet i { animation: ix-online 0.4s ease calc(0.9s + var(--n) * 0.09s) forwards; }
.ix.is-play .ix-fleet i::after { animation: ix-fade 0.3s ease calc(1s + var(--n) * 0.09s) forwards; }

/* Ticketing: tickets arrive and get closed */
.ix-tix { display: flex; flex-direction: column; gap: 8px; padding: 13px; }
.ix-tix span {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 9px; border-radius: 8px; font-size: 12.5px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07); white-space: nowrap; overflow: hidden;
  opacity: 0; transform: translateX(-24px);
}
.ix-tix b { font: 600 10.5px var(--mono, monospace); color: var(--c2); }
.ix-tix em {
  margin-left: auto; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.ix.is-play .ix-tix span { animation: ix-slide 0.45s var(--ease-out) calc(0.95s + var(--n) * 0.22s) forwards; }
.ix.is-play .ix-tix em { animation: ix-check 0.35s ease calc(1.75s + var(--n) * 0.25s) forwards; }

/* Keyring: the password unlocks into a 2FA code */
.ix-key { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 14px; }
.ix-key-field {
  position: relative; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.ix-key-lock {
  flex: none; width: 13px; height: 10px; border-radius: 2px; background: var(--c); position: relative; margin-top: 4px;
}
.ix-key-lock::before {
  content: ""; position: absolute; left: 2px; bottom: 8px; width: 9px; height: 8px; border: 2px solid var(--c);
  border-bottom: 0; border-radius: 6px 6px 0 0; transform-origin: 100% 100%;
}
.ix.is-play .ix-key-lock::before { animation: ix-unlock 0.4s ease 1.45s forwards; }
.ix-key-dots, .ix-key-code { position: absolute; left: 36px; font: 600 16px/1 var(--mono, monospace); letter-spacing: 0.12em; }
.ix-key-dots { color: #cfd6e2; }
.ix-key-code { color: var(--c2); opacity: 0; transform: translateY(8px); letter-spacing: 0.08em; }
.ix.is-play .ix-key-dots { animation: ix-out 0.3s ease 1.55s forwards; }
.ix.is-play .ix-key-code { animation: ix-up 0.45s var(--ease-out) 1.7s forwards; }
.ix-key-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ix-key-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--c), var(--c2)); transform-origin: left; transform: scaleX(0); }
.ix.is-play .ix-key-bar i { animation: ix-count 6.7s linear 1.7s forwards; }

/* OptaMeet: a live meeting talking */
.ix-meet { display: flex; align-items: center; justify-content: center; }
.ix-rec {
  position: absolute; left: 10px; top: 9px; display: flex; align-items: center; gap: 5px;
  font: 600 10px var(--mono, monospace); letter-spacing: 0.1em; color: #fca5a5;
}
.ix-rec i { width: 7px; height: 7px; border-radius: 50%; background: #f87171; box-shadow: 0 0 8px #f87171; animation: ix-blink 1.2s ease infinite; }
.ix-wave { display: flex; align-items: center; gap: 6px; height: 66px; margin-top: 8px; }
.ix-wave i {
  width: 6px; height: 100%; border-radius: 6px; background: linear-gradient(180deg, var(--c2), var(--c));
  transform: scaleY(0.12);
}
.ix.is-play .ix-wave i { animation: ix-talk 0.9s ease-in-out calc(0.9s + var(--n) * 0.07s) infinite alternate; }
.ix-wave i:nth-child(3n) { animation-duration: 0.7s !important; }
.ix-wave i:nth-child(3n + 1) { animation-duration: 1.05s !important; }

/* ---------------- one system ---------------- */
.ix-core { position: relative; width: 168px; height: 168px; pointer-events: none; }
.ix-ring, .ix-burst { position: absolute; inset: 0; border-radius: 50%; opacity: 0; }
.ix-ring {
  background: conic-gradient(from 0deg, #3aa0ff, #8b5cf6, #e2b93b, #6d7dff, #3aa0ff);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63.5%, #000 68%, transparent 69.5%);
  mask: radial-gradient(circle, transparent 62%, #000 63.5%, #000 68%, transparent 69.5%);
  filter: drop-shadow(0 0 18px rgba(109, 125, 255, 0.7));
  transform: scale(0.3) rotate(-90deg);
}
.ix-burst { background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(126, 200, 255, 0.5) 30%, transparent 62%); }
.ix.is-merge .ix-burst { animation: ix-burst 0.9s var(--ease-out) 0.38s forwards; }
.ix.is-merge .ix-ring { animation: ix-ring 0.8s var(--ease-out) 0.4s forwards, ix-spin 9s linear 1.2s infinite; }
/* the ring opens out and frames the wordmark */
.ix.is-one .ix-core { animation: ix-core 1.1s var(--ease-out) 0.35s forwards; }

.ix-lockup { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; max-width: 900px; }
.ix-lockup > * { opacity: 0; }
.ix-word { position: relative; display: inline-flex; }
.ix-word img { width: clamp(220px, 34vw, 360px); height: auto; }
.ix-word sup { position: absolute; right: -14px; top: -6px; font-size: 13px; color: #c9d1de; }
.ix-lockup h2 {
  margin: 0; font-size: clamp(26px, 4.6vw, 54px); line-height: 1.08; font-weight: 700; letter-spacing: -0.025em;
  background: linear-gradient(110deg, #7ec8ff 0%, #3aa0ff 30%, #8b5cf6 60%, #c4b5fd 80%, #7ec8ff 100%);
  background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ix-four { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin: 0; font-size: 15px; color: #c9d1de; }
.ix-four span { display: inline-flex; align-items: center; gap: 8px; opacity: 0; transform: translateY(8px); }
.ix-four span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }

.ix.is-one .ix-lockup > .ix-kicker { animation: ix-up 0.6s var(--ease-out) 0.55s forwards; }
.ix.is-one .ix-word { animation: ix-word 1s var(--ease-out) 0.25s forwards; }
.ix.is-one .ix-lockup h2 { animation: ix-up 0.8s var(--ease-out) 0.7s forwards, ix-shine 3s ease 1s forwards; }
.ix.is-one .ix-four { opacity: 1; }
.ix.is-one .ix-four span { animation: ix-up 0.5s var(--ease-out) calc(1.15s + var(--n) * 0.12s) forwards; }

/* ---------------- progress, skip, leaving ---------------- */
.ix-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255, 255, 255, 0.06); }
.ix-progress i { display: block; height: 100%; background: linear-gradient(90deg, #3aa0ff, #8b5cf6, #e2b93b, #6d7dff); transform-origin: left; transform: scaleX(0); }
.ix.is-play .ix-progress i { animation: ix-count 12s linear forwards; }
.ix-skip {
  position: absolute; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2; padding: 9px 18px; border-radius: 999px; font: 600 14px var(--font); color: #e6ebf3; cursor: pointer;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.16); backdrop-filter: blur(8px);
}
.ix-skip:hover { background: rgba(255, 255, 255, 0.14); }
.ix.is-leave { animation: ix-leave 0.85s var(--ease-in-out) forwards; pointer-events: none; }

/* ---------------- phones and small screens ---------------- */
@media (max-width: 1240px) and (min-width: 1100px) {
  .ix-cards { grid-template-columns: repeat(4, minmax(0, 236px)); gap: 18px; }
  .ix-viz { height: 116px; }
}
@media (max-width: 1099px) {
  .ix-cards { grid-template-columns: repeat(2, minmax(0, 300px)); gap: 14px; }
}
@media (max-width: 560px) {
  .ix-stage { padding: 64px 14px 72px; }
  .ix-cards { gap: 10px; }
  .ix-card { padding: 10px; border-radius: 16px; }
  .ix-viz { height: 78px; border-radius: 10px; }
  .ix-copy h3 { margin-top: 9px; font-size: 16px; }
  .ix-copy p { font-size: 11.5px; }
  .ix-fleet { gap: 5px; padding: 8px; }
  .ix-tix { gap: 5px; padding: 7px; }
  .ix-tix span { height: 19px; font-size: 9.5px; padding: 0 6px; gap: 5px; }
  .ix-tix b { font-size: 8.5px; }
  .ix-tix em { width: 11px; height: 11px; }
  .ix-key { padding: 9px; gap: 8px; }
  .ix-key-field { height: 32px; padding: 0 9px; }
  .ix-key-dots, .ix-key-code { left: 30px; font-size: 13px; }
  .ix-wave { height: 40px; gap: 4px; }
  .ix-wave i { width: 5px; }
  .ix-core { width: 128px; height: 128px; }
  .ix-four { font-size: 13px; gap: 8px 16px; }
}
/* phones held sideways and other short screens: one compact row */
@media (max-height: 560px) and (min-width: 600px) {
  .ix-stage { padding: 20px 24px; }
  .ix-set > .ix-kicker { display: none; }
  .ix-cards { grid-template-columns: repeat(4, minmax(0, 200px)); gap: 10px; }
  .ix-card { padding: 9px; border-radius: 14px; }
  .ix-viz { height: 66px; border-radius: 9px; }
  .ix-copy h3 { margin: 8px 0 2px; font-size: 15px; }
  .ix-copy p { font-size: 11px; }
  .ix-fleet { gap: 4px; padding: 7px; }
  .ix-tix { gap: 3px; padding: 5px; }
  .ix-tix span { height: 16px; font-size: 8.5px; padding: 0 5px; gap: 4px; }
  .ix-tix b { font-size: 7.5px; }
  .ix-tix em { width: 9px; height: 9px; }
  .ix-key { padding: 8px; gap: 6px; }
  .ix-key-field { height: 28px; padding: 0 8px; }
  .ix-key-dots, .ix-key-code { left: 28px; font-size: 12px; }
  .ix-wave { height: 34px; gap: 3px; margin-top: 4px; }
  .ix-wave i { width: 4px; }
  .ix-core { width: 110px; height: 110px; }
  .ix-lockup { gap: 10px; }
  .ix-word img { width: 220px; }
  .ix-lockup h2 { font-size: 26px; }
}

/* ---------------- keyframes ---------------- */
@keyframes ix-fade { to { opacity: 1; } }
@keyframes ix-out { to { opacity: 0; } }
@keyframes ix-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes ix-card { to { opacity: 1; transform: none; filter: none; } }
@keyframes ix-sheen { to { transform: translateX(70%); } }
@keyframes ix-online {
  to { background: color-mix(in srgb, var(--c) 30%, transparent); border-color: color-mix(in srgb, var(--c) 70%, transparent);
       box-shadow: 0 0 12px -2px color-mix(in srgb, var(--c) 80%, transparent); }
}
@keyframes ix-slide { to { opacity: 1; transform: none; } }
@keyframes ix-check {
  to { background: #34d399; border-color: #34d399; box-shadow: 0 0 10px #34d399; }
}
@keyframes ix-unlock { to { transform: rotate(28deg) translateX(3px); } }
@keyframes ix-count { to { transform: scaleX(1); } }
@keyframes ix-blink { 50% { opacity: 0.25; } }
@keyframes ix-talk { from { transform: scaleY(0.15); } to { transform: scaleY(1); } }
@keyframes ix-burst { 0% { opacity: 0; transform: scale(0.2); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(3.2); } }
@keyframes ix-ring { to { opacity: 1; transform: scale(1) rotate(0deg); } }
@keyframes ix-spin { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes ix-core { to { transform: scale(4.2); opacity: 0.22; } }
@keyframes ix-word {
  from { opacity: 0; transform: scale(0.86); filter: blur(10px); letter-spacing: 0.4em; }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes ix-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes ix-drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }
@keyframes ix-floor { to { background-position: 0 64px; } }
@keyframes ix-leave { to { opacity: 0; transform: scale(1.04); filter: blur(4px); } }

@media (prefers-reduced-motion: reduce) {
  .ix, .ix * { animation: none !important; transition: none !important; }
}
