/* --- MIDNIGHT TECH THEME VARIABLES --- */
:root {
    /* Color Palette */
    --color-primary-bg: #04001e;
    /* Deepest Navy */
    --color-secondary-bg: #0a0a2a;
    /* Navy */
    --color-card-bg: rgba(17, 34, 64, 0.7);
    /* Glassy Navy */
    --color-accent: #2a78cc;
    /* Neon Teal */
    --color-accent-hover: #4dabf7;
    /* Lighter Teal */
    --color-heading: #ffffff;
    /* White-ish Blue */
    --color-body: #b0b8d0;
    /* Slate */
    --color-border: #1f1f3a;
    /* Dark Purple-Blue */

    /* Typography */
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;

    /* Effects */
    --transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
    --shadow: 0 10px 30px -10px rgba(2, 12, 27, 0.7);
    --shadow-hover: 0 20px 30px -15px rgba(2, 12, 27, 0.7);
    --glow: 0 0 20px rgba(100, 255, 218, 0.2);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2a78cc 0%, #4dabf7 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.01));
    --gradient-header: linear-gradient(135deg, rgba(4, 0, 30, 0.98) 0%, rgba(42, 120, 204, 0.1) 100%);
}

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

html {
    scroll-padding-top: 6rem;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-primary-bg);
    color: var(--color-body);
    line-height: 1.7;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(100, 255, 218, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(100, 255, 218, 0.05) 0%, transparent 40%);
    padding-top: 5rem;
}

/* --- REUSABLE COMPONENTS --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: 6rem 0;
}

.section__title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    text-align: center;
    margin-bottom: 4rem;
    color: var(--color-heading);
    font-weight: 700;
    position: relative;
}

.section__title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--color-accent);
    border-radius: 2px;
    box-shadow: var(--glow);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 16px 32px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-family: var(--font-mono);
    transition: var(--transition);
    font-size: 1rem;
    position: relative;
    z-index: 1;
    overflow: hidden;
    cursor: pointer;
}

.btn--primary {
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
    background: transparent;
}

.btn--primary:hover {
    color: var(--color-primary-bg);
    box-shadow: var(--glow);
    transform: translateY(-3px);
}

.btn--primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: var(--color-accent);
    transition: var(--transition);
    z-index: -1;
}

.btn--primary:hover::before {
    width: 100%;
}

.btn--outline {
    border: 1px solid var(--color-body);
    color: var(--color-body);
    background: transparent;
}

.btn--outline:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(100, 255, 218, 0.1);
    transform: translateY(-3px);
}

/* --- ANIMATED BACKGROUND --- */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(100, 255, 218, 0.03);
    animation: float 20s infinite linear;
}

.bg-circle:nth-child(1) {
    width: 300px;
    height: 300px;
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.bg-circle:nth-child(2) {
    width: 200px;
    height: 200px;
    top: 60%;
    left: 80%;
    animation-delay: -5s;
}

.bg-circle:nth-child(3) {
    width: 150px;
    height: 150px;
    top: 30%;
    left: 70%;
    animation-delay: -10s;
}

.bg-circle:nth-child(4) {
    width: 250px;
    height: 250px;
    top: 70%;
    left: 10%;
    animation-delay: -15s;
}

@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }

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

/* --- HEADER / NAVIGATION --- */
.main-header {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--gradient-header);
    backdrop-filter: blur(25px);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    height: 5rem;
}

.main-header.scrolled {
    background: rgba(10, 25, 47, 0.98);
    backdrop-filter: blur(30px);
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
    box-shadow: 0 8px 40px rgba(100, 255, 218, 0.1);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
}

.nav__logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--color-heading);
    text-decoration: none;
    position: relative;
    padding: 0.5rem 0;
    transition: var(--transition);
}

.nav__logo::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: var(--transition);
}

.nav__logo:hover::after {
    width: 100%;
}

.nav__links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.nav__link {
    text-decoration: none;
    color: var(--color-body);
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav__link:hover,
.nav__link.active {
    color: var(--color-heading);
    transform: translateY(-2px);
}

.nav__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: var(--transition);
    border-radius: 2px;
}

.nav__link:hover::after,
.nav__link.active::after {
    width: 100%;
}

.nav__link i {
    font-size: 0.9rem;
    transition: var(--transition);
}

.nav__link:hover i {
    transform: scale(1.1);
    color: var(--color-accent);
}

.nav__toggle {
    font-size: 1.5rem;
    color: var(--color-heading);
    cursor: pointer;
    display: none;
    transition: var(--transition);
}

/* --- DESKTOP DROPDOWN STYLES --- */
.nav__item {
    position: relative;
}

.nav__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: rgba(10, 25, 47, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.5rem 0;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 100;
}

.nav__item:hover .nav__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    color: var(--color-body);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.dropdown__link:hover {
    color: var(--color-heading);
    background: rgba(100, 255, 218, 0.05);
    border-left-color: var(--color-accent);
}

.dropdown__link i {
    font-size: 0.85rem;
}

.dropdown__link i {
    font-size: 0.85rem;
}

/* --- HERO SECTION --- */
.hero {
    padding: 4rem 0 6rem;
    position: relative;
    overflow: visible;
}

.hero__container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
    text-align: center;
}

.hero__image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    width: 220px;
    height: 220px;
    overflow: visible;
}

.hero__image {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--color-accent);
    box-shadow: var(--glow), var(--shadow);
    position: relative;
    z-index: 2;
    transition: var(--transition);
}

.hero__image:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(100, 255, 218, 0.4), var(--shadow-hover);
}

/* Skill Orbit */
.skill-orbit {
    position: absolute;
    width: 240px;
    height: 240px;
    aspect-ratio: 1 / 1;
    min-width: 240px;
    min-height: 240px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* animation: rotate 40s linear infinite; */
    pointer-events: none;
    /* Allow clicking the image behind icons if needed, but icons have pointer-events auto below if they need it */
}

.skill-icon {
    pointer-events: auto;
    /* Re-enable for icons */
}

@keyframes rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes counter-rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(-360deg);
    }
}

.skill-icon {
    position: absolute;
    width: 36px;
    height: 36px;
    background: var(--color-card-bg);
    border: 2px solid var(--color-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--color-accent);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    z-index: 10;
    transform: translate(-50%, -50%);
    /* animation: counter-rotate 40s linear infinite; */
}

.skill-icon:hover {
    background: var(--color-accent);
    color: var(--color-primary-bg);
    transform: scale(1.2);
    box-shadow: var(--glow);
}

.skill-icon:nth-child(1) {
    top: 0%;
    left: 50%;
}

.skill-icon:nth-child(2) {
    top: 14.6%;
    left: 85.4%;
}

.skill-icon:nth-child(3) {
    top: 50%;
    left: 100%;
}

.skill-icon:nth-child(4) {
    top: 85.4%;
    left: 85.4%;
}

.skill-icon:nth-child(5) {
    top: 100%;
    left: 50%;
}

.skill-icon:nth-child(6) {
    top: 85.4%;
    left: 14.6%;
}

.skill-icon:nth-child(7) {
    top: 50%;
    left: 0%;
}

.skill-icon:nth-child(8) {
    top: 14.6%;
    left: 14.6%;
}

.hero__text-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero__title {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    color: var(--color-heading);
    margin-bottom: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.hero__title .highlight {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.hero__subtitle {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    color: var(--color-body);
    margin-bottom: 3rem;
    line-height: 1.8;
}

.hero__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat {
    text-align: center;
    padding: 1.5rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: var(--transition);
}

.stat:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent);
    box-shadow: var(--glow);
}

.stat__number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.stat__label {
    font-size: 0.9rem;
    color: var(--color-body);
}

.hero__buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Services Section */
.services__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    max-width: 1000px;
    /* Constrain width to add side spacing */
    margin-left: auto;
    margin-right: auto;
}

.service-card {
    background: var(--color-card-bg);
    padding: 2.5rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.service-card:hover {
    transform: translateY(-8px);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-hover);
    background: rgba(17, 34, 64, 0.9);
}

.service-icon {
    font-size: 2rem;
    color: #ffffff;
    /* White icon */
    margin-bottom: 1.2rem;
    transition: var(--transition);
}

.service-card:hover .service-icon {
    transform: scale(1.1);
    color: #ffffff;
    /* Ensure stays white on hover */
}

.service-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.service-desc {
    font-size: 0.95rem;
    color: var(--color-body);
    line-height: 1.7;
}

/* Tech Stack Section */
.tech-stack__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.tech-stack__column {
    background: var(--color-card-bg);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.tech-stack__column:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent);
    box-shadow: var(--glow);
}

.tech-stack__column h3 {
    font-family: var(--font-heading);
    color: var(--color-heading);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tech-stack__column h3 i {
    color: var(--color-accent);
}

.tech-stack__items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tech-stack__items span {
    padding: 0.5rem 1rem;
    background: rgba(100, 255, 218, 0.1);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--color-body);
    transition: var(--transition);
}

.tech-stack__items span:hover {
    background: rgba(100, 255, 218, 0.2);
    border-color: var(--color-accent);
    color: var(--color-heading);
    transform: translateY(-2px);
}

/* Tech Progress */
.tech-progress__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.tech-progress__column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tech-progress__item {
    background: var(--color-card-bg);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.tech-progress__item:hover {
    border-color: var(--color-accent);
    box-shadow: var(--glow);
}

.tech-progress__header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.tech-progress__name {
    font-weight: 600;
    color: var(--color-heading);
}

.tech-progress__percentage {
    color: var(--color-accent);
    font-weight: 700;
}

.tech-progress__bar {
    height: 6px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.tech-progress__fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 1.5s ease;
}

/* Open Source Section */
.open-source {
    text-align: center;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 4rem 2rem;
}

.open-source__icon {
    font-size: 4rem;
    color: var(--color-accent);
    margin-bottom: 2rem;
}

.open-source__text {
    font-size: 1.125rem;
    color: var(--color-body);
    max-width: 700px;
    margin: 0 auto 2rem;
    line-height: 1.8;
}

/* Footer */
.footer {
    background: var(--color-secondary-bg);
    padding: 2rem 0;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.footer__content p {
    color: var(--color-body);
    margin: 0.5rem 0;
}

.footer__content i {
    color: #ff6b6b;
}

/* --- MOBILE MENU & RESPONSIVE --- */
@media screen and (max-width: 768px) {
    .section {
        padding: 4rem 0;
    }

    .section__title {
        font-size: 2rem;
    }

    .main-header {
        height: auto !important;
        min-height: 6rem;
    }

    body {
        padding-top: 6rem !important;
    }

    html {
        scroll-padding-top: 6rem;
    }

    .nav {
        height: 5rem;
        padding: 0 1rem;
        gap: 0;
    }

    .nav__logo {
        font-size: 1.5rem;
    }

    .nav__toggle {
        display: block;
        z-index: 1010;
    }

    /* PROFESSIONAL MOBILE MENU */
    .nav__links {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        height: 100vh;
        background: rgba(10, 25, 47, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 4rem 1.5rem 2rem;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
        transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1);
        z-index: 1005;
        gap: 1rem;
        overflow-y: auto;
        border-left: 1px solid rgba(100, 255, 218, 0.1);
    }

    .nav__links.show-menu {
        right: 0;
    }

    .nav__link {
        font-size: 1.2rem;
        width: 100%;
        display: block;
        padding: 1rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        color: var(--color-heading);
    }

    .nav__link:hover {
        color: var(--color-accent);
        transform: translateX(10px);
        border-bottom-color: var(--color-accent);
    }

    .nav__item {
        width: 100%;
        display: block;
    }

    /* Dropdown Logic */
    .nav__dropdown {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        background: transparent;
        box-shadow: none;
        border: none;
        padding-left: 1.5rem;
        /* Increased indentation for hierarchy */
        display: block;
        /* Always visible */
        min-width: 100%;
        margin-top: -0.5rem;
        /* Pull closer to parent */
    }

    .dropdown__link {
        white-space: normal;
        word-wrap: break-word;
        font-size: 0.95rem;
        /* Slightly smaller than main links */
        padding: 0.6rem 0;
        color: var(--color-body);
        /* Distinct color */
    }

    /* Animation no longer needed for static display */

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

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

    .nav__overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
    }

    .nav__overlay.show-overlay {
        opacity: 1;
        visibility: hidden;
    }

    /* Hero Section Mobile */
    .hero__stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .hero__buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Tech Stack Mobile */
    .tech-stack__grid {
        grid-template-columns: 1fr;
    }

    .tech-progress__grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Open Source Mobile */
    .open-source {
        padding: 3rem 1.5rem;
    }

    .open-source__icon {
        font-size: 3rem;
    }
}

/* --- TABLET RESPONSIVE (768px - 1024px) --- */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

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

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

    .nav__links {
        gap: 1.5rem;
    }
}

/* --- SMALL MOBILE (up to 480px) --- */
@media screen and (max-width: 480px) {
    .section {
        padding: 3rem 0;
    }

    .section__title {
        font-size: 1.75rem;
        margin-bottom: 3rem;
    }

    .container {
        padding: 0 1rem;
    }

    .hero {
        padding: 3rem 0 4rem;
    }

    .hero__image-container {
        width: 220px;
        height: 220px;
    }

    .hero__image {
        width: 220px;
        height: 220px;
    }

    .skill-orbit {
        width: 180px;
        height: 180px;
        min-width: 180px;
        min-height: 180px;
        max-width: none;
    }

    .skill-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .hero__stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat {
        padding: 1rem;
    }

    .stat__number {
        font-size: 2rem;
    }

    .tech-stack__column {
        padding: 1.5rem;
    }

    .tech-progress__grid {
        grid-template-columns: 1fr;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .nav__logo {
        font-size: 1.3rem;
    }

    .open-source {
        padding: 2.5rem 1rem;
    }
}

/* --- PREVENT HORIZONTAL SCROLL --- */
* {
    max-width: 100%;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

img {
    max-width: 100%;
    height: auto;
}

/* Ensure containers don't overflow horizontally */
.container,
.hero__container,
.tech-stack__grid,
.tech-progress__grid {
    max-width: 100%;
}