/* fruitlive-mascot.css - Idle mascot overlay; z-index 1040 */

.flm-layer {
    position: fixed;
    inset: 0;
    z-index: 1040;
    pointer-events: none;
    overflow: hidden;
}

.flm-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.flm-item {
    position: absolute;
    color: var(--phoenix-primary, #0077b6);
    will-change: transform, opacity;
    opacity: 0;
}

.flm-item svg,
.flm-item .fas {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.16));
}

.flm-item .fas {
    font-size: calc(100% * 0.72);
    line-height: 1;
    width: auto;
    height: auto;
}

.flm-dismiss {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 2;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 14px;
    border: 1px solid var(--phoenix-border-color, #d1d5db);
    background: var(--phoenix-card-bg, #fff);
    color: var(--phoenix-text-color, #374151);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.15s;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.flm-layer--visible .flm-dismiss {
    opacity: 1;
    pointer-events: auto;
}

.flm-dismiss:hover {
    background: var(--phoenix-light, #f3f4f6);
}

.flm-layer--rail-open .flm-dismiss {
    left: 16px;
}

.flm-layer--flee .flm-stage {
    animation: flm-stage-flee 0.26s ease-in forwards;
}

@keyframes flm-stage-flee {
    to { opacity: 0; }
}

/* --- Orchard green: leaves fall along 50° circular arcs ------------- */
@keyframes flm-leaf-fall {
    0%   { opacity: 0;    offset-distance: 0%;   transform: rotate(calc(var(--flm-leaf-spin, 0deg) - 15deg)); }
    8%   { opacity: 1;    offset-distance: 10%; }
    35%  { opacity: 1;    offset-distance: 42%; }
    55%  { opacity: 0.75; offset-distance: 65%; transform: rotate(calc(var(--flm-leaf-spin, 0deg) + 5deg)); }
    75%  { opacity: 0.35; offset-distance: 85%; }
    100% { opacity: 0;    offset-distance: 100%; transform: rotate(calc(var(--flm-leaf-spin, 0deg) + 25deg)); }
}

.flm-anim-leaf-fall {
    offset-rotate: 0deg;
    offset-distance: 0%;
    animation-name: flm-leaf-fall;
    /* Linear so keyframe spacing controls the slowdown; fade tracks with it */
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

/* --- Harvest gold: wheat grows from ground -------------------------- */
@keyframes flm-wheat-grow {
    0%   { opacity: 0; transform: scaleY(0.08); }
    18%  { opacity: 1; }
    70%  { opacity: 1; transform: scaleY(1); }
    88%  { opacity: 1; transform: scaleY(1); }
    100% { opacity: 0; transform: scaleY(1); }
}

.flm-anim-wheat-grow {
    transform-origin: bottom center;
    animation-name: flm-wheat-grow;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-fill-mode: forwards;
}

/* --- Irrigation blue: rain ------------------------------------------ */
@keyframes flm-rain-drop {
    0%   { opacity: 0; transform: translateY(-8vh); }
    10%  { opacity: 0.85; }
    100% { opacity: 0; transform: translateY(110vh); }
}

.flm-anim-rain-drop {
    animation-name: flm-rain-drop;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

/*
 * Twilight / sunrise: true upper semicircle via rotating pivot.
 * Child sits at radius above the pivot; rotate -90deg (left) -> 90deg (right).
 */
/*
 * Twilight / sunrise: oval arc across the viewport (flatter toward the bottom).
 * offset-path keeps the icon undistorted (unlike scaleY on a rotating pivot).
 */
.flm-sky-orbit {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.flm-sky-body {
    position: absolute;
    left: 0;
    top: 0;
    width: 80px;
    height: 80px;
    margin-left: -40px;
    margin-top: -40px;
    color: var(--phoenix-primary, #0077b6);
    opacity: 0;
    /* path set in JS for a flatter oval arc */
    offset-rotate: 0deg;
    offset-distance: 0%;
    animation: flm-sky-oval 8s linear forwards;
}

.flm-sky-body svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.16));
}

@keyframes flm-sky-oval {
    0%   { offset-distance: 0%;   opacity: 0; }
    6%   { opacity: 1; }
    92%  { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
}

/* Apple orchard: vine from top of screen, sway; some apples fall off */
.flm-apple-cluster {
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: 50% 0%;
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

.flm-apple-vine {
    width: 40px;
    flex-shrink: 0;
    line-height: 0;
    color: #166534;
}

.flm-apple-vine svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.flm-apple-cluster .flm-apple-fruit {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
    opacity: 1;
    margin-top: -10px;
    flex-shrink: 0;
    will-change: transform;
}

/* Stay on the vine: sway for the scene, then fade */
@keyframes flm-vine-sway-stay {
    0%   { opacity: 0; transform: translateX(-50%) rotate(0deg); }
    7%   { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * -0.7)); }
    20%  { opacity: 1; transform: translateX(-50%) rotate(var(--flm-sway, 9deg)); }
    34%  { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * -1)); }
    48%  { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * 0.85)); }
    62%  { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * -0.55)); }
    76%  { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * 0.4)); }
    88%  { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * -0.15)); }
    100% { opacity: 0; transform: translateX(-50%) rotate(0deg); }
}

.flm-anim-vine-sway-stay {
    animation-name: flm-vine-sway-stay;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

/*
 * Droppers: sway, then hold still so the apple can fall cleanly.
 * --flm-release: fraction (0-1) when the apple detaches.
 * --flm-gone: fraction when the apple has left the screen (vine fades after).
 */
@keyframes flm-vine-sway-drop {
    0%   { opacity: 0; transform: translateX(-50%) rotate(0deg); }
    6%   { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * -0.7)); }
    18%  { opacity: 1; transform: translateX(-50%) rotate(var(--flm-sway, 9deg)); }
    30%  { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * -1)); }
    40%  { opacity: 1; transform: translateX(-50%) rotate(calc(var(--flm-sway, 9deg) * 0.5)); }
    48%  { opacity: 1; transform: translateX(-50%) rotate(0deg); }
    85%  { opacity: 1; transform: translateX(-50%) rotate(0deg); }
    100% { opacity: 0; transform: translateX(-50%) rotate(0deg); }
}

.flm-anim-vine-sway-drop {
    animation-name: flm-vine-sway-drop;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

/* Detached apple: constant-speed exit off the bottom — no settle, no slowdown */
@keyframes flm-apple-fall-off {
    0%   { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(120vh) rotate(300deg); }
}

.flm-anim-apple-fall-off {
    animation-name: flm-apple-fall-off;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

/* Citrus grove: peel / cross-section wheels spin across mid-screen */
@keyframes flm-citrus-spin {
    0%   { opacity: 0; transform: translate(0, 0) rotate(0deg); }
    6%   { opacity: 1; }
    92%  { opacity: 1; transform: translate(var(--flm-roll-x, 115vw), 0) rotate(var(--flm-spin, 720deg)); }
    100% { opacity: 0; transform: translate(calc(var(--flm-roll-x, 115vw) * 1.04), 0) rotate(calc(var(--flm-spin, 720deg) * 1.05)); }
}

.flm-anim-citrus-spin {
    animation-name: flm-citrus-spin;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
    will-change: transform, opacity;
}

/* Vineyard: wine glass slides along the bottom, stops cleanly */
@keyframes flm-wine-slide {
    0%   { opacity: 0; transform: translateX(0); }
    12%  { opacity: 1; transform: translateX(8vw); }
    100% { opacity: 1; transform: translateX(66vw); }
}

.flm-anim-wine-slide {
    animation-name: flm-wine-slide;
    animation-timing-function: cubic-bezier(0.25, 0.8, 0.35, 1);
    animation-fill-mode: forwards;
}

/*
 * Berry patch: mixed berries fall from the top of the screen.
 * --flm-drift: slight horizontal drift while falling.
 */
@keyframes flm-berry-fall {
    0%   { opacity: 0; transform: translate(0, 0) rotate(-8deg); }
    5%   { opacity: 1; }
    88%  { opacity: 1; transform: translate(var(--flm-drift, 0px), 108vh) rotate(12deg); }
    100% { opacity: 0; transform: translate(var(--flm-drift, 0px), 118vh) rotate(16deg); }
}

.flm-anim-berry-fall {
    animation-name: flm-berry-fall;
    animation-timing-function: cubic-bezier(0.33, 0.05, 0.55, 0.35);
    animation-fill-mode: forwards;
    will-change: transform, opacity;
}

/* Stone fruit: large peach rolls left -> right along the bottom */
@keyframes flm-peach-roll {
    0%   { opacity: 0; transform: translateX(0) rotate(0deg); }
    8%   { opacity: 1; }
    92%  { opacity: 1; transform: translateX(110vw) rotate(720deg); }
    100% { opacity: 0; transform: translateX(115vw) rotate(760deg); }
}

.flm-anim-peach-roll {
    animation-name: flm-peach-roll;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@media (prefers-reduced-motion: reduce) {
    .flm-layer { display: none !important; }
}
