/* Live cliché marks under a textarea (cliche-check.js).
   Red pen — штампы, red dots — канцелярит, pencil wave — длинные предложения.
   Yellow stays for new, good text only. */

.ck-field {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.ck-backdrop {
  position: absolute;
  overflow: hidden;
  margin: 0;
  border-style: solid;
  border-color: transparent;
  color: transparent;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  pointer-events: none;
}

.ck-input {
  position: relative;
  z-index: 1;
  /* Keep the textarea's own height as the basis; grow only when the parent is taller. */
  flex: 1 1 auto;
  background: transparent;
}

.ck {
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.ck--stamp {
  background-image: linear-gradient(#cf3326, #cf3326);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 100% 2px;
}

.ck--bureau {
  background-image: radial-gradient(circle, #cf3326 1.1px, transparent 1.5px);
  background-position: 0 100%;
  background-repeat: repeat-x;
  background-size: 6px 4px;
}

/* A pencil wave under a sentence: the school mark for "too long, rewrite". */
.ck--long {
  text-decoration: underline wavy rgba(29, 28, 26, 0.45) 1px;
  text-decoration-skip-ink: none;
  text-underline-offset: 7px;
}

/* One moment of motion: when text arrives, the pen draws the lines. */
@media (prefers-reduced-motion: no-preference) {
  .ck-backdrop.is-fresh .ck--stamp {
    animation: ck-draw 380ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(min(var(--i, 0), 14) * 45ms + 120ms);
  }

  .ck-backdrop.is-fresh .ck--bureau,
  .ck-backdrop.is-fresh .ck--long {
    animation: ck-fade 320ms ease-out both;
    animation-delay: calc(min(var(--i, 0), 14) * 45ms + 120ms);
  }
}

@keyframes ck-draw {
  from {
    background-size: 0 2px;
  }
}

@keyframes ck-fade {
  from {
    opacity: 0;
  }
}
