@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    list-style: none;
    scroll-behavior: smooth;
    text-decoration: none;
}

:root {
    --text-color: #e2e8f0;
    --hover-color: #22d3ee;
    --accent-purple: #7c3aed;
    --bg-color: #04060d;
    --secon-bg-color: #0c1422;
    --big-font: clamp(1.85rem, 4vw, 2.8rem);
    --norma-font: clamp(1.25rem, 2.5vw, 2rem);
    --neon-box-shadow: 0 0 .5rem #22d3ee;
    --h2-font: clamp(1.6rem, 3.5vw, 2.4rem);
    --section-pad-x: clamp(1rem, 5vw, 10%);
    --font-neon-text-shadow: 0 0 10px rgb(34, 211, 238),
        0 0 20px rgb(34, 211, 238),
        0 0 30px rgb(34, 211, 238),
        0 0 40px rgb(34, 211, 238);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: "Poppins", sans-serif;
    background: radial-gradient(rgb(15,39,51),rgb(6,10,20),rgb(4,6,13));
    background-attachment: fixed;
    color: var(--text-color);
    overflow-x: hidden;
    width: 100%;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 20px var(--section-pad-x);
    background: rgba(6, 10, 20, .55);
    position: fixed;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

header.scrolled {
    background: rgba(6, 10, 20, .85);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.logo {
    font-size: clamp(1.05rem, 2.5vw, 1.375rem);
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-color);
    flex-shrink: 0;
}

span {
    color: var(--hover-color);
}

.navlist {
    display: flex;
}

.navlist a {
    color: var(--text-color);
    font-weight: 500;
    padding: 10px 20px;
}

.navlist a:hover {
    color: var(--hover-color);
    text-shadow: var(--font-neon-text-shadow);
}

#menu-icon {
    font-size: 1.8rem;
    z-index: 10001;
    cursor: pointer;
    margin-left: 25px;
    background: var(--hover-color);
    border-radius: 3px;
    color: var(--secon-bg-color);
    display: none;
}

.portfolio {
    min-height: 100vh;
    padding: 120px var(--section-pad-x) 100px;
    background: transparent;
    width: 100%;
}

.main-text {
    text-align: center;
    margin-bottom: 50px;
}

.main-text h2 {
    font-size: var(--big-font);
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 20px;
}

/* Per-letter shake-on-hover for the "Projects" heading */
.shake-heading {
    display: inline-flex;
    cursor: default;
}

.shake-heading .letter {
    display: inline-block;
    transition: transform 0.15s ease;
}

.shake-heading:hover .letter {
    animation-name: letterShake;
    animation-duration: 0.4s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: 1;
}

.shake-heading:hover .letter:nth-child(1) { animation-delay: 0s; }
.shake-heading:hover .letter:nth-child(2) { animation-delay: 0.08s; }
.shake-heading:hover .letter:nth-child(3) { animation-delay: 0.16s; }
.shake-heading:hover .letter:nth-child(4) { animation-delay: 0.24s; }
.shake-heading:hover .letter:nth-child(5) { animation-delay: 0.32s; }
.shake-heading:hover .letter:nth-child(6) { animation-delay: 0.4s; }
.shake-heading:hover .letter:nth-child(7) { animation-delay: 0.48s; }
.shake-heading:hover .letter:nth-child(8) { animation-delay: 0.56s; }

@keyframes letterShake {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-3px); }
    50%  { transform: translateX(0); }
    75%  { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .shake-heading:hover .letter {
        animation: none;
    }
}

.category-container {
    display: flex;
    justify-content: center;
    margin-bottom: 50px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    width: 100%;
}

.category-bar {
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem;
    border-radius: 999px;
    background: rgba(12, 20, 34, 0.72);
    border: 1px solid rgba(34, 211, 238, 0.22);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 12px 40px rgba(0, 0, 0, 0.35),
        0 0 28px rgba(34, 211, 238, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.category-indicator {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.95), rgba(124, 58, 237, 0.85));
    box-shadow:
        0 6px 22px rgba(34, 211, 238, 0.35),
        0 0 18px rgba(124, 58, 237, 0.25);
    transition: transform 0.38s cubic-bezier(0.2, 0.7, 0.2, 1),
                width 0.38s cubic-bezier(0.2, 0.7, 0.2, 1),
                height 0.38s cubic-bezier(0.2, 0.7, 0.2, 1),
                opacity 0.25s ease;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
}

.category-btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 1.15rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: rgba(226, 232, 240, 0.72);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 550;
    letter-spacing: 0.01em;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.25s ease, transform 0.2s ease;
}

.category-btn span {
    color: inherit;
}

.category-btn i {
    font-size: 1.05rem;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.category-btn:hover {
    color: #e2e8f0;
}

.category-btn:hover i {
    opacity: 1;
    transform: scale(1.08);
}

.category-btn.active,
.category-btn.active:hover {
    color: #140139;
}

.category-btn.active i,
.category-btn.active span,
.category-btn.active:hover i,
.category-btn.active:hover span {
    color: #140139;
    opacity: 1;
}

.category-btn:focus-visible {
    outline: 2px solid #22d3ee;
    outline-offset: 3px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.portfolio-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: clamp(1rem, 3vw, 30px);
    padding: 20px 0;
}

.port-box {
    background: linear-gradient(145deg, var(--bg-color), var(--secon-bg-color));
    border-radius: 15px;
    overflow: hidden;
    box-shadow:
        var(--neon-box-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(34, 211, 238, 0.2);
}

.port-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.1), transparent);
    transition: left 0.5s ease;
    z-index: 1;
}

.port-box:hover::before {
    left: 100%;
}

.port-box:hover {
    transform: translateY(-10px);
    box-shadow:
        0 15px 35px rgba(34, 211, 238, 0.3),
        0 0 25px rgba(34, 211, 238, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: var(--hover-color);
}

.port-image {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.port-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
    filter: brightness(0.8) contrast(1.1);
}

.port-box:hover .port-image img {
    transform: scale(1.1);
    filter: brightness(1) contrast(1.2);
}

.port-content {
    padding: clamp(1.1rem, 3vw, 25px);
    position: relative;
    z-index: 2;
}

.port-content h3 {
    font-size: clamp(1.15rem, 2.5vw, 1.4rem);
    font-weight: 700;
    color: var(--hover-color);
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

.description p {
    color: var(--text-color);
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

.port-content a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--hover-color);
    color: var(--bg-color);
    border-radius: 50%;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.4);
    position: relative;
    overflow: hidden;
}

.port-content a:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 0 25px rgba(34, 211, 238, 0.8);
}

.port-content a::before {
    content: '';
    position: absolute;
    width: 0;
    height: 100%;
    background: var(--text-color);
    transition: width 0.3s ease;
    left: 50%;
    transform: translateX(-50%);
}

.port-content a:hover::before {
    width: 100%;
}

.port-content a i {
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.port-content a:hover i {
    color: var(--bg-color);
}

/* Category-specific styling */
.port-box.ai {
    border-left: 4px solid #ff6b6b;
}

.port-box.ai:hover {
    box-shadow:
        0 15px 35px rgba(255, 107, 107, 0.3),
        0 0 25px rgba(34, 211, 238, 0.2);
}

.port-box.data {
    border-left: 4px solid #4ecdc4;
}

.port-box.data:hover {
    box-shadow:
        0 15px 35px rgba(78, 205, 196, 0.3),
        0 0 25px rgba(34, 211, 238, 0.2);
}

.port-box.research {
    border-left: 4px solid #45b7d1;
}

.port-box.research:hover {
    box-shadow:
        0 15px 35px rgba(69, 183, 209, 0.3),
        0 0 25px rgba(34, 211, 238, 0.2);
}

/* Animation classes */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-up {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.5s ease-out;
}

.slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

footer {
    background: transparent;
    padding: 1.5rem var(--section-pad-x);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, .1);
}

footer p {
    color: rgba(203, 213, 225, .7);
    text-align: center;
    font-size: clamp(0.75rem, 2vw, 0.95rem);
}

/* Responsive */
@media (max-width: 991px) {
    header {
        padding: 15px var(--section-pad-x);
    }
    .portfolio {
        padding: 100px var(--section-pad-x) 80px;
    }
}

@media (max-width: 768px) {
    #menu-icon {
        display: block;
        transition: all .4s ease;
        margin-left: 12px;
        flex-shrink: 0;
    }
    #menu-icon.bx-x {
        transform: rotate(-180deg);
    }
    .navlist {
        z-index: 999;
        display: flex;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        flex-direction: column;
        background: rgba(4, 6, 13, .98);
        text-align: left;
        padding: 0 var(--section-pad-x);
        border-bottom: 1px solid rgba(255,255,255,.08);
        box-shadow: 0 16px 40px rgba(0,0,0,.45);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    }
    .navlist a {
        display: block;
        padding: 0.85rem 0;
        font-size: 1rem;
    }
    .navlist.open {
        max-height: 420px;
        opacity: 1;
        pointer-events: auto;
        padding: 0.75rem var(--section-pad-x) 1.25rem;
    }
    .portfolio-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .category-container {
        margin-bottom: 30px;
    }
    .category-bar {
        width: 100%;
        border-radius: 1.25rem;
        gap: 0.3rem;
        padding: 0.35rem;
    }
    .category-indicator {
        border-radius: 0.9rem;
    }
    .category-btn {
        flex: 1 1 calc(50% - 0.3rem);
        justify-content: center;
        padding: 0.65rem 0.75rem;
        font-size: 0.8rem;
        border-radius: 0.9rem;
    }
    .category-btn span {
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .port-box:hover {
        transform: translateY(-5px);
    }
    .port-image {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .portfolio {
        padding: 90px var(--section-pad-x) 60px;
    }
    .main-text {
        margin-bottom: 30px;
    }
    .port-content {
        padding: 1.1rem;
    }
    .description p {
        font-size: 0.9rem;
    }
}

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

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

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
