/* The path inside a game (aleph-bet-path.js): a game's lessons numbered in the order to take them, the one to play
   now in colour with a flag, the ones done ticked, the ones ahead grey until started — as the language pages draw
   their stops. Every colour is the look's (aleph-bet-theme.css). Nothing here moves a tile: the number and the flag
   sit on its edge, and the grid's rows open up only enough for the flag.

   The path is either a grid of lessons (data-ab-path on the grid) or a run of sections, each with a grid (data-ab-path
   on what holds them: the Verb Chart's stems); so "the grid" below is whatever holds the steps, and a right-to-left
   grid is one with dir="rtl" itself or inside the path. */

:is([data-ab-path], [data-ab-path] *):has(> [data-ab-step]) { row-gap: 1.35rem !important; padding-top: .55rem; }

[data-ab-path] :is([data-ab-step], [data-ab-review]) { position: relative; }

/* The number, at the corner the reading starts from (top right in Hebrew); a tick once the lesson has a star. */
.ab-step-num {
  position: absolute; top: -.6rem; left: -.5rem; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.75rem; height: 1.75rem; padding: 0 .35rem;
  border: 2px solid var(--ab-surface); border-radius: 999px; background: var(--ab-surface-2); color: var(--ab-muted);
  font: 800 .9rem/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-shadow: 0 2px 6px rgba(var(--ab-shadow), .18); pointer-events: none;
}
[data-ab-state="done"] > .ab-step-num { background: var(--ab-go); color: var(--ab-on-go); }
[data-ab-state="next"] > .ab-step-num { background: var(--ab-primary); color: var(--ab-on-go); }

/* In a right-to-left grid the number goes to the top RIGHT, where the reading starts — by the grid's dir, because a
   tile itself is often dir="ltr" for its English name — and the game's star, which sits there, to the other corner. */
:is([data-ab-path][dir="rtl"], [data-ab-path] [dir="rtl"]) > :is([data-ab-step], [data-ab-review]) > .ab-step-num { left: auto; right: -.5rem; }
:is([data-ab-path][dir="rtl"], [data-ab-path] [dir="rtl"]) > :is([data-ab-step], [data-ab-review]) > :is([class$="-stars"], [class$="-group-star"], [class$="-bubble-star"]) {
  right: auto; left: -.4rem;
}

/* A review (aleph-bet-path.js): "Review" where a number would be, a word, so a pill rather than a disc. */
.ab-step-review { padding: 0 .55rem; font-size: .72rem; letter-spacing: .02em; text-transform: uppercase; }

/* The one to play now: ringed, and flagged. */
[data-ab-path] [data-ab-state="next"] { z-index: 1; box-shadow: 0 0 0 5px var(--ab-go-ring), 0 12px 24px rgba(var(--ab-shadow), .16); }
.ab-step-flag {
  position: absolute; left: 50%; bottom: -.85rem; z-index: 2; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: .25rem; padding: .22rem .7rem .22rem .55rem;
  border: 2px solid var(--ab-surface); border-radius: 999px; background: var(--ab-go); color: var(--ab-on-go);
  font: 800 .78rem/1.15 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  white-space: nowrap; box-shadow: 0 3px 8px rgba(var(--ab-shadow), .2); pointer-events: none;
  animation: ab-step-flag 1.8s ease-in-out infinite;
}
[dir="rtl"] .ab-step-flag { direction: ltr; }
@keyframes ab-step-flag { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.07); } }

/* Ahead: grey until started, never locked — a hover or the keyboard brings its colour back. */
[data-ab-path] [data-ab-state="ahead"] { filter: grayscale(1); opacity: .6; transition: filter .15s, opacity .15s; }
[data-ab-path] [data-ab-state="ahead"]:focus-visible { filter: none; opacity: 1; }
@media (hover: hover) { [data-ab-path] [data-ab-state="ahead"]:hover { filter: none; opacity: 1; } }

@media (max-width: 480px) {
  :is([data-ab-path], [data-ab-path] *):has(> [data-ab-step]) { row-gap: 1.2rem !important; }
  .ab-step-num { min-width: 1.55rem; height: 1.55rem; font-size: .8rem; top: -.55rem; }
  .ab-step-review { font-size: .66rem; }
  .ab-step-flag { font-size: .72rem; padding: .18rem .55rem .18rem .45rem; bottom: -.8rem; }
}
@media (prefers-reduced-motion: reduce) { .ab-step-flag { animation: none; } }
