/* Engine `ruler` (DESIGN §13.1): every selector starts with `.ru-` (state classes `.is-*` allowed). Package B.
   The Pilana workshop: warm board walls, the bench, the measured things, the clothespins, the pencil on the ruler's
   edge, the saw, the bridge over the river, Detlić Tok. The things are drawn in local units under a matrix, so every
   shape keeps a screen-px ink line (vector-effect). Motion is transform / opacity only; no filters. */

/* ---------------------------------------------------------------- drawings in local units */
.ru-art * { vector-effect: non-scaling-stroke; }
.ru-w { transform-box: fill-box; transform-origin: center; }
.ru-lbl { font-size: 22px; }
.ru-fragnum { font-weight: 800; fill: #24263B; }
.ru-notetext { font-weight: 900; fill: #EC4A3D; }
.ru-gap-ghost { fill: rgba(47, 111, 214, .1); stroke: #2F6FD6; stroke-width: 2.4; stroke-dasharray: 7 5; }

/* ---------------------------------------------------------------- the pencil on the ruler's edge, the saw */
.ru-graphite { fill: none; stroke: #3C3F5C; stroke-width: 5; stroke-linecap: round; }
.ru-pencil.is-parked { opacity: .9; }
.ru-pencil.is-hint, .ru-saw.is-hint, .ru-frag.is-hint { animation: ru-glow .9s ease-in-out infinite; }
.ru-kerf { stroke: #5B3A1A; stroke-width: 4; stroke-linecap: round; }
.ru-dust { animation: ru-fall .7s ease-in forwards; }
@keyframes ru-fall { to { opacity: 0; transform: translateY(14px); } }
@keyframes ru-glow { 50% { opacity: .55; } }

/* ---------------------------------------------------------------- clothespins (estimate) */
.ru-clip { cursor: grab; }
.ru-clip.is-active > .ru-art { opacity: 1; }
.ru-clip.is-parked:not(.is-active) { opacity: .92; }
.ru-clip.is-active.is-parked { animation: ru-hop 1.2s ease-in-out infinite; }
.ru-clip.is-in { animation: ru-snap .35s cubic-bezier(.3, 1.5, .5, 1); }
.ru-clip.is-lifted { opacity: .95; }
.ru-clip.is-guess { opacity: .95; }
@keyframes ru-hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-5px); } }
@keyframes ru-snap { from { transform: translateY(-10px) scale(1.12); } }

/* ---------------------------------------------------------------- hints, marks, gags */
.ru-hintring { fill: rgba(255, 197, 61, .3); stroke: #F5A300; stroke-width: 4; animation: ru-breathe .9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.ru-hintring.is-zero { stroke-dasharray: 6 4; }
.ru-dropline { fill: none; stroke: #F5A300; stroke-width: 3.4; stroke-dasharray: 7 6; stroke-linecap: round; }
.ru-hintbtn { animation: ru-btn-pulse .9s ease-in-out infinite; }
@keyframes ru-btn-pulse { 50% { box-shadow: 0 0 0 8px rgba(255, 197, 61, .55); } }
@keyframes ru-breathe { 50% { transform: scale(1.18); opacity: .55; } }
.ru-endmark { fill: none; stroke: #17A565; stroke-width: 5; animation: ru-pop .45s cubic-bezier(.3, 1.5, .5, 1); transform-box: fill-box; transform-origin: center; }
.ru-miss { fill: rgba(255, 150, 54, .28); stroke: #FF9636; stroke-width: 4; animation: ru-pop .3s ease-out; transform-box: fill-box; transform-origin: center; }
.ru-diff { fill: rgba(255, 150, 54, .38); stroke: #FF9636; stroke-width: 2.4; animation: ru-fadein .3s ease-out; }
.ru-diff.is-out { opacity: 0; transition: opacity .45s; }
.ru-before { fill: rgba(255, 150, 54, .4); stroke: #FF9636; stroke-width: 2.4; animation: ru-blink .6s steps(2) 2; }
.ru-count { fill: rgba(23, 165, 101, .25); stroke: #17A565; stroke-width: 2.4; animation: ru-fadein .25s ease-out; }
.ru-countnum { font-weight: 900; fill: #0F8550; }
.ru-cmcount circle { fill: #FFC53D; stroke: #24263B; stroke-width: 2.4; }
.ru-cmcount text { font-weight: 900; font-size: 17px; fill: #24263B; }
.ru-cmcount { animation: ru-pop .35s cubic-bezier(.3, 1.5, .5, 1); transform-box: fill-box; transform-origin: center; }
.ru-wrongline { fill: none; stroke: #FF9636; stroke-width: 5; stroke-linecap: round; }
.ru-nudge { animation: ru-nudge .4s ease-in-out; }
@keyframes ru-nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes ru-pop { from { transform: scale(.3); opacity: 0; } }
@keyframes ru-fadein { from { opacity: 0; } }
@keyframes ru-blink { 50% { opacity: .2; } }
.ru-obj.is-shake { animation: ru-shake .38s ease-in-out 2; }
@keyframes ru-shake { 25% { transform: translateX(-4px) rotate(-1deg); } 75% { transform: translateX(4px) rotate(1deg); } }
.is-bounce.ru-w { animation: ru-bounce .42s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes ru-bounce { 40% { transform: translateY(-6px) scale(1.04); } }

/* ---------------------------------------------------------------- payoffs */
.ru-ray { stroke: #FFC53D; stroke-width: 4; stroke-linecap: round; transform: rotate(var(--a)); animation: ru-ray .8s ease-out forwards; }
@keyframes ru-ray { from { opacity: 1; } to { opacity: 0; transform: rotate(var(--a)) translateY(-10px); } }
.ru-hawk { animation: ru-stamp .5s cubic-bezier(.3, 1.6, .5, 1); transform-box: fill-box; transform-origin: center; }
.ru-fx .is-out { opacity: 0; transition: opacity .5s; }
@keyframes ru-stamp { from { transform: scale(2.2) rotate(-25deg); opacity: 0; } }
.ru-rain { animation: ru-rain 1.9s cubic-bezier(.4, 0, .7, 1) both; animation-delay: calc(var(--i) * 0.12s); }
.ru-raintext { font-weight: 900; font-size: 17px; fill: #24263B; }
@keyframes ru-rain { from { opacity: 0; translate: 0 -30px; } 15% { opacity: 1; } 80% { opacity: 1; } to { opacity: 0; translate: 0 260px; } }
.ru-k-gusenica.is-wiggle .ru-seg { animation: ru-inch .5s ease-in-out infinite; animation-delay: calc(var(--i) * -0.08s); }
@keyframes ru-inch { 50% { transform: translateY(-0.12px); } }
.ru-wave { animation: ru-wave 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -0.4s); }
@keyframes ru-wave { 50% { transform: translateX(0.18px); } }
.ru-piece.is-landed { animation: ru-bounce .42s cubic-bezier(.3, 1.5, .5, 1); }
.ru-splash { animation: ru-splash .6s ease-out forwards; }
@keyframes ru-splash { from { opacity: 1; transform: scale(.5); } to { opacity: 0; transform: scale(1.4) translateY(-6px); } }
.ru-tok-hop { animation: ru-tokhop .42s ease-in-out infinite; }
@keyframes ru-tokhop { 50% { transform: translateY(-6px); } }
.ru-eraser { pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .ru-hintring, .ru-hintbtn, .ru-clip.is-active.is-parked, .ru-wave, .ru-tok-hop, .ru-k-gusenica.is-wiggle .ru-seg, .ru-pencil.is-hint, .ru-saw.is-hint, .ru-frag.is-hint { animation: none !important; }
}
[data-motion="reduce"] .ru-hintring, [data-motion="reduce"] .ru-wave, [data-motion="reduce"] .ru-tok-hop, [data-motion="reduce"] .ru-clip { animation: none !important; }

/* Workaround (foundation patch requested): js/geo/ruler.js draws the unit „cm“ at length + 0.3, on top of the last
   two-digit numeral („12“ reads „12m“). Until the foundation moves it, the engine hides it; the tasks say „cm“. */
.ru-board .st-ruler-unit { display: none; }
.ru-difftext { font-weight: 900; fill: #E07A1C; paint-order: stroke; stroke: #FFF7EA; stroke-width: 5px; stroke-linejoin: round; }
