/* ==========================================================================
   EliteCore — "The Performance Core" intro / preloader
   Pairs with intro.js. Everything is scoped under .eci so it can't leak into
   the app. The overlay is position:fixed, so the page underneath never moves.
   ========================================================================== */

@font-face {
  font-family: 'EC Intro Condensed';
  src: url('./fonts/barlow-condensed-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'EC Intro Condensed';
  src: url('./fonts/barlow-condensed-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

.eci {
  /* Brand tokens */
  --eci-bg: #080b10;
  --eci-blue: #416fc1;
  --eci-blue-hi: #8fb0ec; /* electric highlight for the moving point and pulse */
  --eci-steel: 138, 151, 171; /* rgb() channels for the grid and guide lines */
  --eci-white: #ffffff;

  /* Composition (desktop / landscape) */
  --eci-d: clamp(110px, min(34vh, 40vw), 300px); /* emblem diameter */
  --eci-fs: clamp(34px, min(8.4vw, 10vh), 112px); /* ELITECORE size */
  --eci-gap: calc(var(--eci-d) * 0.24 + 10px); /* clears the guide rings around the emblem */
  --eci-cell: 48px; /* grid cell */

  position: fixed;
  inset: 0;
  z-index: 2147483000;
  overflow: hidden;
  background: var(--eci-bg);
  color: var(--eci-white);
  font-family: 'EC Intro Condensed', 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif-condensed, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  touch-action: none;
  overscroll-behavior: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  contain: strict;
}

/* Portrait / phone: its own composition, not a crop of desktop. */
.eci.eci--m {
  --eci-d: clamp(120px, min(60vw, 33vh), 270px);
  --eci-fs: clamp(34px, min(16vw, 8.4vh), 84px);
  --eci-gap: calc(var(--eci-d) * 0.17 + 16px);
  --eci-cell: 40px;
}

/* --- Technical grid --------------------------------------------------- */
.eci-grid {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-image:
    linear-gradient(rgba(var(--eci-steel), 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--eci-steel), 0.1) 1px, transparent 1px),
    linear-gradient(rgba(var(--eci-steel), 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--eci-steel), 0.05) 1px, transparent 1px);
  background-size:
    calc(var(--eci-cell) * 4) calc(var(--eci-cell) * 4),
    calc(var(--eci-cell) * 4) calc(var(--eci-cell) * 4),
    var(--eci-cell) var(--eci-cell),
    var(--eci-cell) var(--eci-cell);
  background-position: var(--eci-gx, 50%) var(--eci-gy, 50%);
  -webkit-mask-image: radial-gradient(ellipse 62% 60% at var(--eci-gx, 50%) var(--eci-gy, 50%), #000 10%, transparent 100%);
  mask-image: radial-gradient(ellipse 62% 60% at var(--eci-gx, 50%) var(--eci-gy, 50%), #000 10%, transparent 100%);
}
.eci--m .eci-grid {
  /* Simpler on phones: major lines only. */
  background-image:
    linear-gradient(rgba(var(--eci-steel), 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--eci-steel), 0.075) 1px, transparent 1px);
  background-size: calc(var(--eci-cell) * 2) calc(var(--eci-cell) * 2), calc(var(--eci-cell) * 2) calc(var(--eci-cell) * 2);
}

/* Soft vignette keeps the edges quiet. */
.eci::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 85% 80% at 50% 48%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* --- Motion layer (SVG) ---------------------------------------------- */
.eci-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.eci-fx path,
.eci-fx line,
.eci-fx circle {
  vector-effect: non-scaling-stroke;
}

/* --- Brand composition ------------------------------------------------ */
.eci-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--eci-gap);
  padding:
    max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(72px, calc(env(safe-area-inset-bottom) + 64px)) max(24px, env(safe-area-inset-left));
  pointer-events: none;
  transform-origin: 50% 40%;
}
.eci--m .eci-stage {
  /* Optical centre sits a touch high on tall screens. */
  padding-bottom: max(96px, calc(env(safe-area-inset-bottom) + 88px));
}

.eci-core {
  position: relative;
  flex: none;
  width: var(--eci-d);
  height: var(--eci-d);
}
.eci-glow {
  position: absolute;
  inset: -38%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(65, 111, 193, 0.34), rgba(65, 111, 193, 0.1) 52%, transparent 100%);
  opacity: 0;
}
.eci-logo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  opacity: 0;
  clip-path: circle(0% at 50% 50%);
  -webkit-user-drag: none;
}
.eci-core.eci-nologo .eci-logo {
  display: none;
}

.eci-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  white-space: nowrap;
  max-width: 100%;
}

.eci-word {
  display: flex;
  overflow: hidden; /* the mask for the rising letters */
  font-weight: 700;
  font-size: var(--eci-fs);
  line-height: 0.84;
  padding: 0.06em 0 0.03em;
  letter-spacing: 0.06em;
  margin-right: -0.06em; /* cancel trailing tracking so the word stays optically centred */
  text-transform: uppercase;
}
.eci-word > span {
  display: inline-block;
  transform: translateY(112%);
}

.eci-perf {
  display: flex;
  align-items: center;
  gap: 0.85em;
  margin-top: max(10px, calc(var(--eci-fs) * 0.2));
  font-weight: 600;
  font-size: max(15px, calc(var(--eci-fs) * 0.22));
  line-height: 1;
  letter-spacing: 0.52em;
  color: var(--eci-blue);
}
.eci-perf .eci-t {
  margin-right: -0.52em;
  clip-path: inset(0 100% 0 0);
}
.eci-rule {
  width: 2.4em;
  height: 1px;
  background: var(--eci-blue);
  transform: scaleX(0);
  transform-origin: 100% 50%;
}
.eci-rule + .eci-t + .eci-rule {
  transform-origin: 0 50%;
}

.eci-sig {
  display: flex;
  gap: 0.9em;
  margin-top: max(14px, calc(var(--eci-fs) * 0.3));
  font-weight: 600;
  font-size: max(12px, calc(var(--eci-fs) * 0.155));
  line-height: 1;
  letter-spacing: 0.34em;
  color: rgba(255, 255, 255, 0.8);
}
.eci-sig > span {
  margin-right: -0.34em;
  clip-path: inset(0 100% 0 0);
}
.eci-sig i {
  font-style: normal;
  color: var(--eci-blue);
}
.eci--m .eci-sig {
  font-size: max(13px, calc(var(--eci-fs) * 0.2));
  letter-spacing: 0.26em;
}

/* --- Skip ------------------------------------------------------------- */
.eci-skip {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(8, 11, 16, 0.6);
  color: rgba(255, 255, 255, 0.66);
  font: 600 13px/1 'EC Intro Condensed', 'Barlow Condensed', 'Arial Narrow', sans-serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  animation: eci-skip-in 0.4s 0.35s ease-out forwards;
  transition: color 0.15s, border-color 0.15s;
}
.eci-skip:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.eci-skip:focus-visible {
  outline: 2px solid var(--eci-blue);
  outline-offset: 3px;
  color: #fff;
}
.eci--m .eci-skip {
  right: 50%;
  transform: translateX(50%);
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
}
.eci--clean .eci-skip {
  display: none;
}
@keyframes eci-skip-in {
  to {
    opacity: 1;
  }
}

.eci-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .eci-skip {
    animation: none;
    opacity: 1;
  }
}
