/* ==========================================================================
   SEA (Studio for Eclectic Architecture) — Animated Flying Parrot Cursor
   Brand Colors: Teal/Cyan #008C9E, Dark Teal #006F80, Slate #081F2C, White #FFF
   ========================================================================== */

/* Hide native cursor ONLY on desktop devices supporting fine pointer + hover */
@media (hover: hover) and (pointer: fine) {
    html.sea-cursor-enabled,
    html.sea-cursor-enabled body,
    html.sea-cursor-enabled a,
    html.sea-cursor-enabled button,
    html.sea-cursor-enabled [role="button"],
    html.sea-cursor-enabled .bs-btn-1,
    html.sea-cursor-enabled .bs-btn-2,
    html.sea-cursor-enabled .bs-offcanvas-btn-1,
    html.sea-cursor-enabled .card-img a {
        cursor: none !important;
    }

    /* Preserve native text selection cursor for inputs and text areas */
    html.sea-cursor-enabled input,
    html.sea-cursor-enabled textarea,
    html.sea-cursor-enabled select,
    html.sea-cursor-enabled [contenteditable="true"] {
        cursor: text !important;
    }
}

/* Suppress legacy Barsi orange template cursor if present */
.wa-cursor,
.wa-cursor-text {
    display: none !important;
}

/* Flight trail canvas */
#sea-cursor-trail-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none !important;
    z-index: 99998;
    background: transparent;
    contain: strict;
}

/* Main cursor container */
.sea-cursor-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    pointer-events: none !important;
    z-index: 99999;
    will-change: transform;
    user-select: none !important;
    contain: layout style;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sea-cursor-container.is-visible {
    opacity: 1;
}

.sea-cursor-container.is-hidden {
    opacity: 0 !important;
}

/* Cursor anchor positioned at mouse/flight target */
.sea-cursor-anchor {
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    pointer-events: none !important;
}

/* Precision target dot near beak */
.sea-cursor-target-dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 4px;
    background: #008C9E;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(0, 140, 158, 0.9), 0 0 2px #ffffff;
    pointer-events: none !important;
    z-index: 4;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

/* The Flying Parrot Wrapper */
.sea-parrot-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 54px;
    height: 46px;
    transform: translate(-55%, -50%);
    transform-origin: 50% 50%;
    pointer-events: none !important;
    transition: filter 0.3s ease;
}

/* Parrot SVG */
.sea-parrot-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 4px 8px rgba(8, 31, 44, 0.22));
}

/* Wing flapping animation keyframes */
@keyframes seaParrotWingNear {
    0% {
        transform: rotate(-36deg) scaleY(1.05) skewY(-6deg);
    }
    50% {
        transform: rotate(38deg) scaleY(0.72) skewY(10deg);
    }
    100% {
        transform: rotate(-36deg) scaleY(1.05) skewY(-6deg);
    }
}

@keyframes seaParrotWingFar {
    0% {
        transform: rotate(-30deg) scaleY(1.02) skewY(-5deg);
    }
    50% {
        transform: rotate(32deg) scaleY(0.68) skewY(8deg);
    }
    100% {
        transform: rotate(-30deg) scaleY(1.02) skewY(-5deg);
    }
}

@keyframes seaParrotTailFlow {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(7deg) scaleX(0.96);
    }
}

@keyframes seaParrotBodyBob {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

/* Default wing flapping rates */
.sea-parrot-wing-near {
    transform-origin: 27px 18px;
    animation: seaParrotWingNear 0.22s ease-in-out infinite;
    will-change: transform;
}

.sea-parrot-wing-far {
    transform-origin: 24px 17px;
    animation: seaParrotWingFar 0.22s ease-in-out infinite;
    will-change: transform;
}

.sea-parrot-tail {
    transform-origin: 16px 26px;
    animation: seaParrotTailFlow 0.44s ease-in-out infinite;
    will-change: transform;
}

.sea-parrot-body-group {
    animation: seaParrotBodyBob 0.22s ease-in-out infinite;
}

/* Fast flying state: rapid wing flaps */
.sea-cursor-container.is-speeding .sea-parrot-wing-near,
.sea-cursor-container.is-speeding .sea-parrot-wing-far {
    animation-duration: 0.13s;
}

/* Hovering / Idle state: gentle leisurely flaps */
.sea-cursor-container.is-hovering .sea-parrot-wing-near,
.sea-cursor-container.is-hovering .sea-parrot-wing-far,
.sea-cursor-container.is-idle .sea-parrot-wing-near,
.sea-cursor-container.is-idle .sea-parrot-wing-far {
    animation-duration: 0.42s;
}

/* --- STATE: Hover Navigation Links (Gentle slow hover) --- */
.sea-cursor-container.state-nav .sea-parrot-wrapper {
    filter: drop-shadow(0 0 10px rgba(0, 140, 158, 0.75)) drop-shadow(0 2px 4px rgba(8, 31, 44, 0.4));
}
.sea-cursor-container.state-nav .sea-cursor-target-dot {
    transform: translate(-50%, -50%) scale(1.4);
    box-shadow: 0 0 10px #008C9E;
}

/* --- STATE: Hover Button (Luminous teal highlight & slight expansion) --- */
.sea-cursor-container.state-button .sea-parrot-wrapper {
    transform: translate(-55%, -50%) scale(1.15);
    filter: drop-shadow(0 0 14px rgba(0, 140, 158, 0.95)) drop-shadow(0 0 4px #00E5FF);
}
.sea-cursor-container.state-button .sea-cursor-target-dot {
    background: #00E5FF;
    transform: translate(-50%, -50%) scale(1.5);
    box-shadow: 0 0 12px #00E5FF;
}

/* --- STATE: Hover Project Images (Circling glide & Explore Badge) --- */
.sea-cursor-container.state-project .sea-parrot-wrapper {
    filter: drop-shadow(0 0 12px rgba(0, 140, 158, 0.85));
}

.sea-parrot-badge-explore {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(8, 31, 44, 0.85);
    border: 1.5px solid #008C9E;
    box-shadow: 0 8px 24px rgba(8, 31, 44, 0.6), 0 0 16px rgba(0, 140, 158, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none !important;
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.25s ease;
    z-index: 2;
}

.sea-parrot-badge-explore span.text {
    font-family: inherit;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #ffffff;
    line-height: 1;
    margin-top: 2px;
}

.sea-parrot-badge-explore .badge-icon {
    margin-bottom: 2px;
    color: #008C9E;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sea-cursor-container.state-project .sea-parrot-badge-explore {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* --- STATE: Text Inputs (Faded out for clear text cursor) --- */
.sea-cursor-container.state-text {
    opacity: 0.15 !important;
}

/* --- STATE: Mouse Click Reaction --- */
.sea-cursor-container.is-active .sea-parrot-wrapper {
    transform: translate(-55%, -50%) scale(0.92);
    transition-duration: 0.08s;
}

/* Reduced motion accessibility fallback */
@media (prefers-reduced-motion: reduce) {
    #sea-cursor-trail-canvas {
        display: none !important;
    }
    .sea-parrot-wing-near,
    .sea-parrot-wing-far,
    .sea-parrot-tail,
    .sea-parrot-body-group {
        animation: none !important;
    }
    .sea-parrot-wrapper,
    .sea-cursor-container,
    .sea-parrot-badge-explore {
        transition: none !important;
    }
}
