/* ============================================
   KAIG GROUP — Animation Styles
   ============================================ */

/* ── Keyframe Animations ── */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 20px 10px rgba(255, 0, 0, 0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
        opacity: 0;
    }

    to {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
}

@keyframes lineExpand {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroSlideIn {
    from {
        opacity: 0;
        transform: scale(1.1);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes marquee {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ── Scroll Reveal Classes ── */
/* Elements start hidden, JS adds .revealed when in viewport */

.reveal {
    opacity: 0;
    transition: opacity var(--duration-slower) var(--ease-out),
        transform var(--duration-slower) var(--ease-out);
}

.reveal.reveal-up {
    transform: translateY(60px);
}

.reveal.reveal-down {
    transform: translateY(-60px);
}

.reveal.reveal-left {
    transform: translateX(-60px);
}

.reveal.reveal-right {
    transform: translateX(60px);
}

.reveal.reveal-scale {
    transform: scale(0.9);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger children */
.stagger-children .reveal:nth-child(1) {
    transition-delay: 0ms;
}

.stagger-children .reveal:nth-child(2) {
    transition-delay: 100ms;
}

.stagger-children .reveal:nth-child(3) {
    transition-delay: 200ms;
}

.stagger-children .reveal:nth-child(4) {
    transition-delay: 300ms;
}

.stagger-children .reveal:nth-child(5) {
    transition-delay: 400ms;
}

.stagger-children .reveal:nth-child(6) {
    transition-delay: 500ms;
}

.stagger-children .reveal:nth-child(7) {
    transition-delay: 600ms;
}

.stagger-children .reveal:nth-child(8) {
    transition-delay: 700ms;
}

.stagger-children .reveal:nth-child(9) {
    transition-delay: 800ms;
}

.stagger-children .reveal:nth-child(10) {
    transition-delay: 900ms;
}

.stagger-children .reveal:nth-child(11) {
    transition-delay: 1000ms;
}

.stagger-children .reveal:nth-child(12) {
    transition-delay: 1100ms;
}

.stagger-children .reveal:nth-child(13) {
    transition-delay: 1200ms;
}

.stagger-children .reveal:nth-child(14) {
    transition-delay: 1300ms;
}

/* ── Parallax Helpers ── */
.parallax-bg {
    will-change: transform;
    transition: transform 0.1s linear;
}

.parallax-slow {
    --parallax-speed: 0.3;
}

.parallax-medium {
    --parallax-speed: 0.5;
}

.parallax-fast {
    --parallax-speed: 0.7;
}

/* ── Card 3D Tilt ── */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform var(--duration-normal) var(--ease-out);
}

.tilt-card:hover {
    box-shadow: var(--shadow-lg);
}

.tilt-card .tilt-card-inner {
    transform-style: preserve-3d;
    transition: transform var(--duration-normal) var(--ease-out);
}

.tilt-card .tilt-card-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
            rgba(255, 255, 255, 0.06) 0%,
            transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-smooth);
}

.tilt-card:hover .tilt-card-shine {
    opacity: 1;
}

/* ── Magnetic Button ── */
.magnetic-btn {
    position: relative;
    display: inline-flex;
    transition: transform var(--duration-normal) var(--ease-spring);
}

.magnetic-btn .magnetic-btn-text {
    transition: transform var(--duration-normal) var(--ease-spring);
}

/* ── Hero Carousel ── */
.hero-slide {
    opacity: 0;
    position: absolute;
    inset: 0;
    transition: opacity 1s var(--ease-smooth);
}

.hero-slide.active {
    opacity: 1;
    z-index: 2;
}

.hero-slide .hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 8s linear;
}

.hero-slide.active .hero-bg {
    transform: scale(1.05);
}

/* Hero text animation */
.hero-text-line {
    overflow: hidden;
}

.hero-text-line span {
    display: inline-block;
    transform: translateY(120%);
    transition: transform 0.8s var(--ease-out);
}

.hero-slide.active .hero-text-line span {
    transform: translateY(0);
}

.hero-text-line:nth-child(2) span {
    transition-delay: 0.15s;
}

.hero-text-line:nth-child(3) span {
    transition-delay: 0.3s;
}

/* Hero dots/arrows */
.hero-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    cursor: pointer;
    transition: var(--transition-all);
}

.hero-dot.active {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.2);
}

.hero-dot:hover {
    border-color: var(--primary);
}

.hero-arrow {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-all);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(4px);
}

.hero-arrow:hover {
    border-color: var(--primary);
    background: var(--primary);
    transform: scale(1.1);
}

/* ── Count Up Number ── */
.count-number {
    font-family: var(--font-display);
    font-size: var(--text-5xl);
    font-weight: var(--weight-black);
    color: var(--primary);
    line-height: 1;
}

.count-number .count-suffix {
    font-size: 0.6em;
    color: var(--primary-light);
}

/* ── Timeline ── */
.timeline-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0;
    background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
    transition: height 1.5s var(--ease-out);
}

.timeline-line.animated {
    height: 100%;
}

.timeline-dot {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    border: 3px solid var(--bg-primary);
    box-shadow: 0 0 0 3px var(--primary);
    position: relative;
    z-index: 2;
    animation: pulseGlow 2s ease-in-out infinite;
}

/* ── Loading/Skeleton ── */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-tertiary) 25%,
            var(--bg-card-hover) 50%,
            var(--bg-tertiary) 75%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* ── Page Transition ── */
.page-transition {
    position: fixed;
    inset: 0;
    background: var(--primary);
    z-index: 10000;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.5s var(--ease-out);
}

.page-transition.active {
    transform: scaleY(1);
    transform-origin: top;
}

/* ── Preloader ── */
.preloader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-logo {
    width: 120px;
    animation: pulse 1.5s ease-in-out infinite;
}

[data-theme="light"] .preloader-logo {
    filter: invert(1) hue-rotate(180deg);
}

/* ── Gradient Animation Background ── */
.gradient-bg {
    background: linear-gradient(-45deg,
            var(--secondary-dark),
            var(--secondary),
            #3a0000,
            var(--secondary-dark));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

/* ── Hover Underline Effect ── */
.hover-line {
    position: relative;
    display: inline-block;
}

.hover-line::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--duration-normal) var(--ease-out);
}

.hover-line:hover::after {
    width: 100%;
}

/* ── Responsive: Disable heavy animations on mobile ── */
@media (max-width: 768px) {
    .reveal {
        transition-duration: 0.5s;
    }

    .reveal.reveal-up {
        transform: translateY(30px);
    }

    .reveal.reveal-left {
        transform: translateX(-30px);
    }

    .reveal.reveal-right {
        transform: translateX(30px);
    }

    .tilt-card:hover {
        transform: none;
    }

    .hero-slide .hero-bg {
        transition: none;
    }

    .hero-slide.active .hero-bg {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ── Perfect Circular Orbit Ecosystem ── */
.orbit-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -3rem auto 0 auto;
    overflow: visible;
}

.orbit-center {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(255, 0, 0, 0.2) 0%, rgba(20, 20, 20, 1) 80%);
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.8);
    z-index: 10;
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.orbit-center-logo {
    width: 75%;
    height: auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
}

/* The track spins the entire ecosystem ring */
.orbit-track {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    margin-top: -300px;
    margin-left: -300px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    animation: trackSpin 60s linear infinite;
    box-sizing: border-box;
    pointer-events: none;
}

/* Positions each company along the track */
.orbit-planet {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transform: rotate(var(--angle)) translate(300px);
}

/* Counter-rotates dynamically to lock the logo strictly upright */
.orbit-item-rotator {
    position: absolute;
    width: 80px;
    height: 80px;
    margin-top: -40px;
    margin-left: -40px;
    animation: uprightLock 60s linear infinite;
    pointer-events: auto;
}

.orbit-item-content {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    padding: 10px;
    box-sizing: border-box;
}

.orbit-item-content:hover {
    filter: brightness(1.2);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.orbit-item-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0px 2px 4px rgba(255, 255, 255, 0.2));
}

/* Light mode support */
[data-theme="light"] .orbit-item-content {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .orbit-item-content:hover {
    background: #ffffff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Animations */
@keyframes trackSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes uprightLock {
    from {
        transform: rotate(calc(-1 * var(--angle)));
    }

    to {
        transform: rotate(calc(-1 * (var(--angle) + 360deg)));
    }
}

/* Responsive Mobile Layout */
@media (max-width: 768px) {
    .orbit-wrapper {
        height: 400px;
        margin-bottom: 3rem;
    }

    .orbit-center {
        width: 100px;
        height: 100px;
    }

    .orbit-track {
        width: 280px;
        height: 280px;
        margin-top: -140px;
        margin-left: -140px;
    }

    .orbit-planet {
        transform: rotate(var(--angle)) translate(140px);
    }

    .orbit-item-rotator {
        width: 50px;
        height: 50px;
        margin-top: -25px;
        margin-left: -25px;
    }
}

/* ── Aurelion Blinking Light ── */
@keyframes aurelionBlink {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.3), inset 0 0 5px rgba(255, 255, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.9), inset 0 0 10px rgba(255, 255, 255, 0.5);
    }
}

.aurelion-blink {
    animation: aurelionBlink 2s ease-in-out infinite;
}

/* ── Mobile Overrides ── */
@media (max-width: 768px) {
    .timeline-line {
        left: 20px;
    }
}