/* ===== Portfolio Animated Website - Design System & Animations ===== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    overflow-x: hidden;
}

/* --- Glassmorphism Utilities --- */
.glass-panel {
    background: rgba(19, 127, 236, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-card {
    background: rgba(19, 127, 236, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(19, 127, 236, 0.2);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-card:hover {
    background: rgba(19, 127, 236, 0.1);
    border-color: rgba(19, 127, 236, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(19, 127, 236, 0.15);
}

.glass {
    background: rgba(19, 127, 236, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-contact {
    background: rgba(28, 33, 39, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- Glow Effects --- */
.neon-glow {
    box-shadow: 0 0 15px rgba(19, 127, 236, 0.3);
}

.glow-accent {
    box-shadow: 0 0 20px rgba(19, 127, 236, 0.15);
}

/* --- Background Effects --- */
.gradient-mesh {
    background-image:
        radial-gradient(at 0% 0%, rgba(19, 127, 236, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(19, 127, 236, 0.1) 0px, transparent 50%);
}

.bg-mesh {
    background-image:
        radial-gradient(at 0% 0%, rgba(19, 127, 236, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(19, 127, 236, 0.1) 0px, transparent 50%);
}

/* Floating particles background */
.particles-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(19, 127, 236, 0.3);
    border-radius: 50%;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

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

/* --- Scroll Reveal System --- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1),
        transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    transition-delay: var(--delay, 0s);
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1),
        transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    transition-delay: var(--delay, 0s);
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(60px);
    transition: opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1),
        transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    transition-delay: var(--delay, 0s);
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.8s cubic-bezier(0.25, 0.8, 0.25, 1),
        transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    transition-delay: var(--delay, 0s);
}

.reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* --- Hero Entrance Animations --- */
@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

@keyframes heroPulseGlow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(19, 127, 236, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(19, 127, 236, 0.6);
    }
}

.hero-animate {
    animation: heroFadeIn 1s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    opacity: 0;
}

.hero-animate-delay-1 {
    animation-delay: 0.15s;
}

.hero-animate-delay-2 {
    animation-delay: 0.3s;
}

.hero-animate-delay-3 {
    animation-delay: 0.45s;
}

.hero-animate-delay-4 {
    animation-delay: 0.6s;
}

/* --- Hero Building Text Animation --- */
.hero-build-container {
    min-height: 4.5rem;
    display: flex;
    align-items: center;
}

.hero-build-word {
    display: flex;
    gap: 0;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1;
    font-family: 'Space Grotesk', sans-serif;
}

.hero-build-char {
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.hero-build-char-inner {
    display: inline-block;
    will-change: transform, opacity;
}

/* Build-in: each fragment slides from a random direction */
.hero-build-char-inner.build-in {
    animation: charBuildIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Build-out: each fragment deconstructs outward */
.hero-build-char-inner.build-out {
    animation: charBuildOut 0.45s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* Directional build variants — set via CSS custom properties */
@keyframes charBuildIn {
    0% {
        opacity: 0;
        transform: translate(var(--bx, 0px), var(--by, 30px)) rotate(var(--br, 0deg)) scale(0.3);
        filter: blur(2px);
    }
    60% {
        opacity: 1;
        filter: blur(0px);
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
        filter: blur(0px);
    }
}

@keyframes charBuildOut {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: translate(var(--bx-out, 0px), var(--by-out, -25px)) rotate(var(--br-out, 0deg)) scale(0.2);
        filter: blur(3px);
    }
}

/* Accent line that draws across during build */
.hero-build-line {
    position: absolute;
    bottom: -4px;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #137fec, rgba(19,127,236,0.3));
    border-radius: 2px;
    transform-origin: left;
    transform: scaleX(0);
    box-shadow: 0 0 12px rgba(19,127,236,0.5);
}

.hero-build-line.draw {
    animation: lineDraw 0.8s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.hero-build-line.undraw {
    animation: lineUndraw 0.4s cubic-bezier(0.55, 0, 1, 0.45) forwards;
    transform-origin: right;
}

@keyframes lineDraw {
    0%   { transform: scaleX(0); opacity: 0; }
    100% { transform: scaleX(1); opacity: 1; }
}

@keyframes lineUndraw {
    0%   { transform: scaleX(1); opacity: 1; }
    100% { transform: scaleX(0); opacity: 0; }
}

/* --- Progress Bar Animation --- */
.progress-bar-animated {
    width: 0% !important;
    transition: width 1.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.progress-bar-animated.animate {
    /* width set by JS */
}

/* --- Bar Chart Animation --- */
.bar-animated {
    height: 0px !important;
    transition: height 1.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.bar-animated.animate {
    /* height set by JS */
}

/* --- Skill Ring Animation --- */
.skill-ring {
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Counter Animation --- */
.counter {
    display: inline-block;
}

/* --- Section Divider --- */
.section-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(19, 127, 236, 0.3), transparent);
    margin: 0;
}

/* --- Animated Nav Link --- */
.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #137fec;
    transition: width 0.3s ease;
    border-radius: 1px;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link.active {
    color: #137fec !important;
}

/* --- Floating Decorative Elements --- */
@keyframes floatY {

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

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

@keyframes floatRotate {

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

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

.float-animation {
    animation: floatY 4s ease-in-out infinite;
}

.float-animation-slow {
    animation: floatY 6s ease-in-out infinite;
}

/* --- Timeline Line Draw --- */
.timeline-line {
    position: relative;
}

.timeline-line::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #137fec, rgba(19, 127, 236, 0.1));
    transform-origin: top;
    transform: scaleY(0);
    transition: transform 1.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.timeline-line.revealed::before {
    transform: scaleY(1);
}

/* --- Magnetic Hover on Buttons --- */
.btn-magnetic {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        box-shadow 0.3s ease;
}

.btn-magnetic:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(19, 127, 236, 0.3);
}

/* --- Card Tilt Shine --- */
.card-shine {
    position: relative;
    overflow: hidden;
}

.card-shine::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0) 40%,
            rgba(255, 255, 255, 0.03) 50%,
            rgba(255, 255, 255, 0) 60%,
            rgba(255, 255, 255, 0) 100%);
    transform: rotate(30deg) translateX(-100%);
    transition: transform 0.8s ease;
    pointer-events: none;
    z-index: 1;
}

.card-shine:hover::before {
    transform: rotate(30deg) translateX(100%);
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #101922;
}

::-webkit-scrollbar-thumb {
    background: rgba(19, 127, 236, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(19, 127, 236, 0.5);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* --- Mobile Menu --- */
.mobile-menu-btn {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
}

/* --- Semester Card Staggered Animation --- */
@keyframes semesterSlideIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.95);
    }

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

.semester-card {
    opacity: 0;
    transform: translateY(24px) scale(0.95);
}

.semester-card.semester-visible {
    animation: semesterSlideIn 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    animation-delay: calc(var(--sem-delay, 0) * 0.15s);
}

/* --- Semester Subject Dots --- */
.semester-card ul li {
    position: relative;
    padding-left: 14px;
}

.semester-card ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #137fec;
    box-shadow: 0 0 6px rgba(19, 127, 236, 0.9);
}

.semester-card ul li.no-dot {
    padding-left: 0;
}

.semester-card ul li.no-dot::before {
    display: none;
}

/* --- Expertise Heatmap Tiles --- */
.heatmap-tile {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.heatmap-tile-pro {
    background: #137fec;
    box-shadow: 0 0 12px rgba(19, 127, 236, 0.4);
    color: #ffffff;
}

.heatmap-tile-mid {
    background: rgba(19, 127, 236, 0.3);
    border: 1px solid rgba(19, 127, 236, 0.2);
    color: #e0e8f0;
}

.heatmap-tile-found {
    background: rgba(74, 96, 112, 0.2);
    border: 1px solid rgba(74, 96, 112, 0.15);
    color: #a0b4c4;
}

/* --- Study Diary Image Containers --- */
.diary-entry .w-full.h-\[280px\] {
    position: relative;
    overflow: hidden !important;
    background: transparent;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.diary-entry .w-full.h-\[280px\] img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    border-radius: 0.75rem;
}

.heatmap-tile:hover {
    transform: scale(1.12);
    z-index: 10;
    box-shadow: 0 0 24px rgba(19, 127, 236, 0.5);
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .reveal {
        transform: translateY(20px);
    }

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

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

/* --- Hero Profile Video Card --- */
.hero-video-card {
    position: relative;
    padding: 0 !important;
    min-height: 200px;
}

.hero-profile-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 1rem;
    position: absolute;
    inset: 0;
    opacity: 0;
    animation: videoFadeIn 1.2s cubic-bezier(0.25, 0.8, 0.25, 1) 0.3s forwards;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hero-video-card:hover .hero-profile-video {
    transform: scale(1.03);
}

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

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

/* --- About Me Dashboard Card --- */
.about-me-card {
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #000;
}

.about-me-card-inner {
    display: flex;
    align-items: stretch;
    min-height: 320px;
}

.about-me-left {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 2;
    background: linear-gradient(135deg, rgba(19, 127, 236, 0.08), rgba(19, 127, 236, 0.03)), #101922;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.about-me-wave {
    width: 80px;
    flex-shrink: 0;
    position: relative;
    z-index: 3;
    background: rgba(19, 127, 236, 0.05);
}

.about-me-wave-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.about-me-right {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

.about-me-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    inset: 0;
}

/* Wave path draw animation */
.about-wave-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: wavePathDraw 2.5s cubic-bezier(0.25, 0.8, 0.25, 1) 0.5s forwards;
}

@keyframes wavePathDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
    .about-me-card-inner {
        flex-direction: column;
        min-height: auto;
    }

    .about-me-left {
        padding: 1.5rem;
    }

    .about-me-wave {
        width: 100%;
        height: 50px;
        transform: rotate(90deg);
    }

    .about-me-right {
        height: 250px;
    }

    .about-me-video {
        border-radius: 0 0 1.5rem 1.5rem;
    }
}