/* Entrance: "the bricks between now and next".
   A night-time blueprint corridor. The real homepage is the lit wall at the far end ("next"), a brick
   path is laid toward it as you scroll, and the camera walks in until that wall is the page.

   How it is put together:
   - .intro is a tall scroll runway; .intro-stage sticks to the screen while you travel it.
   - .intro-window holds the real hero at full size and is only scaled down and nudged.
     At the end it is at scale 1, the `landed` class drops the transform, and it is an ordinary page again.
   - The fixed nav gets the same transform, so it rides on top of the small window as part of the mini site.
   - intro.js writes those transforms each frame and draws the corridor on the canvas. The --s/--vx/--vy
     values below are only the first-paint position, before the script has run.
   Everything is gated on `.intro-on` (set in <head> unless reduced motion): without it the extra layers
   are not shown and the hero is a normal first screen. intro.js also removes the class when the hero
   cannot fit in one screen (a phone on its side, heavy zoom), so nothing is ever cut off. */

.intro-canvas, .intro-bar, .intro-copy, .intro-cards, .intro-tag, .intro-rail { display: none; }
/* The far wall is solid while it is small, so the corridor does not show through the page.
   Once landed it turns clear and the pointer field behind the whole site shows instead. */
.intro-on:not(.landed) .intro-window { background: var(--bg); }
/* Logo and "#top" links land here. Top of the page by default; the end of the zoom when the entrance is on. */
.intro { position: relative; }
.intro-anchor { display: block; position: absolute; top: 0; width: 1px; height: 1px; }

.intro-on .intro {
  --travel: 250vh;      /* how much scrolling the entrance takes */
  --zoom: .86;          /* share of that spent zooming; the rest holds on the landed hero */
  --s0: .26;            /* size of the homepage at the start */
  --vpx: .67; --vpy: .43; /* where the far wall sits at the start, as a share of the screen */
  height: calc(100svh + var(--travel));
  background: #0B1222;  /* shows under the stage on iOS when the address bar collapses */
}
.intro-on.landed .intro, .intro-on.landed .intro-stage { background: none; }
.intro-on .intro-anchor { top: calc(var(--travel) * var(--zoom)); }

.intro-on .intro-stage,
.intro-on .nav { --s: .26; --vx: 17vw; --vy: -7svh; }
/* Ground: the brand's Foundation Slate, lifted a little where the page lights it and deepened toward
   the edges. #0B1222 is the same deep slate the chat demo already sits on. */
.intro-on .intro-stage {
  position: sticky; top: 0; height: 100svh; overflow: hidden; isolation: isolate;
  background: radial-gradient(130% 110% at 68% 42%, #18233F 0%, var(--slate) 50%, #0B1222 100%);
  color: var(--paper);
}
.intro-on .intro-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.1s var(--ease) .1s; }
.intro-on .intro-ready .intro-canvas { opacity: 1; }

/* The homepage, small and far away. Square corners: it is a wall on a drawing, not a card. */
.intro-on .intro-window {
  position: absolute; inset: 0; z-index: 3; overflow: hidden; cursor: pointer;
  transform-origin: 50% 50%;
  transform: translate3d(var(--vx), var(--vy), 0) scale(var(--s));
}
.intro-on:not(.landed) .intro-window > * { pointer-events: none; }
.intro-on.landed .intro-window { transform: none; cursor: auto; }
.intro-on .intro-window .hero { height: 100%; }

/* The nav rides on the window until landing (origin = centre of the screen, same as the window) */
.intro-on:not(.landed) .nav {
  transform-origin: 50% 50svh;
  transform: translate3d(var(--vx), var(--vy), 0) scale(var(--s));
  pointer-events: none;
}
.intro-on.landed .intro-canvas, .intro-on.landed .intro-bar, .intro-on.landed .intro-copy,
.intro-on.landed .intro-tag, .intro-on.landed .intro-rail { visibility: hidden; }
.intro-on.landed .intro-cards { display: none; }

/* Top bar: brand, a way to skip, the call. Stays most of the way in; the window grows over it. */
.intro-on .intro-bar { position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: var(--nav-h); padding: 0 var(--pad); display: flex; align-items: center; gap: 8px 20px; }
.intro-bar .logo { height: 34px; margin-right: auto; color: var(--paper); }
.intro-skip {
  min-height: 44px; padding: 0 10px; border: 0; background: none; cursor: pointer; white-space: nowrap;
  font: 500 14px/1 var(--f-body); color: #CBD5E1; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(148, 163, 184, .5);
  transition: color .2s var(--ease), text-decoration-color .2s var(--ease);
}
.intro-skip:hover { color: var(--paper); text-decoration-color: var(--orange); }
/* Brand ghost button: the dark-surface variant from the brand sheet */
.btn-ghost { min-height: 44px; padding: 0 18px; font-size: 15px; border: 1px solid rgba(250, 250, 249, .4); color: var(--paper); background: rgba(11, 18, 34, .78); }
.btn-ghost:hover { border-color: rgba(250, 250, 249, .75); background: #18233F; }

/* The line, what Qortiv does, and the one thing to do here: scroll. It steps aside as the camera moves. */
.intro-on .intro-copy {
  --p: 0;
  display: block; position: absolute; z-index: 2; left: var(--pad); top: 50%; width: min(38vw, 620px);
  transform-origin: 0 50%;
  transform: translate3d(calc(var(--p) * -60vw), -52%, 0) scale(calc(1 + var(--p) * 1.2));
}
.intro-line {
  font: 800 clamp(2.6rem, min(6.4vw, 13svh), 6rem)/.98 var(--f-head); letter-spacing: -0.035em;
  max-width: 9.6ch; text-wrap: balance; color: var(--paper);
}
.intro-now { color: var(--mist); }
.intro-next { color: var(--orange); }
.intro-sub { margin-top: clamp(18px, 3svh, 28px); max-width: 34ch; font-size: clamp(1.02rem, 1.25vw, 1.22rem); line-height: 1.5; color: #CBD5E1; }
.intro-cue {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; margin-top: clamp(18px, 3.4svh, 32px); padding: 0; border: 0; background: none; cursor: pointer;
  font: 600 clamp(1rem, 1.15vw, 1.15rem)/1 var(--f-body); color: var(--paper);
}
.intro-cue-dot { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--orange); color: var(--orange); transition: background-color .2s var(--ease), color .2s var(--ease); }
.intro-cue-dot .lucide, .intro-cue-dot [data-lucide] { width: 20px; height: 20px; stroke-width: 2; animation: intro-nudge 1.7s var(--ease) infinite; }
.intro-cue:hover .intro-cue-dot { background: var(--orange); color: var(--slate); }

/* Jobs done, floating at depth. intro.js places them; --x/--y are the start spot, --o the depth, --k the size.
   Glass cards: the corridor lines show through them, blurred. */
.intro-on .intro-cards { display: block; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.job {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 10px; opacity: 0; white-space: nowrap;
  padding: 10px 14px 10px 11px; border-radius: var(--radius);
  background: rgba(22, 32, 51, .5); border: 1px solid var(--glass-line);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: 0 18px 34px -16px rgba(0, 0, 0, .7);
  font: 500 12px/1.3 var(--f-mono); color: var(--mist);
  will-change: transform, opacity;
  animation: intro-bob 5.2s ease-in-out infinite;
}
.job:nth-child(2n) { animation-delay: -1.6s; }
.job:nth-child(3n) { animation-delay: -3.1s; }
.job b { display: block; font: 700 13.5px/1.25 var(--f-head); color: var(--paper); }
.job .lucide, .job [data-lucide] { flex: none; width: 20px; height: 20px; color: var(--orange); }

/* Drawing notes: a tag on the far wall, and the now-to-next rail that fills as you go */
.intro-on .intro-tag {
  display: block; position: absolute; left: 0; top: 0; z-index: 4; white-space: nowrap; opacity: 0;
  font: 500 12px/1 var(--f-mono); letter-spacing: .08em; color: var(--mist);
}
.intro-on .intro-rail {
  position: absolute; z-index: 4; left: var(--pad); width: min(32vw, 520px); bottom: clamp(18px, 4svh, 34px);
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px;
  font: 500 12px/1 var(--f-mono); letter-spacing: .08em; color: var(--mist); pointer-events: none;
}
.intro-rail-track { position: relative; height: 2px; border-radius: 1px; background: rgba(148, 163, 184, .26); overflow: hidden; }
.intro-rail-fill { position: absolute; inset: 0; background: var(--orange); transform-origin: left; transform: scaleX(0); }
.intro-rail-distance { min-width: 4ch; text-align: right; color: var(--paper); font-variant-numeric: tabular-nums; }

/* First paint: the line rises once, then scroll owns the motion */
.intro-on .intro-line, .intro-on .intro-sub, .intro-on .intro-cue, .intro-on .intro-bar, .intro-on .intro-rail > * { animation: intro-rise .9s var(--ease) both; }
.intro-on .intro-sub { animation-delay: .1s; }
.intro-on .intro-cue { animation-delay: .2s; }
.intro-on .intro-rail > * { animation-delay: .3s; }
@keyframes intro-rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes intro-nudge { 0%, 100% { transform: translateY(-3px); } 50% { transform: translateY(4px); } }
/* `translate` is its own property, so this bob adds to the transform intro.js writes instead of fighting it */
@keyframes intro-bob { 50% { translate: 0 -6px; } }

/* Phones: the line on top, the far wall below it, two cards, a shorter walk, no rail */
@media (max-width: 760px) {
  .intro-on .intro { --travel: 200vh; --s0: .28; --vpx: .5; --vpy: .7; }
  .intro-on .intro-stage, .intro-on .nav { --s: .28; --vx: 0vw; --vy: 20svh; }
  .intro-on .intro-stage { background: radial-gradient(150% 90% at 50% 70%, #18233F 0%, var(--slate) 52%, #0B1222 100%); }
  .intro-on .intro-bar { height: 60px; }
  .intro-bar .logo { height: 28px; }
  .intro-skip { padding: 0 4px; }
  .intro-on .intro-copy { top: 76px; width: auto; right: var(--pad); transform-origin: 0 0; transform: translate3d(calc(var(--p) * -70vw), 0, 0) scale(calc(1 + var(--p) * .8)); }
  .intro-line { font-size: clamp(2rem, min(10vw, 6svh), 3rem); max-width: 10ch; }
  .intro-sub { margin-top: 14px; max-width: 30ch; font-size: 1rem; }
  .intro-cue { margin-top: 12px; min-height: 44px; }
  .intro-cue-dot { width: 38px; height: 38px; }
  .job-wide { display: none; }
  .intro-on .intro-rail, .intro-on .intro-tag { display: none; }
}
/* Short phones: the line and the cue, so nothing sits on top of the far wall */
@media (max-width: 760px) and (max-height: 640px) { .intro-sub { display: none; } }

/* No backdrop-filter: the job cards fall back to a solid surface */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .job { background: var(--surface); } }
