/* HERO ENTRANCE ANIMATIONS */

/* Sidebar container fades up on load */
.sidebar {
    animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

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

/* Name character split — each .char animates in */
.char {
    display: inline-block;
    animation: charIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    transform-origin: bottom center;
}

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

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

.name {
    perspective: 400px;
    display: block;
}

/* Title slides in from left */
.title {
    animation: slideInLeft 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

/* Sanskrit tagline fade-in */
.tagline-devanagari,
.tagline-transliteration {
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
}

/* Bottom sidebar fades up */
.sidebar__bottom {
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.8s both;
}

/* Node graph dots scale in then pulse */
.node-graph__dot {
    animation: dotIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both,
        dotPulse 2s ease-in-out infinite alternate;
}

.node-graph__dot:nth-child(2) {
    animation-delay: 1.2s, 1.6s;
}

.node-graph__dot:nth-child(3) {
    animation-delay: 1.3s, 1.7s;
}

.node-graph__dot:nth-child(4) {
    animation-delay: 1.4s, 1.8s;
}

.node-graph__dot:nth-child(5) {
    animation-delay: 1.5s, 1.9s;
}

.node-graph__dot:nth-child(6) {
    animation-delay: 1.6s, 2.0s;
}

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

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

@keyframes dotPulse {
    from {
        transform: scale(0.8);
        opacity: 0.4;
    }

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

/* SCROLL REVEAL BASE STATES */
.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

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

.reveal.scale-in {
    transform: scale(0.97);
}

.revealed {
    opacity: 1 !important;
    transform: none !important;
}

/* CARD BORDER TRAIL */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes border-spin {
    to {
        --border-angle: 360deg;
    }
}

.project-card {
    --border-angle: 0deg;
}

.project-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: conic-gradient(from var(--border-angle),
            transparent 60%,
            var(--accent) 80%,
            transparent 100%);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 1px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.project-card:hover::before {
    opacity: 1;
    animation: border-spin 3s linear infinite;
}

/* NUMBER COUNTER */
.count-up {
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    display: inline-block;
    min-width: 1ch;
}

/* REDUCED MOTION — kill everything */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    main {
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }

    .reveal,
    .tagline-devanagari,
    .tagline-transliteration {
        opacity: 1 !important;
        transform: none !important;
    }

    .char {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* MOBILE — redefine entrance animations tailored for touch */
@media (max-width: 768px) {
    .char {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
        display: inline !important;
    }

    .name {
        animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both !important;
    }

    .title {
        animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both !important;
    }

    .tagline-devanagari,
    .tagline-transliteration,
    .tagline-group {
        animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both !important;
        opacity: 1;
    }

    nav {
        animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
    }

    .sidebar__bottom {
        animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
    }
}

/* SECTION FADE BOUNDARY */
main {
    -webkit-mask-image: none;
    mask-image: none;
}

section[id] {
    opacity: 1 !important;
    transition: none !important;
}

@media (max-width: 768px) {
    main {
        -webkit-mask-image: none !important;
        mask-image: none !important;
    }
}