/*
 * Dodi the mascot: colour tokens, idle loop, flourishes and reactions.
 * Linked by components/tutor-mascot.blade.php wherever Dodi appears (the tutor and the auth pages),
 * and imported after tutor-rules.css by resources/tutor/transcript-css/input.css for the app bundle.
 * Kept apart from tutor-rules.css so pages without the tutor do not load the transcript rules.
 */
/* ── AI Tutor Mascot (Dodi the Dodo) ─────────────────────────────────────── */
:root {
    --mascot-outline: var(--m3-base-content);
    --mascot-body: color-mix(in oklab, var(--m3-base-content) 38%, var(--m3-base-100));
    --mascot-body-shade: color-mix(in oklab, var(--m3-base-content) 54%, var(--m3-base-100));
    --mascot-accent: var(--m3-warning);
    --mascot-eye: var(--m3-base-100);
    --mascot-pupil: var(--m3-base-content);
    --mascot-blush: color-mix(in oklab, var(--m3-error) 75%, var(--m3-base-100));
}

:root[data-theme$=dark] {
    --mascot-outline: var(--m3-base-100);
    --mascot-body: color-mix(in oklab, var(--m3-base-content) 55%, var(--m3-base-100));
    --mascot-body-shade: color-mix(in oklab, var(--m3-base-content) 36%, var(--m3-base-100));
    --mascot-accent: var(--m3-warning);
    --mascot-eye: var(--m3-base-content);
    --mascot-pupil: var(--m3-base-100);
    --mascot-blush: color-mix(in oklab, var(--m3-error) 78%, var(--m3-base-content));
}

.mascot-svg,
.mascot-svg * {
    transform-box: view-box;
}

.mascot-svg [data-mascot-layer] {
    will-change: transform, opacity;
}

.mascot-svg.is-paused [data-mascot-layer] {
    animation-play-state: paused !important;
}

.mascot-svg.state-idle [data-mascot-layer=head] {
    animation: kip-idle-head 2800ms cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}
.mascot-svg.state-idle [data-mascot-layer=body] {
    animation: kip-idle-body 2800ms cubic-bezier(0.45, 0.05, 0.55, 0.95) 90ms infinite;
}
.mascot-svg.state-idle [data-mascot-layer=tail] {
    animation: kip-idle-tail 2800ms cubic-bezier(0.45, 0.05, 0.55, 0.95) 140ms infinite;
}
.mascot-svg.state-idle [data-mascot-layer=arm-left],
.mascot-svg.state-idle [data-mascot-layer=arm-right] {
    animation: kip-idle-arms 2800ms cubic-bezier(0.45, 0.05, 0.55, 0.95) 180ms infinite;
}
.mascot-svg.state-idle [data-mascot-layer=antenna] {
    animation: kip-idle-antenna 2800ms cubic-bezier(0.45, 0.05, 0.55, 0.95) 240ms infinite;
}
.mascot-svg.state-idle [data-mascot-layer=shadow] {
    animation: kip-idle-shadow 2800ms cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}
.mascot-svg.state-idle [data-mascot-layer=eyelid-left],
.mascot-svg.state-idle [data-mascot-layer=eyelid-right] {
    animation: kip-idle-blink 4000ms cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes kip-idle-head {
    0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
    50% { transform: translate(0.5px, -2.6px) rotate(1.4deg); }
}
@keyframes kip-idle-body {
    0%, 100% { transform: translateY(0px) scale(1, 1); }
    50% { transform: translateY(-1.8px) scale(0.99, 1.015); }
}
@keyframes kip-idle-tail {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-4deg); }
}
@keyframes kip-idle-arms {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2.8px); }
}
@keyframes kip-idle-antenna {
    0%, 100% { transform: rotate(-2.5deg); }
    50% { transform: rotate(4deg); }
}
@keyframes kip-idle-shadow {
    0%, 100% { transform: scaleX(1); opacity: 0.18; }
    50% { transform: scaleX(0.93); opacity: 0.14; }
}
@keyframes kip-idle-blink {
    0%, 91%, 96%, 100% { opacity: 0; }
    93.5% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .mascot-svg,
    .mascot-svg [data-mascot-layer] {
        animation: none !important;
        transition: none !important;
    }
}



/* Tune the whole flourish with one number: 1 = original speed (720-960ms), 3 = owner's first slowdown (2160-2880ms), 1.75 = current (1260-1680ms).
   Panel open/close timing is separate and unchanged. */
:root { --dodi-anim-scale: 1.75; }

/* ── Dodi "tries to fly and can't" (open) / "hopeful hop and tumble back" (close) ────────────────────────────
   Transform and opacity only, on SVG layers (transform-box view-box, origins are the inline pivots).
   --hop is set per SVG by public/js/dodi-flourish.js so the hop reads as ~12px at any rendered size.
   Reduced motion: the rule above already stops every layer animation; the host gets a fixed 120ms fade instead (not scaled). */
.mascot-svg [data-mascot-layer=fx-dust] > *,
.mascot-svg [data-mascot-layer=fx-feather] > * { opacity: 0; transform-box: fill-box; transform-origin: center; }

.mascot-svg.dodi-try-fly [data-mascot-layer=mascot],
.mascot-svg.dodi-try-fly [data-mascot-layer=feet] { animation: dodi-hop calc(720ms * var(--dodi-anim-scale)) cubic-bezier(0.34, 1.2, 0.5, 1) both; }
.mascot-svg.dodi-try-fly [data-mascot-layer=arm-left] { animation: dodi-flap-l calc(720ms * var(--dodi-anim-scale)) linear both; }
.mascot-svg.dodi-try-fly [data-mascot-layer=arm-right] { animation: dodi-flap-r calc(720ms * var(--dodi-anim-scale)) linear both; }
.mascot-svg.dodi-try-fly [data-mascot-layer=shadow] { animation: dodi-shadow calc(720ms * var(--dodi-anim-scale)) ease-out both; }
.mascot-svg.dodi-try-fly [data-mascot-layer=fx-dust] > * { animation: dodi-dust calc(420ms * var(--dodi-anim-scale)) ease-out calc(300ms * var(--dodi-anim-scale)) both; }

.mascot-svg.dodi-win [data-mascot-layer=mascot],
.mascot-svg.dodi-win [data-mascot-layer=feet] { animation: dodi-hop-win calc(800ms * var(--dodi-anim-scale)) cubic-bezier(0.3, 0.9, 0.4, 1) both; }
.mascot-svg.dodi-win [data-mascot-layer=arm-left] { animation: dodi-flap-l calc(800ms * var(--dodi-anim-scale)) linear both; }
.mascot-svg.dodi-win [data-mascot-layer=arm-right] { animation: dodi-flap-r calc(800ms * var(--dodi-anim-scale)) linear both; }
.mascot-svg.dodi-win [data-mascot-layer=shadow] { animation: dodi-shadow calc(800ms * var(--dodi-anim-scale)) ease-out both; }

.mascot-svg.dodi-flop-back [data-mascot-layer=mascot],
.mascot-svg.dodi-flop-back [data-mascot-layer=feet] { animation: dodi-tumble calc(760ms * var(--dodi-anim-scale)) cubic-bezier(0.3, 0.7, 0.4, 1) both; }
.mascot-svg.dodi-flop-back [data-mascot-layer=arm-left] { animation: dodi-flap-l calc(760ms * var(--dodi-anim-scale)) linear both; }
.mascot-svg.dodi-flop-back [data-mascot-layer=arm-right] { animation: dodi-flap-r calc(760ms * var(--dodi-anim-scale)) linear both; }
.mascot-svg.dodi-flop-back [data-mascot-layer=head] { animation: dodi-shake calc(760ms * var(--dodi-anim-scale)) linear both; }
.mascot-svg.dodi-flop-back [data-mascot-layer=shadow] { animation: dodi-shadow calc(760ms * var(--dodi-anim-scale)) ease-out both; }
.mascot-svg.dodi-flop-back [data-mascot-layer=fx-feather] > * { animation: dodi-feather calc(700ms * var(--dodi-anim-scale)) ease-out calc(260ms * var(--dodi-anim-scale)) both; }

/* Glide to the header: frantic wing beat while airborne (not scaled: a flap is a flap). */
.mascot-svg.dodi-flying [data-mascot-layer=arm-left] { animation: dodi-beat-l 150ms linear infinite; }
.mascot-svg.dodi-flying [data-mascot-layer=arm-right] { animation: dodi-beat-r 150ms linear infinite; }
@keyframes dodi-beat-l { 0%, 100% { transform: rotate(-38deg); } 50% { transform: rotate(10deg); } }
@keyframes dodi-beat-r { 0%, 100% { transform: rotate(38deg); } 50% { transform: rotate(-10deg); } }

@keyframes dodi-hop {
    0%   { transform: translateY(0) scale(1, 1); }
    14%  { transform: translateY(0) scale(1.1, 0.82); }
    32%  { transform: translateY(calc(var(--hop, 12px) * -1)) scale(0.94, 1.1); }
    46%  { transform: translateY(calc(var(--hop, 12px) * -0.85)) scale(1, 1.02); }
    64%  { transform: translateY(0) scale(1.14, 0.8); }
    78%  { transform: translateY(0) scale(0.97, 1.05); }
    100% { transform: translateY(0) scale(1, 1); }
}
@keyframes dodi-hop-win {
    0%   { transform: translateY(0) scale(1, 1); }
    16%  { transform: translateY(0) scale(1.1, 0.84); }
    34%  { transform: translateY(calc(var(--hop, 12px) * -0.9)) scale(0.95, 1.08); }
    70%  { transform: translateY(calc(var(--hop, 12px) * -0.75)) scale(1, 1.02); }
    88%  { transform: translateY(0) scale(1.06, 0.92); }
    100% { transform: translateY(0) scale(1, 1); }
}
@keyframes dodi-tumble {
    0%   { transform: translateY(0) rotate(0deg) scale(1, 1); }
    16%  { transform: translateY(calc(var(--hop, 12px) * -0.9)) rotate(0deg) scale(0.96, 1.08); }
    34%  { transform: translateY(calc(var(--hop, 12px) * -0.9)) rotate(-6deg); }
    56%  { transform: translateY(0) rotate(-12deg) scale(1.08, 0.88); }
    70%  { transform: translateY(calc(var(--hop, 12px) * -0.3)) rotate(5deg) scale(0.98, 1.03); }
    84%  { transform: translateY(0) rotate(0deg) scale(1.06, 0.92); }
    100% { transform: translateY(0) rotate(0deg) scale(1, 1); }
}
@keyframes dodi-flap-l {
    0%, 12%, 62%, 100% { transform: rotate(0deg); }
    18%, 30%, 42%, 54% { transform: rotate(-38deg); }
    24%, 36%, 48% { transform: rotate(10deg); }
}
@keyframes dodi-flap-r {
    0%, 12%, 62%, 100% { transform: rotate(0deg); }
    18%, 30%, 42%, 54% { transform: rotate(38deg); }
    24%, 36%, 48% { transform: rotate(-10deg); }
}
@keyframes dodi-shake {
    0%, 78%, 100% { transform: rotate(0deg); }
    84% { transform: rotate(4deg); }
    90% { transform: rotate(-4deg); }
    95% { transform: rotate(2deg); }
}
@keyframes dodi-shadow {
    0%, 100% { transform: scaleX(1); opacity: 0.18; }
    36% { transform: scaleX(0.7); opacity: 0.08; }
    66% { transform: scaleX(1.15); opacity: 0.22; }
}
@keyframes dodi-dust {
    0% { opacity: 0.55; transform: translate(0, 0) scale(0.4); }
    100% { opacity: 0; transform: translate(var(--dust-x, 5px), -4px) scale(1.5); }
}
@keyframes dodi-feather {
    0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
    15% { opacity: 0.9; }
    100% { opacity: 0; transform: translate(10px, 26px) rotate(160deg); }
}

/* Reduced motion: no hop or flap; the host does a 120ms fade (JS adds .dodi-fade only in that case). */
.tutor-mascot-host.dodi-fade { animation: dodi-fade 120ms ease-out; }
@keyframes dodi-fade { from { opacity: 0.4; } to { opacity: 1; } }

/* Dodi greets with a wave and head tilt when the nudge bubble appears (JS adds/removes .dodi-wave). */
.mascot-svg.dodi-wave [data-mascot-layer=arm-right] { animation: dodi-wave-arm calc(700ms * var(--dodi-anim-scale)) ease-in-out both; }
.mascot-svg.dodi-wave [data-mascot-layer=head] { animation: dodi-tilt calc(700ms * var(--dodi-anim-scale)) ease-in-out both; }
@keyframes dodi-wave-arm { 0%, 100% { transform: rotate(0deg); } 20%, 60% { transform: rotate(-40deg); } 40%, 80% { transform: rotate(-10deg); } }
@keyframes dodi-tilt { 0%, 100% { transform: rotate(0deg); } 35%, 70% { transform: rotate(-7deg); } }

/* Static mascot styles live here, not in style="" attributes: the school-bot widget frame CSP is
   style-src 'self', which drops inline style attributes. One class per pivot (mp-<rig>-<layer>);
   SVG px origins are view-box user units (transform-box: view-box above). */
.tutor-mascot-host { pointer-events: none; }
.mascot-svg { pointer-events: none; overflow: visible; }
.mascot-dust-l { --dust-x: -6px; }
.mascot-dust-r { --dust-x: 6px; }
.citi-palette { --sk: #C68652; --ss: #9E6336; --hr: #11151E; --tr: #141519; --sh: #FFFFFF; --wh: #FFFFFF; --rd: #D7262B; --nv: #1B2B65; }
.mp-dodi-shadow { transform-origin: 122px 218px; }
.mp-dodi-feet { transform-origin: 116px 214px; }
.mp-dodi-mascot { transform-origin: 118px 204px; }
.mp-dodi-arm-left { transform-origin: 68px 136px; }
.mp-dodi-hand-left { transform-origin: 52px 154px; }
.mp-dodi-tail { transform-origin: 174px 142px; }
.mp-dodi-body { transform-origin: 118px 156px; }
.mp-dodi-chest-core { transform-origin: 76px 140px; }
.mp-dodi-head { transform-origin: 92px 86px; }
.mp-dodi-antenna { transform-origin: 96px 28px; }
.mp-dodi-blush { transform-origin: 82px 72px; }
.mp-dodi-eye-left { transform-origin: 74px 50px; }
.mp-dodi-eye-open-left { transform-origin: 74px 50px; }
.mp-dodi-pupil-left { transform-origin: 74px 50px; }
.mp-dodi-eyelid-left { transform-origin: 74px 50px; }
.mp-dodi-eye-happy-left { transform-origin: 74px 50px; }
.mp-dodi-eye-right { transform-origin: 74px 50px; }
.mp-dodi-eye-open-right { transform-origin: 74px 50px; }
.mp-dodi-pupil-right { transform-origin: 74px 50px; }
.mp-dodi-eyelid-right { transform-origin: 74px 50px; }
.mp-dodi-eye-happy-right { transform-origin: 74px 50px; }
.mp-dodi-mouth { transform-origin: 48px 60px; }
.mp-dodi-beak-lower { transform-origin: 48px 64px; }
.mp-dodi-arm-right { transform-origin: 108px 124px; }
.mp-dodi-hand-right { transform-origin: 142px 156px; }
.mp-dodi-fx-sparks { transform-origin: 120px 96px; }
.mp-dodi-spark-1 { transform-origin: 28px 36px; }
.mp-dodi-spark-2 { transform-origin: 206px 46px; }
.mp-dodi-fx-chirp { transform-origin: 14px 56px; }
.mp-dodi-fx-z { transform-origin: 146px 28px; }
.mp-dodi-fab-shadow { transform-origin: 38px 106px; }
.mp-dodi-fab-fab-button { transform-origin: 36px 80px; }
.mp-dodi-fab-fab-icon { transform-origin: 36px 82px; }
.mp-dodi-fab-feet { transform-origin: 36px 66px; }
.mp-dodi-fab-mascot { transform-origin: 36px 66px; }
.mp-dodi-fab-tail { transform-origin: 52px 48px; }
.mp-dodi-fab-arm-left { transform-origin: 20px 52px; }
.mp-dodi-fab-hand-left { transform-origin: 16px 56px; }
.mp-dodi-fab-body { transform-origin: 36px 56px; }
.mp-dodi-fab-chest-core { transform-origin: 24px 52px; }
.mp-dodi-fab-head { transform-origin: 28px 30px; }
.mp-dodi-fab-antenna { transform-origin: 30px 12px; }
.mp-dodi-fab-blush { transform-origin: 26px 28px; }
.mp-dodi-fab-eye-left { transform-origin: 23px 21px; }
.mp-dodi-fab-eye-open-left { transform-origin: 23px 21px; }
.mp-dodi-fab-pupil-left { transform-origin: 23px 21px; }
.mp-dodi-fab-eyelid-left { transform-origin: 23px 21px; }
.mp-dodi-fab-eye-happy-left { transform-origin: 23px 21px; }
.mp-dodi-fab-eye-right { transform-origin: 23px 21px; }
.mp-dodi-fab-eye-open-right { transform-origin: 23px 21px; }
.mp-dodi-fab-pupil-right { transform-origin: 23px 21px; }
.mp-dodi-fab-eyelid-right { transform-origin: 23px 21px; }
.mp-dodi-fab-eye-happy-right { transform-origin: 23px 21px; }
.mp-dodi-fab-mouth { transform-origin: 14px 23px; }
.mp-dodi-fab-beak-lower { transform-origin: 14px 25px; }
.mp-dodi-fab-arm-right { transform-origin: 38px 46px; }
.mp-dodi-fab-hand-right { transform-origin: 46px 54px; }
.mp-dodi-fab-fx-sparks { transform-origin: 36px 40px; }
.mp-dodi-fab-spark-1 { transform-origin: 9px 30px; }
.mp-dodi-fab-spark-2 { transform-origin: 64px 24px; }
.mp-dodi-fab-fx-chirp { transform-origin: 4px 22px; }
.mp-dodi-fab-fx-z { transform-origin: 46px 12px; }
.mp-citi-shadow { transform-origin: 120px 222px; }
.mp-citi-mascot { transform-origin: 120px 214px; }
.mp-citi-tail { transform-origin: 148px 142px; }
.mp-citi-feet { transform-origin: 120px 214px; }
.mp-citi-leg-left { transform-origin: 107px 166px; }
.mp-citi-leg-right { transform-origin: 133px 166px; }
.mp-citi-body { transform-origin: 120px 164px; }
.mp-citi-arm-left { transform-origin: 91px 124px; }
.mp-citi-forearm-left { transform-origin: 80px 148px; }
.mp-citi-hand-left { transform-origin: 77px 168px; }
.mp-citi-chest-core { transform-origin: 134px 142px; }
.mp-citi-head { transform-origin: 120px 111px; }
.mp-citi-antenna { transform-origin: 120px 29px; }
.mp-citi-brow-left { transform-origin: 105px 65px; }
.mp-citi-brow-right { transform-origin: 135px 65px; }
.mp-citi-blush { transform-origin: 120px 89px; }
.mp-citi-eye-left { transform-origin: 105px 78px; }
.mp-citi-eye-open-left { transform-origin: 105px 78px; }
.mp-citi-pupil-left { transform-origin: 105px 78px; }
.mp-citi-eyelid-left { transform-origin: 105px 78px; }
.mp-citi-eye-happy-left { transform-origin: 105px 78px; }
.mp-citi-eye-right { transform-origin: 135px 78px; }
.mp-citi-eye-open-right { transform-origin: 135px 78px; }
.mp-citi-pupil-right { transform-origin: 135px 78px; }
.mp-citi-eyelid-right { transform-origin: 135px 78px; }
.mp-citi-eye-happy-right { transform-origin: 135px 78px; }
.mp-citi-mouth { transform-origin: 120px 96px; }
.mp-citi-beak-gap { transform-origin: 120px 98px; }
.mp-citi-beak-lower { transform-origin: 120px 98px; }
.mp-citi-arm-right { transform-origin: 149px 124px; }
.mp-citi-forearm-right { transform-origin: 160px 148px; }
.mp-citi-hand-right { transform-origin: 163px 168px; }
.mp-citi-fx-sparks { transform-origin: 120px 96px; }
.mp-citi-spark-1 { transform-origin: 42px 46px; }
.mp-citi-spark-2 { transform-origin: 198px 50px; }
.mp-citi-fx-chirp { transform-origin: 188px 78px; }
.mp-citi-fx-z { transform-origin: 176px 30px; }
