/* divtodiv — the journey homepage. Loaded after next.css, which supplies the shared look
   (type, header, pills, form, footer). This file adds the world behind the page, the
   sticky chapters the flight is timed by, the labels and readout, and the fallbacks. */

/* A stop's anchor is its section top: the script, not the browser, settles the view. */
html { scroll-padding-top: 0; }
html.journey-on { scroll-behavior: auto; }

/* ---------------------------------------------------------------- the world */

#world {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Darkens the side the text sits on, so it stays readable over the lights: the left
   for most stops, the bottom where the text runs along the bottom (the two high views). */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: calc(1 - var(--dawn));
  background: radial-gradient(ellipse at 50% 50%, rgba(10, 10, 11, 0) 55%, rgba(10, 10, 11, 0.55) 100%);
}
.vignette::before,
.vignette::after {
  content: "";
  position: absolute;
  inset: 0;
  transition: opacity 0.9s var(--ease);
}
.vignette::before { background: linear-gradient(90deg, rgba(10, 10, 11, 0.86) 0%, rgba(10, 10, 11, 0.5) 34%, rgba(10, 10, 11, 0) 62%); }
.vignette::after {
  opacity: 0;
  background: linear-gradient(0deg, rgba(10, 10, 11, 0.92) 0%, rgba(10, 10, 11, 0.74) 30%, rgba(10, 10, 11, 0) 56%);
}
html:is([data-stop="process"], [data-stop="field"]) .vignette::before { opacity: 0; }
html:is([data-stop="process"], [data-stop="field"]) .vignette::after { opacity: 1; }

.labels {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Still views (reduced motion): nothing moves by itself, and no guided tour is offered. */
html.is-still [data-tour] { display: none; }
html.is-still :is(.grain, .scroll-cue span) { animation: none; }

/* Until the world is running there is nothing to label or measure. */
html:not(.journey-on) :is(.vignette, .labels, .hud, [data-tour]) { display: none; }

/* The header floats over the scene, and at times the core or a tower is right behind
   it. A band of the night colour, fading out below, keeps the logo, the chapter links
   and "Write to us" readable whatever passes underneath. It lifts at sunrise, when
   the header takes its usual light backing. */
html.journey-on .hdr::before {
  content: "";
  position: absolute;
  inset: 0 0 -30px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 10, 11, 0.96) 0, rgba(10, 10, 11, 0.94) 58%, rgba(10, 10, 11, 0) 100%);
  transition: opacity 0.5s var(--ease);
}
html.journey-on.is-dawn .hdr::before { opacity: 0; }

/* ---------------------------------------------------------------- stops */

/* Each stop is as long as its part of the flight; its text sticks while the camera moves. */
.stop {
  position: relative;
  min-height: var(--len);
}
#top { --len: 160svh; }
#software { --len: 260svh; }
#automation { --len: 260svh; }
#ai { --len: 200svh; }
#privacy { --len: 240svh; }
#process { --len: 240svh; }
#field { --len: 180svh; }
#contact { --len: auto; }

/* Never taller than the window: on a short screen the text scrolls inside its block,
   so its last line can always be reached. */
.stop__in {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  max-height: 100svh;
  padding: clamp(76px, 12svh, 104px) var(--pad) clamp(52px, 11svh, 124px);
  overflow-y: auto;
  scrollbar-width: none;
}
.stop__in::-webkit-scrollbar { display: none; }
/* Auto margins, not justify-content, so overflowing text starts at the top and scrolls. */
.stop__in > :first-child { margin-top: auto; }

.stop .chapter__copy {
  width: min(600px, 46vw);
  max-width: none;
}

.stop h2 {
  font-size: clamp(34px, min(4.4vw, 8.4svh), 80px);
  margin-bottom: 0.36em;
}
.stop .prose { font-size: clamp(16px, min(1.2vw, 2.5svh), 19px); }
.stop .eyebrow { margin-bottom: clamp(12px, 2.2svh, 22px); }
.stop .chapter__more { margin-top: clamp(16px, 3svh, 28px); }
.stop .platforms { margin-top: clamp(14px, 2.6svh, 26px); }

/* 0 · Arrival: the headline holds the left; the city and the core take the right. */
#top .stop__in > :first-child { margin-top: auto; }
#top .hero__foot { margin-bottom: auto; }
/* The headline, kicker and buttons are fully visible in the first painted frame, with
   or without script and whether or not another frame is ever drawn. Their entrance
   only settles them into place: it never hides, clips or fades them (the shared
   slide-up from behind a mask in next.css is replaced here). */
.js #top .hero__word { animation: settle 0.9s var(--ease) both; }
.js #top .hero__line:nth-child(2) .hero__word { animation-delay: 0.08s; }
.js #top .hero__line:nth-child(3) .hero__word { animation-delay: 0.16s; }
.js #top .kicker { animation: settle-block 0.7s var(--ease) 0.1s both; }
.js #top .hero__foot { animation: settle-block 0.7s var(--ease) 0.3s both; }
@keyframes settle {
  from { transform: translateY(0.08em); }
  to { transform: none; }
}
@keyframes settle-block {
  from { transform: translateY(8px); }
  to { transform: none; }
}

/* 1 · the five systems, as a list when there are no towers to carry them */
.stack li {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

/* 3 · the console sits beside the core, on darker glass so it reads over the glow */
.stop .console { margin-top: clamp(16px, 3svh, 34px); }
html.journey-on .stop .console { background: color-mix(in srgb, var(--bg-solid) 74%, transparent); }
.stop .console__body { min-height: 10.5em; padding-top: 12px; }
.stop .chips { margin-top: clamp(12px, 2svh, 18px); }

/* 4 · cloud or on-prem, and the standards the architecture is built to align with */
.stop .switch { margin-top: clamp(14px, 2.6svh, 30px); }
.stop .switch button { height: clamp(34px, 5svh, 44px); }
.stop .compare { margin-top: clamp(10px, 2svh, 26px); }
.stop .compare div { padding: clamp(7px, 1.3svh, 14px) 0; }
.aligned { margin-top: clamp(14px, 2.8svh, 30px); }
.aligned .eyebrow { margin-bottom: 12px; font-size: 11px; color: var(--subtle); }
.standards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.standards li {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
}

/* 5 · the four steps */
.stop .timeline { margin-top: clamp(18px, 3.4svh, 40px); }
.stop .timeline__fill { transform: scaleY(var(--fill, 0)); }
html:not(.journey-on) .timeline li { opacity: 1; }

/* On a wide screen the steps run left to right, under the route they describe. */
@media (min-width: 900px) and (min-aspect-ratio: 17/20) {
  html.js:not(.no-webgl) #process .chapter__copy { width: auto; }
  html.js:not(.no-webgl) #process .timeline {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(18px, 2.6vw, 44px);
    padding: 26px 0 0;
  }
  html.js:not(.no-webgl) #process .timeline li { padding-bottom: 0; }
  html.js:not(.no-webgl) #process .timeline li::before { left: 0; top: -30.5px; }
  html.js:not(.no-webgl) #process .timeline h3 { font-size: clamp(18px, 1.5vw, 23px); }
  html.js:not(.no-webgl) #process .timeline p { font-size: clamp(14px, 1.05vw, 15.5px); line-height: 1.5; }
  html.js:not(.no-webgl) #process .timeline__line { top: 0; right: 0; bottom: auto; width: auto; height: 1px; }
  html.js:not(.no-webgl) #process .timeline__fill { transform: scaleX(var(--fill, 0)); transform-origin: 0 50%; }
}

/* 6 · in the field */
#field .industries__rows { overflow: hidden; margin: 0 calc(var(--pad) * -1); }
#field .industries__note { margin-top: clamp(20px, 5svh, 56px); padding: 0; }

/* 7 · contact reads as an ordinary page: it is as long as its content. It starts one
   window down, so the sun has room to rise before the form arrives. */
#contact .stop__in {
  position: relative;
  max-height: none;
  padding-top: calc(100svh + clamp(84px, 13svh, 120px));
  padding-bottom: 10svh;
}
#contact .stop__in > :first-child { margin-top: 0; }

/* ------------------------------------------- when the world is running */

/* Each stop's text holds one place on screen and cross-fades with the next (the script
   sets its opacity), instead of scrolling past. The sections keep their lengths, so
   the page is exactly as long as before the script arrived. */
html.journey-on .stop__in {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100svh;
  opacity: 0;
  pointer-events: none;
}
html.journey-on #top .stop__in { opacity: 1; pointer-events: auto; }
html.journey-on #contact .stop__in {
  position: relative;
  height: auto;
  opacity: 1;
  pointer-events: auto;
  isolation: isolate;
}
/* By day a veil of the page colour sits behind the form and the footer, so the city
   drawn behind them stays faint. It is its own layer (added by the script): fading it
   costs neither a restyle of the form nor a repaint. */
.veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  background: rgba(245, 245, 247, 0.88);
}
#contact .veil {
  background: linear-gradient(180deg, rgba(245, 245, 247, 0) calc(100svh - 60px), rgba(245, 245, 247, 0.88) calc(100svh + 110px));
}

/* The towers and the gates carry these two lists; screen readers still read them. */
html.journey-on .stack,
html.journey-on .pipeline {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* The standards run under the core and its vault: each chip carries its own dark. */
html.journey-on .standards li { background: color-mix(in srgb, var(--bg-solid) 96%, transparent); }
/* The two high views: the text runs along the bottom, on its own band of dark, soft at the top. */
@media (min-width: 900px) and (min-aspect-ratio: 17/20) {
  html.journey-on #process .chapter__copy {
    margin-right: calc(var(--pad) * -1);
    margin-left: calc(var(--pad) * -1);
    padding: 44px var(--pad) 0;
    background: linear-gradient(180deg, rgba(10, 10, 11, 0), rgba(10, 10, 11, 0.8) 44px);
  }
}
/* The core fills the view at these two stops, and on narrower windows the text column
   reaches into it. So here the column carries its own dark, soft at every edge that
   meets the scene; the readout and the standards row below sit on it too. */
@media (min-width: 900px) and (min-aspect-ratio: 17/20) {
  html.journey-on :is(#ai, #privacy) .stop__in { isolation: isolate; }
  html.journey-on :is(#ai, #privacy) .chapter__copy { position: relative; }
  html.journey-on :is(#ai, #privacy) .chapter__copy::before {
    content: "";
    position: absolute;
    inset: -56px -88px -400px calc(var(--pad) * -1);
    z-index: -1;
    display: block;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(10, 10, 11, 0.97) 0, rgba(10, 10, 11, 0.97) calc(100% - 96px), rgba(10, 10, 11, 0));
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 56px);
    mask-image: linear-gradient(180deg, transparent, #000 56px);
  }
}
/* The districts are labelled in the world itself. */
html.journey-on #field .industries__rows { display: none; }

/* ---------------------------------------------- labels pinned in the world */

.wtag {
  position: absolute;
  top: 0; left: 0;
  padding-left: 46px;
  opacity: 0;
  will-change: transform, opacity;
}
/* A soft dark backing so the label reads over the lights behind it. */
.wtag b,
.wtag i {
  width: fit-content;
  background: color-mix(in srgb, var(--bg-solid) 94%, transparent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--bg-solid) 94%, transparent);
  border-radius: 2px;
}
.wtag::before {
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 36px; height: 1px;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
}
.wtag::after {
  content: "";
  position: absolute;
  left: -3px; top: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 14px color-mix(in srgb, var(--ink) 90%, transparent);
}
.wtag b {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.wtag i {
  display: block;
  margin-top: 5px;
  max-width: 230px;
  font-style: normal;
  font-size: 13px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--ink) 80%, var(--bg-solid));
}
.wtag i:empty { display: none; }
/* Near the right edge the label hangs to the left of its point. */
.wtag.is-flip { padding-right: 46px; padding-left: 0; translate: -100% 0; }
.wtag.is-flip::before { right: 0; left: auto; }
.wtag.is-flip::after { right: -3px; left: auto; }
.wtag.is-flip b, .wtag.is-flip i { margin-left: auto; text-align: right; }
.wtag.is-lit b { text-shadow: 0 0 18px color-mix(in srgb, var(--ink) 90%, transparent); }
.wtag.is-lit i { color: var(--ink); }

/* ---------------------------------------------------------------- readout */

.hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}
.hud__read {
  position: absolute;
  left: var(--pad);
  bottom: 20px;
  display: flex;
  gap: 18px;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
}
.hud__read span:first-child { color: var(--ink); }
.hud__marks {
  position: absolute;
  right: 7px;
  top: 50%;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 21px;
  translate: 0 -50%;
}
.hud__marks i {
  width: 6px;
  height: 1px;
  background: var(--subtle);
  transition: width 0.5s var(--ease), background 0.3s;
}
.hud__marks i.is-active { width: 12px; background: var(--ink); }

/* ------------------------------------------- short, wide windows (laptops) */

/* The two fullest stops (the console and the cloud/on-prem table) are tightened so
   they fit a 650 to 780px-tall window without scrolling inside the block. */
@media (min-width: 900px) and (min-aspect-ratio: 17/20) and (max-height: 780px) {
  .stop__in { padding-top: 70px; padding-bottom: 44px; }
  .stop h2 { font-size: clamp(30px, min(4.4vw, 7svh), 80px); margin-bottom: 0.26em; }
  .stop .eyebrow { margin-bottom: 10px; }
  .stop .compare div { padding: 4px 0; }
  .stop .compare dd { font-size: 15px; }
  .stop .switch { margin-top: 12px; }
  .stop .switch button { height: 32px; }
  .aligned { margin-top: 10px; }
  .aligned .eyebrow { margin-bottom: 7px; }
  .standards li { padding: 4px 11px; }
  .stop .console { margin-top: 12px; padding: 12px 18px 10px; }
  .stop .console__body { min-height: 9.4em; padding-top: 6px; line-height: 1.6; }
  .stop .chips { margin-top: 10px; }
  .stop .chips li { padding: 5px 12px; }
  .stop .chapter__more { margin-top: 12px; }
  .hud__read { bottom: 14px; }
}

/* ---------------------------------------------------------------- phones */

@media (max-width: 899px), (max-aspect-ratio: 17/20) {
  /* The text sits at the bottom, so the dark falls there. */
  .vignette::before,
  .vignette::after {
    opacity: 1 !important;
    background:
      linear-gradient(0deg, rgba(10, 10, 11, 0.94) 0%, rgba(10, 10, 11, 0.66) 40%, rgba(10, 10, 11, 0) 70%),
      linear-gradient(180deg, rgba(10, 10, 11, 0.6) 0%, rgba(10, 10, 11, 0) 16%);
  }
  .vignette::after { display: none; }
  .stop__in { padding: 76px var(--pad) 58px; }
  .stop .chapter__copy { width: auto; padding-top: 0; }
  .stop .chapter__copy::before { display: none; }
  /* On a phone the text shares the screen with the scene: give it its own dark, soft at the top. */
  html.journey-on .stop .chapter__copy {
    margin-right: calc(var(--pad) * -1);
    margin-left: calc(var(--pad) * -1);
    padding: 60px var(--pad) 0;
    background: linear-gradient(180deg, rgba(10, 10, 11, 0), rgba(10, 10, 11, 0.97) 54px);
  }
  html.journey-on .aligned {
    margin: 0 calc(var(--pad) * -1);
    padding: clamp(10px, 2svh, 22px) var(--pad) 0;
    background: rgba(10, 10, 11, 0.97);
  }
  /* Keep the tall stops short enough that the scene still shows above them. */
  html.journey-on .stop .compare div { grid-template-columns: 7.2em 1fr; padding: 5px 0; }
  html.journey-on .stop .compare dd { font-size: 14px; }
  html.journey-on .stop .switch button { height: 36px; }
  html.journey-on .standards,
  html.journey-on .stop .chips {
    flex-wrap: nowrap;
    margin-right: calc(var(--pad) * -1);
    padding-right: var(--pad);
    overflow-x: auto;
    scrollbar-width: none;
  }
  html.journey-on .stop .chips li { white-space: nowrap; }
  html.journey-on .stop .console { padding: 12px 14px 10px; }
  /* The four steps: titles stay, and the step the flight has reached shows its
     sentence (the others are still read out by screen readers). */
  html.journey-on #process .timeline { margin-top: 14px; padding-left: 26px; }
  html.journey-on #process .timeline li { display: grid; grid-template-columns: 2.1em 1fr; align-items: baseline; padding-bottom: 9px; }
  html.journey-on #process .timeline li::before { left: -30.5px; }
  html.journey-on #process .timeline__no { margin: 0; }
  html.journey-on #process .timeline h3 { margin: 0; font-size: 18px; }
  html.journey-on #process .timeline li p { grid-column: 2; margin-top: 4px; }
  html.journey-on #process .timeline li:not(.is-now) p {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  html.journey-on #process .timeline__line { bottom: 14px; }
  html.journey-on .stop .console__body { min-height: 13.2em; padding-top: 8px; font-size: 11.5px; }
  .stop h2 { font-size: clamp(30px, min(8.6vw, 6svh), 46px); }
  .stop .prose { font-size: clamp(15px, min(4.2vw, 2.2svh), 17px); line-height: 1.55; }
  #top .stop__in > :first-child { margin-top: auto; }
  #top .hero__foot { margin-bottom: 0; }
  #top .hero__title { font-size: clamp(34px, min(11.4vw, 7svh), 72px); }
  .stack li { grid-template-columns: 58px 1fr; padding: 12px 0; }
  .stop .timeline li { padding-bottom: 14px; }
  .stop .timeline h3 { font-size: 19px; }
  .stop .timeline p { font-size: 14.5px; line-height: 1.5; }
  .stop .timeline__line { bottom: 30px; }
  .wtag { padding-left: 30px; }
  .wtag::before { width: 22px; }
  .wtag.is-flip { padding-right: 30px; padding-left: 0; }
  .wtag i { display: none; }
  .hud__read { bottom: 16px; }
  #contact .stop__in { padding-top: calc(100svh + 88px); }
  /* The progress marks stay on a phone, as marks only. */
  .hud__marks { display: flex; }
}

/* ---------------------------------------------------------------- plain page */

/* No script, or no 3D: an ordinary dark page with every word and a working form. */
html:not(.js) .stop,
html.no-webgl .stop { min-height: 0; }
html:not(.js) .stop__in,
html.no-webgl .stop__in {
  position: relative;
  min-height: 0;
  max-height: none;
  padding-top: 12svh;
  padding-bottom: 6svh;
  overflow: visible;
  opacity: 1 !important;
  pointer-events: auto !important;
}
html:not(.js) #top .stop__in,
html.no-webgl #top .stop__in { min-height: 92svh; padding-top: 120px; }
html:not(.js) #contact .stop__in,
html.no-webgl #contact .stop__in { padding-top: 12svh; }
html:not(.js) #world,
html.no-webgl #world,
html:not(.js) .scroll-cue,
html.no-webgl .scroll-cue { display: none; }
html:not(.js) .stop .chapter__copy,
html.no-webgl .stop .chapter__copy { width: auto; max-width: 720px; }

@media (prefers-reduced-motion: reduce) {
  .js #top .hero__word, .js #top .kicker, .js #top .hero__foot { animation: none; }
}
