/* Bolu Yönetim assistant – robot mascot. Replaces figur.css (same .bf classes and state names).
   States: .bf--bekleme .bf--selam .bf--dusunuyor .bf--konusuyor .bf--yonlendir
   Sizes: .bf--mini (24) .bf--kucuk (40) .bf--orta (44) close-up (head only); .bf--buyuk full body (160–220 width).
   The figure is decorative (aria-hidden). Variables via JS: --rb-ust/--rb-alt (free arm pose), --rb-tx/--rb-ty/--rb-th/--rb-ts (defaults for tracking; for performance robot.js writes the tracking value directly as an inline transform on .rb-takip-kafa and .rb-izle). */
.bf { display: inline-block; flex: none; width: var(--bf-boy, 44px); height: var(--bf-boy, 44px); overflow: visible; vertical-align: middle; pointer-events: none; }
.bf--mini { --bf-boy: 24px; }
.bf--kucuk { --bf-boy: 40px; }
.bf--orta { --bf-boy: 44px; }
.bf--buyuk { --bf-boy: clamp(160px, 24vw, 220px); }
.rb.bf--buyuk { height: calc(var(--bf-boy) * 1.2); }
.rb--yakin .rb-beden { display: none; }

/* Rotation centres (in viewBox units) */
.rb-govde, .rb-nefes, .rb-kafa, .rb-takip-kafa, .rb-izle, .rb-bakis, .rb-serbest .rb-ust, .rb-serbest .rb-alt { transform-box: view-box; }
.rb-nefes { transform-origin: 100px 189px; }
.rb-kafa, .rb-takip-kafa { transform-origin: 100px 146px; }
.rb-izle { transform-origin: 100px 84px; }
.rb-serbest .rb-ust { transform-origin: 128px 153px; transform: rotate(var(--rb-ust, -12deg)); }
.rb-serbest .rb-alt { transform-origin: 128px 169px; transform: rotate(var(--rb-alt, 4deg)); }
.rb-goz, .rb-d { transform-box: fill-box; transform-origin: 50% 50%; }

/* Cursor tracking: JS writes smoothed values (no transition in CSS) */
.rb-takip-kafa { transform: rotate(var(--rb-th, 0deg)); }
.rb-izle { transform: translate(var(--rb-tx, 0px), var(--rb-ty, 0px)) scale(var(--rb-ts, 1)); }

.rb-kafa { transition: transform 0.4s ease; }
.rb-bakis { transition: transform 0.35s ease; }
.rb-goz { transition: transform 70ms ease-in; }
.rb-yanak { opacity: 0; transform: translateY(11px); }
.rb-dalga { opacity: 0; transition: opacity 0.2s; }
.rb-isik { opacity: 0.45; }
.rb-ekran { opacity: 0; }
.rb-yansima { opacity: 0.55; }

/* 1. Idle: float + breathing + occasional headset light; eye blink via JS (.bf--kirp) */
.rb .rb-govde { animation: rb-suzul 4s ease-in-out infinite alternate; }
.rb .rb-nefes { animation: rb-nefes 4s ease-in-out infinite alternate; }
.bf--bekleme .rb-isik { animation: rb-isik 6.5s ease-in-out infinite; }
.bf--kirp .rb-goz { transform: scaleY(0.1); }

/* 2. Greeting: arm raises, forearm waves 3 times; head tilts sideways, eyes smile (lower-edge arc) */
.bf--selam .rb-govde { animation: rb-zipla 0.7s ease-out 1; }
.bf--selam .rb-kafa { animation: rb-sel-kafa 2.4s ease-in-out 1; }
.bf--selam .rb-yanak { animation: rb-yanak 2.4s ease-in-out 1; }
.bf--selam .rb-bakis { transform: translate(0, -1px); }
.bf--selam .rb-isik { animation: rb-parla 2.4s ease-in-out 1; }
.bf--selam .rb-serbest .rb-ust { animation: rb-sel-ust 2.4s ease-in-out 1; }
.bf--selam .rb-serbest .rb-alt { animation: rb-sel-alt 2.4s ease-in-out 1; }

/* 3. Thinking: gaze wanders left-right up top, head slightly tilted, headset light pulses */
.bf--dusunuyor .rb-bakis { transform: translate(4px, -5px); animation: rb-dusun 3.2s ease-in-out infinite; }
.bf--dusunuyor .rb-kafa { transform: rotate(4deg); }
.bf--dusunuyor .rb-isik { animation: rb-nabiz 1s ease-in-out infinite; }

/* 4. Speaking: sound wave in the visor, short rhythm in the eyes; phone/tablet screen lights up; pen writes in the planner */
.bf--konusuyor .rb-dalga { opacity: 1; }
.bf--konusuyor .rb-d { animation: rb-dalga 0.3s ease-in-out 4 alternate; }
.bf--konusuyor .rb-d:nth-child(2), .bf--konusuyor .rb-d:nth-child(4) { animation-delay: 0.1s; }
.bf--konusuyor .rb-d:nth-child(3) { animation-delay: 0.2s; }
.bf--konusuyor .rb-goz { animation: rb-konus 0.3s ease-in-out 4 alternate; }
.bf--konusuyor .rb-ekran { animation: rb-ekran 0.3s ease-in-out 4 alternate; }
.bf--konusuyor .rb-yansima { animation: rb-titre 0.3s ease-in-out 4 alternate; }
.rb--a-ajanda.bf--konusuyor .rb-serbest .rb-alt { animation: rb-yaz 0.3s ease-in-out 4 alternate; }

/* 5. Pointing: free hand points at the target (--rb-yu/--rb-ya), gaze shifts that way (--rb-bx/--rb-by) */
.bf--yonlendir .rb-bakis { transform: translate(var(--rb-bx, 4px), var(--rb-by, 4px)); }
.bf--yonlendir .rb-serbest .rb-ust { animation: rb-yon-ust 2.6s ease-in-out 1; }
.bf--yonlendir .rb-serbest .rb-alt { animation: rb-yon-alt 2.6s ease-in-out 1; }
.bf--yonlendir .rb-isik { animation: rb-parla 1.2s ease-in-out 1; }

@keyframes rb-suzul { from { transform: translateY(0); } to { transform: translateY(-2px); } }
@keyframes rb-nefes { from { transform: scale(1, 1); } to { transform: scale(1.012, 1.025); } }
@keyframes rb-isik { 0%, 84%, 100% { opacity: 0.45; } 90% { opacity: 1; } 95% { opacity: 0.2; } }
@keyframes rb-zipla { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-4px); } }
@keyframes rb-sel-kafa { 0%, 100% { transform: rotate(0); } 15%, 82% { transform: rotate(-6deg); } }
@keyframes rb-yanak { 0%, 100% { opacity: 0; transform: translateY(11px); } 14%, 84% { opacity: 1; transform: translateY(0); } }
@keyframes rb-parla { 0%, 100% { opacity: 0.45; } 45% { opacity: 1; } }
@keyframes rb-sel-ust { 0%, 100% { transform: rotate(var(--rb-ust, -12deg)); } 15%, 84% { transform: rotate(-95deg); } }
@keyframes rb-sel-alt {
  0%, 100% { transform: rotate(var(--rb-alt, 4deg)); }
  15% { transform: rotate(-60deg); } 28% { transform: rotate(-100deg); } 41% { transform: rotate(-60deg); }
  54% { transform: rotate(-100deg); } 67% { transform: rotate(-60deg); } 80% { transform: rotate(-92deg); }
}
@keyframes rb-dusun { 0%, 38%, 100% { transform: translate(4px, -5px); } 50%, 88% { transform: translate(-4px, -5px); } }
@keyframes rb-nabiz { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }
@keyframes rb-dalga { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
@keyframes rb-konus { from { transform: scaleY(1); } to { transform: scaleY(0.86); } }
@keyframes rb-ekran { from { opacity: 0.08; } to { opacity: 0.4; } }
@keyframes rb-titre { from { opacity: 0.45; } to { opacity: 0.75; } }
@keyframes rb-yaz { from { transform: rotate(var(--rb-alt, 80deg)); } to { transform: rotate(calc(var(--rb-alt, 80deg) + 6deg)); } }
@keyframes rb-yon-ust { 0%, 100% { transform: rotate(var(--rb-ust, -12deg)); } 18%, 80% { transform: rotate(var(--rb-yu, -48deg)); } }
@keyframes rb-yon-alt { 0%, 100% { transform: rotate(var(--rb-alt, 4deg)); } 18%, 80% { transform: rotate(var(--rb-ya, -6deg)); } }

/* Static use (mini avatars next to messages) and pausing while not visible */
.bf--sabit, .bf--sabit * { animation: none !important; }
.bf--durdur, .bf--durdur * { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .bf, .bf * { animation: none !important; transition: none !important; }
}

/* ---- Site integration (site-d classes; same as ../ENTEGRASYON.md) ---- */
.by-asistan-ac .bf { --bf-boy: 40px; margin: -0.45rem 0; }
.by-asistan-ac[aria-expanded="true"] .bf * { animation-play-state: paused; }
.by-asistan__kimlik { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.by-mesaj--figurlu { position: relative; margin-left: 30px; }
.by-mesaj--figurlu > .bf { position: absolute; left: -30px; bottom: 0; }
.d-bas__figur { display: block; width: fit-content; margin: 0 0 1rem; }

/* White robot additions (load after ../robot/robot.css). Outfit change between pages: .bf--giyin (~1 s, set by BoluFigur.giydir). */
.rb-sapka, .rb-gozluk, .rb-pirilti { transform-box: view-box; }
.rb-esya, .rb-giysi, .rb-p { transform-box: fill-box; transform-origin: 50% 50%; }
.rb-pirilti { opacity: 0; pointer-events: none; }
.rb--yakin .rb-pirilti { display: none; }

/* Black-gold robot: the smile hides while the sound wave shows */
.rb-agiz { transition: opacity 0.2s; }
.bf--konusuyor .rb-agiz { opacity: 0; }

/* Page-specific idle motion of the held item (only while idle; .bf--sabit, pausing and reduced motion are handled in robot.css).
   Origins are the hand position in item coordinates. */
.rb-esya--canta, .rb-esya--anahtar, .rb-esya--paspas, .rb-esya--supurge, .rb-esya--sulama, .rb-esya--kitap { transform-box: view-box; }
.rb-esya--canta { transform-origin: 65px 199px; }
.rb-esya--anahtar, .rb-esya--paspas, .rb-esya--supurge { transform-origin: 64px 198px; }
.rb-esya--sulama { transform-origin: 64px 200px; }
.rb-esya--kitap { transform-origin: 31px 142px; }
.rb-tik { stroke-dasharray: 1; }

.bf--bekleme .rb-esya--canta { animation: rb-canta 3s ease-in-out infinite alternate; }
.bf--bekleme .rb-esya--anahtar { animation: rb-anahtar 4s ease-in-out infinite; }
.bf--bekleme .rb-esya--paspas { animation: rb-paspas 2.4s ease-in-out infinite alternate; }
.bf--bekleme .rb-esya--supurge { animation: rb-supur 1.6s ease-in-out infinite alternate; }   /* sweeping towards the dustpan */
.bf--bekleme .rb-esya--sulama { animation: rb-sulama 5s ease-in-out infinite; }
.bf--bekleme .rb-damla circle { animation: rb-damla 5s ease-in infinite; }
.bf--bekleme .rb-damla circle:nth-child(2) { animation-delay: 0.15s; }
.bf--bekleme .rb-damla circle:nth-child(3) { animation-delay: 0.3s; }
.bf--bekleme .rb-esya--kitap { animation: rb-kitap 3.2s ease-in-out infinite alternate; }
.bf--bekleme .rb-tik { animation: rb-tik 4.5s ease-in-out infinite; }
.bf--bekleme .rb-esya--hesap .rb-ekran { animation: rb-hesap 3s ease-in-out infinite; }
.bf--bekleme .rb-tus { animation: rb-tus 3s ease-in-out infinite; }
.bf--bekleme .rb-satir { animation: rb-satir 3s ease-in-out infinite; }
.bf--bekleme .rb-satir:nth-of-type(2) { animation-delay: 0.6s; }
.bf--bekleme .rb-satir:nth-of-type(3) { animation-delay: 1.2s; }
.rb-damla { opacity: 1; }
.rb-damla circle { opacity: 0; }

@keyframes rb-canta { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes rb-anahtar { 0%, 55%, 100% { transform: rotate(0); } 65%, 85% { transform: rotate(-16deg); } 75% { transform: rotate(-2deg); } }
@keyframes rb-supur { from { transform: rotate(-3deg); } to { transform: rotate(9deg); } }
@keyframes rb-paspas { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes rb-sulama { 0%, 45%, 100% { transform: rotate(0); } 60%, 88% { transform: rotate(-14deg); } }
@keyframes rb-damla { 0%, 60% { opacity: 0; transform: translateY(0); } 64% { opacity: 1; } 88% { opacity: 0; transform: translateY(14px); } 100% { opacity: 0; } }
@keyframes rb-kitap { from { transform: rotate(0); } to { transform: rotate(-6deg); } }
@keyframes rb-tik { 0%, 8% { stroke-dashoffset: 1; } 45%, 90% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 1; } }
@keyframes rb-hesap { 0%, 62%, 100% { opacity: 0.05; } 68%, 88% { opacity: 0.45; } }
@keyframes rb-tus { 0%, 55%, 70%, 100% { fill: #AEB7C1; } 60%, 65% { fill: #F2C94C; } }
@keyframes rb-satir { 0%, 100% { opacity: 0.35; } 30% { opacity: 1; } }

/* Outfit change (must stay after the idle rules: same specificity, so the pop wins during the change) */
.bf--giyin .rb-govde { animation: rb-giyin-don 0.9s ease-in-out 1; transform-origin: 100px 236px; }
.bf--giyin .rb-sapka { animation: rb-sapka-dus 0.75s cubic-bezier(.3, 1.5, .6, 1) 1 both; }
.bf--giyin .rb-gozluk { animation: rb-belir 0.5s ease-out 0.25s 1 both; }
.bf--giyin .rb-esya, .bf--giyin .rb-giysi { animation: rb-pop 0.6s cubic-bezier(.3, 1.6, .6, 1) 0.15s 1 both; }
.bf--giyin .rb-pirilti { opacity: 1; }
.bf--giyin .rb-p { animation: rb-pirilti 0.9s ease-out 1 both; }

@keyframes rb-giyin-don {
  0% { transform: translateY(0) scaleX(1); }
  30% { transform: translateY(-6px) scaleX(0.82); }
  55% { transform: translateY(-6px) scaleX(1.04); }
  100% { transform: translateY(0) scaleX(1); }
}
@keyframes rb-sapka-dus { from { transform: translateY(-34px); opacity: 0; } 40% { opacity: 1; } to { transform: translateY(0); opacity: 1; } }
@keyframes rb-belir { from { opacity: 0; } to { opacity: 1; } }
@keyframes rb-pop { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rb-pirilti { 0% { transform: scale(0) rotate(0); opacity: 0; } 35% { opacity: 1; } 100% { transform: scale(1.3) rotate(90deg); opacity: 0; } }
