/* Import Poppins font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap');

/* Reset default browser styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    border: none;
    outline: none;
    font-family: "Poppins", sans-serif;
}

/* CSS variables for consistent color scheme */
:root {
    --bg-color: #1f242d;         /* Primary background color */
    --second-bg-color: #323946;  /* Secondary background color for boxes/sections */
    --main-color: #7cf03d;       /* Accent color (green) */
    --white-color: #fff;         /* Text color */
    --diabled-color: #fff3;      /* Color for disabled elements */
}

/* Set base font size for consistent rem units (1rem = 10px) */
html {
    font-size: 62.5%;
}

/* Basic body styling */
body {
    color: var(--white-color);
}

/* Header styling - fixed at top of viewport */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 9%;
    background: var(--bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    visibility: hidden;  /* Initially hidden for animation */
    opacity: 0;
}

/* Animation class for header */
header.active {
    animation: show-header 1.5s linear forwards;
    animation-delay: 1.2s;
}

/* Animation to fade in the header */
@keyframes show-header {
    100% {
        visibility: visible;
        opacity: 1;
    }
}

/* Logo styling */
.logo {
    font-size: 3rem;
    color: var(--white-color);
    font-weight: 700;
}

/* Navigation link styling */
nav a {
    font-size: 2rem;
    color: var(var(--white-color));
    font-weight: 500;
    margin-left: 3.5rem;
    transition: .5s;
}

/* Hover and active states for navigation links */
nav a:hover,
nav a.active {
    color: var(--main-color);
}

/* Mobile menu icon - hidden by default */
#menu-icon {
    font-size: 4rem;
    display: none;
}

/* Animated bars container for page transitions */
.bars-box {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
}

/* Individual bars for transition effect */
.bars-box .bar {
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    animation: hide-bars .5s ease-in-out both;
    animation-delay: calc(.1s * var(--i));
}

/* Animation to hide bars from top to bottom */
@keyframes hide-bars {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-100%);
    }
}

/* Animation for active bars */
.bars-box.active .bar {
    animation: show-bars .5s ease-in-out both;
    animation-delay: calc(.1s * var(--i));
}

/* Animation to show bars from top to bottom */
@keyframes show-bars {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(0);
    }
}

/* Base styling for all sections */
section {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 10rem 9% 2rem;
    visibility: hidden;  /* Initially hidden for animation */
    opacity: 0;
    overflow: hidden;
}

/* Animation class for sections */
section.active {
    animation: show-content 1.5s linear forwards;
    animation-delay: 1.6s;
}

/* Animation to show section content */
@keyframes show-content {
    100% {
        visibility: visible;
        opacity: 1;
        overflow: auto;
    }
}

/* Home section layout */
.home {
    display: flex;
    align-items: center;
    gap: 5rem;
}

/* Primary heading in home section */
.home-detail h1 {
    font-size: clamp(3.5rem, 10vw, 5.5rem); /* Responsive font size */
}

/* Secondary heading in home section */
.home-detail h2 {
    display: inline-block;
    font-size: 3.2rem;
    margin-top: -1rem;
}

/* Paragraph text in home section */
.home-detail p {
    font-size: 1.6rem;
    margin: 1rem 0 2.5rem;
}

/* Container for button and social icons */
.home-detail .btn-sci {
    display: flex;
    align-items: center;
}

/* Primary button styling */
.btn {
    display: inline-block;
    padding: 1rem 3rem;
    background: var(--main-color);
    border: .2rem solid var(--main-color);
    border-radius: 4rem;
    box-shadow: 0 0 1rem var(--main-color);
    font-size: 1.6rem;
    color: var(--bg-color);
    font-weight: 500;
    transition: .5s;
}

/* Button hover effect */
.btn:hover {
    background: transparent;
    color: var(--main-color);
    box-shadow: none;
}

/* Social icons container */
.home-detail .btn-sci .sci {
    margin-left: 2rem;
}

/* Individual social icon links */
.home-detail .btn-sci .sci a {
    display: inline-flex;
    padding: .8rem;
    border: .2rem solid var(--main-color);
    border-radius: 50%;
    font-size: 2rem;
    color: var(--main-color);
    margin: 0 .8rem;
    transition: .5s;
}

/* Social icon hover effect */
.home-detail .btn-sci .sci a:hover {
    background: var(--main-color);
    color: var(--bg-color);
    box-shadow: 0 0 1rem var(--main-color);
}

/* Typing animation text element */
.home-detail h2 span {
    position: relative;
    display: inline-block;
    color: transparent;
    -webkit-text-stroke: .07rem var(--main-color);
    animation: display-text 16s linear infinite;
    animation-delay: calc(-4s * var(--i));
}

/* Animation to display different text items */
@keyframes display-text {
    25%, 100% {
        display: none;
    }
}

/* Typing animation effect */
.home-detail h2 span::before {
    content: attr(data-text);
    position: absolute;
    width: 0;
    border-right: .2rem solid var(--main-color);
    color: var(--main-color);
    white-space: nowrap;
    overflow: hidden;
    animation: fill-text 4s linear infinite;
}

/* Animation for typing effect */
@keyframes fill-text {
    10%, 100% {
        width: 0;
    }
    70%, 90% {
        width: 100%;
    }
}

/* Container for profile image with animated border */
.home-img .img-box {
    position: relative;
    width: 32vw;
    height: 32vw;
    border-radius: 50%;
    padding: .5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Animated border effect using pseudo-elements */
.home-img .img-box::before,
.home-img .img-box::after {
    content: '';
    position: absolute;
    width: 50rem;
    height: 50rem;
    background: conic-gradient(transparent, transparent, transparent, var(--main-color));
    transform: rotate(0deg);
    animation: rotate-border 10s linear infinite;
}

/* Second border with delay */
.home-img .img-box::after {
    animation-delay: -5s;
}

/* Animation for rotating border */
@keyframes rotate-border {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: rotate(180deg) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 0.7;
    }
}

/* Container for actual image */
.home-img .img-box .img-item {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    border-radius: 50%;
    border: .01rem solid var(--bg-color);
    display: flex;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

/* Profile image styling */
.home-img .img-box .img-item img {
    position: absolute;
    top: 3rem;
    display: block;
    width: 85%;
    object-fit: cover;
    mix-blend-mode: lighten; /* Effect for better blending with background */
}

/* Section headings */
.heading {
    font-size: 4.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

/* Highlighted text in headings */
.heading span {
    color: var(--main-color);
}

/* Services section grid layout */
.services-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40rem, 1fr));
    gap: 2rem;
}

/* Individual service box styling */
.services-container .services-box {
    padding: 3rem 2.5rem;
    background: var(--second-bg-color);
    border: .2rem solid var(--second-bg-color);
    border-radius: 1rem;
    transition: .5s;
    height: 100%; /* Ensure all boxes in a row have equal height */
    display: flex;
    flex-direction: column; /* Stack content vertically */
}

/* Service box hover effect */
.services-container .services-box:hover {
    border-color: var(--main-color);
    transform: scale(1.02);
}

/* Icon container in service boxes */
.services-box .icon {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Icon styling */
.services-box .icon i {
    font-size: 4.5rem;
    transition: .5s;
}

/* Icon color change on hover */
.services-box:hover .icon :not(a i) {
    color: var(--main-color);
}

/* Link in icon section */
.services-box .icon a {
    display: inline-flex;
    background: var(--white-color);
    border-radius: 50%;
    padding: 1rem;
    transition: .5s;
}

/* Link background change on hover */
.services-box:hover .icon a {
    background: var(--main-color);
}

/* Icon in link */
.services-box .icon a i {
    font-size: 3rem;
    color: var(--bg-color);
    transform: rotate(255deg);
}

/* Icon rotation on hover */
.services-box .icon a:hover i {
    transform: rotate(180deg);
}

/* Service box heading */
.services-box h3 {
    font-size: 3rem;
    margin: .5rem 0 2rem;
    transition: .5s;
}

/* Service box heading color change on hover */
.services-box:hover h3 {
    color: var(--main-color);
}

/* Service box paragraph */
.services-box p {
    font-size: 1.6rem;
}

/* Resume section grid layout */
.resume-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40rem, 1fr));
    gap: 3rem;
}

/* Resume box heading */
.resume-box h2 {
    font-size: 4.5rem;
}

/* Resume box paragraph */
.resume-box p {
    font-size: 1.6rem;
}

/* Resume description */
.resume-box .desc {
    margin: 2rem 0 2.5rem;
}

/* Resume navigation button */
.resume-box .resume-btn {
    width: 100%;
    height: 5.3rem;
    background: var(--second-bg-color);
    border: .2rem solid var(--second-bg-color);
    font-size: 1.6rem;
    color: var(--white-color);
    font-weight: 500;
    margin-bottom: 2rem;
    border-radius: .8rem;
    cursor: pointer;
}

/* Active state for resume button */
.resume-box .resume-btn.active {
    border-color: var(--main-color);
    color: var(--main-color);
}

/* Resume detail sections - hidden by default */
.resume-detail {
    display: none;
}

/* Active resume detail section */
.resume-detail.active {
    display: block;
}

/* Resume detail heading */
.resume-box .heading {
    font-size: 3.5rem;
    text-align: left;
}

/* Grid for resume items */
.resume-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr));
    gap: 2rem;
    height: auto;
    max-height: 45rem;
    overflow: auto;
}

/* Scrollbar styling for resume list */
.resume-list::-webkit-scrollbar {
    width: .7rem;
}

.resume-list::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 1rem;
}

.resume-list:hover::-webkit-scrollbar-thumb {
    background: var(--main-color);
}

/* Individual resume item */
.resume-list .resume-item {
    background: var(--second-bg-color);
    border-radius: .8rem;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%; /* Ensure equal height in a row */
}

/* Year display in resume items */
.resume-item .year {
    color: var(--main-color);
}

/* Resume item heading */
.resume-item h3 {
    font-size: 2.2rem;
}

/* Company name in resume items */
.resume-item .company {
    position: relative;
    margin-left: 2rem;
    margin-bottom: 2rem;
}

/* Dot before company name */
.resume-item .company::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: .5rem;
    background: var(--main-color);
    border-radius: 50%;
    margin-left: -2rem;
}

/* Special styling for skills section */
.resume-detail.skills .resume-list {
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    height: auto;
    overflow: visible;
}

.resume-detail.skills .resume-item {
    position: relative;
    align-items: center;
    height: auto;
}

/* Skill icon */
.resume-detail.skills .resume-item i {
    font-size: 8.5rem;
    transition: .5s;
}

/* Skill icon hover effect */
.resume-detail.skills .resume-item:hover i {
    color: var(--main-color);
}

/* Tooltip for skill name */
.resume-detail.skills .resume-item span {
    position: absolute;
    top: -20%;
    background: var(--white-color);
    color: var(--bg-color);
    font-size: 1.6rem;
    padding: .5rem 1rem;
    border-radius: .6rem;
    pointer-events: none;
    opacity: 0;
    transform: scale(.9);
    transition: .2s;
}

/* Tooltip display on hover */
.resume-detail.skills .resume-item:hover span {
    top: -25%;
    opacity: 1;
    transform: scale(1);
}

/* Special styling for about section */
.resume-detail.about .resume-list {
    height: auto;
    grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr));
}

.resume-detail.about .resume-item {
    height: auto;
    padding: 0 0 .5rem;
    background: transparent;
}

/* About section text */
.resume-detail.about .resume-item p {
    color: var(--main-color);
}

/* Value text in about section */
.resume-detail.about .resume-item p span {
    color: var(--white-color);
    margin-left: 1rem;
    font-size: 1.8rem;
}

/* Portfolio section grid layout */
.portfolio-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
}

/* Portfolio detail section - hidden by default */
.portfolio-detail {
    display: none;
}

/* Active portfolio detail */
.portfolio-detail.active {
    display: block;
}

/* Number display in portfolio */
.portfolio-container .numb {
    font-size: 8rem;
    -webkit-text-stroke: .07rem var(--white-color);
    color: transparent;
    line-height: 1;
}

/* Portfolio heading */
.portfolio-box h3 {
    font-size: 3.5rem;
    margin: .8rem 0 2rem;
}

/* Portfolio text */
.portfolio-box p {
    font-size: 1.6rem;
}

/* Technologies used section */
.portfolio-box .tech {
    margin: 2rem 0;
    color: var(--main-color);
    border-bottom: .1rem solid var(--white-color);
    padding-bottom: 2rem;
}

/* Link container for portfolio items */
.portfolio-box .live-github a {
    position: relative;
    display: inline-flex;
    padding: 1.3rem;
    font-size: 3rem;
    color: var(--white-color);
    border-radius: 50%;
    background: var(--second-bg-color);
    transition: .5s;
}

/* Link hover effect */
.portfolio-box .live-github a:hover {
    color: var(--main-color);
}

/* Spacing for first link */
.portfolio-box .live-github a:first-child {
    margin-right: 1.5rem;
}

/* Icon rotation in first link */
.portfolio-box .live-github a:first-child i {
    transform: rotate(135deg);
}

/* Tooltip for links */
.portfolio-box .live-github a span {
    position: absolute;
    top: -60%;
    left: 50%;
    transform: translateX(-50%) scale(.9);
    font-size: 1.6rem;
    white-space: nowrap;
    padding: .5rem 1rem;
    border-radius: .6rem;
    pointer-events: none;
    background: var(--white-color);
    color: var(--bg-color);
    opacity: 0;
    transition: .2s;
}

/* Tooltip display on hover */
.portfolio-box .live-github a:hover span {
    top: -70%;
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Carousel for portfolio images */
.portfolio-box .portfolio-carousel {
    width: 100%;
    height: 45rem;
    border-radius: 1rem;
    overflow: hidden;
}

/* Image slide container */
.portfolio-carousel .img-slide {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    gap: 2rem;
    height: inherit;
    transition: .5s;
}

/* Individual image item */
.portfolio-carousel .img-item {
    height: inherit;
}

/* Image styling */
.portfolio-carousel .img-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1rem;
}

/* Navigation buttons for carousel */
.portfolio-box .navigation {
    text-align: right;
    margin-top: 2rem;
}

.portfolio-box .navigation button {
    display: inline-flex;
    padding: .4rem;
    background: var(--second-bg-color);
    border: .2rem solid var(--main-color);
    border-radius: .6rem;
    font-size: 4rem;
    color: var(--main-color);
    cursor: pointer;
}

/* Disabled navigation button */
.portfolio-box .navigation button.disabled {
    border-color: var(--second-bg-color);
    color: var(--diabled-color);
}

/* Right arrow button */
.portfolio-box .navigation .arrow-right {
    margin-left: 1.5rem;
}

/* Contact section grid layout */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 3rem;
}

/* Vertical alignment for first contact box */
.contact-container .contact-box:first-child {
    align-self: center;
}

/* Contact heading */
.contact-box h2 {
    font-size: 4.5rem;
}

/* Contact text */
.contact-box p {
    font-size: 1.6rem;
}

/* Contact description */
.contact-box .desk {
    margin: 1.5rem 0 2.5rem;
}

/* Contact detail items */
.contact-box .contact-detail {
    display: flex;
    align-items: center;
    margin: 2rem 0;
}

/* Icon in contact details */
.contact-detail i {
    display: inline-flex;
    background: var(--second-bg-color);
    color: var(--main-color);
    font-size: 3rem;
    padding: 1.2rem;
    border-radius: .6rem;
    margin-right: 1.5rem;
}

/* Label in contact details */
.contact-detail .detail p:first-child {
    color: var(--main-color);
}

/* Contact form */
.contact-box form {
    background: var(--second-bg-color);
    padding: 2.5rem 3.5rem 3.5rem;
    border-radius: 1rem;
    text-align: center;
}

/* Form heading */
.contact-box .heading {
    font-size: 3.5rem;
}

/* Form field container */
.contact-box .field-box {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

/* Input and textarea styling */
.contact-box .field-box input,
.contact-box .field-box textarea {
    padding: 1.5rem;
    background: var(--bg-color);
    border: .15rem solid var(--bg-color);
    border-radius: .6rem;
    font-size: 1.6rem;
    color: var(--white-color);
}

/* Textarea specific styling */
.contact-box .field-box textarea {
    grid-column: 1 / -1; /* Span all columns */
    height: 26rem;
    resize: none;
}

/* Focus state for form fields */
.contact-box .field-box input:focus,
.contact-box .field-box textarea:focus {
    border-color: var(--main-color);
}

/* Form submit button */
.contact-box .btn {
    margin-top: 2rem;
    cursor: pointer;
}

/* Equal height box fix for various sections */
.services-box, 
.resume-box, 
.resume-item,
.portfolio-box,
.contact-box,
.education-box {
    height: 100%; /* Ensure all boxes take full height of their container */
    width: 100%;
    word-wrap: break-word; /* Handle long text */
}

/* Grid containers with automatic row sizing */
.services-container,
.resume-container,
.portfolio-container,
.contact-container,
.resume-list {
    grid-auto-rows: minmax(min-content, auto);
    width: 100%;
}

/* Prevent content overflow in boxes */
[class$="-box"] > * {
    max-width: 100%;
}

/* Responsive media handling */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Media Queries for Responsive Design */

/* Larger screens */
@media screen and (max-width: 1200px) {
    html {
        font-size: 55%; /* Slightly reduce base font size */
    }
}

/* Medium-sized screens */
@media screen and (max-width: 992px) {
    header {
        padding: 2rem 4%; /* Reduce header padding */
    }

    section {
        padding: 10rem 4% 2rem; /* Reduce section padding */
    }
}

/* Contact form fields stack on smaller screens */
@media screen and (max-width: 810px) {
    .contact-box .field-box {
        grid-template-columns: 1fr; /* Single column layout */
    }
}

/* Tablet and smaller screens */
@media screen and (max-width: 810px) {
    /* Show mobile menu icon */
    #menu-icon {
        display: block;
    }

    /* Mobile navigation menu */
    nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        padding: 1rem 0;
        background: var(--bg-color);
        border-top: .1rem solid rgba(0, 0, 0, .2);
        box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .2);
        text-align: center;
        display: none; /* Hidden by default */
    }

    /* Active mobile menu */
    nav.active {
        display: block;
    }
    
    /* Mobile menu links */
    nav a {
        display: block;
        margin: 4rem 0;
    }

    /* Home section layout change */
    .home {
        flex-direction: column-reverse;
        justify-content: center;
        gap: 2rem;
    }

    /* Adjust profile image size */
    .home-img .img-box {
        width: 35rem;
        height: 35rem;
    }

    /* Single column layout for various sections */
    .resume-container,
    .portfolio-container,
    .contact-container {
        grid-template-columns: 1fr;
    }

    /* Add spacing in resume container */
    .resume-container {
        gap: 3rem;
    }

    /* Change order of portfolio items */
    .portfolio-container .portfolio-box:first-child {
        order: 1;
    }

    /* Restore two-column layout for contact form */
    .contact-box .field-box {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Smaller tablets and large mobile screens */
@media screen and (max-width: 600px) {
    /* Further reduce profile image size */
    .home-img .img-box {
        width: 30rem;
        height: 30rem;
    }

    /* Stack contact form fields */
    .contact-box .field-box {
        grid-template-columns: 1fr;
    }
}

/* Small mobile screens */
@media screen and (max-width: 450px) {
    html {
        font-size: 50%; /* Further reduce base font size */
    }
}

/* Very small mobile screens */
@media screen and (max-width: 400px) {
    /* Center align text in various elements */
    .home-detail,
    .resume-box h2,
    .resume-box .heading,
    .resume-box .desc,
    .resume-detail.about .resume-item {
        text-align: center;
    }

    /* Stack button and social icons */
    .home-detail .btn-sci {
        flex-direction: column-reverse;
    }

    /* Adjust margin for social icons */
    .home-detail .btn-sci .sci {
        margin-left: 0;
        margin-bottom: 2rem;
    }

    /* Reduce padding in contact form */
    .contact-box form {
        padding: 2.5rem 3rem 3.5rem;
    }

    /* Reduce contact heading size */
    .contact-box h2 {
        font-size: 3.5rem;
    }
}
