/* /tools/linkedin-post-generator/ in the painted theme (template-parts/painted/pages/linkedin-post-generator.php):
   beside the generator's form, one draft as the feed meets it. One card: the author (Jordan O., the draft and its tone),
   the post on a fixed line height (--lh), two dashed marks across it, after its second line (where a phone cuts it) and
   its third (a computer), each named at the card's right edge, what lies under the second faded under a wash of the
   card's white with See more beside it, then a gauge of the post's characters against LinkedIn's 3,000 (--g, a share,
   unitless).

   On entry, from the first paint and in CSS alone: the paragraphs come in one by one, the phone's mark draws, then the
   computer's, the wash settles over what the feed keeps behind see more, and the gauge fills. The drawn state is the
   marked post, so with reduced motion, or in a browser that runs no animation, it stands marked from the first paint. */

.lpg { display: grid; gap: 10px; margin: 0; text-align: left; }
.lpg-h { margin: 0; font: 600 11px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: color-mix(in srgb, var(--cd) 82%, #000); }
.lpg-lead { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text); }

.lpg-card { display: grid; gap: 14px; margin-top: 2px; padding: 16px 16px 14px; border-radius: 18px; background: #fff; box-shadow: 0 1px 2px rgba(70, 50, 36, .06), 0 18px 34px -26px rgba(80, 52, 40, .5); }
.lpg-by { display: flex; align-items: center; gap: 10px; }
.lpg-by .gsp-face { flex: none; width: 36px; height: 36px; border-radius: 50%; }
.lpg-by p { display: grid; gap: 2px; margin: 0; font-size: 13px; line-height: 1.3; }
.lpg-by b { font-weight: 600; color: var(--ink); }
.lpg-by span { font-size: 12px; color: var(--mute); }

/* the post: every line --lh tall and one blank line between paragraphs, so its n-th line ends at n times --lh */
.lpg-post { --lh: 21px; position: relative; }
.lpg-x { padding-right: 78px; font-size: 13px; line-height: var(--lh); color: var(--text); }
.lpg-x p { margin: 0; }
.lpg-x p + p { margin-top: var(--lh); }
/* a mark: a dashed line across the card where a line ends, its name over it at the right edge */
.lpg-cut { position: absolute; z-index: 1; left: 0; right: 0; top: calc(var(--at) * var(--lh)); height: 0; }
.lpg-cut::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; border-top: 1.5px dashed color-mix(in srgb, var(--ink) 50%, transparent); clip-path: inset(0); }
.lpg-cut-p { --at: 2; }
.lpg-cut-c { --at: 3; }
.lpg-cut-c::before { border-top-color: var(--c); }
.lpg-cut b { position: absolute; right: 0; bottom: 5px; font: 600 9.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.lpg-cut-c b { color: var(--cd); }
.lpg-cut i { position: absolute; right: 0; top: 6px; font: 500 11px/1.2 var(--sans); font-style: normal; color: var(--mute); white-space: nowrap; }
/* what the feed keeps behind see more: under the computer's mark, a wash of the card's white */
.lpg-fold { position: absolute; left: 0; right: 0; top: calc(3 * var(--lh) + 1px); bottom: 0; background: linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, .7)); pointer-events: none; }

/* the gauge: its name, the bar, the count against the limit */
.lpg-m { display: grid; grid-template-columns: 80px minmax(0, 1fr) 94px; align-items: center; gap: 10px; margin: 0; padding-top: 12px; border-top: 1px dashed var(--line); }
.lpg-mn { font: 600 9.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.lpg-c { font: 500 11.5px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--mute); text-align: right; white-space: nowrap; }
.lpg-c b { font-weight: 600; color: var(--cd); }
.lpg-g { position: relative; display: block; height: 8px; border-radius: 999px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line-2); }
.lpg-g::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--c); clip-path: inset(0 calc(100% - var(--g) * 1%) 0 0 round 999px); }
.lpg-ft { font-size: 11.5px; line-height: 1.4; color: color-mix(in srgb, var(--mute) 75%, var(--ink)); }

/* the moment, in ms from the first paint */
@media (prefers-reduced-motion: no-preference) {
  .lpg-x p { animation: lpg-in .4s ease calc(150ms + var(--i) * 130ms) backwards; }
  .lpg-cut::before { animation: lpg-draw .55s cubic-bezier(.3, .7, .3, 1) 1100ms backwards; }
  .lpg-cut-c::before { animation-delay: 1450ms; }
  .lpg-cut b, .lpg-cut i { animation: lpg-in .3s ease 1300ms backwards; }
  .lpg-cut-c b, .lpg-cut-c i { animation-delay: 1650ms; }
  .lpg-fold { animation: lpg-fade .6s ease 1850ms backwards; }
  .lpg-g::before { animation: lpg-fill .7s cubic-bezier(.3, .7, .3, 1) 2150ms backwards; }
}
@keyframes lpg-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes lpg-draw { from { clip-path: inset(0 100% 0 0); } }
@keyframes lpg-fade { from { opacity: 0; } }
@keyframes lpg-fill { from { clip-path: inset(0 100% 0 0 round 999px); } }

@media (max-width: 480px) {
  .lpg-card { padding: 14px 14px 12px; }
  .lpg-x { padding-right: 70px; }
  .lpg-m { grid-template-columns: 74px minmax(0, 1fr) 84px; }
}
