/* Six Sigma and Project Management: opening screen v3 (12 Nov 2026).
   Pairs with assets/js/six-sigma-hero-v3.js. Colours are the page's own tokens (.sp-void sets --ib-*), no new hues.
   The hero is dark in both themes, so there is one look. Without JavaScript the figure is a static bell curve between
   the two specification limits (the .spv-fallback svg) and every word is in place.
   Planes: the page's grid and glow (far), the instrument canvas (middle), the labels and readouts (near). */

.sp-hero {
  --spv-px: 0; --spv-py: 0; --spv-s: 0;
  --spv-in: cubic-bezier(.23, 1, .32, 1);
  --spv-move: cubic-bezier(.77, 0, .175, 1);
}

/* ---- entrance: everything is painted at frame 0 (the H1 is the LCP), then rises a few pixels in 0.3 s ---- */
.sp-hero .sp-reveal { opacity: 1; transform: none; transition: none; }
@media (prefers-reduced-motion: no-preference) {
  .sp-hero .sp-reveal { animation: spv-rise .3s var(--spv-in) both; animation-delay: calc(var(--i, 0) * 12ms); }
  @keyframes spv-rise { from { transform: translate3d(0, 6px, 0); } to { transform: none; } }
}

/* ---- layout ---- */
.sp-hero-grid { grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: clamp(1.5rem, 3.4vw, 3.25rem); }
.sp-gauge-wrap { max-width: 42rem; margin-inline: 0 auto; }
@media (min-width: 1025px) { .sp-gauge-wrap { margin-right: calc(-1 * clamp(0px, 3vw, 2.5rem)); } }

.sp-hero h1 { font-size: clamp(2.4rem, 4.5vw, 3.6rem); max-width: none; }
.sp-hero-eyebrow { font-size: .72rem; letter-spacing: .2em; }

/* far plane: the page's own grid drifts opposite to the pointer */
.sp-hero .sp-grid { translate: calc(var(--spv-px) * -6px) calc(var(--spv-py) * -4px); }

/* ---- the instrument ---- */
.spv {
  position: relative; width: 100%;
  border: 1px solid var(--ib-line-strong); border-radius: .875rem;
  background: linear-gradient(180deg, rgba(16, 19, 20, .78), rgba(10, 12, 13, .62));
  box-shadow: var(--ib-shadow-lg);
  padding: .8rem .9rem .9rem;
  translate: 0 calc(var(--spv-s) * -22px);
  opacity: calc(1 - var(--spv-s) * .55);
}
.spv-head { display: flex; justify-content: space-between; margin-bottom: .55rem; }
.spv-txt { font-family: var(--ib-font-mono, ui-monospace, monospace); font-size: .6rem; letter-spacing: .14em; color: var(--ib-ink-muted); }
.spv-stage {
  position: relative; width: 100%; aspect-ratio: 600 / 340; overflow: hidden;
  border-radius: .5rem; background: rgba(6, 8, 10, .45);
  translate: calc(var(--spv-px) * -10px) calc(var(--spv-py) * -6px);
}
.spv-cv, .spv-fallback { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.spv-cv { touch-action: pan-y; cursor: ew-resize; -webkit-tap-highlight-color: transparent; }
.spv-fb-band { fill: rgba(242, 239, 232, .035); }
.spv-fb-bell { fill: rgba(242, 239, 232, .1); stroke: rgba(242, 239, 232, .8); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spv-fb-spec { stroke: var(--ib-accent); stroke-width: 1.2; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.spv-fb-tgt { stroke: rgba(242, 239, 232, .3); stroke-width: 1; stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
html.spv-on .spv-fallback { display: none; }

/* labels sit at the fixed rows of the two limits and the target (the value axis is fixed: 0.984 to 1.016) */
.spv-lbl {
  position: absolute; left: .55rem; pointer-events: none; z-index: 1;
  font-family: var(--ib-font-mono, ui-monospace, monospace); font-size: .6rem; letter-spacing: .14em;
  translate: calc(var(--spv-px) * -5px) calc(var(--spv-py) * -3px);
}
.spv-lbl-usl { top: calc(5% + 90% * .1875 - 1.15rem); color: var(--ib-accent); }
.spv-lbl-lsl { top: calc(5% + 90% * .8125 + .2rem); color: var(--ib-accent); }
.spv-lbl-tgt { top: calc(5% + 90% * .5 - 1.15rem); color: var(--ib-ink-muted); }

.spv-live, .spv-tapes { display: grid; gap: .45rem; margin-top: .55rem; }
.spv-live { grid-template-columns: 1.5fr 1fr 1fr 1fr; min-height: 5.1rem; }
html:not(.spv-on) .spv-live { visibility: hidden; }
.spv-tapes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.spv-tape, .spv-cell {
  background: rgba(10, 12, 13, .55); border: 1px solid var(--ib-line); border-radius: .375rem;
  padding: .45rem .6rem .5rem; min-width: 0;
}
.spv-tape span, .spv-cell span { display: block; font-family: var(--ib-font-mono, ui-monospace, monospace); font-size: .56rem; letter-spacing: .13em; color: var(--ib-ink-muted); white-space: nowrap; }
.spv-val, .spv-cell b {
  display: block; margin-top: .2rem; font-family: var(--ib-font-mono, ui-monospace, monospace);
  font-size: .95rem; font-weight: 500; letter-spacing: .02em; color: var(--ib-ink);
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.spv-val.is-key { color: var(--ib-accent); }
.spv-cell--cpk b { font-size: 1.55rem; line-height: 1.05; letter-spacing: -.01em; }
.spv-cell--cpk i { display: block; margin-top: .15rem; font-style: normal; font-family: var(--ib-font-mono, ui-monospace, monospace); font-size: .56rem; letter-spacing: .1em; color: var(--ib-ink-soft); white-space: nowrap; }
.spv-cell--cpk.is-good b { color: var(--ib-accent); }

.sp-gauge-note { margin-top: .85rem; text-align: left; }

/* ---- fact row: three cells ---- */
.sp-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { .sp-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px) { .sp-facts { grid-template-columns: 1fr; margin-top: 1.75rem; } }

/* ---- tablet: copy first, the instrument under it ---- */
@media (max-width: 1024px) {
  .sp-hero-grid { grid-template-columns: 1fr; }
  .sp-hero h1 { font-size: clamp(2.6rem, 8.2vw, 3.6rem); }
  .sp-gauge-wrap { max-width: 40rem; margin: 1.5rem 0 0; }
}

/* ---- phone: the chart is the field behind the copy, so the button stays on the first screen ---- */
@media (max-width: 640px) {
  .sp-hero { padding-bottom: 2rem; }
  .sp-hero h1 { font-size: clamp(2.05rem, 10.4vw, 2.7rem); line-height: 1.1; }
  .sp-hero-sub { font-size: .92rem; line-height: 1.5; margin-top: 1.1rem; }
  .sp-hero-actions { margin-top: 1.5rem; }
  .sp-hero-grid { position: static; gap: 0; }
  .sp-hero-grid > div:first-child { position: relative; z-index: 1; }
  .sp-gauge-wrap { display: contents; }
  .spv { display: contents; }
  .spv-stage {
    position: absolute; z-index: 0; left: 0; right: 0; top: 4.5rem; bottom: auto; height: 31rem; width: auto; aspect-ratio: auto;
    border-radius: 0; background: none; translate: none;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 70%, transparent 100%);
            mask-image: linear-gradient(180deg, transparent 0, #000 14%, #000 70%, transparent 100%);
    opacity: .5;
  }
  .spv-lbl { display: none; }   /* the chart sits behind the copy here: its limit labels would cross the eyebrow and the H1 */
  .spv-head, .spv-tapes, .sp-gauge-note { position: relative; z-index: 1; }
  .spv-head { margin: 2rem 0 .5rem; }
  .spv-tapes { margin-top: 0; }
  .spv-tape { padding: .4rem .5rem .45rem; }
  .spv-tape span { font-size: .5rem; letter-spacing: .08em; }
  .spv-val { font-size: .8rem; letter-spacing: 0; }
  .spv-live { display: none; }
  .sp-gauge-note { margin-top: .7rem; }
  .sp-hero-grid > div:first-child { pointer-events: none; }
  .sp-hero-grid > div:first-child .sp-hero-actions { pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .spv, .spv-stage, .spv-lbl, .sp-hero .sp-grid { translate: none; opacity: 1; }
}
