/* The learning stories page's hovers (Oren, 2026-10-09: the shared light-blue ring "is not good"). Each
   control moves the way its job reads -- on to the whole story, more stories below, writing your own,
   the course a story is about, closing a window -- and keeps its colours against the theme's green
   a:hover / button:hover (pinned in stories.css and overlays.css). Transitions only, so a hover let go
   of half-way turns back from where it is; :focus-visible shows the same state with a focus ring; with
   reduced motion the end state shows without the travel. Loaded after overlays.css. */

/* Forward is the reading direction: left in Hebrew and Arabic, right in English. caret-left.svg points
   left, so it turns round in English. */
.cil-st { --st-out: cubic-bezier(.22, 1, .36, 1); --st-fwd: -1; --st-flip: 1; --st-start: right; }
.lang-to-css-ltr .cil-st { --st-fwd: 1; --st-flip: -1; --st-start: left; }

/* ---- Buttons ---- */
.cil-st .cil-st-btn { transition: transform .2s var(--st-ease), text-underline-offset .3s var(--st-out), text-decoration-color .3s var(--st-out); }
.cil-st .cil-st-btn:focus-visible { outline: 2px solid var(--cil-blue-dark-1); outline-offset: 3px; }
.cil-st .cil-st-btn__label { position: relative; transition: transform .3s var(--st-out); }

/* Any other button (watch, send, close the thanks): an underline rises in under the words, and a play
   mark steps the way it points. Not while it is disabled -- "שולח…" stays still. */
.cil-st .cil-st-btn:not(.cil-st-btn--read, .cil-st-btn--share, .cil-st-btn--send, .cil-st-btn--retry) { text-decoration: underline transparent 2px; text-underline-offset: 10px; }
.cil-st .cil-st-btn:not(.cil-st-btn--read, .cil-st-btn--share, .cil-st-btn--send, .cil-st-btn--retry):not(:disabled, [aria-disabled="true"]):is(:hover, :focus-visible) { text-decoration-color: currentColor; text-underline-offset: 5px; }

/* "לנסות שוב" -- loading afresh: the circling arrow goes once round the way it points. */
.cil-st .cil-st-btn--retry img { transition: transform .6s var(--st-out); }
.cil-st .cil-st-btn--retry:is(:hover, :focus-visible) img { transform: rotate(360deg); }
.cil-st .cil-st-btn:is([data-st-watch], [data-st-reader-watch], [data-st-featured-play]) img { transition: transform .3s var(--st-out); }
.cil-st .cil-st-btn:is([data-st-watch], [data-st-reader-watch], [data-st-featured-play]):is(:hover, :focus-visible) img { transform: translateX(2px); }

/* "לסיפור המלא" -- on to the story: the words step back and a caret slides out ahead of them. */
.cil-st .cil-st-btn--read .cil-st-btn__label::after {
    content: ""; position: absolute; top: 50%; inset-inline-end: -22px; width: 16px; height: 16px; margin-top: -8px; background: currentColor;
    -webkit-mask: url("../../../images/stories-page/caret-left.svg") center / contain no-repeat; mask: url("../../../images/stories-page/caret-left.svg") center / contain no-repeat;
    opacity: 0; transition: opacity .3s var(--st-out), transform .3s var(--st-out);
}
.cil-st .cil-st-btn--read .cil-st-btn__label::after { transform: translateX(calc(var(--st-fwd) * -8px)) scaleX(var(--st-flip)); }
.cil-st .cil-st-btn--read:is(:hover, :focus-visible) .cil-st-btn__label { transform: translateX(calc(var(--st-fwd) * -6px)); }
.cil-st .cil-st-btn--read:is(:hover, :focus-visible) .cil-st-btn__label::after { opacity: 1; transform: translateX(0) scaleX(var(--st-flip)); }

/* "הצגת סיפורים נוספים" -- more below: the site's "show more" (design-system/load-more.css). */

/* "שיתוף הסיפור שלי" -- writing your own: the pencil tips onto its point and an underline is written
   under the words from where reading starts. */
.cil-st .cil-st-btn--share img { transform-origin: 15% 85%; transition: transform .35s var(--st-out); }
.cil-st .cil-st-btn--share .cil-st-btn__label::after {
    content: ""; position: absolute; inset-inline: 0; bottom: -3px; height: 2px; border-radius: 1px; background: currentColor;
    transform: scaleX(0); transform-origin: var(--st-start) center; transition: transform .35s var(--st-out);
}
.cil-st .cil-st-btn--share:is(:hover, :focus-visible) img { transform: rotate(-14deg) translateY(-1px); }
.cil-st .cil-st-btn--share:is(:hover, :focus-visible) .cil-st-btn__label::after { transform: scaleX(1); }

/* "שליחת הסיפור" -- sending what you wrote: the same writing, with the pen at the far end, the end the words
   are written toward. The line is written from where reading starts up to the pen, and the pen tips onto its
   point and steps on as if finishing the line; it faces the way of writing in each direction. Still while
   it sends (the spinner takes over). */
/* The span faces the pen (mirrored about its middle in English); the picture inside does the writing in its
   own terms -- tip down at its corner, a step towards its tip -- so it reads the same both ways. */
.cil-st .cil-st-btn--send .cil-st-btn__pen { flex: none; display: block; width: 18px; height: 18px; }
.lang-to-css-ltr .cil-st .cil-st-btn--send .cil-st-btn__pen { transform: scaleX(-1); }
.cil-st .cil-st-btn--send .cil-st-btn__pen img { display: block; transform-origin: 15% 85%; transition: transform .35s var(--st-out); }
.cil-st .cil-st-btn--send .cil-st-btn__label::after {
    content: ""; position: absolute; inset-inline: 0; bottom: -3px; height: 2px; border-radius: 1px; background: currentColor;
    transform: scaleX(0); transform-origin: var(--st-start) center; transition: transform .35s var(--st-out);
}
.cil-st .cil-st-btn--send:not([aria-disabled="true"]):is(:hover, :focus-visible) .cil-st-btn__label::after { transform: scaleX(1); }
.cil-st .cil-st-btn--send:not([aria-disabled="true"]):is(:hover, :focus-visible) .cil-st-btn__pen img {
    transform: translateX(-3px) rotate(-14deg) translateY(-1px);
    /* Once tipped onto its point, it keeps writing while the pointer stays: small strokes along the line. */
    animation: cil-st-write .9s ease-in-out .35s infinite;
}
@keyframes cil-st-write {
    0%, 100% { transform: translateX(-3px) rotate(-14deg) translateY(-1px); }
    20% { transform: translateX(-4.5px) rotate(-19deg) translateY(0); }
    40% { transform: translateX(-3.5px) rotate(-11deg) translateY(-2px); }
    60% { transform: translateX(-5.5px) rotate(-18deg) translateY(.5px); }
    80% { transform: translateX(-4px) rotate(-12deg) translateY(-1.5px); }
}
.cil-st .cil-st-btn--send.is-sending .cil-st-btn__pen { display: none; }

/* ---- The close button: the popup's iris (popup/assets/frontend-modal.css) ----
   A red disc opens from the centre -- the house close colour, as the site's other close buttons (Oren 2026-10-15)
   -- and the cross turns white a moment after; it closes on a slow-start curve, so the cross is dark again
   before the white shows. */
.cil-st .cil-st-close {
    overflow: hidden; isolation: isolate; transition: color .1s ease;
    -webkit-mask-image: radial-gradient(circle, var(--cil-black) 100%, transparent 100%); mask-image: radial-gradient(circle, var(--cil-black) 100%, transparent 100%);
}
.cil-st .cil-st-close::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: var(--cil-red); pointer-events: none;
    transform: scale(0); transition: transform .35s cubic-bezier(.55, 0, .8, .2);
}
.cil-st .cil-st-close:is(:hover, :focus-visible)::before { transform: scale(1); transition: transform .45s var(--st-out); }
.cil-st .cil-st-close:is(:hover, :focus-visible) { color: var(--cil-white); transition-delay: .08s; }
.cil-st .cil-st-close:focus-visible { outline: 3px solid var(--cil-yellow); outline-offset: -3px; }
.cil-st-close__cross {
    width: 20px; height: 20px; background: currentColor;
    -webkit-mask: url("../../../images/stories-page/close.svg") center / contain no-repeat; mask: url("../../../images/stories-page/close.svg") center / contain no-repeat;
}

/* ---- The course: the tag on a story and the reader's course row ----
   Its outline is drawn in from the reading start (parts.php, cil_stories_trace) and the book steps
   forward; the row's caret steps with it. */
.cil-st .cil-st-tag--course, .cil-st .cil-st-course { position: relative; }
.cil-st-trace { position: absolute; top: .75px; left: .75px; width: calc(100% - 1.5px); height: calc(100% - 1.5px); overflow: visible; pointer-events: none; transform: scaleX(var(--st-fwd)); }
/* Square caps overlap where the line closes on itself, so no seam shows; at rest the one dash sits wholly
   before the path's start (offset 105 of a 100 + 110 pattern), so not even a cap shows. */
.cil-st-trace rect { fill: none; stroke: var(--cil-blue-dark-1); stroke-width: 1.5; stroke-linecap: square; stroke-dasharray: 100 110; stroke-dashoffset: 105; transition: stroke-dashoffset .45s var(--st-out); }
.cil-st :is(.cil-st-tag--course, .cil-st-course):is(:hover, :focus-visible) .cil-st-trace rect { stroke-dashoffset: 0; }
/* In the story window the course row's outline draws slower: 10%, then another 15% (Oren, 2026-10-09). */
.cil-st .cil-st-course .cil-st-trace rect { transition-duration: .569s; }
/* The share form's three fields: the same draw round the field it is in, on focus -- 30% slower than the
   course row, then half that speed again (Oren, 2026-10-09: "way too fast"). */
.cil-st-field__box { position: relative; display: block; }
.cil-st-field__box textarea { display: block; }
.cil-st .cil-st-field__box .cil-st-trace rect { transition-duration: 1.48s; }
.cil-st .cil-st-field__box:focus-within .cil-st-trace rect { stroke-dashoffset: 0; }
.cil-st .cil-st-tag--course img, .cil-st .cil-st-course__icon, .cil-st .cil-st-course__go img { transition: transform .3s var(--st-out); }
.cil-st .cil-st-tag--course:is(:hover, :focus-visible) img { transform: translateX(calc(var(--st-fwd) * 2px)); }
.cil-st .cil-st-course:is(:hover, :focus-visible) .cil-st-course__icon { transform: translateX(calc(var(--st-fwd) * 3px)); }
.cil-st .cil-st-course:is(:hover, :focus-visible) .cil-st-course__go img { transform: translateX(calc(var(--st-fwd) * 3px)) scaleX(var(--st-flip)); }
.cil-st :is(.cil-st-tag--course, .cil-st-course):focus-visible { outline: 2px solid var(--cil-blue-dark-1); outline-offset: 2px; }

/* ---- Text links ("לסיפור המלא" on the wide tile, "לסיפור הבא", all the videos): the caret steps forward.
   Written with the turn-round, so English steps too (stories.css's mirror alone would hold it still). */
.cil-st .cil-st-stage__all img { transition: transform .25s var(--st-ease); }
.cil-st :is(.cil-st-link, .cil-st-stage__all):is(:hover, :focus-visible) img { transform: translateX(calc(var(--st-fwd) * 3px)) scaleX(var(--st-flip)); }

@media (prefers-reduced-motion: reduce) {
    /* !important: the hovers above are written at several specificities, and none of them may move here. */
    .cil-st :is(.cil-st-btn, .cil-st-btn *, .cil-st-close, .cil-st-trace rect, .cil-st-tag--course img, .cil-st-course img),
    .cil-st .cil-st-btn__label::after, .cil-st .cil-st-close::before, .cil-st .cil-st-stage__all img,
    .cil-st :is(.cil-more__btn, .cil-more__label), .cil-st .cil-more__label::after { transition: none !important; }
    /* Nothing travels: the caret shows in its place, the pencil stays level; the underline, the outline and the iris still show. */
    .cil-st :is(.cil-st-btn--read, .cil-more__btn):is(:hover, :focus-visible) :is(.cil-st-btn__label, .cil-more__label) { transform: none; }
    .cil-st .cil-st-btn--share:is(:hover, :focus-visible) img { transform: none; }
    .cil-st .cil-st-btn--send:is(:hover, :focus-visible) .cil-st-btn__pen img { transform: none; animation: none; }
    .cil-st .cil-st-btn--retry:is(:hover, :focus-visible) img { transform: none; }
}
