/* ============ #why (v7): 不是你不够努力。/ 是这 3 个错。 ============
   Paper. Head + 3 mistake rows (huge word, red ✕, one line) -> punch alone -> two-lane diagram
   (靠感觉: cracked red arrow straight to 下单 / 先测: green 测 node + bin) -> receipt with blank amounts + RM0 stamp -> CTA.
   ds.css owns section, head, type, marks, receipt and stamp. Everything here is scoped under #why.
   Motion: sec-why.js adds .why-armed to the section and .is-in to [data-why-reveal] in view.
   Hidden start states hang on html.ds-motion #why.why-armed, so no JS / reduced motion = final state. */

#why .why-h2 .l { display: block; }

/* ---- 1 · the three mistakes ---- */
#why .why-top { gap: var(--ds-s6); }
#why .why-ms { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ds-line); }
#why .why-m { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "w x" "t t"; align-items: center; gap: var(--ds-s1) var(--ds-s4);
  padding: var(--ds-s2) 0 var(--ds-s4); border-bottom: 1px solid var(--ds-line); }
#why .why-w { grid-area: w; margin: 0; font: 900 var(--ds-fs-num-l)/1.1 var(--ds-zh); letter-spacing: .02em; color: var(--ds-text); white-space: nowrap; }
#why .why-x { grid-area: x; width: 40px; height: 40px; }
#why .why-x svg { width: 22px; height: 22px; }
#why .why-t { grid-area: t; margin: 0; max-width: var(--ds-measure); font: 400 var(--ds-fs-body)/var(--ds-lh-body) var(--ds-zh); color: var(--ds-text-2); }

/* ---- 2 · punch line, alone ---- */
#why .why-punch { margin: var(--ds-s5) 0 0; text-align: center; }
#why .why-punch-l { margin: 0; font: 900 var(--ds-fs-num-l)/1.2 var(--ds-zh); letter-spacing: .02em; color: var(--ds-text); word-break: keep-all; }
#why .why-punch-l .l { display: inline; }
#why .why-punch-l .ds-nw { display: inline-block; }
#why .why-punch-s { margin: var(--ds-s2) 0 0; font: 400 var(--ds-fs-lead)/var(--ds-lh-lead) var(--ds-zh); color: var(--ds-text-2); }

/* ---- 3 · two lanes. Both rows share one column grid, so the empty middle of the top lane sits
         right above the green 测: the one extra step is the only difference. ---- */
#why .why-flow { margin: var(--ds-s6) auto 0; max-width: 760px; }
#why .wl-box { display: grid; gap: var(--ds-s2); }
#why .wl { padding: var(--ds-s4); border-radius: var(--ds-r); background: var(--ds-white); box-shadow: inset 0 0 0 1px var(--ds-line); }
#why .wl-k { display: flex; align-items: center; gap: var(--ds-s2); margin: 0 0 var(--ds-s2); font: 700 var(--ds-fs-body)/1.4 var(--ds-zh); color: var(--ds-text); }
#why .wl-k small { margin-left: var(--ds-s1); font: 400 var(--ds-fs-fine)/1.4 var(--ds-zh); color: var(--ds-mute); }
#why .wl-ic { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--ds-white); flex: none; }
#why .wl-ic svg { width: 14px; height: 14px; }
#why .wl-ic--bad { background: var(--ds-dn-t); }
#why .wl-ic--good { background: var(--ds-up); }

#why .wl-row { --mid: 48px; display: grid; grid-template-columns: auto minmax(16px, 1fr) var(--mid) minmax(16px, 1fr) 7.2em; align-items: center; column-gap: var(--ds-s1); }
#why .wl-n1 { grid-column: 1; }
#why .wl-end { grid-column: 5; display: flex; align-items: center; gap: var(--ds-s2); min-width: 0; }
#why .wl-node { display: inline-block; padding: var(--ds-s2) 10px; border-radius: var(--ds-r-s); background: var(--ds-paper); box-shadow: inset 0 0 0 1px var(--ds-line);
  font: 700 var(--ds-fs-small)/1.4 var(--ds-zh); color: var(--ds-text); white-space: nowrap; }
#why .wl-node--pass { background: var(--ds-white); box-shadow: inset 0 0 0 2px var(--ds-up); color: var(--ds-up-t); }
#why .wl-out { font: 900 var(--ds-fs-h3)/1 var(--ds-zh); color: var(--ds-dn-t); }

/* arrows: a 2px line + a fixed head (the line stretches, the head never distorts) */
#why .wl-arrow { display: flex; align-items: center; min-width: 0; height: 24px; color: var(--ds-up); transform-origin: 0 50%; }
#why .wl-ln { flex: 1; height: 2px; min-width: 4px; border-radius: 1px; background: currentColor; }
#why .wl-head { flex: none; width: 9px; height: 14px; margin-left: -6px; }
#why .wl-a1 { grid-column: 2; } #why .wl-a2 { grid-column: 4; }
#why .wl-arrow--crack { grid-column: 2 / 5; color: var(--ds-dn); }
#why .wl-crack { flex: none; width: 16px; height: 24px; margin: 0 2px; }

/* the green 测 node: the one step in the middle */
#why .wl-test { grid-column: 3; display: grid; place-items: center; width: var(--mid); height: var(--mid); border-radius: 50%; background: var(--ds-up); color: var(--ds-white);
  font: 900 var(--ds-fs-h3)/1 var(--ds-zh); }

/* the bin hangs under 测: bad ideas drop out here */
#why .wl-bin { grid-column: 3; grid-row: 2; justify-self: center; display: grid; justify-items: center; gap: 2px; margin-top: 2px; color: var(--ds-mute); }
#why .wl-drop { width: 0; height: 8px; border-left: 2px dashed currentColor; }
#why .wl-bin-ic { width: 22px; height: 22px; }
#why .wl-bin small { font: 700 var(--ds-fs-fine)/1.3 var(--ds-zh); color: var(--ds-mute); white-space: nowrap; }

#why .why-diff { margin: var(--ds-s5) auto 0; max-width: 760px; font-size: var(--ds-fs-h3); }

/* ---- 4 · the price of the pain ---- */
#why .why-cost { display: grid; grid-template-areas: "h" "r" "c"; gap: var(--ds-s4); margin-top: var(--ds-s6); padding-top: var(--ds-s6); border-top: 1px solid var(--ds-line); }
#why .why-cost-head { grid-area: h; }
#why .why-cost-q { margin-top: 0; font-size: var(--ds-fs-h2); line-height: var(--ds-lh-h2); font-weight: 900; }
#why .why-cost-q .l { display: block; }
#why .why-rc { grid-area: r; width: 100%; justify-self: center; }
#why .why-rc .ds-receipt-in { padding: var(--ds-s4) var(--ds-s5) calc(var(--ds-s4) + 10px); }
#why .why-rc .ds-receipt-rows { gap: var(--ds-s2); }
#why .why-rc .ds-receipt-rows b { min-width: 5.5em; }
#why .why-rc-sum { margin-top: var(--ds-s1); padding-top: var(--ds-s2); border-top: 2px solid var(--ds-text); font-weight: 700 !important; }
#why .why-rc-sum b { color: var(--ds-text); }
#why .why-rc-sum .ds-blank { border-bottom-color: var(--ds-text); }
#why .why-rc-total { justify-content: center; margin-top: var(--ds-s2); padding: var(--ds-s2) 0 0; border-top: 2px dashed var(--ds-line); }
#why .why-cta { grid-area: c; margin-top: 0; }

/* ---- motion: once, in view, every step <= 400ms ---- */
html.ds-motion #why.why-armed .why-m { transition: opacity var(--ds-t3) var(--ds-ease), transform var(--ds-t3) var(--ds-ease); }
html.ds-motion #why.why-armed .why-m:nth-child(2) { transition-delay: .12s; }
html.ds-motion #why.why-armed .why-m:nth-child(3) { transition-delay: .24s; }
html.ds-motion #why.why-armed .why-x { transition: transform var(--ds-t2) var(--ds-ease-thunk), opacity var(--ds-t1) ease-out; transition-delay: inherit; }
html.ds-motion #why.why-armed .why-ms:not(.is-in) .why-m { opacity: 0; transform: translateX(-16px); }
html.ds-motion #why.why-armed .why-ms:not(.is-in) .why-x { opacity: 0; transform: scale(1.6); }

html.ds-motion #why.why-armed .wl-arrow--crack { transition: transform var(--ds-t3) var(--ds-ease); }
html.ds-motion #why.why-armed .wl-out { transition: opacity var(--ds-t2) ease-out .35s; }
html.ds-motion #why.why-armed .wl-test { transition: transform var(--ds-t2) var(--ds-ease-thunk) .3s, opacity var(--ds-t1) ease-out .3s; }
html.ds-motion #why.why-armed .wl-bin { transition: transform var(--ds-t3) var(--ds-ease) .5s, opacity var(--ds-t2) ease-out .5s; }
html.ds-motion #why.why-armed .why-flow:not(.is-in) .wl-arrow--crack { transform: scaleX(0); }
html.ds-motion #why.why-armed .why-flow:not(.is-in) .wl-out { opacity: 0; }
html.ds-motion #why.why-armed .why-flow:not(.is-in) .wl-test { opacity: 0; transform: scale(.5); }
html.ds-motion #why.why-armed .why-flow:not(.is-in) .wl-bin { opacity: 0; transform: translateY(-10px); }

/* ---- 360 and below: a touch tighter so the lanes never overflow ---- */
@media (max-width: 374px) {
  #why .wl { padding-left: var(--ds-s2); padding-right: var(--ds-s2); }
  #why .wl-row { --mid: 44px; grid-template-columns: auto minmax(12px, 1fr) var(--mid) minmax(12px, 1fr) 6.8em; }
  #why .wl-node { padding: 6px 8px; font-size: var(--ds-fs-fine); }
}

/* ---- desktop ---- */
@media (min-width: 960px) {
  #why .why-m { grid-template-columns: 216px 1fr auto; grid-template-areas: "w t x"; gap: var(--ds-s5); padding: var(--ds-s5) 0; }
  #why .why-w { font-size: 48px; }
  #why .why-t { font-size: var(--ds-fs-lead); }
  #why .why-x { width: 48px; height: 48px; }
  #why .why-x svg { width: 26px; height: 26px; }
  /* fix loop: punch (left) beside the two lanes (right) instead of stacked */
  #why .why-mid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: var(--ds-s8); align-items: center; margin-top: var(--ds-s8); }
  #why .why-mid .why-punch { margin: 0; text-align: left; }
  #why .why-mid .why-flow { margin: 0; max-width: none; }
  #why .why-punch-l { font-size: var(--ds-fs-num-l); }
  #why .wl { padding: var(--ds-s5) var(--ds-s6) var(--ds-s6); }
  #why .wl-k { font-size: var(--ds-fs-lead); }
  #why .wl-row { --mid: 64px; column-gap: var(--ds-s2); grid-template-columns: auto minmax(24px, 1fr) var(--mid) minmax(24px, 1fr) 9em; }
  #why .wl-node { padding: 10px var(--ds-s4); font-size: var(--ds-fs-body); }
  #why .wl-test { font-size: 28px; }
  #why .wl-out { font-size: 28px; }
  #why .why-cost { grid-template-columns: 5fr 7fr; grid-template-areas: "h r" "c r"; grid-template-rows: auto 1fr; column-gap: var(--ds-s9); row-gap: var(--ds-s6); align-items: start; margin-top: var(--ds-s8); padding-top: var(--ds-s8); }
  #why .why-rc { max-width: 440px; justify-self: end; }
}

/* fix loop (page length): phones end the section on the s6 step (40) instead of 64; desktop keeps --ds-sec-y */
@media (max-width: 959px) { #why.ds-sec { padding-bottom: var(--ds-s6); } }

/* ---------- v9 mobile polish (12 Nov): the end column fits the widest end (过了才下单), so the lanes fill the card ---------- */
@media (max-width: 959px) {
  #why .wl-row { grid-template-columns: auto minmax(16px, 1fr) var(--mid) minmax(16px, 1fr) 5.8em; }
}
@media (max-width: 374px) {
  #why .wl-row { grid-template-columns: auto minmax(12px, 1fr) var(--mid) minmax(12px, 1fr) 5.3em; }
}
