/* 04 · The plan strips the help away, in motion (Wave B, item 07). mid-plan.js
   marks the block .mp when it runs; without it (no JavaScript) none of this
   applies and sections.css shows the sentence at its first stage (marker and
   translations). Tokens: motion.css.

   mid-plan.js gives each of the three phrases its own progress for each kind of
   help, so that they go one after another, not in unison:
     --u (on each word of a translation)  0 written, 1 un-written (right to left)
     --b (on .hl)                          0 marker on, 1 swept off (right to left)
     --ul (on .hl)                         the pen's underline: 1 none, 0 drawn,
                                           back to 1 as it pulls back to the left */

/* (Wave J) The marker covers the whole height of the letters: from just above the ascenders (0.75 em over the
   baseline in Uslovie Book) to just below the descenders (0.22 em under it), in place of sections.css's
   .hl::before inset (30 % … 16 %, which covered little more than the x-height). The box of an inline phrase is the
   font's content area (1.03 em over the baseline, 0.29 em under it), so the insets are in em; the soft uneven
   corners, the tilt and the sweep below are unchanged. Lines stand 1.78 em apart (2.1 on a phone), so neighbouring
   lines' marks stay apart. Also without JavaScript. */
.plan .hl::before {inset:.2em -.07em .02em}

/* The translations, word by word, un-written behind a feathered edge. */
.mp .hl i {opacity:1}
/* (Wave J) Each word's box is widened by padding (and the layout kept by an equal negative margin), so the mask,
   which covers only the box, never cuts the handwriting: Bad Script's ascenders (б, в) stand 0.97 em over its
   baseline and its descenders (у, р, д) 0.42 em under it, beyond the 1 em line box, and б's flag overhangs to the
   right. */
.mp .hl i .w {display:inline-block;padding:.45em .35em .55em .25em;margin:-.45em -.35em -.55em -.25em;--k:calc(1 - var(--u,0));
  -webkit-mask:linear-gradient(90deg,#000 calc(100% - 12px),#0000) 0 0/calc(var(--k) * 100% + var(--k) * 14px) 100% no-repeat;
  mask:linear-gradient(90deg,#000 calc(100% - 12px),#0000) 0 0/calc(var(--k) * 100% + var(--k) * 14px) 100% no-repeat}

/* The marker, swept off from its right end; the end keeps the chisel's slant. */
.mp .hl::before {opacity:1;--r:calc((1 - var(--b,0)) * (100% + 14px));
  clip-path:polygon(-6px -6px,calc(var(--r) - 2px) -6px,calc(var(--r) - 10px) calc(100% + 6px),-6px calc(100% + 6px))}

/* The pen's underline, a slightly uneven stroke under the phrase. */
.mp .hl::after {display:none}
.mp .hl .ul {position:absolute;left:-.04em;right:-.04em;bottom:1%;width:calc(100% + .08em);height:.26em;overflow:visible;fill:none;stroke:var(--blue);stroke-linecap:round;pointer-events:none}
/* Stretched to the phrase (the stroke scales with it: 1.2 of the box's 6 units is about 2 px at 48 px type). */
.mp .hl .ul path {stroke-width:1.8;stroke-dasharray:1 2;stroke-dashoffset:var(--ul,1)}

/* (Wave H, fix 3) On a phone nothing is pinned: the sentence and its four stages fit one screen together
   (sections.css). The handwritten translations are 15.5 px. */
@media (max-width:820px) {
  .mp .hl .ul path {stroke-width:2}
  .mp .fade-days button {-webkit-tap-highlight-color:transparent}
  /* (Wave I, item 1) The four cells read as choices: each carries the round box of a form's single choice at its
     top right, open in the pen's faint blue, filled for the stage shown; no cell is dimmed (a dimmed cell read as
     switched off), and a cell darkens a little while it is pressed. */
  .js .mp .fade-days li:not(.now) {opacity:1}
  .mp .fade-days button {position:relative;padding-right:34px;transition:background-color .18s}
  .mp .fade-days li:nth-child(even) button {padding-right:22px}
  .mp .fade-days button::after {content:"";position:absolute;top:16px;right:10px;width:15px;height:15px;box-sizing:border-box;
    border:1.5px solid #1f43a673;border-radius:50%;background:radial-gradient(circle,var(--blue) 0 3.2px,#0000 3.7px) center/0 0 no-repeat;
    transition:border-color .25s,background-size .25s cubic-bezier(.2,.75,.2,1)}
  .mp .fade-days li:nth-child(even) button::after {right:0}
  .mp .fade-days .now button::after {border-color:var(--blue);background-size:100% 100%}
  .mp .fade-days button:active {background-color:#14171c0a}
}
@media (max-width:820px) and (prefers-reduced-motion:reduce) {.mp .fade-days button,.mp .fade-days button::after {transition:none}}

/* (Wave J) The plan's room in the scroll (mid-plan.js, RUN): the block is pinned under the masthead while the page
   scrolls on beneath it by --pin-run, and that scroll takes the help away. The run is the section's own height
   (a spacer after the block), so the sheet counter, the margin rail and the price's band below simply come later;
   the block arrives at its place and leaves it at the speed of the scroll. Only while mid-plan.js sets .pin: not
   with reduced motion, not without JavaScript. */
.mp.pin .plan-hold {position:sticky;top:var(--pin-top,0px)}
.mp.pin::after {content:"";display:block;height:var(--pin-run,0px)}
@media (prefers-reduced-motion:reduce) {.mp.pin .plan-hold {position:static}.mp.pin::after {display:none}}
