/* 12 · Buttons and links in motion (Wave C). mid-button.js marks <html> .ib
   when it runs; without it the buttons and links are as look.css draws them.
   Tokens: motion.css.

   Ink: a main button fills like ink soaking into paper from where the pointer
   came in (a disc of the deeper blue growing from that point, under the label);
   on a fine pointer it leans a few pixels toward the pointer; on a touch screen a
   press is answered at once (pressed in, and the ink spreads from the finger).
   The text links' underlines are drawn: pointed at, the line pulls back to the
   right and is drawn again from the left. */
.ib :is(.dg-check,.dg-next,.cta,.btn.ink) {position:relative;isolation:isolate;overflow:hidden;-webkit-tap-highlight-color:transparent;--soak:var(--blue-deep)}
.ib :is(.dg-check,.dg-next,.cta,.btn.ink)::before {content:"";position:absolute;left:var(--sx,50%);top:var(--sy,50%);width:var(--sd,240px);height:var(--sd,240px);
  margin:calc(var(--sd,240px) / -2) 0 0 calc(var(--sd,240px) / -2);border-radius:50%;transform:scale(0);z-index:-1;pointer-events:none;
  /* Its advancing edge is feathered, like ink running into cotton paper (Wave C review, fix 8). */
  background:radial-gradient(circle,var(--soak) 0%,var(--soak) 62%,color-mix(in srgb,var(--soak) 0%,transparent) 100%)}
/* The deeper colour comes from the ink, not from a change of the whole button. */
.ib :is(.btn.ink,.dg-check:not(:disabled),.dg-next,.cta):hover {background:var(--blue)}
.ib .sky-band .cta {--soak:#d8e5ff}
.ib .sky-band .cta:hover {background:var(--paper)}
/* No grey tap square anywhere the page answers a finger itself. */
html.ib,html.ib :is(button,a,#exercise,#answer) {-webkit-tap-highlight-color:transparent}
/* The arrow of "Открыть задачу ↗" moves a little the way it points. */
.ib .btn.ink span {transition:transform var(--dur-micro) var(--ease-ink)}
@media (hover:hover) {.ib .btn.ink:hover span {transform:translate(2px,-2px)}}

/* Text links: the underline is a drawn line (a background), so it can be drawn. */
/* Placed on the foot of the content box (whatever the link's padding), where the
   text-decoration underline was drawn. */
.ib :is(.text-link,.faq-mail a,.qa a) {text-decoration-color:transparent;
  background:linear-gradient(currentColor,currentColor) 0 100%/100% 1px no-repeat;background-origin:content-box}
@media (hover:hover) {.ib :is(.text-link,.faq-mail a,.qa a):hover {animation:ib-redraw 560ms var(--ease-ink)}}
@keyframes ib-redraw {
  0% {background-position:100% 100%;background-size:100% 1px}
  42% {background-position:100% 100%;background-size:0% 1px}
  43% {background-position:0 100%;background-size:0% 1px}
  100% {background-position:0 100%;background-size:100% 1px}
}
@media (prefers-reduced-motion:reduce) {
  .ib :is(.text-link,.faq-mail a,.qa a):hover {animation:none}
  .ib .btn.ink span {transition:none}
}
