/* Interactive Particles Canvas - Phase 3 */
.particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
    display: block;
}

/* Hide particles on mobile to prevent overflow and improve performance */
@media (max-width: 768px) {
    .particles-canvas {
        display: none;
    }
}

/* Parallax Effect - Phase 3 */
.parallax-container {
    position: relative;
    will-change: transform;
}

.parallax-slow {
    will-change: transform;
}

.parallax-fast {
    will-change: transform;
}

/* --- NEW BACKGROUND PATTERNS --- */

/* 1. Tech Grid Pattern */
.bg-grid-pattern {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: 50px 50px;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    pointer-events: none;
}

/* 2. Dot Pattern */
.bg-dot-pattern {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: 24px 24px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
    pointer-events: none;
}

/* 3. Ambient Glow Spots */
/* ✅ P2: Xóa filter:blur(60px) — tốn GPU offscreen buffer
   Thay bằng radial-gradient multi-stop có soft edge tự nhiên.
   Visual gần tương đương, GPU freed hoàn toàn. */
.glow-spot {
    position: absolute;
    width: 900px;
    height: 900px;
    /* Multi-stop gradient tạo soft fade tự nhiên — không cần blur() */
    background: radial-gradient(
        circle at center,
        rgba(217, 255, 0, 0.14) 0%,
        rgba(217, 255, 0, 0.08) 25%,
        rgba(217, 255, 0, 0.04) 50%,
        rgba(217, 255, 0, 0.01) 65%,
        transparent 70%
    );
    border-radius: 50%;
    /* filter: blur(60px); — ĐÃ XÓA: không còn tạo offscreen GPU buffer */
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}

.glow-spot-left {
    top: 20%;
    left: -200px;
}

.glow-spot-right {
    bottom: 20%;
    right: -200px;
}

/* Timeline Components - Enhanced Glassmorphism */
.timeline-container {
    position: relative;
    padding: 2rem 0;
}

.timeline-line {
    position: absolute;
    left: 28px; /* Adjusted for larger icons */
    top: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, #D9FF00, rgba(217, 255, 0, 0.1));
    transform-origin: top;
    transform: scaleY(0);
    transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

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

.timeline-item {
    position: relative;
    padding-left: 80px; /* More space for larger icon layout */
    margin-bottom: 40px;
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item.active {
    opacity: 1;
    transform: translateX(0);
}

/* Timeline Dot as Icon Container */
.timeline-dot {
    position: absolute;
    left: 8px; /* Centered with line */
    top: 0;
    width: 42px;
    height: 42px;
    background: #0a0a0a;
    border: 2px solid rgba(217, 255, 0, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D9FF00;
    z-index: 10;
    box-shadow: 0 0 0 4px rgba(10, 10, 10, 1); /* Spacing from line */
    transition: all 0.3s ease;
}

.timeline-item:hover .timeline-dot {
    border-color: #D9FF00;
    box-shadow: 0 0 15px rgba(217, 255, 0, 0.4), 0 0 0 4px rgba(10, 10, 10, 1);
    transform: scale(1.1);
}

/* Pulse effect for current/latest item */
.timeline-dot.current {
    box-shadow: 0 0 0 0 rgba(217, 255, 0, 0.7);
    animation: pulse-dot-enhanced 2s infinite;
}

@keyframes pulse-dot-enhanced {
    0% {
        box-shadow: 0 0 0 0 rgba(217, 255, 0, 0.4), 0 0 0 4px rgba(10, 10, 10, 1);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(217, 255, 0, 0), 0 0 0 4px rgba(10, 10, 10, 1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(217, 255, 0, 0), 0 0 0 4px rgba(10, 10, 10, 1);
    }
}

/* ============================================
   UNIFIED TIMELINE CARD STYLES - COMPACT
   ============================================ */

/* Glass Card Style - Compact */
.timeline-card {
    /* ✅ P2: Xóa backdrop-filter:blur(10px) — nhiều cards cùng blur = GPU quá tải
       Tăng background opacity lên 0.78 để bù visual (vẫn có depth, ít transparent hơn) */
    background: rgba(22, 22, 22, 0.78);
    /* backdrop-filter: blur(10px); — ĐÃ XÓA */
    /* -webkit-backdrop-filter: blur(10px); — ĐÃ XÓA */
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Glow effect on hover */
.timeline-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(217, 255, 0, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timeline-card:hover {
    transform: translateY(-4px);
    border-color: rgba(217, 255, 0, 0.2);
    box-shadow: 
        0 20px 40px -15px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(217, 255, 0, 0.1) inset;
    background: rgba(30, 30, 30, 0.6);
}

.timeline-card:hover::before {
    opacity: 1;
}

/* Card Header - Date Badge & GPA/Icon */
.timeline-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.625rem;
}

/* Date Badge */
.timeline-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #9ca3af;
    font-size: 0.6875rem;
    font-family: 'Space Grotesk', monospace;
    font-weight: 500;
    transition: all 0.3s ease;
}

.timeline-date-badge i {
    opacity: 0.7;
}

.timeline-card:hover .timeline-date-badge {
    background: rgba(217, 255, 0, 0.1);
    color: #D9FF00;
    border-color: rgba(217, 255, 0, 0.25);
}

/* GPA Display */
.timeline-gpa {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.gpa-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 0;
}

.gpa-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    transition: color 0.3s ease;
}

.timeline-card:hover .gpa-value {
    color: #D9FF00;
}

/* Icon Badge (for non-GPA items) */
.timeline-icon-badge {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #6b7280;
    transition: all 0.3s ease;
}

.timeline-card:hover .timeline-icon-badge {
    background: rgba(217, 255, 0, 0.1);
    border-color: rgba(217, 255, 0, 0.3);
    color: #D9FF00;
    transform: scale(1.05);
}

/* Card Content */
.timeline-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

/* Card Body - Unified layout for title + status/award */
.timeline-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.375rem;
}

.timeline-card-body .timeline-title {
    flex-shrink: 0;
}

.timeline-card-body .timeline-subtitle {
    margin-top: 0.125rem;
}

/* Title container in card body (for enrollment card with subtitle) */
.timeline-card-body > div:has(.timeline-title) {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.timeline-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.timeline-card:hover .timeline-title {
    color: #D9FF00;
}

.timeline-subtitle {
    font-size: 0.8125rem;
    color: #9ca3af;
    font-weight: 400;
    line-height: 1.4;
}

/* Status Badges */
.timeline-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    width: fit-content;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-progress {
    color: #D9FF00;
}

.status-progress .status-dot {
    width: 6px;
    height: 6px;
    background: #D9FF00;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

.status-completed {
    color: #10b981;
}

/* Status alignment variants - DEPRECATED: use .timeline-card-body instead */
.status-right {
    margin-left: auto;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Achievement/Award Badge */
.timeline-award {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #eab308;
    margin-top: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-award i {
    opacity: 0.9;
    flex-shrink: 0;
}

.timeline-award.award-blue {
    color: #60a5fa;
}

/* Award alignment variants - DEPRECATED: use .timeline-card-body instead */
.timeline-award.award-right {
    margin-left: auto;
}

/* Semester Details Grid - Compact */
.timeline-semesters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline-semesters.semesters-1 {
    grid-template-columns: 1fr;
    max-width: 100px;
    margin-left: 0;
}

.timeline-semesters.semesters-2 {
    grid-template-columns: repeat(2, 1fr);
}

.semester-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    padding: 0.5rem 0.375rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    transition: all 0.25s ease;
}

.semester-box:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.semester-label {
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

.semester-gpa {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #ffffff;
}

/* ============================================
   ALTERNATING TIMELINE LAYOUT
   ============================================ */

/* Desktop: Alternating zigzag layout */
@media (min-width: 769px) {
    .timeline-line {
        left: 50%;
        transform: translateX(-50%) scaleY(0);
        width: 2px;
    }

    .timeline-line.active {
        transform: translateX(-50%) scaleY(1);
    }

    .timeline-item {
        width: 50%;
        padding-left: 0;
        margin-bottom: 0; /* Clear margin, handle via padding */
        padding-bottom: 40px;
        position: relative;
    }

    /* Odd items (1, 3, 5...) - Left side */
    .timeline-item:nth-child(odd) {
        margin-left: 0;
        margin-right: auto;
        padding-right: 60px; /* Space for dot */
        text-align: left;
        transform: translateX(-50px);
    }

    .timeline-item:nth-child(odd).active {
        transform: translateX(0);
    }
    
    .timeline-item:nth-child(odd) .timeline-card {
        margin-left: auto; /* Push card to right of the left-half */
        margin-right: 0;
    }

    .timeline-item:nth-child(odd) .flex-responsive {
        flex-direction: row;
    }
    
    .timeline-item:nth-child(odd) .justify-responsive {
        justify-content: flex-start;
    }
    
    /* Card body alignment for odd items (row direction) */
    .timeline-item:nth-child(odd) .timeline-card-body {
        flex-direction: row;
    }
    
    /* GPA section always aligns to the right side of card */
    .timeline-item:nth-child(odd) .timeline-gpa {
        align-items: flex-end;
        text-align: right;
    }

    /* Even items (2, 4, 6...) - Right side */
    .timeline-item:nth-child(even) {
        margin-left: auto;
        margin-right: 0;
        padding-left: 60px; /* Space for dot */
        text-align: left;
        transform: translateX(50px);
    }

    .timeline-item:nth-child(even).active {
        transform: translateX(0);
    }
    
    /* Card body alignment for even items (row direction - same as odd) */
    .timeline-item:nth-child(even) .timeline-card-body {
        flex-direction: row;
    }
    
    /* GPA section always aligns to the right side of card */
    .timeline-item:nth-child(even) .timeline-gpa {
        align-items: flex-end;
        text-align: right;
    }

    /* Timeline dots positioning */
    .timeline-item:nth-child(odd) .timeline-dot {
        left: auto;
        right: -21px; /* Half of width (42px) */
    }

    .timeline-item:nth-child(even) .timeline-dot {
        left: -21px; /* Half of width (42px) */
        right: auto;
    }

    /* Connector lines - Enhanced */
    .timeline-item::after {
        content: '';
        position: absolute;
        top: 21px; /* Mid of dot */
        width: 40px;
        height: 1px;
        background: linear-gradient(to right, rgba(217, 255, 0, 0.5), transparent);
    }

    .timeline-item:nth-child(odd)::after {
        right: 21px; /* Connect to dot */
        left: auto;
        background: linear-gradient(to left, rgba(217, 255, 0, 0.5), transparent);
    }

    .timeline-item:nth-child(even)::after {
        left: 21px; /* Connect to dot */
        right: auto;
    }

    /* Animation delays for stagger effect */
    .timeline-item:nth-child(1) { transition-delay: 0ms; }
    .timeline-item:nth-child(2) { transition-delay: 150ms; }
    .timeline-item:nth-child(3) { transition-delay: 300ms; }
    .timeline-item:nth-child(4) { transition-delay: 450ms; }
}

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

    .timeline-item {
        padding-left: 60px;
        padding-bottom: 32px;
        margin-bottom: 0;
        width: 100%;
        text-align: left;
    }
    
    /* Reset odd item styles for mobile */
    .timeline-item:nth-child(odd) {
        padding-right: 0;
        text-align: left;
    }
    
    .timeline-item:nth-child(odd) .timeline-card {
        margin-left: 0;
        margin-right: 0;
    }

    .timeline-dot {
        left: 0;
        width: 40px;
        height: 40px;
    }

    .timeline-item:nth-child(odd) .timeline-dot,
    .timeline-item:nth-child(even) .timeline-dot {
        left: 0;
        right: auto;
    }
    
    .timeline-item::after {
        display: none;
    }
    
    .timeline-card {
        padding: 1.25rem;
    }
    
    .timeline-item:nth-child(odd) .flex-responsive,
    .timeline-item:nth-child(even) .flex-responsive {
        flex-direction: row;
    }
    
    .timeline-item:nth-child(odd) .justify-responsive,
    .timeline-item:nth-child(even) .justify-responsive {
        justify-content: flex-start;
    }
    
    /* Mobile Timeline Card Adjustments */
    .timeline-card {
        padding: 0.875rem 1rem;
    }
    
    .timeline-card-header {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    /* Mobile card body - allow wrapping */
    .timeline-card-body {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .timeline-card-body .timeline-title {
        flex-shrink: 1;
    }
    
    /* Mobile: enrollment card body adjustments */
    .timeline-card-body > div:has(.timeline-title) {
        flex: 1;
        min-width: 0;
    }
    
    .gpa-value {
        font-size: 1.5rem;
    }
    
    .timeline-title {
        font-size: 0.9375rem;
    }
    
    .timeline-semesters {
        gap: 0.375rem;
        margin-top: 0.625rem;
        padding-top: 0.625rem;
    }
    
    .semester-box {
        padding: 0.375rem 0.25rem;
    }
    
    .semester-gpa {
        font-size: 0.875rem;
    }
}

/* ============================================
   MOBILE RESPONSIVE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Hero Section Mobile */
    .min-h-screen {
        min-height: auto;
        padding-top: 6rem;
        padding-bottom: 4rem;
    }

    /* Avatar sizing */
    .relative.w-64.h-64 {
        width: 200px;
        height: 200px;
    }

    /* Hero text adjustments */
    h1 .block.text-xl {
        font-size: 1.1rem !important;
        white-space: normal !important;
        overflow: visible !important;
    }

    /* Typing cursor on mobile */
    .typing-cursor::after {
        display: none;
    }

    /* Bento Grid Mobile */
    .auto-rows-\[180px\] {
        grid-auto-rows: auto;
    }

    .overview-card {
        min-height: 160px;
    }

    .overview-card.md\:col-span-2.row-span-2 {
        min-height: 280px;
    }

    /* Reduce padding in cards */
    .overview-card.p-6,
    .overview-card.p-8 {
        padding: 1rem;
    }

    /* Skills pills mobile */
    .skill-pill {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    /* Project cards mobile */
    .project-card .h-64 {
        height: 180px;
    }

    .project-card .p-8 {
        padding: 1rem;
    }

    .project-card h3 {
        font-size: 1.125rem;
    }

    /* Footer mobile */
    footer .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    footer .grid-cols-2.gap-4 {
        gap: 1rem;
    }

    /* Glow spots smaller on mobile */
    .glow-spot {
        width: 300px;
        height: 300px;
        filter: blur(40px);
    }

    .glow-spot-left {
        left: -100px;
    }

    .glow-spot-right {
        right: -100px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    /* Further reduce padding */
    section {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Timeline extra small */
    .timeline-item {
        padding-left: 32px;
    }

    .timeline-line {
        left: 5px;
    }

    .timeline-dot {
        left: 0;
        width: 12px;
        height: 12px;
    }

    /* Avatar even smaller */
    .relative.w-64.h-64 {
        width: 160px;
        height: 160px;
    }

    /* Education cards */
    .timeline-item .bg-surfaceHighlight {
        padding: 0.75rem;
    }

    .timeline-item h3 {
        font-size: 0.9rem;
    }

    .timeline-item .text-sm {
        font-size: 0.75rem;
    }
    
    /* Extra small screen timeline adjustments */
    .timeline-card {
        padding: 0.75rem 0.875rem;
    }
    
    .timeline-card-header {
        flex-wrap: wrap;
        margin-bottom: 0.375rem;
    }
    
    .timeline-date-badge {
        font-size: 0.625rem;
        padding: 0.2rem 0.5rem;
    }
    
    .gpa-value {
        font-size: 1.375rem;
    }
    
    .gpa-label {
        font-size: 0.55rem;
    }
    
    .timeline-title {
        font-size: 0.875rem;
    }
    
    /* Extra small: card body adjustments */
    .timeline-card-body {
        gap: 0.375rem;
    }
    
    .timeline-subtitle {
        font-size: 0.75rem;
    }
    
    .timeline-award {
        font-size: 0.6875rem;
    }
    
    .timeline-status {
        font-size: 0.625rem;
        margin-top: 0;
    }
    
    .timeline-semesters {
        gap: 0.25rem;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }
    
    .semester-box {
        padding: 0.375rem 0.125rem;
        border-radius: 0.375rem;
    }
    
    .semester-label {
        font-size: 0.5rem;
    }
    
    .semester-gpa {
        font-size: 0.8125rem;
    }
    
    .timeline-icon-badge {
        width: 2rem;
        height: 2rem;
    }

    /* Project image height */
    .project-card .h-64 {
        height: 160px;
    }

    /* Reduce tag sizes */
    .project-card .px-3.py-1,
    .timeline-item .px-2.py-1 {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }

    /* Skill pills */
    .skill-pill {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

