/* ============================================================
   Nexion — Landing journey (index.html only)
   A fixed WebGL canvas plays a camera journey; scroll scrubs it.
   Each .stop is a fixed overlay that fades in at its waypoint.
   html.no-3d = graceful fallback: stops become normal sections.
   ============================================================ */

/* ---- Canvas backdrop ---- */
#webgl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ---- Header logo legibility over the bright scene ---- */
.site-header .logo-mark {
  filter:
    drop-shadow(0 1px 3px rgba(6, 8, 15, 0.95))
    drop-shadow(0 2px 12px rgba(6, 8, 15, 0.8))
    drop-shadow(0 0 26px rgba(6, 8, 15, 0.6));
}

/* ---- Loader ---- */
.j-loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  gap: 1.4rem;
  justify-items: center;
  background: var(--bg);
  transition: opacity 0.7s var(--ease-out), visibility 0.7s;
}

.j-loader .logo-mark {
  height: 2.6rem;
}

.j-loader .logo-ink {
  fill: var(--logo-ink);
}

.j-loader-bar {
  width: 180px;
  height: 2px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}

.j-loader-bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 2px;
  background: var(--grad-brand);
  animation: j-loader-slide 1.1s ease-in-out infinite;
}

@keyframes j-loader-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(450px); }
}

.j-loader.done {
  opacity: 0;
  visibility: hidden;
}

/* ---- Journey scroll space ----
   8 stops + 1 wrap segment back to the start (closed camera loop). */
.journey {
  position: relative;
  height: 900vh;
  z-index: 1;
}

/* Sections parked out of the journey (kept in the DOM for later) */
.stop-parked {
  display: none;
}

/* ---- Stops (fixed overlays) ---- */
.stop {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  align-items: center;
  justify-items: center;
  padding-top: var(--header-h);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.stop.visible {
  visibility: visible;
}

.stop.active {
  visibility: visible;
  pointer-events: auto;
}

/* While travelling, links/buttons inside must not catch clicks */
.j-inner {
  width: 100%;
  will-change: transform, opacity;
}

.j-center {
  text-align: center;
}

.stop .orb {
  display: none; /* orbs only serve the no-3d fallback */
}

/* ---- Hero ---- */
.j-hero-title {
  font-size: var(--fs-hero);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-top: 1.4rem;
  text-shadow: 0 8px 60px rgba(10, 13, 20, 0.85);
}

.j-hero-title span {
  display: inline-block;
}

.j-hero-type {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 1.1rem;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 500;
}

.j-hero-type .type-word {
  color: var(--accent-bright);
}

.j-lead {
  max-width: 620px;
  margin: 1.2rem auto 0;
  color: var(--text-muted);
  font-size: 1.0625rem;
  text-wrap: pretty;
  text-shadow: 0 4px 30px rgba(10, 13, 20, 0.9);
}

.j-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin-top: 2.1rem;
}

/* ---- Section heads on glass air ---- */
.stop .section-head {
  margin-bottom: clamp(1.6rem, 3.5vw, 2.6rem);
}

.stop h2 {
  text-shadow: 0 8px 50px rgba(10, 13, 20, 0.9);
}

/* ---- Service cards ---- */
.j-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.j-card h3 {
  margin-bottom: 0.5rem;
}

.j-card p {
  color: var(--text-muted);
  font-size: var(--fs-small);
  margin-bottom: 1.1rem;
}

.j-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--accent-bright);
}

.j-card .card-link svg {
  width: 15px;
  height: 15px;
  transition: transform var(--dur) var(--ease-out);
}

.j-card .card-link:hover svg {
  transform: translateX(4px);
}

/* ---- Stats ---- */
.j-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  justify-items: center;
}

.j-stat {
  display: grid;
  gap: 0.4rem;
  justify-items: center;
}

.j-stat-num {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 24px var(--glow));
}

.j-stat-label {
  color: var(--text-muted);
  font-size: var(--fs-small);
}

/* ---- Why grid ---- */
.j-why {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  max-width: 900px;
  margin-inline: auto;
}

.j-why-item {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.4rem 1.5rem;
}

.j-why-item .card-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  margin-bottom: 0;
}

.j-why-item h3 {
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.j-why-item p {
  color: var(--text-muted);
  font-size: var(--fs-small);
}

/* ---- Tech marquees ---- */
.j-marquees {
  display: grid;
  gap: 0.4rem;
  max-width: 980px;
  margin-inline: auto;
}

/* ---- Service worlds (01/02/03 captions, preview-style) ---- */
.j-svc {
  max-width: 620px;
  margin-right: auto;
  text-align: left;
}

.j-svc .card-icon {
  margin-bottom: 1rem;
}

.j-svc h2 {
  font-size: var(--fs-h1);
  text-shadow: 0 8px 50px rgba(10, 13, 20, 0.95);
}

.j-svc p {
  color: var(--text-muted);
  font-size: 1.0625rem;
  margin-top: 1rem;
  max-width: 520px;
  text-shadow: 0 4px 30px rgba(10, 13, 20, 0.9);
}

.j-svc-link {
  margin-top: 1.6rem;
  padding: 0.7rem 1.5rem;
}

/* ---- Finale: the white logo plate over the globe — no frame ---- */
.j-finale {
  position: relative;
  text-align: center;
  max-width: 720px;
  margin-inline: auto;
}

.j-finale-logo {
  height: clamp(4.2rem, 9vw, 6.4rem);
  width: auto;
  margin-inline: auto;
  /* neon: tight white rim around the glyphs + brand-colored bloom */
  filter:
    drop-shadow(0 0 1.5px rgba(252, 252, 252, 0.95))
    drop-shadow(0 0 6px rgba(252, 252, 252, 0.55))
    drop-shadow(0 0 18px rgba(34, 211, 238, 0.5))
    drop-shadow(0 0 44px rgba(74, 92, 240, 0.65));
}

.j-finale-tagline {
  margin-top: 1.5rem;
  font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #fcfcfc;
  /* matching neon rim on the lettering */
  text-shadow:
    0 0 1px rgba(252, 252, 252, 0.95),
    0 0 8px rgba(252, 252, 252, 0.6),
    0 0 22px rgba(123, 138, 255, 0.7),
    0 0 42px rgba(34, 211, 238, 0.5);
}

.j-finale .btn {
  margin-top: 2rem;
}

/* ---- Progress rail ---- */
.j-progress {
  position: fixed;
  right: clamp(0.9rem, 2.5vw, 2rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: grid;
  gap: 0.9rem;
  justify-items: center;
}

.j-progress button {
  position: relative;
  width: 14px;
  height: 16px;
  border: none;
  background: transparent;
  padding: 0;
  transition: height var(--dur) var(--ease-out);
}

.j-progress button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  transform: translateX(-50%);
  width: 2px;
  border-radius: 1px;
  background: rgba(252, 252, 252, 0.35);
  transition: background-color var(--dur), box-shadow var(--dur);
}

.j-progress button:hover::before {
  background: rgba(252, 252, 252, 0.8);
}

.j-progress button.active {
  height: 26px;
}

.j-progress button.active::before {
  background: #fcfcfc;
  box-shadow: 0 0 10px rgba(252, 252, 252, 0.55);
}

/* ---- Scroll hint ---- */
.j-hint {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-tiny);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: opacity 0.5s;
}

.j-hint svg {
  width: 14px;
  height: 14px;
  animation: j-hint-bob 1.8s ease-in-out infinite;
}

@keyframes j-hint-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

.j-hint.hidden {
  opacity: 0;
}

/* ---- Footer: hidden in journey mode (the finale ends the page);
   still shown in the no-3d fallback where the page scrolls classically. ---- */
html:not(.no-3d) .site-footer {
  display: none;
}

.site-footer {
  position: relative;
  z-index: 3;
}

/* ============================================================
   Fallback (html.no-3d): small screens, reduced motion or no
   WebGL — the journey flattens into a classic scrolling page.
   ============================================================ */
html.no-3d #webgl,
html.no-3d .j-progress,
html.no-3d .j-hint,
html.no-3d .j-loader {
  display: none;
}

html.no-3d .journey {
  height: auto;
}

html.no-3d .stop {
  position: relative;
  inset: auto;
  min-height: auto;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  padding-block: var(--section-pad);
  overflow: hidden;
}

html.no-3d .stop-hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-items: center;
  background:
    radial-gradient(ellipse 70% 55% at 50% 32%, var(--accent-soft), transparent 70%),
    var(--bg);
}

html.no-3d .stop .orb {
  display: block;
}

html.no-3d .stop .j-inner {
  position: relative;
  z-index: 1;
}

/* ---- Responsive (journey mode is desktop-first; ≤899px falls
   back to no-3d via JS, these rules cover both) ---- */
@media (max-width: 1100px) {
  .j-cards {
    gap: 0.9rem;
  }
}

@media (max-width: 899px) {
  .j-cards {
    grid-template-columns: 1fr;
    max-width: 460px;
    margin-inline: auto;
  }

  .j-stats {
    grid-template-columns: 1fr 1fr;
  }

  .j-why {
    grid-template-columns: 1fr;
    max-width: 560px;
    gap: 0.7rem;
  }

  /* Journey overlays on phones: tighter type, and let a too-tall stop
     scroll inside itself instead of clipping (chains to the page). */
  .stop {
    align-items: center;
    overflow-y: auto;
    padding-bottom: max(3.2rem, env(safe-area-inset-bottom, 0px) + 2.6rem);
  }

  .stop .section-head {
    margin-bottom: 1.2rem;
  }

  .stop .section-head .lead,
  .j-svc p,
  .j-lead {
    font-size: 0.95rem;
  }

  .j-why-item {
    padding: 0.95rem 1.05rem;
    gap: 0.85rem;
  }

  .j-why-item .card-icon {
    width: 38px;
    height: 38px;
  }

  .j-why-item h3 {
    font-size: 0.98rem;
  }

  .j-why-item p {
    font-size: 0.85rem;
  }

  .j-svc .card-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 0.7rem;
  }

  .j-svc h2 {
    font-size: var(--fs-h2);
  }

  .j-progress {
    right: 0.55rem;
    gap: 0.55rem;
  }

  .j-progress button {
    height: 13px;
  }

  .j-progress button.active {
    height: 21px;
  }

  .j-hint {
    bottom: max(0.9rem, env(safe-area-inset-bottom, 0px) + 0.5rem);
  }

  .j-finale-logo {
    height: clamp(3rem, 13vw, 4.6rem);
  }
}
