/* ChiroOS landing: scroll journey (#features). Motion = transform + opacity only,
   all keyed by #features[data-step]. --step feeds calc() so one rule set drives every layer. */

#features[data-step="1"] { --step: 1; }
#features[data-step="2"] { --step: 2; }
#features[data-step="3"] { --step: 3; }
#features[data-step="4"] { --step: 4; }
#features[data-step="5"] { --step: 5; }
#features[data-step="6"] { --step: 6; }
#features[data-step="7"] { --step: 7; }
#features[data-step="8"] { --step: 8; }
#features[data-step="9"] { --step: 9; }
#features { --step: 1; --j-ease: cubic-bezier(0.2, 0.8, 0.2, 1); }

#features .j-head h2 { max-width: 760px; }
#features .j-wrap { position: relative; margin-top: 36px; }

/* ---- Stage ---- */
#features .j-stage {
  position: sticky;
  top: 72px;
  z-index: 4;
  height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 78% 12%, rgba(196, 139, 139, 0.14), transparent 55%),
    radial-gradient(rgba(43, 61, 80, 0.07) 1px, transparent 1.4px) 0 0 / 18px 18px,
    var(--paper);
  box-shadow: 0 10px 30px rgba(43, 61, 80, 0.08);
  --sc: 0.71;
}
#features .j-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 360px;
  height: 420px;
  margin: -210px 0 0 -180px;
  transform: scale(var(--sc));
}
#features .j-arts { position: absolute; inset: 0; }
#features .j-arts > :nth-child(1), #features .j-steps > :nth-child(1), #features .j-chip:nth-child(1) { --i: 1; --k: 0; }
#features .j-arts > :nth-child(2), #features .j-steps > :nth-child(2), #features .j-chip:nth-child(2) { --i: 2; --k: 1; }
#features .j-arts > :nth-child(3), #features .j-steps > :nth-child(3), #features .j-chip:nth-child(3) { --i: 3; --k: 2; }
#features .j-arts > :nth-child(4), #features .j-steps > :nth-child(4), #features .j-chip:nth-child(4) { --i: 4; --k: 3; }
#features .j-arts > :nth-child(5), #features .j-steps > :nth-child(5), #features .j-chip:nth-child(5) { --i: 5; --k: 4; }
#features .j-arts > :nth-child(6), #features .j-steps > :nth-child(6), #features .j-chip:nth-child(6) { --i: 6; --k: 5; }
#features .j-arts > :nth-child(7), #features .j-steps > :nth-child(7) { --i: 7; }
#features .j-arts > :nth-child(8), #features .j-steps > :nth-child(8) { --i: 8; }
#features .j-arts > :nth-child(9), #features .j-steps > :nth-child(9) { --i: 9; }

/* ---- Artifacts: swish in from the right, exit to the left ---- */
#features .j-art {
  --d: calc(var(--i) - var(--step));
  --a: min(calc(var(--d) * var(--d)), 1);
  --sg: clamp(-1, var(--d), 1);
  position: absolute;
  left: 30px;
  top: 34px;
  width: 300px;
  height: 380px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 11px;
  line-height: 15px;
  pointer-events: none;
  transform: translate3d(calc(var(--sg) * 150px), calc(var(--a) * 18px), 0) rotate(calc(var(--sg) * 7deg)) scale(calc(1 - var(--a) * 0.1));
  opacity: calc(1 - var(--a));
  transition: transform 750ms var(--j-ease), opacity 520ms ease;
}
#features .j-art.j-plain { overflow: visible; border: 0; background: none; box-shadow: none; }
#features .j-art.j-form {
  --p: clamp(0, calc(var(--step) - var(--i)), 1);
  left: 55px;
  width: 250px;
  border-radius: 28px;
  transform-origin: 0 0;
  transform: translate3d(calc(var(--p) * -51px), calc(var(--p) * -30px), 0) rotate(calc(var(--p) * -8deg)) scale(calc(1 - var(--p) * 0.88));
  opacity: calc(1 - var(--p));
}
#features .j-abs { position: absolute; left: 14px; right: 14px; }
#features .j-hd { position: absolute; left: 14px; right: 14px; top: 14px; }
#features .j-tag { margin: 0; color: var(--rose); font-size: 9px; font-weight: 800; letter-spacing: 0.08em; line-height: 12px; text-transform: uppercase; }
#features .j-ttl { margin: 2px 0 0; color: var(--teal); font-size: 13px; font-weight: 800; line-height: 18px; }
#features .j-lbl { display: block; color: var(--soft); font-size: 9px; font-weight: 700; line-height: 12px; }
#features .j-art b, #features .j-art strong { color: var(--teal); font-weight: 700; }
#features .j-muted { color: var(--muted); }
#features .j-r { height: 40px; padding-top: 6px; border-bottom: 1px solid var(--line); }
#features .j-r b { display: block; font-size: 11px; line-height: 16px; }
#features .j-sec { height: 56px; border-bottom: 1px solid var(--line); }
#features .j-sec p { max-width: 186px; height: 30px; margin: 4px 0 0; color: var(--muted); }

/* 1 form */
#features .j-notch { position: absolute; left: 50%; top: 8px; width: 44px; height: 4px; margin-left: -22px; border-radius: 4px; background: var(--line); }
#features .j-prog i { display: block; height: 4px; margin-top: 4px; overflow: hidden; border-radius: 4px; background: var(--paper); }
#features .j-prog i::after { content: ""; display: block; width: 75%; height: 100%; border-radius: 4px; background: var(--rose); }
#features .j-prog { font-size: 9px; font-weight: 700; line-height: 12px; color: var(--muted); }
#features .j-foot { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 10px; background: var(--mint-2); color: var(--teal); font-size: 10px; font-weight: 700; }
#features .j-foot svg, #features .j-pin { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--rose); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 2 emails */
#features .j-strip { position: absolute; height: 40px; padding: 2px 10px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--soft); font-size: 9px; font-weight: 700; line-height: 11px; }
#features .j-s2 { left: 24px; top: 0; width: 252px; background: var(--mint-2); }
#features .j-s1 { left: 12px; top: 12px; width: 276px; padding-top: 3px; }
#features .j-card { position: absolute; left: 0; right: 0; top: 28px; height: 220px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: var(--shadow); }
#features .j-send { display: flex; align-items: center; gap: 8px; height: 28px; }
#features .j-av { display: grid; width: 28px; height: 28px; flex: none; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font-size: 12px; font-weight: 800; }
#features .j-send small { display: block; color: var(--soft); font-size: 9px; line-height: 11px; }
#features .j-send b { display: block; font-size: 11px; line-height: 14px; white-space: nowrap; }
#features .j-pill { margin-left: auto; padding: 2px 7px; border-radius: 999px; background: var(--rose-2); color: var(--rose); font-size: 9px; font-weight: 800; white-space: nowrap; }
#features .j-subj { margin: 8px 0 0; color: var(--teal); font-size: 13px; font-weight: 800; line-height: 18px; }
#features .j-card p.j-ln { max-width: 186px; height: 30px; margin: 8px 0 0; color: var(--muted); }
#features .j-lang { display: flex; align-items: center; gap: 4px; height: 20px; margin-top: 14px; color: var(--soft); font-size: 9px; }
#features .j-lang em { padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-style: normal; font-weight: 800; }
#features .j-lang em:first-child { border-color: var(--teal); background: var(--teal); color: #fff; }
#features .j-lang span { margin-left: 4px; }
#features .j-dots { display: flex; gap: 6px; }
#features .j-dots span { flex: 1; height: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--soft); font-size: 10px; font-weight: 800; line-height: 22px; text-align: center; }
#features .j-dots span:nth-child(2) { border-color: var(--rose); background: var(--rose-2); color: var(--rose); }

/* 3 travel card */
#features .j-tabs { display: flex; gap: 6px; }
#features .j-tabs span { padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; font-weight: 700; }
#features .j-tabs span.on { border-color: var(--teal); background: var(--teal); color: #fff; }
#features .j-note { padding: 8px 10px; border-radius: 10px; background: var(--mint-2); color: var(--muted); }

/* 5 scan */
#features .j-svg { display: block; width: 90px; height: 164px; }
#features .j-gauge { height: 46px; }
#features .j-gauge span { display: flex; align-items: baseline; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 700; }
#features .j-gauge strong { font-size: 17px; line-height: 20px; }
#features .j-gauge i { display: block; height: 5px; margin-top: 3px; overflow: hidden; border-radius: 5px; background: var(--paper); }
#features .j-gauge i::after { content: ""; display: block; width: var(--v); height: 100%; border-radius: 5px; background: var(--rose); }

/* 6 plan */
#features .j-stats { display: flex; gap: 6px; }
#features .j-stats div { flex: 1; padding: 7px 0; border-radius: 10px; background: var(--mint-2); text-align: center; }
#features .j-stats b { display: block; font-size: 18px; line-height: 22px; }
#features .j-stats span { color: var(--soft); font-size: 9px; font-weight: 700; }
#features .j-pay { display: flex; gap: 8px; }
#features .j-pay div { flex: 1; height: 76px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
#features .j-pay div.on { border: 2px solid var(--rose); background: var(--rose-2); padding: 9px; }
#features .j-pay b { display: block; font-size: 12px; }
#features .j-pay span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 13px; }
#features .j-btn { height: 34px; border-radius: 8px; background: var(--rose); color: #fff; font-size: 12px; font-weight: 800; line-height: 34px; text-align: center; }

/* 7 end of plan */
#features .j-ba { display: flex; align-items: center; gap: 10px; height: 44px; border-bottom: 1px solid var(--line); }
#features .j-ba b { width: 38px; font-size: 12px; }
#features .j-ba span { color: var(--muted); font-size: 12px; font-weight: 700; }
#features .j-ba em { color: var(--rose); font-style: normal; font-weight: 800; }
#features .j-rhythm { padding: 10px 12px; border-radius: 12px; background: var(--teal); color: #fff; }
#features .j-rhythm .j-tag { color: var(--teal-2); }
#features .j-rhythm strong { display: block; margin-top: 2px; color: #fff; font-size: 17px; line-height: 22px; }
#features .j-rhythm span { display: block; margin-top: 2px; color: rgba(255, 255, 255, 0.78); font-size: 10px; line-height: 14px; }

/* 8 reviews + GBP */
#features .j-box { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
#features .j-stars { color: var(--rose); font-size: 13px; letter-spacing: 2px; line-height: 14px; }
#features .j-box p { max-width: 186px; margin: 6px 0 0; }
#features .j-gbp { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--teal); }
#features .j-sched { display: inline-block; margin: 8px 0 0; padding: 3px 8px; border-radius: 999px; background: var(--rose-2); color: var(--rose); font-size: 9px; font-weight: 800; }

/* 9 miracles of the week */
#features .j-wn { display: block; font-size: 11px; line-height: 16px; }
#features .j-badges { display: flex; gap: 6px; margin-top: 10px; }
#features .j-badges span { padding: 3px 8px; border-radius: 999px; background: var(--rose-2); color: var(--rose); font-size: 9px; font-weight: 800; line-height: 9px; }
#features .j-badges span + span { background: var(--mint-2); color: var(--teal); }
#features .j-goal { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ---- Data chips: the swish ---- */
#features .j-chips { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#features .j-chip {
  --x: 14px;
  --y: 3px;
  --s: 0.5;
  --o: 0;
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 9px 0 7px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 4px 12px rgba(43, 61, 80, 0.28);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  transform-origin: 0 50%;
  transform: translate3d(var(--x), var(--y), 0) scale(var(--s));
  opacity: var(--o);
  transition: transform 800ms var(--j-ease) calc(var(--k) * 60ms), opacity 420ms ease calc(var(--k) * 60ms);
}
#features .j-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--rose); }
/* step 1: chips rest invisibly on the form rows so they lift off it */
#features[data-step="1"] .j-chip { --x: 69px; --s: 1; }
#features[data-step="1"] .j-chip:nth-child(1) { --y: 139px; }
#features[data-step="1"] .j-chip:nth-child(2) { --y: 179px; }
#features[data-step="1"] .j-chip:nth-child(3) { --y: 219px; }
#features[data-step="1"] .j-chip:nth-child(4) { --y: 259px; }
#features[data-step="1"] .j-chip:nth-child(5) { --y: 299px; }
#features[data-step="1"] .j-chip:nth-child(6) { --y: 339px; }
/* landing spots per step: chip n -> (x, y) in canvas px; unlisted chips fade back to the source chip */
#features[data-step="2"] .j-chip:nth-child(1) { --x: 236px; --y: 111px; --s: 1; --o: 1; }
#features[data-step="2"] .j-chip:nth-child(3) { --x: 236px; --y: 143px; --s: 1; --o: 1; }
#features[data-step="2"] .j-chip:nth-child(4) { --x: 236px; --y: 181px; --s: 1; --o: 1; }
#features[data-step="2"] .j-chip:nth-child(5) { --x: 236px; --y: 220px; --s: 1; --o: 1; }
#features[data-step="3"] .j-chip:nth-child(1) { --x: 236px; --y: 61px; --s: 1; --o: 1; }
#features[data-step="3"] .j-chip:nth-child(3) { --x: 236px; --y: 106px; --s: 1; --o: 1; }
#features[data-step="3"] .j-chip:nth-child(2) { --x: 236px; --y: 146px; --s: 1; --o: 1; }
#features[data-step="3"] .j-chip:nth-child(4) { --x: 236px; --y: 186px; --s: 1; --o: 1; }
#features[data-step="3"] .j-chip:nth-child(5) { --x: 236px; --y: 226px; --s: 1; --o: 1; }
#features[data-step="4"] .j-chip:nth-child(1) { --x: 236px; --y: 61px; --s: 1; --o: 1; }
#features[data-step="4"] .j-chip:nth-child(6) { --x: 236px; --y: 111px; --s: 1; --o: 1; }
#features[data-step="4"] .j-chip:nth-child(2) { --x: 236px; --y: 167px; --s: 1; --o: 1; }
#features[data-step="4"] .j-chip:nth-child(4) { --x: 236px; --y: 223px; --s: 1; --o: 1; }
#features[data-step="5"] .j-chip:nth-child(1) { --x: 236px; --y: 61px; --s: 1; --o: 1; }
#features[data-step="5"] .j-chip:nth-child(3) { --x: 56px; --y: 212px; --s: 1; --o: 1; }
#features[data-step="5"] .j-chip:nth-child(6) { --x: 144px; --y: 254px; --s: 1; --o: 1; }
#features[data-step="5"] .j-chip:nth-child(4) { --x: 236px; --y: 276px; --s: 1; --o: 1; }
#features[data-step="6"] .j-chip:nth-child(1) { --x: 236px; --y: 61px; --s: 1; --o: 1; }
#features[data-step="6"] .j-chip:nth-child(4) { --x: 236px; --y: 316px; --s: 1; --o: 1; }
#features[data-step="6"] .j-chip:nth-child(2) { --x: 236px; --y: 356px; --s: 1; --o: 1; }
#features[data-step="7"] .j-chip:nth-child(1) { --x: 236px; --y: 61px; --s: 1; --o: 1; }
#features[data-step="7"] .j-chip:nth-child(4) { --x: 236px; --y: 102px; --s: 1; --o: 1; }
#features[data-step="7"] .j-chip:nth-child(3) { --x: 236px; --y: 150px; --s: 1; --o: 1; }
#features[data-step="7"] .j-chip:nth-child(6) { --x: 236px; --y: 188px; --s: 1; --o: 1; }
#features[data-step="8"] .j-chip:nth-child(4) { --x: 236px; --y: 127px; --s: 1; --o: 1; }
#features[data-step="8"] .j-chip:nth-child(1) { --x: 236px; --y: 157px; --s: 1; --o: 1; }
#features[data-step="8"] .j-chip:nth-child(3) { --x: 236px; --y: 285px; --s: 1; --o: 1; }
#features[data-step="9"] .j-chip:nth-child(1) { --x: 236px; --y: 124px; --s: 1; --o: 1; }
#features[data-step="9"] .j-chip:nth-child(2) { --x: 236px; --y: 160px; --s: 1; --o: 1; }
#features[data-step="9"] .j-chip:nth-child(4) { --x: 236px; --y: 261px; --s: 1; --o: 1; }

/* Source chip: where the form docks once it has shrunk away */
#features .j-src {
  --q: clamp(0, calc(var(--step) - 1), 1);
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(43, 61, 80, 0.1);
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  opacity: var(--q);
  transform: translate3d(0, calc((1 - var(--q)) * -8px), 0);
  transition: transform 700ms var(--j-ease) 160ms, opacity 500ms ease 160ms;
}
#features .j-src svg { width: 12px; height: 12px; fill: none; stroke: var(--rose); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Steps + progress rail ---- */
#features .j-steps { position: relative; }
#features .j-step {
  --e: calc(var(--step) - var(--i));
  position: relative;
  display: flex;
  align-items: center;
  min-height: 58vh;
  padding: 28px 0 28px 40px;
}
#features .j-step::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--line); }
#features .j-fill {
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--rose);
  transform-origin: 50% 0;
  transform: scaleY(clamp(0, calc(var(--e) + 0.5), 1));
  transition: transform 700ms var(--j-ease);
}
#features .j-dot {
  position: absolute;
  left: 0;
  top: calc(50% - 8px);
  width: 16px;
  height: 16px;
  border: 2px solid var(--teal-2);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 calc((1 - min(var(--e) * var(--e), 1)) * 6px) rgba(196, 139, 139, 0.22);
  transform: scale(calc(1.25 - min(var(--e) * var(--e), 1) * 0.25));
  transition: transform 500ms var(--j-ease), box-shadow 500ms ease;
}
#features .j-dot::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--rose); opacity: clamp(0, calc(var(--e) + 1), 1); transition: opacity 400ms ease; }
#features .j-copy { max-width: 440px; }
#features .j-num { margin: 0; color: rgba(143, 165, 176, 0.55); font-size: 40px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; transition: color 400ms ease; }
#features .j-step.is-active .j-num { color: var(--rose); }
#features .j-copy .feature-head { margin-top: 10px; }
#features .j-copy h3 { margin: 0; color: var(--teal); font-size: 22px; font-weight: 800; line-height: 1.2; }
#features .j-copy p.j-text { margin: 12px 0 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
#features .j-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 8px 0 0 -2px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--rose);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}
#features .j-link:hover { color: #b87a7a; text-decoration: underline; text-underline-offset: 3px; }
#features .j-link:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; border-radius: 4px; }

/* ---- Reveal helper (only hides when JS is running) ---- */
.j-js #features [data-reveal] { opacity: 0; transform: translate3d(0, 28px, 0); transition: opacity 600ms ease, transform 800ms var(--j-ease); }
.j-js #features [data-reveal].is-in { opacity: 1; transform: none; }
.j-js #features .j-step[data-reveal] { opacity: 1; transform: none; }
.j-js #features .j-step[data-reveal] .j-copy { opacity: 0; transform: translate3d(28px, 0, 0); transition: opacity 600ms ease, transform 800ms var(--j-ease); }
.j-js #features .j-step[data-reveal].is-in .j-copy { opacity: 1; transform: none; }

/* ---- Desktop: stage left, steps right ---- */
@media (min-width: 960px) {
  #features .j-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; margin-top: 48px; }
  #features .j-stage { top: 96px; height: 520px; border-radius: 24px; --sc: 1; }
  #features .j-wrap > .j-stage-col { min-width: 0; }
  #features .j-step { min-height: 70vh; }
}
@media (max-width: 959px) {
  #features .j-stage-col { display: contents; }
  #features .j-wrap { display: block; }
  /* phone: the artifacts alone carry the motion; the answer chips overlap text at this scale */
  #features .j-chip { display: none; }
}
/* clip, not hidden: hidden would make the section a scroll container and break the sticky stage */
#features { overflow-x: clip; }
@media (max-width: 959px) and (max-height: 640px) {
  #features .j-stage { position: relative; top: 0; }
}

/* ---- Reduced motion: opacity crossfade only ---- */
@media (prefers-reduced-motion: reduce) {
  #features .j-art, #features .j-art.j-form { transform: none; transition: opacity 300ms linear; }
  #features .j-chips { display: none; }
  #features .j-src { transform: none; transition: opacity 300ms linear; }
  #features .j-fill, #features .j-dot { transition: none; }
  #features .j-dot { transform: none; }
  .j-js #features [data-reveal], .j-js #features .j-step[data-reveal] .j-copy { transform: none; transition: opacity 300ms linear; }
}
