/* Data and automation page. Teal is the system, amber is the threshold.
   The report side sits on a paler, flatter ground; the system side on the dark world. */
.sv-hero, .sv-week, .sv-end { --sv-pale: #1a2531; --sv-pale-ink: #c3ced9; --sv-good: #46b37b; --sv-bad: #ef6257; }
.sv-acts { display: block; color: var(--teal); }
.hero h1 { max-width: 15ch; }
.hero .lede { max-width: 32em; }

/* ---------- hero: three real dashboards as planes in depth, around the swarm chart ---------- */
.sv-hero { overflow: hidden; }
.sv-hero .wrap { position: relative; z-index: 2; }
.sv-planes { position: absolute; inset: 0; z-index: 1; perspective: 1400px; pointer-events: none; }
.sv-plane { position: absolute; transform: translate3d(calc(var(--px, 0) * var(--d)), calc(var(--py, 0) * var(--d) * .6 + var(--hy, 0px) * var(--s)), 0); transition: transform .7s var(--ease); will-change: transform; }
.sv-plane > div { transform: rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz, 0deg)); border-radius: .6rem; overflow: hidden; border: 1px solid var(--line-2); box-shadow: 0 40px 70px -30px rgba(0, 0, 0, .9); }
.sv-plane img { width: 100%; height: auto; filter: brightness(var(--b, .7)) saturate(.85); }
.sv-plane--back { left: 51vw; top: 11vh; width: 20vw; --d: -14px; --s: -.08; --ry: -24deg; --rx: 5deg; --b: .5; opacity: .8; }
.sv-plane--mid { left: 57vw; bottom: -7vh; width: 29vw; --d: -30px; --s: -.2; --ry: -14deg; --rx: 12deg; --rz: -2deg; --b: .68; }
.sv-plane--front { right: -7vw; top: 60vh; width: 22vw; --d: -54px; --s: -.38; --ry: -30deg; --rx: 3deg; --b: .82; }
@media (prefers-reduced-motion: no-preference) {
  .sv-plane > div { animation: sv-plane 1.6s var(--ease) both; }
  .sv-plane--mid > div { animation-delay: .15s; } .sv-plane--front > div { animation-delay: .3s; }
  @keyframes sv-plane { from { opacity: 0; transform: translate3d(6vw, 2vh, -200px) rotateY(calc(var(--ry) * 1.6)) rotateX(var(--rx)); } }
}

/* ---------- lead-in ---------- */
.sv-lead { padding-bottom: clamp(2.5rem, 6vh, 4rem); }

/* ---------- the week: a split stage. Base rules are the ordinary (reduced motion) layout ---------- */
.sv-stage { position: relative; display: grid; grid-template-columns: 1fr 1fr; }
.sv-side { position: relative; min-width: 0; padding: clamp(1.5rem, 4vh, 2.5rem) var(--edge) clamp(2rem, 5vh, 3rem); }
.sv-side--report { background: var(--sv-pale); color: var(--sv-pale-ink); padding-right: clamp(1.5rem, 5vw, 4.5rem); }
.sv-side--system { background: rgba(5, 8, 13, .86); padding-left: clamp(1.5rem, 5vw, 4.5rem); }
.sv-side__in { max-width: 38rem; display: flex; flex-direction: column; height: 100%; }
.sv-side--report .sv-side__in { margin-left: auto; }
.sv-side h3 { font-size: clamp(1.35rem, 2.2vw, 1.9rem); }
.sv-side--report h3 { color: #dfe6ee; }

.sv-chart { margin-top: 1rem; display: flex; flex-direction: column; }
.sv-plot { position: relative; height: 12rem; }
.sv-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sv-grid { stroke: var(--line); stroke-width: 1; }
.sv-rop { stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 5 5; }
.sv-line { fill: none; stroke: #93a3b5; stroke-width: 2; stroke-linejoin: round; }
.sv-line--low { stroke: var(--sv-bad); }
.sv-side--system .sv-line { stroke: var(--teal); stroke-width: 2.5; }
.sv-dot { position: absolute; left: 0; top: 0; width: .625rem; height: .625rem; margin: -.3125rem 0 0 -.3125rem; border-radius: 50%; background: #93a3b5; box-shadow: 0 0 0 3px var(--sv-pale); will-change: transform; }
.sv-dot.is-low { background: var(--sv-bad); }
.sv-side--system .sv-dot { background: var(--teal); box-shadow: 0 0 0 3px var(--bg), 0 0 18px 2px rgba(43, 212, 167, .55); }
.sv-days { position: relative; height: 1.4rem; font-size: .8rem; color: var(--ink-2); }
.sv-days span { position: absolute; top: .25rem; transform: translateX(-50%); }

/* the report's own tile: green, then red, then it just sits there */
.sv-tile { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; margin-top: .75rem; }
.sv-tile__n { font: 600 clamp(1.6rem, 2.6vw, 2.2rem)/1 var(--display); letter-spacing: -.02em; }
.sv-tile__l { color: var(--ink-2); }
.sv-tile .tag, .sv-tile__s { margin-left: auto; }
.sv-tile--report { position: relative; z-index: 0; padding: .7rem .9rem; border-radius: .5rem; overflow: hidden; color: #eaf6ee; }
.sv-tile--report::before, .sv-tile--report::after { content: ""; position: absolute; inset: 0; z-index: -1; background: #1f5c41; }
.sv-tile--report::after { background: #8f2f2a; opacity: 0; transition: opacity .5s var(--ease); }
.sv-tile--report.is-low::after { opacity: 1; }
.sv-tile--report .sv-tile__l { color: inherit; opacity: .8; }
.sv-tile__s { font-size: .85rem; font-weight: 600; }

.sv-log { margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .5rem; }
.sv-log li { display: grid; grid-template-columns: 6.4em 1fr; gap: .75rem; align-items: baseline; padding: .22rem 0; font-size: .95rem; line-height: 1.4; }
.sv-log time { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
.sv-side--system .sv-log time { color: var(--teal); }
.sv-latest { display: none; }
.sv-verdict { margin-top: .9rem; font: 600 clamp(1.05rem, 1.5vw, 1.3rem)/1.3 var(--display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--teal); }
.sv-side--report .sv-verdict { color: #dfe6ee; }
.sv-verdict.is-bad { color: var(--amber); }
.sv-side--report .sv-verdict.is-bad { color: #ff8a80; }

.sv-rail { display: none; }
.sv-ctl { grid-column: 1 / -1; order: -1; display: grid; grid-template-columns: 1fr 1fr; gap: .25rem clamp(1.5rem, 3vw, 3rem); align-items: end; padding: 1.25rem var(--edge); background: var(--bg-3); border-block: 1px solid var(--line); }
.sv-field { min-width: 0; }
.sv-field label { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-weight: 500; }
.sv-field output { font-family: var(--display); font-weight: 600; color: var(--ink); }
.sv-field--rop output { color: var(--amber); }
.sv-field input { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 2.75rem; margin: 0; background: none; cursor: pointer; --thumb: var(--teal); }
.sv-field--rop input { --thumb: var(--amber); }
.sv-field input::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line-2); }
.sv-field input::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-2); }
.sv-field input::-webkit-slider-thumb { -webkit-appearance: none; width: 1.5rem; height: 1.5rem; margin-top: calc(-.75rem + 2px); border-radius: 50%; border: 3px solid var(--bg-3); background: var(--thumb); box-shadow: 0 0 0 1px var(--thumb); transition: transform .25s var(--ease); }
.sv-field input::-moz-range-thumb { width: 1.125rem; height: 1.125rem; border-radius: 50%; border: 3px solid var(--bg-3); background: var(--thumb); box-shadow: 0 0 0 1px var(--thumb); }
.sv-field input:active::-webkit-slider-thumb { transform: scale(1.15); }
.sv-play { display: none; min-width: 10.5rem; }
.sv-note { grid-column: 1 / -1; display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.sv-note__rop { flex: none; width: 1.5rem; border-top: 2px dashed var(--amber); }

/* ---------- the week, pinned: scroll is the clock ---------- */
.scrolly .sv-week .seq__stick { display: block; padding-top: 0; }
.scrolly .sv-stage { height: 100%; }
.scrolly .sv-side { padding-top: calc(var(--head-h) + clamp(1rem, 3.5vh, 2.25rem)); padding-bottom: 9.5rem; min-height: 0; }
.scrolly .sv-chart { flex: 1 1 0; min-height: 5.5rem; max-height: 17rem; }
.scrolly .sv-plot { flex: 1 1 0; height: auto; min-height: 0; }
.scrolly .sv-field--week { display: none; }
.scrolly .sv-play { display: inline-flex; }
.scrolly .sv-ctl { position: absolute; z-index: 6; left: 50%; bottom: 1.25rem; width: min(42rem, calc(100% - 2rem)); margin-left: max(-21rem, calc(-50% + 1rem)); grid-template-columns: 1fr auto; padding: .8rem 1.25rem .7rem; border: 1px solid var(--line-2); border-radius: 1.25rem; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9); }
.scrolly .sv-log li { opacity: 0; transform: translate3d(0, .5rem, 0); transition: opacity .35s var(--ease), transform .45s var(--ease); }
.scrolly .sv-side--system .sv-log li { transform: translate3d(1.25rem, 0, 0); }
.scrolly .sv-log li.is-on { opacity: 1; transform: none; }
.scrolly .sv-side--system .sv-log li.is-new time { color: var(--amber); }
.scrolly .sv-verdict { min-height: 2.6em; opacity: 0; transform: translate3d(0, .5rem, 0); transition: opacity .4s var(--ease), transform .5s var(--ease); }
.scrolly .sv-verdict.is-on { opacity: 1; transform: none; }

/* the divider is the clock: a line for the week, a dot, a tick per day, the time */
.scrolly .sv-rail { display: block; position: absolute; z-index: 5; left: 50%; top: calc(var(--head-h) + 1.25rem); bottom: 13.5rem; width: 0; }
.sv-rail__line, .sv-rail__fill { position: absolute; left: -.5px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.sv-rail__fill { left: -1px; width: 2px; background: var(--teal); transform-origin: 50% 0; transform: scaleY(var(--t, 0)); }
.sv-tick { position: absolute; left: -1.375rem; top: calc(var(--f) * 100%); width: 2.75rem; height: 2.75rem; margin-top: -1.375rem; padding: 0; border: 0; background: none; color: var(--ink-2); font: 500 .78rem var(--text); cursor: pointer; display: grid; place-items: center; }
.sv-tick::before { content: ""; width: .7rem; height: 1px; background: var(--ink-2); }
.sv-tick span { position: absolute; left: 2rem; transition: color .2s; }
.sv-tick:hover span, .sv-tick:focus-visible span { color: var(--ink); }
.sv-rail__dot { position: absolute; left: -.375rem; top: -.375rem; width: .75rem; height: .75rem; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(5, 8, 13, .9); will-change: transform; }
.sv-rail.is-low .sv-rail__dot { background: var(--amber); }
.sv-clock { position: absolute; left: -3.75rem; top: .9rem; width: 7.5rem; min-height: 2.75rem; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--ink); font: 600 .95rem var(--display); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .9); will-change: transform; }
.sv-clock:active { cursor: grabbing; }

/* ---------- what a report gives you ---------- */
.sv-gives { margin-top: .5rem; gap: 0; border-top: 1px solid var(--line); }
.sv-gives li { padding: 1.1rem 0; border-bottom: 1px solid var(--line); font: 500 clamp(1.15rem, 1.7vw, 1.4rem)/1.3 var(--display); letter-spacing: -.01em; color: var(--ink); }

/* ---------- dashboards: one large, two smaller; the picture answers the pointer ---------- */
.sv-built { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(2.5rem, 5vw, 4.5rem) clamp(1.5rem, 3vw, 3rem); margin-top: clamp(2.5rem, 6vh, 4rem); }
.sv-built__item { grid-column: span 6; display: grid; gap: 1.25rem; align-content: start; perspective: 1100px; }
.sv-built__item--lead { grid-column: 1 / -1; grid-template-columns: 8fr 4fr; gap: clamp(1.5rem, 3vw, 3rem); align-items: end; }
.sv-built__item p { max-width: 34em; }
.sv-built__item--lead h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.sv-built .shot { transform: rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)); transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.sv-built .shot.is-tilt { box-shadow: 0 40px 70px -40px rgba(43, 212, 167, .35); }
.scrolly .sv-trigger { opacity: var(--a, 0); transform: translate3d(0, calc((1 - var(--a, 0)) * 1.5rem), 0); }

/* ---------- the four phases, joined by a line that draws ---------- */
.sv-phases { position: relative; counter-reset: sv-phase; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1.5rem, 3vw, 3rem); margin-top: clamp(2.5rem, 6vh, 4rem); padding-top: 1.5rem; }
.sv-phases::before, .sv-phases::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--line-2); }
.sv-phases::after { top: -.5px; height: 2px; background: var(--teal); transform-origin: 0 50%; transform: scaleX(var(--q, 1)); }
.sv-phases li { position: relative; counter-increment: sv-phase; }
.sv-phases li::after { content: ""; position: absolute; left: 0; top: calc(-1.5rem - .3rem); width: .6rem; height: .6rem; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px var(--bg); transition: background-color .4s, transform .5s var(--ease); }
.sv-phases li::before { content: counter(sv-phase); display: block; font: 600 clamp(2.2rem, 3.4vw, 3rem)/1 var(--display); font-variant-numeric: tabular-nums; color: var(--teal); margin-bottom: 1.25rem; transition: color .4s; }
.scrolly .sv-phases li:not(.is-on)::before { color: var(--ink-2); }
.scrolly .sv-phases li:not(.is-on)::after { background: #3a4a5a; transform: scale(.7); }
.sv-phases h3 { font-size: 1.25rem; }
.sv-phases p { margin-top: .6rem; }

/* ---------- the close: the system side takes the page ---------- */
.sv-end .seq__stick { min-height: 100svh; display: grid; align-items: end; padding: 6rem 0 clamp(4rem, 12vh, 8rem); text-align: center; }
.sv-end__copy h2 { max-width: 18ch; margin-inline: auto; }
.sv-end__copy .lede { margin: 1.5rem auto 0; }
.sv-end__copy .actions { justify-content: center; }
.sv-end__report, .sv-end__answer, .sv-end__divider { display: none; }
.scrolly .sv-end__report, .scrolly .sv-end__answer { display: grid; align-items: center; position: absolute; top: 0; bottom: 0; text-align: left; }
.scrolly .sv-end__report { left: 0; width: 50%; padding: 0 clamp(1.5rem, 4vw, 4rem) 0 var(--edge); background: var(--sv-pale); color: #dfe6ee; clip-path: inset(0 calc(var(--k, 0) * 100%) 0 0); will-change: clip-path; z-index: 2; }
.scrolly .sv-end__answer { left: 50%; width: 50%; padding: 0 var(--edge) 0 clamp(1.5rem, 4vw, 4rem); color: var(--teal); opacity: calc(1 - var(--k, 0) * 2.2); transform: translate3d(calc(var(--k, 0) * -12vw), 0, 0); }
.sv-end__report p, .sv-end__answer p { font: 600 clamp(1.9rem, 4vw, 3.4rem)/1.04 var(--display); letter-spacing: -.028em; max-width: 11ch; text-wrap: balance; }
.scrolly .sv-end__divider { display: block; position: absolute; z-index: 3; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line-2); transform: translate3d(calc(var(--k, 0) * -50vw), 0, 0); opacity: calc(1 - var(--k2, 0)); }
.scrolly .sv-end__copy { position: relative; z-index: 1; opacity: var(--k2, 0); transform: translate3d(0, calc((1 - var(--k2, 0)) * 2rem), 0); }

@media (max-width: 62rem) {
  .sv-built__item--lead { grid-template-columns: 1fr; }
  .sv-phases { grid-template-columns: 1fr; padding-top: 0; padding-left: 3.25rem; gap: 2rem; }
  .sv-phases::before, .sv-phases::after { left: 1rem; right: auto; top: .5rem; bottom: .5rem; width: 1px; height: auto; }
  .sv-phases::after { left: calc(1rem - .5px); width: 2px; transform-origin: 50% 0; transform: scaleY(var(--q, 1)); }
  .sv-phases li::after { display: none; }
  .sv-phases li::before { position: absolute; left: -3.25rem; top: -.35rem; width: 2rem; margin: 0; padding: .35rem 0; text-align: center; font-size: 1.9rem; background: var(--bg); }
  .sv-plane--back { width: 30vw; } .sv-plane--mid { width: 36vw; left: 52vw; } .sv-plane--front { width: 28vw; }
}
/* portrait screens: the swarm sits in the top third, so the planes flank it */
@media (max-aspect-ratio: 85/100) {
  .sv-plane--back { left: -22vw; right: auto; top: 9.5vh; width: 40vw; --ry: 26deg; --b: .45; }
  .sv-plane--mid { display: none; }
  .sv-plane--front { right: -25vw; top: 30vh; width: 46vw; --b: .6; }
}
@media (max-width: 40rem) {
  .hero h1 { max-width: none; }
  .sv-stage { grid-template-columns: 1fr; }
  .sv-ctl { grid-template-columns: 1fr; padding-block: 1rem; }
  .sv-side, .sv-side--report, .sv-side--system { padding: 1.5rem var(--edge) 2rem; }
  .sv-plot { height: 8rem; }
  .sv-built__item { grid-column: 1 / -1; }

  /* pinned on a phone: report on top, the clock strip, the system below */
  .scrolly .sv-stage { grid-template-rows: auto auto 1fr; align-content: start; }
  .scrolly .sv-side--report { padding: calc(var(--head-h) + .5rem) var(--edge) .6rem; }
  .scrolly .sv-side--system { padding: .6rem var(--edge) 7.25rem; }
  .scrolly .sv-side h3 { font-size: 1.15rem; }
  .scrolly .sv-chart { flex: none; margin-top: .4rem; min-height: 0; }
  .scrolly .sv-plot { flex: none; height: 5.25rem; }
  .scrolly .sv-side--system .sv-plot { height: 4rem; }
  .scrolly .sv-days { display: none; }
  .scrolly .sv-tile { margin-top: .5rem; }
  .scrolly .sv-tile--report { padding: .4rem .7rem; }
  .scrolly .sv-tile__n { font-size: 1.4rem; }
  .scrolly .sv-side--report .sv-log { display: none; }
  .scrolly .sv-latest { display: block; margin-top: .4rem; min-height: 1.4em; font-size: .88rem; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
  .scrolly .sv-log { margin-top: .45rem; padding-top: .3rem; }
  .scrolly .sv-log li { grid-template-columns: 5.9em 1fr; gap: .5rem; padding: .1rem 0; font-size: .86rem; line-height: 1.35; }
  .scrolly .sv-verdict { margin-top: .4rem; min-height: 1.3em; font-size: 1rem; }
  .scrolly .sv-rail { position: relative; left: auto; top: auto; bottom: auto; width: auto; height: 2.75rem; background: linear-gradient(90deg, var(--sv-pale) 50%, #05080d 50%); border-block: 1px solid var(--line-2); }
  .scrolly .sv-rail__line { display: none; }
  .scrolly .sv-rail__fill { left: 0; right: 0; top: auto; bottom: -1px; width: auto; height: 2px; transform-origin: 0 50%; transform: scaleX(var(--t, 0)); }
  .scrolly .sv-tick { left: calc(1.5rem + var(--f) * (100% - 3rem)); top: 0; margin: 0 0 0 -1.375rem; }
  .scrolly .sv-tick::before { display: none; }
  .scrolly .sv-tick span { position: static; }
  .scrolly .sv-rail__dot { display: none; }
  .scrolly .sv-clock { left: 0; top: 0; margin: -1px 0 0; width: 6.9rem; font-size: .88rem; }
  .scrolly .sv-ctl { left: .5rem; right: .5rem; bottom: .5rem; width: auto; margin: 0; grid-template-columns: 1fr auto; gap: 0 .9rem; padding: .5rem .9rem; border-radius: 1rem; }
  .scrolly .sv-play { min-width: 0; min-height: 2.75rem; padding: .5rem .9rem; font-size: .9rem; }
  .scrolly .sv-note { display: none; }
  .scrolly .sv-field label { font-size: .9rem; }

  .sv-end .seq__stick { text-align: left; }
  .sv-end__copy h2, .sv-end__copy .lede { margin-inline: 0; }
  .sv-end__copy .actions { justify-content: flex-start; }
  .scrolly .sv-end__report { width: 100%; height: 50%; bottom: auto; padding: var(--head-h) var(--edge) 0; clip-path: inset(0 0 calc(var(--k, 0) * 100%) 0); }
  .scrolly .sv-end__answer { left: 0; width: 100%; top: 50%; padding: 0 var(--edge); transform: translate3d(0, calc(var(--k, 0) * -8vh), 0); }
  .scrolly .sv-end__divider { left: 0; right: 0; top: 50%; bottom: auto; width: auto; height: 1px; transform: translate3d(0, calc(var(--k, 0) * -50svh), 0); }
}
@media (max-width: 40rem) and (max-height: 46rem) {
  .scrolly .sv-side--system .sv-chart { display: none; }
  .scrolly .sv-plot { height: 4.25rem; }
}
