/* Scroll animations for the homepage sections (20 Nov 2026).
   Dark sections use the hero's navy-glass look; light sections use white lift cards.
   Everything plays once, when its section is well into view. Nothing is hidden unless the script runs (html.sa-on). */

/* Items: hidden until their section comes into view */
html.sa-on .sa { opacity: 0; transition: opacity .9s ease, transform .9s cubic-bezier(.22,.61,.36,1), filter .9s ease, box-shadow .9s ease;
  transition-delay: calc(var(--i, 0) * 120ms + 120ms); }
html.sa-on .sa-dark .sa { transform: translate(var(--sx, -26px), 8px); filter: blur(6px); }
html.sa-on .sa-light .sa { transform: translateY(28px) scale(.97); }
html.sa-on .sa-in .sa { opacity: 1; transform: none; filter: none; }

/* Pop-up cards added over pictures and empty space */
.sa-host { position: relative; }
.sa-pop { position: absolute; z-index: 3; width: max-content; max-width: min(300px, 80%); border-radius: 12px; padding: 11px 14px; font: 500 12.5px/1.4 Inter, Arial, sans-serif;
  opacity: 0; transform: translate(var(--sx, 0), 12px); filter: blur(6px); pointer-events: none;
  transition: opacity .9s ease, transform .9s cubic-bezier(.22,.61,.36,1), filter .9s ease; }
.sa-pop.on { opacity: 1; transform: none; filter: none; }
.sa-pop b { display: block; font-size: 13px; }
.sa-pop .sa-ph { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.sa-pop .sa-ph i { flex: 0 0 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; color: #fff; background: var(--ac); }
.sa-pop .sa-ph small { display: block; font-size: 10.5px; }
.sa-pop .sa-row { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.sa-pop .sa-ok { color: #2bd38c; font-weight: 700; } .sa-pop .sa-bad { color: #ff6b8f; font-weight: 700; }
.sa-pop.dark { color: #dbe6ec; background: linear-gradient(160deg, rgba(17,56,79,.96), rgba(7,28,42,.96)); border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 20px 48px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.08); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); overflow: hidden; }
.sa-pop.dark::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--ac), transparent 85%); }
.sa-pop.dark b { color: #fff; } .sa-pop.dark .sa-ph small { color: #9fb6c4; }
.sa-pop.dark .sa-ph i { box-shadow: 0 0 14px color-mix(in srgb, var(--ac) 60%, transparent); }
.sa-pop.light { color: #33475a; background: #fff; border: 1px solid #e3eaef; border-left: 4px solid var(--ac); box-shadow: 0 18px 40px rgba(11,31,46,.18); }
.sa-pop.light b { color: #0b1f2e; } .sa-pop.light .sa-ph small { color: #6a7c88; }
.sa-pop.light .sa-ok { color: #0a8f5a; } .sa-pop.light .sa-bad { color: #c8125e; }

/* 12 steps: each step lights up in turn */
.j-phase li .sa-tick { position: absolute; right: 12px; top: 12px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: #2bd38c; color: #04202a; opacity: 0; transform: scale(.4); transition: opacity .4s ease, transform .5s cubic-bezier(.2,.9,.25,1.3); }
.j-phase li.lit .sa-tick { opacity: 1; transform: none; }
.j-phase li { transition: box-shadow .5s ease, transform .5s ease; }
.j-phase li.lit { box-shadow: 0 0 0 2px rgba(79,212,223,.85), 0 10px 24px rgba(11,31,46,.22); }
.j-phase li.lit .j-num { background: #4fd4df; color: #04202a; transition: background .4s ease, color .4s ease; }
.j-phase li.done { box-shadow: none; }

/* Margin leaks: the problem is crossed out, then the fix lights up */
.pair-problem { text-decoration: line-through; text-decoration-color: transparent; text-decoration-thickness: 1.5px; transition: text-decoration-color .9s ease, opacity .9s ease; }
.pairs li.fixed .pair-problem { text-decoration-color: #c8125e; opacity: .65; }
.pairs li { transition: box-shadow .6s ease; }
.pairs li.fixed { box-shadow: inset 0 3px 0 #0a8f5a; }
.pairs li.fixed .pair-change::before { color: #0a8f5a; }

/* Intelligence examples: bars grow, tags and chips pop */
html.sa-on .intel-grid .intel-bar i { transition: width 1.1s cubic-bezier(.22,.61,.36,1) !important; }
html.sa-on .intel-grid .sa-zero { width: 0 !important; }
html.sa-on .sa-pip { opacity: 0; transform: scale(.6); transition: opacity .45s ease, transform .5s cubic-bezier(.2,.9,.25,1.3); }
html.sa-on .sa-pip.on { opacity: 1; transform: none; }

/* Pipelines (item tracker stages, Xero and Revit steps) light up in order */
.track-stages li { transition: box-shadow .5s ease, transform .5s ease, filter .5s ease; }
html.sa-on .sa-pipe li { filter: saturate(.4) brightness(.9); }
html.sa-on .sa-pipe li.lit { filter: none; box-shadow: 0 0 0 2px #4fd4df, 0 12px 26px rgba(11,31,46,.25); transform: translateY(-3px); }
html.sa-on .sa-pipe li.done { filter: none; }

/* Four views: a progress line under the active tab */
.workflow-tab { position: relative; }
.sa-tabbar { position: absolute; left: 0; bottom: -1px; height: 3px; width: 0; background: linear-gradient(90deg, #4fd4df, #c8125e); }
.sa-tabbar.run { width: 100%; transition: width var(--t, 6s) linear !important; }

/* Report formats become badges */
.report-formats li { transition: background .4s ease, color .4s ease, padding .4s ease; border-radius: 6px; }
.report-formats li.chip { background: var(--ac); color: #fff; padding: 3px 10px; }

/* Soft photo backgrounds in empty space (loaded only when the section is near) */
.sa-bg { position: relative; isolation: isolate; }
.sa-bg::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 55%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 1.2s ease;
  background: var(--sa-fade), var(--sa-img) var(--sa-pos, center) / cover no-repeat; }
.sa-bg.sa-img-on::after { opacity: 1; }
.sa-bg.sa-dark { --sa-fade: linear-gradient(90deg, var(--sa-c, #061b2a) 0%, rgba(6,27,42,.86) 35%, rgba(6,27,42,.62) 100%); }
.sa-bg.sa-light { --sa-fade: linear-gradient(90deg, var(--sa-c, #fff) 0%, rgba(255,255,255,.86) 35%, rgba(255,255,255,.7) 100%); }
@media (max-width: 860px) { .sa-bg::after { width: 100%; opacity: 0 !important; } .sa-pop { max-width: 86%; font-size: 11.5px; } .sa-pop.sa-wide { display: none; } }
@media (max-width: 1180px) { .sa-pop.sa-wide { display: none; } }

/* Visitors who reduce motion: the site turns transitions off, so these come back as gentle fades and short slides */
@media (prefers-reduced-motion: reduce) {
  html.sa-on .sa, .sa-pop, .j-phase li .sa-tick, .pair-problem, .pairs li, html.sa-on .sa-pip, .track-stages li, .report-formats li, .sa-bg::after {
    transition: opacity .9s ease, transform .9s cubic-bezier(.22,.61,.36,1), filter .9s ease, text-decoration-color .9s ease, background .5s ease, box-shadow .5s ease !important; }
  html.sa-on .sa { transition-delay: calc(var(--i, 0) * 120ms + 120ms) !important; }
}

/* Live screens: real I-Cost screens with a moving spotlight and pop-up cards (like the homepage hero) */
.ls { position: relative; margin: 40px auto 0; max-width: 1060px; }
.ls-panel { margin-top: 0; }
.ls-narrow { max-width: 430px; margin-left: 0; }
.ls-frame { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid rgba(255,255,255,.18); background: #0b1720; box-shadow: 0 30px 70px rgba(0,0,0,.45);
  transform: perspective(1600px) rotateX(7deg) translateY(30px); opacity: 0; transition: transform 1.1s cubic-bezier(.2,.7,.2,1), opacity .9s ease; }
.ls.in .ls-frame { transform: perspective(1600px) rotateX(0) translateY(0); opacity: 1; }
html:not(.sa-on) .ls-frame { opacity: 1; transform: none; }
.sa-light .ls-frame { border-color: #d9e2e8; box-shadow: 0 30px 70px rgba(11,31,46,.22); }
.ls-bar { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; background: #0d1b26; color: #8fa3b1; font: 500 11px/1 Inter, Arial, sans-serif; }
.ls-bar i { width: 7px; height: 7px; border-radius: 50%; background: #2c3c48; }
.ls-bar span { margin-left: 8px; }
.ls-bar b { margin-left: auto; display: flex; align-items: center; gap: 6px; font-weight: 600; color: #8fe3c6; }
.ls-bar b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2bd38c; animation: lsLive 1.8s ease-out infinite; }
@keyframes lsLive { 0% { box-shadow: 0 0 0 0 rgba(43,211,140,.6); } 70%, 100% { box-shadow: 0 0 0 7px rgba(43,211,140,0); } }
.ls-shot { position: relative; }
.ls-shot img { display: block; width: 100%; height: auto; }
.ls-hl { position: absolute; border: 2px solid #4fd4df; border-radius: 8px; opacity: 0; pointer-events: none;
  box-shadow: 0 0 0 3000px rgba(4,16,26,0), 0 0 0 rgba(79,212,223,0); transition: opacity .6s ease, box-shadow .8s ease; }
.ls-hl.on { opacity: 1; box-shadow: 0 0 0 3000px rgba(4,16,26,.42), 0 0 22px rgba(79,212,223,.75); }
.ls .sa-pop { max-width: 290px; z-index: 4; }
.ls .sa-pop img { display: block; width: 100%; border-radius: 7px; margin-top: 7px; }
.ls .sa-pop .sa-n { position: absolute; right: 10px; top: 10px; font: 700 10px/1 Inter, Arial, sans-serif; opacity: .55; }
@media (max-width: 860px) {
  .ls-narrow { max-width: 100%; }
  .ls .sa-pop { position: relative; left: auto !important; right: auto !important; top: auto !important; bottom: auto !important; max-width: none; width: auto; margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .ls-frame, .ls-hl { transition: opacity .9s ease, transform .9s cubic-bezier(.22,.61,.36,1), box-shadow .8s ease !important; }
}

/* Other pages */
main { overflow-x: clip; }
.ls-hero { margin: 0; max-width: none; }
.ls-hero .sa-pop { max-width: 250px; }

/* Page headers with a live screen on the right */
.hero-split-live { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 48px; }
.hero-split-live h1 { font-size: clamp(2.3rem, 3.4vw, 3.6rem); }
.page-hero .ls-hero .ls-frame { box-shadow: 0 34px 80px rgba(0,0,0,.55); }
@media (max-width: 960px) { .hero-split-live { grid-template-columns: 1fr; gap: 32px; } }
