/* Story lab: a story card and three readers. State 0 unread, 1 scored and marked, 2 rewritten and scored again. */
.sl { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.sl-card { padding: 20px 24px 22px; }
.sl-card .kicker { margin-bottom: 12px; }
.sl-line { position: relative; font-size: 1.0625rem; line-height: 1.6; }
.sl-line b { font-weight: 600; }
.sl-strike, .sl-old { position: relative; }
.sl-strike { transition: opacity 240ms ease; }

/* state 1: a pencil line under the weak words, then the marker lands on them */
.sl-old::after {
  content: ""; position: absolute; left: -2px; right: -2px; bottom: -3px; height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='6'%3E%3Cpath d='M0 3q5-4 10 0t10 0' fill='none' stroke='%236f7678' stroke-width='1.4'/%3E%3C/svg%3E") 0 0 repeat-x;
  clip-path: inset(0 100% 0 0); transition: clip-path 200ms var(--ease);
}
.sl-worst .mk { margin-left: 10px; vertical-align: 1px; opacity: 0; transform: scale(0.6); transition: opacity 140ms linear, transform 200ms var(--ease); }
.sl[data-state="1"] .sl-old::after, .sl[data-state="2"] .sl-old::after { clip-path: inset(0); }
.sl[data-state="1"] .sl-old::after { transition: clip-path 380ms var(--ease) 950ms; }
.sl[data-state="1"] .sl-worst .mk, .sl[data-state="2"] .sl-worst .mk { opacity: 1; transform: none; }
.sl[data-state="1"] .sl-worst .mk { transition-delay: 1250ms; }

/* state 2: the old line is struck through and the new one is written in */
.sl-strike::after {
  content: ""; position: absolute; left: -3px; right: -3px; top: 52%; height: 1.5px; background: var(--pencil);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 200ms var(--ease);
}
.sl[data-state="2"] .sl-strike { opacity: 0.55; }
.sl[data-state="2"] .sl-strike::after { transform: scaleX(1); transition: transform 320ms var(--ease); }
.sl-new { clip-path: inset(0 100% 0 0); opacity: 0; transition: clip-path 200ms var(--ease), opacity 160ms linear; }
.sl[data-state="2"] .sl-new { clip-path: inset(0); opacity: 1; transition: clip-path 700ms var(--ease) 260ms, opacity 120ms linear 260ms; }

.sl-slot { position: relative; }
.sl-slot .squiggle { position: absolute; left: 0; top: 9px; transition: opacity 200ms linear 200ms; }
.sl-slot .squiggle + .squiggle { top: 24px; }
.sl[data-state="2"] .sl-slot .squiggle { opacity: 0; transition-delay: 0ms; }
.sl-new { min-height: 2.4em; }
.sl-card .btn-ink { margin-top: 20px; min-width: 9.5em; }

.sl-readers { display: grid; gap: 12px; }
.reader { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 14px 9px; }
.reader-name { font-weight: 600; font-size: 0.875rem; }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 11px; height: 11px; border: 1.5px solid var(--ink); border-radius: 2px; background: transparent; transition: background-color 180ms ease, transform 180ms var(--ease); }
.pips i.on { background: var(--ink); }
.pips i.on:nth-child(1) { transition-delay: 0ms; }
.pips i.on:nth-child(2) { transition-delay: 50ms; }
.pips i.on:nth-child(3) { transition-delay: 95ms; }
.pips i.on:nth-child(4) { transition-delay: 135ms; }
.pips i.on:nth-child(5) { transition-delay: 170ms; }
.reader-says { grid-column: 1 / -1; min-height: 1.25em; }
.reader:not(.scored) .reader-says { color: var(--pencil); }

@media (max-width: 640px) {
  .sl { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .sl-card { padding: 16px 16px 18px; }
  .sl-line { font-size: 0.9375rem; }
  .sl-readers { gap: 8px; }
  .reader { padding: 8px 12px 7px; }
  .reader-says { font-size: 1rem; }
}
