/* === CSS Custom Properties === */
:root {
    --primary: #6c63ff;
    --secondary: #ff6584;
    --dark: #1e293b;
    --light: #f8fafc;
    --accent: #f59e0b;
    --success: #10b981;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
}

/* === Reset and Base Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.7;
    color: var(--dark);
    background: var(--light);
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--light);
}

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

::-webkit-scrollbar-track {
    background: linear-gradient(180deg, var(--light), rgba(226, 232, 240, 0.5));
    border-radius: 8px;
    /* No margin needed; sticky navbar handled by position: sticky */
    transition: background 0.3s ease;
}

body:hover ::-webkit-scrollbar-track {
    background: linear-gradient(180deg, var(--light), rgba(226, 232, 240, 0.8));
}

::-webkit-scrollbar-thumb {
    background: var(--gradient);
    border-radius: 8px;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
    min-height: 40px;
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    box-shadow: 0 0 10px rgba(108, 99, 255, 0.7);
}

/* === Container === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === Animated Background === */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

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

/* === Navigation === */
.nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--dark);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background 0.3s, color 0.3s;
}

.nav.scrolled {
    background: rgba(30, 41, 59, 0.9);
    color: white;
}

.nav.scrolled .logo,
.nav.scrolled .nav-links li a {
    color: white;
}

.nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links li a {
    color: var(--dark);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
    transition: color 0.3s;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    background: var(--gradient);
    bottom: 0;
    left: 0;
    transition: width 0.3s;
}

.nav-links li a:hover::after,
.nav-links li a:focus::after {
    width: 100%;
}

.nav-links li a:hover,
.nav-links li a:focus-visible {
    color: var(--primary);
    outline: none;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
    z-index: 1001;
}

.hamburger span {
    width: 30px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: transform 0.3s, opacity 0.3s, background 0.3s;
}

.nav.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
    background: var(--secondary);
}

.nav.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.nav.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    background: var(--secondary);
}

/* === Sections === */
.section {
    padding: 6rem 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
}

.section-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    text-align: center;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
}

.section-title::after {
    content: '';
    width: 100px;
    height: 5px;
    background: var(--gradient);
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 5px;
}

/* === Home Section === */
.home {
    text-align: center;
    position: relative;
}

.home-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 3rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin: 0 auto;
}

.profile-photo {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 2rem;
    border: 5px solid white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

.profile-photo:hover {
    transform: scale(1.05);
}

.home h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.home p {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 2.5rem;
}

.animate-text {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2.5rem;
    background: var(--gradient);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.2rem;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 10px rgba(108, 99, 255, 0.3);
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(108, 99, 255, 0.4);
    outline: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before,
.btn:focus-visible::before {
    left: 100%;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}

.btn-outline:hover,
.btn-outline:focus-visible {
    background: var(--primary);
    color: white;
}

.btn-group {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
}

/* === About Section === */
.about-content {
    display: flex;
    align-items: center;
    gap: 3rem;
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.about-img {
    flex: 1;
    max-width: 400px;
    border-radius: 15px;
    overflow: hidden;
}

.about-img img {
    width: 100%;
    height: auto;
    transition: transform 0.3s;
}

.about-img:hover img {
    transform: scale(1.05);
}

.about-text {
    flex: 1;
}

.about-text p {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

.personal-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.personal-info div {
    font-size: 1rem;
    color: #64748b;
}

.personal-info strong {
    color: var(--dark);
}

/* === Experience Section === */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    width: 4px;
    background: var(--gradient);
    top: 0;
    bottom: 0;
    left: 50%;
    border-radius: 4px;
}

.timeline-item {
    padding: 20px 40px;
    position: relative;
    width: 50%;
    margin-bottom: 2rem;
}

.timeline-item:nth-child(odd) {
    left: 0;
}

.timeline-item:nth-child(even) {
    left: 50%;
}

.timeline-content {
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.timeline-date {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.timeline-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.timeline-company {
    font-size: 1.2rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.timeline-desc {
    color: #64748b;
    list-style: disc;
    padding-left: 1.5rem;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border: 4px solid var(--primary);
    border-radius: 50%;
    top: 30px;
}

.timeline-item:nth-child(odd)::after {
    right: -12px;
}

.timeline-item:nth-child(even)::after {
    left: -12px;
}

/* === Projects Section === */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.project-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-content {
    padding: 1.5rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.project-tag {
    background: #e2e8f0;
    color: var(--dark);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
}

.project-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.project-desc {
    color: #64748b;
    margin-bottom: 1.5rem;
}

.project-desc i {
    margin-right: 0.5rem;
    color: var(--primary);
}

.project-links {
    display: flex;
    gap: 1rem;
}

/* === Skills Section === */
.skills-container {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    list-style: none;
}

.skill-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    border: 1px solid #e2e8f0;
}

.skill-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(108, 99, 255, 0.1);
    border-color: var(--primary);
}

.skill-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.skill-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.skill-level {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-top: 1rem;
    overflow: hidden;
}

.skill-level-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 3px;
    transition: width 1s ease-in-out;
}

/* === Contact Section === */
.contact-container {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin: 0 auto;
}

.contact-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
    outline: none;
}

.form-textarea {
    min-height: 150px;
    resize: vertical;
}

.error-message {
    color: #e3342f;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: block;
}

.submit-btn {
    grid-column: span 2;
    justify-self: center;
    width: 200px;
}

/* === Footer === */
.footer {
    background: var(--dark);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

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

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover,
.footer-link:focus-visible {
    color: white;
    outline: none;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transition: background 0.3s, transform 0.3s;
}

.social-link:hover,
.social-link:focus-visible {
    background: var(--primary);
    transform: translateY(-5px);
    outline: none;
}

.copyright {
    color: #94a3b8;
    font-size: 0.9rem;
}

/* === Scroll Animation === */
.animate-on-scroll.animated {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* === Scroll to Top Button === */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, background 0.3s, transform 0.3s;
    z-index: 1100; /* Increased to avoid overlap with mobile menu */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.scroll-top-btn:hover,
.scroll-top-btn:focus-visible {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    transform: translateY(-5px);
    outline: none;
}

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

/* === Accessibility: Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .animated-bg,
    .btn::before,
    .profile-photo,
    .about-img img,
    .project-card,
    .skill-item,
    .timeline-content {
        animation: none !important;
        transition: none !important;
    }

    /* Preserve functional transitions */
    .btn,
    .btn-outline,
    .nav-links li a,
    .scroll-top-btn,
    .social-link,
    .footer-link,
    .form-input,
    .form-textarea {
        transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s, background 0.3s, color 0.3s;
    }

    ::-webkit-scrollbar-thumb,
    ::-webkit-scrollbar-track {
        transition: none !important;
    }
}

/* === Responsive Design === */
@media (max-width: 992px) {
    .about-content {
        flex-direction: column;
    }

    .about-img {
        max-width: 100%;
    }

    .timeline::before {
        left: 31px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
    }

    .timeline-item:nth-child(even) {
        left: 0;
    }

    .timeline-item::after {
        left: 27px; /* Centered on 4px timeline line (31px - 4px/2 = 27px) */
    }

    ::-webkit-scrollbar {
        width: 6px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: white;
        padding: 2rem;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 20px 20px;
    }

    .nav-links.active {
        display: flex;
        background: var(--dark);
        color: white;
    }

    .nav.scrolled .nav-links.active {
        background: var(--dark);
    }

    .nav-links.active li a {
        color: white;
    }

    .hamburger {
        display: flex;
    }

    .home h1 {
        font-size: 2.8rem;
    }

    .section-title {
        font-size: 2.8rem;
    }

    .contact-form {
        grid-template-columns: 1fr;
    }

    .form-group.full-width,
    .submit-btn {
        grid-column: span 1;
    }

    .submit-btn {
        width: 100%;
    }

    .scroll-top-btn {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    .home h1 {
        font-size: 2.2rem;
    }

    .home p {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .btn-group {
        flex-direction: column;
        align-items: center;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .profile-photo {
        width: 180px;
        height: 180px;
    }

    ::-webkit-scrollbar {
        width: 4px;
    }
}
