/* ==========================================================================
   Cebot karakteri v2 — hareket ve ifade katmanı (js/cebot.js ile birlikte)
   Pivotlar SVG görünüm kutusuna göre verilir; ifadeler body[data-cebot] ya
   da .cebot-activity.<durum> ile değişir.
   ========================================================================== */
.cebot-sprite { display: block; position: relative; }
.cebot-sprite .cb { display: block; width: 100%; height: 100%; overflow: visible; }
.cb * { transform-box: fill-box; }
.cb-compact .cb { overflow: hidden; }
.cb-compact .cb-shadow, .cb-compact .cb-zzz, .cb-compact .cb-thrust { display: none; }

/* ---- Pivotlar ve temel dönüşümler ---- */
.cb-float { transform-box: view-box; transform-origin: 80px 150px; }
.cb-look { transform-box: view-box; transform-origin: 80px 92px; transform: rotate(calc(var(--lx, 0) * 7deg)) translateY(calc(var(--ly, 0) * 1.6px)); transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.cb-head { transform-box: view-box; transform-origin: 80px 92px; }
.cb-face { transform: translate(calc(var(--lx, 0) * 6px), calc(var(--ly, 0) * 4.5px)); transition: transform .14s ease-out; }
.cb-reflect { transform: translateX(calc(var(--lx, 0) * -5px)); transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.cb-arm-l { transform-box: view-box; transform-origin: 46px 99px; transform: rotate(24deg); }
.cb-arm-r { transform-box: view-box; transform-origin: 114px 99px; transform: rotate(-24deg); }
.cb-eye { transform-origin: center; transition: transform .07s ease-in; }
.cb-glint { transition: transform .3s; }
.cb-mouth, .cb-mouth-open, .cb-happy, .cb-sleep, .cb-brows, .cb-eyes { transform-origin: center; transition: opacity .18s, transform .25s cubic-bezier(.2, .8, .2, 1); }
.cb-happy, .cb-sleep, .cb-brows, .cb-mouth-open, .cb-zzz { opacity: 0; }
.cb-shadow, .cb-thrust, .cb-bulb, .cb-core, .cb-ring, .cb-ear-ring { transform-origin: center; }
.cb-zzz text { transform-box: fill-box; transform-origin: center; }

/* ---- Boşta: süzülme, nefes, yaşayan ışıklar ---- */
.cb-float { animation: cb-float 4.6s ease-in-out var(--cb-phase, 0s) infinite; }
.cb-shadow { animation: cb-shadow 4.6s ease-in-out var(--cb-phase, 0s) infinite; }
.cb-thrust { animation: cb-thrust .18s steps(2) infinite alternate, cb-thrust-breathe 4.6s ease-in-out var(--cb-phase, 0s) infinite; }
.cb-head { animation: cb-tilt 9s ease-in-out var(--cb-phase, 0s) infinite; }
.cb-arm-l { animation: cb-arm-l 4.6s ease-in-out var(--cb-phase, 0s) infinite; }
.cb-arm-r { animation: cb-arm-r 4.6s ease-in-out var(--cb-phase, 0s) infinite; }
.cb-bulb-halo { animation: cb-pulse 2.8s ease-in-out infinite; }
.cb-core-halo { animation: cb-pulse 3.6s ease-in-out -1s infinite; }
.cb-ring { animation: cb-spin 9s linear infinite; }
.cb-ear-ring { animation: cb-spin 14s linear infinite; }
.cb-eyecast { animation: cb-cast 4.6s ease-in-out infinite; }

.cb-blink .cb-eye { transform: scaleY(.08); }
.cb-curious .cb-head { animation: cb-curious 1.8s cubic-bezier(.3, .7, .3, 1) 1; }
.cb-curious .cb-glint { transform: translate(1px, -1px) scale(1.25); }

@keyframes cb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes cb-shadow { 0%, 100% { transform: scaleX(1); opacity: .24; } 50% { transform: scaleX(.78); opacity: .12; } }
@keyframes cb-thrust { from { opacity: .75; } to { opacity: 1; } }
@keyframes cb-thrust-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(.82, .7); } }
@keyframes cb-tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-2.5deg); } 65% { transform: rotate(2deg); } }
@keyframes cb-curious { 0%, 100% { transform: rotate(0); } 30%, 70% { transform: rotate(11deg); } }
@keyframes cb-arm-l { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(31deg); } }
@keyframes cb-arm-r { 0%, 100% { transform: rotate(-24deg); } 50% { transform: rotate(-31deg); } }
@keyframes cb-pulse { 0%, 100% { opacity: .25; transform: scale(.85); } 50% { opacity: .62; transform: scale(1.12); } }
@keyframes cb-cast { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes cb-spin { to { transform: rotate(360deg); } }
@keyframes cb-bulb-fast { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
@keyframes cb-scan { 0%, 100% { transform: translate(-3.5px, -3px); } 50% { transform: translate(3.5px, -3px); } }
@keyframes cb-work { 0%, 100% { transform: translateX(-1.5px); } 50% { transform: translateX(1.5px); } }
@keyframes cb-wave { 0%, 100% { transform: rotate(-24deg); } 20% { transform: rotate(-150deg); } 40% { transform: rotate(-112deg); } 60% { transform: rotate(-155deg); } 80% { transform: rotate(-118deg); } }
@keyframes cb-hop { 0% { transform: translateY(0) scale(1, 1); } 18% { transform: translateY(2px) scale(1.06, .92); } 45% { transform: translateY(-16px) scale(.96, 1.05); } 72% { transform: translateY(0) scale(1.05, .94); } 100% { transform: translateY(0) scale(1, 1); } }
@keyframes cb-shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-6deg); } 40% { transform: rotate(5deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(2deg); } }
@keyframes cb-jolt { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-9px) scale(1.04); } 100% { transform: translateY(0) scale(1); } }
@keyframes cb-snooze { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(2px); } }
@keyframes cb-z { 0% { opacity: 0; transform: translate(0, 6px) scale(.6); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -8px) scale(1.1); } }

/* ---- Durumlar ------------------------------------------------------------
   genel: body[data-cebot=...] .cb-global     yerel: .cebot-activity.<durum> */

/* Düşünüyor: gözler yukarıda gezinir, anten hızlanır, halkalar hızlı döner */
body[data-cebot="thinking"] .cb-global .cb-eyes, .cebot-activity.thinking .cb-eyes { animation: cb-scan 1.5s ease-in-out infinite; }
body[data-cebot="thinking"] .cb-global .cb-bulb-halo, .cebot-activity.thinking .cb-bulb-halo { animation: cb-bulb-fast .7s ease-in-out infinite; }
body[data-cebot="thinking"] .cb-global .cb-ear-ring, .cebot-activity.thinking .cb-ear-ring { animation-duration: 1.4s; }
body[data-cebot="thinking"] .cb-global .cb-mouth, .cebot-activity.thinking .cb-mouth { transform: scaleX(.5); }

/* Çalışıyor: odaklı kısık gözler, çekirdek halkası hızlı döner */
body[data-cebot="working"] .cb-global .cb-eye, .cebot-activity.working .cb-eye { transform: scaleY(.5); }
body[data-cebot="working"] .cb-global .cb-eyes, .cebot-activity.working .cb-eyes { animation: cb-work .5s ease-in-out infinite; }
body[data-cebot="working"] .cb-global .cb-ring, .cebot-activity.working .cb-ring { animation-duration: .9s; }
body[data-cebot="working"] .cb-global .cb-bulb-halo, .cebot-activity.working .cb-bulb-halo,
body[data-cebot="working"] .cb-global .cb-core-halo, .cebot-activity.working .cb-core-halo { animation: cb-bulb-fast .45s ease-in-out infinite; }

/* Mutlu: ^^ gözler, el sallama, esneyerek zıplama */
body[data-cebot="happy"] .cb-global .cb-eyes, .cebot-activity.success .cb-eyes, .cb-poke .cb-eyes { opacity: 0; }
body[data-cebot="happy"] .cb-global .cb-happy, .cebot-activity.success .cb-happy, .cb-poke .cb-happy { opacity: 1; }
body[data-cebot="happy"] .cb-global .cb-arm-r, .cebot-activity.success .cb-arm-r, .cb-poke .cb-arm-r { animation: cb-wave 1.1s ease-in-out 1; }
body[data-cebot="happy"] .cb-global .cb-float, .cebot-activity.success .cb-float, .cb-poke .cb-float { animation: cb-hop .8s cubic-bezier(.3, .7, .3, 1) 1; }
body[data-cebot="happy"] .cb-global .cb-mouth, .cebot-activity.success .cb-mouth, .cb-poke .cb-mouth { transform: scale(1.3, 1.5); }

/* Üzgün / hata */
body[data-cebot="sad"] .cb-global .cb-brows, .cebot-activity.error .cb-brows { opacity: 1; }
body[data-cebot="sad"] .cb-global .cb-mouth, .cebot-activity.error .cb-mouth { transform: rotate(180deg) translateY(-2px); }
body[data-cebot="sad"] .cb-global .cb-head, .cebot-activity.error .cb-head { animation: cb-shake .6s ease-in-out 1; }
body[data-cebot="sad"] .cb-global .cb-eye, .cebot-activity.error .cb-eye { transform: scaleY(.78) translateY(1px); }
body[data-cebot="sad"] .cb-global .cb-thrust { opacity: .5; }

/* Konuşuyor: ağız açıklığı JS'in harf senkronu ile (--cb-mouth) */
body[data-cebot="talking"] .cb-global .cb-mouth { opacity: 0; }
body[data-cebot="talking"] .cb-global .cb-mouth-open { opacity: 1; transform: scaleY(var(--cb-mouth, .4)); transition: transform .06s linear; }

/* Dinliyor: yazdığın kutuya bakar, anten nabız atar */
body[data-cebot="listening"] .cb-global .cb-bulb-halo { animation: cb-bulb-fast .9s ease-in-out infinite; }
body[data-cebot="listening"] .cb-global .cb-glint { transform: translateY(1.5px); }

/* Uykulu: gözler kapalı, yavaş nefes, Zzz */
body[data-cebot="sleepy"] .cb-global .cb-eyes { opacity: 0; }
body[data-cebot="sleepy"] .cb-global .cb-sleep { opacity: 1; }
body[data-cebot="sleepy"] .cb-global .cb-float { animation: cb-snooze 3.2s ease-in-out infinite; }
body[data-cebot="sleepy"] .cb-global .cb-head { animation: none; transform: rotate(-7deg); transition: transform 1.2s; }
body[data-cebot="sleepy"] .cb-global .cb-bulb-halo { animation: none; opacity: .1; }
body[data-cebot="sleepy"] .cb-global .cb-thrust { opacity: .45; }
body[data-cebot="sleepy"] .cb-global .cb-zzz { opacity: 1; }
body[data-cebot="sleepy"] .cb-global .cb-zzz text { animation: cb-z 2.4s ease-out infinite; }
body[data-cebot="sleepy"] .cb-global .cb-zzz text:nth-child(2) { animation-delay: .8s; }
body[data-cebot="sleepy"] .cb-global .cb-zzz text:nth-child(3) { animation-delay: 1.6s; }

/* Şaşkın: iri gözler, "o" ağız, irkilme */
body[data-cebot="surprised"] .cb-global .cb-eye { transform: scale(1.22); }
body[data-cebot="surprised"] .cb-global .cb-mouth { opacity: 0; }
body[data-cebot="surprised"] .cb-global .cb-mouth-open { opacity: 1; transform: scale(.75, .9); }
body[data-cebot="surprised"] .cb-global .cb-float { animation: cb-jolt .45s cubic-bezier(.3, .7, .3, 1) 1; }

/* Üzerine gelince el salla */
.cebot-fab:hover .cb-arm-r, .hero-cebot:hover .cb-arm-r, .s-cebot:hover .cb-arm-r { animation: cb-wave 1.2s ease-in-out 1; }

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