@import url('/page-css/experiments.css');

/* Fluid Vision — experiment 05.
   The existing WebGL fluid field fills the page; camera tracking lives in a
   compact card in the bottom-right corner and only sends splat points. */

.site-root[data-ka-page='experiments/fluid-vision'] {
  --fvision-blue: #1767ff;
  --fvision-sky: #7dd3fc;
}

.site-root[data-ka-page='experiments/fluid-vision'] .ka-fvision-page {
  margin: 0;
  padding: 0;
  background: #000;
  color: #fff;
  overflow: hidden;
}

/* 130px = the site's 44px contact strip plus the 86px header. */
.ka-fvision-stage {
  position: relative;
  height: calc(100svh - 130px);
  min-height: 600px;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

.ka-fvision {
  position: absolute;
  inset: 0;
}

.ka-fvision__sim {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  touch-action: none;
}

.ka-fvision-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.18) 30%, transparent 52%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.4) 0%, transparent 46%);
}

/* ---------- Editorial overlay ---------- */

.ka-fvision-overlay {
  position: absolute;
  z-index: 3;
  top: clamp(32px, 5.2vh, 66px);
  left: max(24px, calc((100vw - 1180px) / 2));
  width: min(720px, calc(100vw - 48px));
  pointer-events: none;
}

.ka-fvision-launch {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
  margin-top: 26px;
  padding: 13px 22px;
  border: 0;
  border-radius: 4px;
  background: #1558e9;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 16px 38px rgba(3, 12, 26, 0.45);
  transition: background 0.2s ease, transform 0.2s ease;
}

.ka-fvision-launch span {
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}

.ka-fvision-launch:hover:not(:disabled) {
  background: #0947c8;
  transform: translateY(-1px);
}

.ka-fvision-launch:disabled {
  opacity: 0.7;
  cursor: progress;
}

.ka-fvision-kicker {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 22px;
  color: #78b7ff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.21em;
}

.ka-fvision-kicker:before {
  content: '';
  width: 30px;
  height: 2px;
  background: var(--fvision-blue);
}

.ka-fvision-overlay h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(56px, 7.4vw, 114px);
  font-weight: 760;
  line-height: 0.9;
  letter-spacing: -0.075em;
  white-space: normal;
  text-shadow: 0 3px 30px rgba(0, 0, 0, 0.45);
}

.ka-fvision-overlay p {
  max-width: 540px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.55;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

/* ---------- Corner camera preview ---------- */

.ka-fvision-preview {
  position: absolute;
  z-index: 5;
  right: 20px;
  bottom: clamp(16px, 2.6vh, 24px);
  width: 236px;
  overflow: hidden;
  border: 1px solid rgba(130, 197, 255, 0.34);
  border-radius: 12px;
  background: rgba(4, 12, 22, 0.78);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
}

.ka-fvision-preview__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(23, 103, 255, 0.18), transparent 66%),
    #050d18;
}

.ka-fvision-preview__video,
.ka-fvision-preview__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ka-fvision-preview__video {
  transform: scaleX(-1);
  filter: saturate(0.95) contrast(1.04) brightness(0.94);
}

.ka-fvision-preview__canvas {
  pointer-events: none;
}

.ka-fvision-preview__cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  padding: 16px;
  text-align: center;
}

.ka-fvision-preview__cover strong {
  max-width: 26ch;
  color: #eaf2ff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.ka-fvision-preview__cover small {
  color: #8ea4bf;
  font-size: 9.5px;
  line-height: 1.5;
}

.ka-fvision-preview__icon,
.ka-fvision-preview__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(125, 211, 252, 0.4);
  border-radius: 50%;
  color: #9fd4ff;
}

.ka-fvision-preview__mark {
  border-color: rgba(255, 190, 160, 0.5);
  color: #ffc9a8;
  font-size: 15px;
  font-weight: 700;
}

.ka-fvision-preview__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(148, 178, 224, 0.25);
  border-top-color: var(--fvision-sky);
  border-radius: 50%;
  animation: ka-fvision-spin 0.9s linear infinite;
}

@keyframes ka-fvision-spin {
  to { transform: rotate(360deg); }
}

.ka-fvision-preview__start {
  min-height: 30px;
  margin-top: 2px;
  padding: 6px 15px;
  border: 0;
  border-radius: 4px;
  background: #1558e9;
  color: #fff;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ka-fvision-preview__start:hover {
  background: #0947c8;
}

/* ---------- Preview status bar ---------- */

.ka-fvision-preview__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-top: 1px solid rgba(122, 166, 255, 0.22);
  color: #cfe0f5;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ka-fvision-preview__state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #93a9c4;
}

.ka-fvision-preview__state[data-live='true'] {
  color: var(--fvision-sky);
}

.ka-fvision-preview__state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.ka-fvision-preview__state[data-live='true'] i {
  box-shadow: 0 0 8px rgba(125, 211, 252, 0.9);
}

.ka-fvision-preview__mood {
  max-width: 66px;
  margin-left: auto;
  overflow: hidden;
  color: #f2f8ff;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.ka-fvision-preview__fps {
  color: #93a9c4;
  font-weight: 600;
  white-space: nowrap;
}

.ka-fvision-preview__stop {
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: transparent;
  color: #dfeaf8;
  font: inherit;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ka-fvision-preview__stop:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .ka-fvision-overlay {
    width: min(560px, calc(100vw - 280px));
  }

  .ka-fvision-overlay h1 {
    font-size: clamp(52px, 8.4vw, 92px);
  }
}

@media (max-width: 760px) {
  /* 110px = the site's 40px contact strip plus the 70px header. */
  .ka-fvision-stage {
    height: calc(100svh - 110px);
    min-height: 520px;
  }

  .ka-fvision-overlay {
    top: 26px;
    left: 18px;
    width: calc(100vw - 36px);
  }

  .ka-fvision-kicker {
    margin-bottom: 16px;
    font-size: 10px;
  }

  .ka-fvision-overlay h1 {
    font-size: clamp(46px, 13.4vw, 68px);
  }

  .ka-fvision-overlay p {
    max-width: 420px;
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.5;
  }

  .ka-fvision-launch {
    min-height: 42px;
    margin-top: 18px;
    padding: 11px 18px;
    font-size: 10.5px;
    gap: 16px;
  }

  .ka-fvision-preview {
    right: 12px;
    bottom: 12px;
    width: 164px;
  }

  .ka-fvision-preview__cover {
    gap: 5px;
    padding: 8px;
  }

  .ka-fvision-preview__cover strong {
    font-size: 10px;
  }

  .ka-fvision-preview__cover small {
    display: none;
  }

  .ka-fvision-preview__icon,
  .ka-fvision-preview__mark {
    width: 24px;
    height: 24px;
  }

  .ka-fvision-preview__icon svg {
    width: 16px;
    height: 16px;
  }

  .ka-fvision-preview__start {
    min-height: 26px;
    padding: 5px 11px;
    font-size: 9px;
  }

  .ka-fvision-preview__bar {
    gap: 5px;
    padding: 6px 8px;
    font-size: 7.5px;
  }

  .ka-fvision-preview__mood {
    max-width: 52px;
    font-size: 8px;
  }

  .ka-fvision-preview__fps {
    display: none;
  }
}

@media (max-width: 420px) {
  .ka-fvision-overlay p {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ka-fvision-preview__spinner {
    animation: none;
  }

  .ka-fvision-launch:hover:not(:disabled) {
    transform: none;
  }
}
