* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    touch-action: manipulation;
}

:root {
    --primary-color: #00fff2;
    --secondary-color: #ff00ea;
    --bg-dark: #0a0a0f;
    --text-color: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
    background-attachment: fixed;
    background-size: 100% 100%;
    color: var(--text-color);
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    width: 100%;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    line-height: 1.6;
}

/* Animated Stars Background */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    background: rgba(0, 255, 242, 0.1);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    background: rgba(0, 255, 242, 0.2);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 255, 242, 0.4);
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.scroll-to-top:hover svg {
    transform: translateY(-3px);
}

/* Mobile adjustments for scroll button */
@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
    }
}

/* Animated Stars Background */
.stars,
.stars2,
.stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.stars {
    background: transparent;
    box-shadow: 
        1000px 300px #fff, 1200px 400px #fff, 800px 100px #fff,
        1500px 500px #fff, 300px 600px #fff, 1800px 200px #fff,
        700px 700px #fff, 1600px 800px #fff, 400px 200px #fff,
        1900px 600px #fff, 500px 400px #fff, 1100px 900px #fff,
        200px 800px #fff, 1400px 100px #fff, 900px 500px #fff,
        1700px 700px #fff, 600px 300px #fff, 1300px 600px #fff,
        100px 400px #fff, 1000px 700px #fff;
    width: 1px;
    height: 1px;
    animation: animStar 50s linear infinite;
}

.stars2 {
    background: transparent;
    box-shadow: 
        800px 500px var(--primary-color), 1400px 300px var(--primary-color),
        200px 700px var(--primary-color), 1600px 600px var(--primary-color),
        1000px 200px var(--primary-color), 400px 400px var(--primary-color),
        1800px 800px var(--primary-color), 600px 100px var(--primary-color);
    width: 2px;
    height: 2px;
    animation: animStar 100s linear infinite;
}

.stars3 {
    background: transparent;
    box-shadow: 
        1100px 400px var(--secondary-color), 300px 300px var(--secondary-color),
        1500px 700px var(--secondary-color), 700px 600px var(--secondary-color),
        1700px 200px var(--secondary-color), 500px 500px var(--secondary-color);
    width: 3px;
    height: 3px;
    animation: animStar 150s linear infinite;
}

@keyframes animStar {
    from { transform: translateY(0px); }
    to { transform: translateY(-2000px); }
}

/* Header */
.projects-header {
    position: relative;
    z-index: 10;
    padding: 2rem 4rem;
    animation: fadeInDown 1s ease-out;
}

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

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-left {
    flex: 0 0 auto;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.header-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2rem;
}

/* Glitch Effect */
.glitch {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 900;
    color: var(--primary-color);
    position: relative;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 15px rgba(0, 255, 242, 0.15));
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.glitch:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px var(--primary-color))
            drop-shadow(0 0 20px var(--primary-color));
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--secondary-color);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--primary-color);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(39px, 9999px, 88px, 0); }
    20% { clip: rect(96px, 9999px, 12px, 0); }
    40% { clip: rect(45px, 9999px, 73px, 0); }
    60% { clip: rect(22px, 9999px, 56px, 0); }
    80% { clip: rect(71px, 9999px, 34px, 0); }
    100% { clip: rect(8px, 9999px, 91px, 0); }
}

.page-title-section {
    text-align: center;
    margin: 2rem 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 5% 2rem;
}

.page-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: 0.3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--primary-color));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
}

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

.page-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
    letter-spacing: 0.15rem;
}

/* Tagline with Typing Effect */
.header-tagline {
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: rgba(255, 255, 255, 0.8);
    min-height: 2rem;
    font-weight: 300;
    letter-spacing: 0.1rem;
    user-select: none;
    text-align: right;
}

.typed-text {
    color: var(--primary-color);
    font-weight: 500;
}

.cursor {
    animation: blink 1s infinite;
    color: var(--primary-color);
    font-weight: 700;
}

.cursor::after {
    content: '|';
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Social Links */
.social-links {
    display: flex;
    gap: 1.2rem;
    justify-content: flex-end;
    align-items: center;
}

.social-icon {
    width: 36px;
    height: 36px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 255, 242, 0.1);
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.social-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--hover-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.social-icon:hover::before {
    opacity: 1;
}

.social-icon:hover {
    background: rgba(0, 255, 242, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 255, 242, 0.3);
}

.social-icon svg {
    width: 20px;
    height: 20px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.social-icon:hover svg {
    transform: scale(1.1);
}

/* Page Title Section */
.filter-section {
    position: relative;
    z-index: 10;
    padding: 2rem 4rem;
    animation: fadeIn 1.2s ease-out 0.3s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.filter-btn {
    padding: 0.65rem 1.8rem;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: var(--text-color);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.05rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.filter-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.filter-btn:hover {
    border-color: rgba(0, 255, 242, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 242, 0.2);
}

.filter-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 5px 20px rgba(0, 255, 242, 0.3);
    font-weight: 500;
}

.filter-btn.active::before {
    opacity: 0.08;
}

/* Projects Main */
.projects-main {
    position: relative;
    z-index: 10;
    padding: 2rem 4rem 4rem;
    animation: fadeIn 1.5s ease-out 0.6s both;
}

.projects-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2.5rem;
}

/* Project Card */
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.4s ease;
    position: relative;
    cursor: pointer;
    opacity: 0;
    animation: projectCardFadeIn 0.6s ease-out forwards;
}

@keyframes projectCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }
.project-card:nth-child(6) { animation-delay: 0.6s; }

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 255, 242, 0.1), rgba(255, 0, 234, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--primary-color);
    box-shadow: 0 20px 50px rgba(0, 255, 242, 0.3);
}

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

.project-thumbnail {
    position: relative;
    width: 100%;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 255, 242, 0.1), rgba(255, 0, 234, 0.1));
    overflow: hidden;
}

.project-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    max-width: 100%;
    display: block;
}

.project-card:hover .project-thumbnail img {
    transform: scale(1.03);
}

/* Make logo area non-selectable and prevent pointer events on the overlay so clicks pass through */
.project-logo-overlay,
.project-logo-fallback img {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.project-thumbnail svg {
    width: 80px;
    height: 80px;
    color: var(--primary-color);
    filter: drop-shadow(0 0 15px var(--primary-color));
    animation: float 3s ease-in-out infinite;
}

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

.project-status-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    backdrop-filter: blur(10px);
}

.project-status-badge.completed {
    background: rgba(0, 255, 0, 0.2);
    color: #00ff00;
    border: 1px solid #00ff00;
}

.project-status-badge.in-progress {
    background: rgba(0, 255, 242, 0.2);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.project-status-badge.planning {
    background: rgba(255, 0, 234, 0.2);
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.project-content {
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.project-category {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.project-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-color);
    line-height: 1.3;
}

.project-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

.project-progress {
    margin-bottom: 1.5rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-label span:first-child {
    color: rgba(255, 255, 255, 0.7);
}

.progress-label span:last-child {
    color: var(--primary-color);
    font-weight: 600;
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    transition: width 1s ease-out;
    box-shadow: 0 0 15px var(--primary-color);
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.project-technologies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tech-tag {
    padding: 0.4rem 0.9rem;
    background: rgba(0, 255, 242, 0.1);
    border: 1px solid rgba(0, 255, 242, 0.3);
    border-radius: 15px;
    font-size: 0.8rem;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background: var(--primary-color);
    color: var(--bg-dark);
    transform: scale(1.05);
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--primary-color);
    border-radius: 50px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.project-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-link:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0, 255, 242, 0.4);
}

.project-link:hover::before {
    opacity: 0.2;
}

.project-link span {
    position: relative;
    z-index: 1;
}

.project-link svg {
    width: 18px;
    height: 18px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.project-link:hover svg {
    transform: translateX(5px);
}

/* Footer */
.projects-footer {
    position: relative;
    z-index: 10;
    background: var(--card-bg);
    border-top: 1px solid var(--card-border);
    padding: 2rem 4rem;
    backdrop-filter: blur(10px);
    margin-top: 4rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-content p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-links a:hover::after {
    width: 100%;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .projects-header,
    .filter-section,
    .projects-main,
    .projects-footer {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .projects-header,
    .filter-section,
    .projects-main,
    .projects-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    /* Stack header elements vertically */
    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }
    
    .header-left {
        width: 100%;
        text-align: center;
    }
    
    .header-right {
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    
    /* Center and increase logo size on mobile */
    .glitch {
        font-size: clamp(3rem, 12vw, 5rem);
    }
    
    .header-tagline {
        text-align: center;
        width: 100%;
    }
    
    /* Stack social links horizontally but with good spacing */
    .social-links {
        justify-content: center;
        gap: 1.5rem;
    }
    
    .social-icon {
        width: 42px;
        height: 42px;
    }
    
    .social-icon svg {
        width: 22px;
        height: 22px;
    }
    
    .page-title-section {
        padding: 2rem 5% 2rem;
    }
    
    .header-subtitle {
        font-size: clamp(1rem, 3vw, 1.2rem);
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-container {
        gap: 0.8rem;
    }
    
    .filter-btn {
        padding: 0.7rem 1.5rem;
        font-size: 0.85rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .projects-header,
    .filter-section,
    .projects-main,
    .projects-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Larger logo on small screens */
    .glitch {
        font-size: clamp(2.5rem, 10vw, 4rem);
        letter-spacing: 0.2rem;
    }
    
    .social-icon {
        width: 48px;
        height: 48px;
    }
    
    .social-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .back-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
    
    .project-content {
        padding: 1.5rem;
    }
    
    .project-title {
        font-size: 1.3rem;
    }
    
    .filter-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.8rem;
    }
    
    .page-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }
    
    .page-subtitle {
        font-size: clamp(0.9rem, 4vw, 1.1rem);
    }
}

/* Landscape mobile phones */
@media (max-height: 600px) and (orientation: landscape) {
    .projects-header {
        padding: 1rem 5%;
    }
    
    .header-content {
        gap: 1rem;
    }
    
    .glitch {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }
    
    .page-title-section {
        padding: 2rem 5% 1rem;
    }
    
    .page-title {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }
    
    .social-icon {
        width: 40px;
        height: 40px;
    }
}

/* Ripple animation for social icons */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Hidden state for filtering */
.project-card.hidden {
    display: none;
}
