/**
 * Pyramid Character - Pixel Art CSS
 * Reusable animated character with speech bubble
 */

/* Container for characters */
.pyramid-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
    /* Clip to viewport edges only */
    clip-path: inset(0);
}

/* Base character element */
.pyramid-char {
    position: absolute;
    width: 4px;
    height: 4px;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    /* Hardware acceleration for smooth animation */
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    box-shadow:
        /* === PYRAMID HEAD === */
        /* Row 1 - Peak */
        24px 0 0 #E8B84A,
        /* Row 2 */
        20px 4px 0 #C9983A,
        24px 4px 0 #F5C854,
        28px 4px 0 #C9983A,
        /* Row 3 */
        16px 8px 0 #C9983A,
        20px 8px 0 #F5C854,
        24px 8px 0 #F5C854,
        28px 8px 0 #F5C854,
        32px 8px 0 #C9983A,
        /* Row 4 - brick line */
        12px 12px 0 #A87D2A,
        16px 12px 0 #A87D2A,
        20px 12px 0 #A87D2A,
        24px 12px 0 #A87D2A,
        28px 12px 0 #A87D2A,
        32px 12px 0 #A87D2A,
        36px 12px 0 #A87D2A,
        /* Row 5 - Eye row top */
        8px 16px 0 #E8B84A,
        12px 16px 0 #F5C854,
        16px 16px 0 #FFFFFF,
        20px 16px 0 #FFFFFF,
        24px 16px 0 #FFFFFF,
        28px 16px 0 #F5C854,
        32px 16px 0 #F5C854,
        36px 16px 0 #F5C854,
        40px 16px 0 #E8B84A,
        /* Row 6 - Eye row middle (blue eye) */
        4px 20px 0 #E8B84A,
        8px 20px 0 #F5C854,
        12px 20px 0 #FFFFFF,
        16px 20px 0 #1E90FF,
        20px 20px 0 #1E90FF,
        24px 20px 0 #FFFFFF,
        28px 20px 0 #F5C854,
        32px 20px 0 #F5C854,
        36px 20px 0 #F5C854,
        40px 20px 0 #F5C854,
        44px 20px 0 #E8B84A,
        /* Row 7 - Eye row bottom */
        0 24px 0 #C9983A,
        4px 24px 0 #F5C854,
        8px 24px 0 #F5C854,
        12px 24px 0 #FFFFFF,
        16px 24px 0 #1E90FF,
        20px 24px 0 #000033,
        24px 24px 0 #FFFFFF,
        28px 24px 0 #F5C854,
        32px 24px 0 #F5C854,
        36px 24px 0 #F5C854,
        40px 24px 0 #F5C854,
        44px 24px 0 #F5C854,
        48px 24px 0 #C9983A,
        /* Row 8 - brick line */
        -4px 28px 0 #A87D2A,
        0 28px 0 #A87D2A,
        4px 28px 0 #A87D2A,
        8px 28px 0 #A87D2A,
        12px 28px 0 #FFFFFF,
        16px 28px 0 #FFFFFF,
        20px 28px 0 #FFFFFF,
        24px 28px 0 #F5C854,
        28px 28px 0 #A87D2A,
        32px 28px 0 #A87D2A,
        36px 28px 0 #A87D2A,
        40px 28px 0 #A87D2A,
        44px 28px 0 #A87D2A,
        48px 28px 0 #A87D2A,
        52px 28px 0 #A87D2A,
        /* Row 9 - pyramid bottom */
        -8px 32px 0 #E8B84A,
        -4px 32px 0 #F5C854,
        0 32px 0 #F5C854,
        4px 32px 0 #F5C854,
        8px 32px 0 #F5C854,
        12px 32px 0 #F5C854,
        16px 32px 0 #F5C854,
        20px 32px 0 #F5C854,
        24px 32px 0 #F5C854,
        28px 32px 0 #F5C854,
        32px 32px 0 #F5C854,
        36px 32px 0 #F5C854,
        40px 32px 0 #F5C854,
        44px 32px 0 #F5C854,
        48px 32px 0 #F5C854,
        52px 32px 0 #F5C854,
        56px 32px 0 #E8B84A,
        /* === BODY === */
        /* Row 10 - neck/body top */
        12px 36px 0 #FFFFFF,
        16px 36px 0 #FFFFFF,
        20px 36px 0 #FFFFFF,
        24px 36px 0 #FFFFFF,
        28px 36px 0 #FFFFFF,
        32px 36px 0 #FFFFFF,
        36px 36px 0 #FFFFFF,
        /* Row 11 - body with arms */
        4px 40px 0 #FFFFFF,
        8px 40px 0 #FFFFFF,
        12px 40px 0 #FFFFFF,
        16px 40px 0 #FFFFFF,
        20px 40px 0 #FFFFFF,
        24px 40px 0 #FFFFFF,
        28px 40px 0 #FFFFFF,
        32px 40px 0 #FFFFFF,
        36px 40px 0 #FFFFFF,
        40px 40px 0 #FFFFFF,
        44px 40px 0 #FFFFFF,
        /* Row 12 - body middle */
        8px 44px 0 #FFFFFF,
        12px 44px 0 #FFFFFF,
        16px 44px 0 #FFFFFF,
        20px 44px 0 #FFFFFF,
        24px 44px 0 #FFFFFF,
        28px 44px 0 #FFFFFF,
        32px 44px 0 #FFFFFF,
        36px 44px 0 #FFFFFF,
        40px 44px 0 #FFFFFF,
        /* Row 13 - body bottom */
        12px 48px 0 #FFFFFF,
        16px 48px 0 #FFFFFF,
        20px 48px 0 #FFFFFF,
        24px 48px 0 #FFFFFF,
        28px 48px 0 #FFFFFF,
        32px 48px 0 #FFFFFF,
        36px 48px 0 #FFFFFF,
        /* === PANTS === */
        /* Row 14 - pants top */
        12px 52px 0 #4A3728,
        16px 52px 0 #4A3728,
        20px 52px 0 #4A3728,
        24px 52px 0 #4A3728,
        28px 52px 0 #4A3728,
        32px 52px 0 #4A3728,
        36px 52px 0 #4A3728,
        /* Row 15 - pants/legs */
        12px 56px 0 #4A3728,
        16px 56px 0 #4A3728,
        32px 56px 0 #4A3728,
        36px 56px 0 #4A3728,
        /* === SHOES === */
        /* Row 16 - shoes */
        8px 60px 0 #2C1810,
        12px 60px 0 #2C1810,
        16px 60px 0 #2C1810,
        32px 60px 0 #2C1810,
        36px 60px 0 #2C1810,
        40px 60px 0 #2C1810;
}

/* Expand clickable area with pseudo-element */
.pyramid-char::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    width: 80px;
    height: 80px;
    background: transparent;
}

/* Speech bubble */
.pyramid-char .speech-bubble {
    position: absolute;
    top: -45px;
    left: 24px;
    transform: translateX(-50%);
    background: #FFFFFF;
    border: 3px solid #5C4033;
    border-radius: 12px;
    padding: 8px 16px;
    font-family: 'DotGothic16', monospace;
    font-size: 16px;
    font-weight: bold;
    color: #8B0000;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

.pyramid-char .speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #5C4033;
}

.pyramid-char .speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #FFFFFF;
    z-index: 1;
}

.pyramid-char.show-bubble .speech-bubble {
    opacity: 1;
    visibility: visible;
}

/* ===== MOVEMENT ANIMATIONS ===== */

/* Left to right */
@keyframes pyramid-move-left-right {
    0% { transform: translate(-80px, 0); }
    100% { transform: translate(calc(100vw + 80px), 0); }
}

/* Right to left */
@keyframes pyramid-move-right-left {
    0% { transform: translate(calc(100vw + 80px), 0); }
    100% { transform: translate(-80px, 0); }
}

/* Right to left - small (scale 0.4) */
@keyframes pyramid-move-right-left-small {
    0% { transform: translateX(calc(100vw + 80px)) scale(0.4); }
    100% { transform: translateX(-80px) scale(0.4); }
}

/* Diagonal: top-left to bottom-right */
@keyframes pyramid-move-diagonal-down {
    0% { transform: translate(-80px, -80px); }
    100% { transform: translate(calc(100vw + 80px), calc(100vh + 80px)); }
}

/* Diagonal: bottom-right to top-left */
@keyframes pyramid-move-diagonal-up {
    0% { transform: translate(calc(100vw + 80px), calc(100vh + 80px)); }
    100% { transform: translate(-80px, -80px); }
}

/* Diagonal: top-right to bottom-left */
@keyframes pyramid-move-diagonal-down-reverse {
    0% { transform: translate(calc(100vw + 80px), -80px); }
    100% { transform: translate(-80px, calc(100vh + 80px)); }
}

/* Diagonal: bottom-left to top-right */
@keyframes pyramid-move-diagonal-up-reverse {
    0% { transform: translate(-80px, calc(100vh + 80px)); }
    100% { transform: translate(calc(100vw + 80px), -80px); }
}

/* Top to bottom */
@keyframes pyramid-move-top-bottom {
    0% { transform: translate(0, -80px); }
    100% { transform: translate(0, calc(100vh + 80px)); }
}

/* Bottom to top */
@keyframes pyramid-move-bottom-top {
    0% { transform: translate(0, calc(100vh + 80px)); }
    100% { transform: translate(0, -80px); }
}

/* Wiggle animation */
@keyframes pyramid-wiggle {
    0%, 100% { margin-left: 0; }
    50% { margin-left: 4px; }
}

/* ===== ANIMATION PRESETS ===== */

/* Diagonal down (top-left to bottom-right) */
.pyramid-char.anim-diagonal-down {
    animation: pyramid-move-diagonal-down 18s linear infinite, pyramid-wiggle 0.8s steps(2) infinite;
}

/* Vertical down */
.pyramid-char.anim-top-bottom {
    animation: pyramid-move-top-bottom 22s linear infinite, pyramid-wiggle 0.7s steps(2) infinite;
}

/* Diagonal up (bottom-left to top-right) */
.pyramid-char.anim-diagonal-up {
    animation: pyramid-move-diagonal-up-reverse 25s linear infinite, pyramid-wiggle 0.6s steps(2) infinite;
}

/* Horizontal right */
.pyramid-char.anim-left-right {
    animation: pyramid-move-left-right 20s linear infinite, pyramid-wiggle 0.75s steps(2) infinite;
}

/* Horizontal left */
.pyramid-char.anim-right-left {
    animation: pyramid-move-right-left 20s linear infinite, pyramid-wiggle 0.75s steps(2) infinite;
}

/* Vertical up */
.pyramid-char.anim-bottom-top {
    animation: pyramid-move-bottom-top 22s linear infinite, pyramid-wiggle 0.7s steps(2) infinite;
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media screen and (max-width: 800px) {
    .pyramid-container {
        /* Ensure proper rendering on mobile */
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    .pyramid-char {
        /* Scale down slightly for mobile performance */
        transform-origin: 0 0;
    }

    .pyramid-char .speech-bubble {
        font-size: 14px;
        padding: 6px 12px;
    }
}
