/* Effects layer, Writing (docs/FX.md). Normal and Turn it up only.
   - Text bleeds in like ink as it scrolls into view: the paragraphs of a piece, and the
     words on the home Writing cards.
   - A piece opens with a chrome drop cap (a piece's page only; not a song's lyrics).
   - On a piece's page the reading bar along the top is a thick run of liquid metal with
     a glowing drop at its tip. Each card's own progress line is chrome too. */

@property --fx-ink {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 200%;
}
@keyframes fx-ink {
  from { --fx-ink: 0%; filter: blur(3px); }
  to { --fx-ink: 200%; filter: none; }
}
@supports (animation-timeline: view()) {
  :where(html:not([data-fx="calm"])) :is(.writing-body > p, .writing-body > blockquote, .writing-cards .writing-open > p) {
    -webkit-mask-image: radial-gradient(ellipse 120% 160% at 0% 50%, #000 calc(var(--fx-ink) - 30%), transparent var(--fx-ink));
    mask-image: radial-gradient(ellipse 120% 160% at 0% 50%, #000 calc(var(--fx-ink) - 30%), transparent var(--fx-ink));
    animation: fx-ink linear both;
    animation-timeline: view();
    animation-range: entry 10% cover 30%;
  }
}

:where(html:not([data-fx="calm"])) .writing-page .writing-body > p:first-of-type::first-letter {
  float: left;
  margin: 0.06em 0.1em 0 0;
  font-family: var(--serif);
  font-size: 4.4em;
  line-height: 0.78;
  background: linear-gradient(160deg, #ffffff, #cfd8e2 22%, #5b6876 40%, #ffffff 55%, var(--grad-lilac) 72%, var(--grad-mint));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent1) 60%, transparent));
}
:where(html:not([data-fx="calm"])) .writing-page[data-kind="poem"] .writing-body > p:first-of-type::first-letter,
:where(html:not([data-fx="calm"])) .writing-page[data-kind="lyrics"] .writing-body > p:first-of-type::first-letter {
  float: none;
  font-size: 1.6em;
}

:where(html:not([data-fx="calm"])):has(.writing-page) .scroll-progress {
  height: 6px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, #5b6876, #ffffff, var(--accent1), #ffffff, var(--accent2), #ffffff, #5b6876) 0 0 / 200% 100%;
  box-shadow: 0 0 12px var(--accent2), 0 0 26px var(--accent1), inset 0 -1px 1px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  animation: grow linear, fx-drift 2.4s linear infinite alternate;
  animation-timeline: scroll(root block), auto;
}
:where(html:not([data-fx="calm"])) .writing-progress-fill {
  box-shadow: 0 0 8px var(--accent2), 0 0 2px #fff;
}
