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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #121212;
    color: white;
    scroll-behavior: smooth;
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #121212;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top: 5px solid #1db954;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

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

.loader-text {
    color: #fff;
    font-size: 1.2rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: #000;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
}

.logo span {
    color: #1db954;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
    margin: 0;
    padding: 0;
}

nav ul li a {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s;
    font-weight: 500;
    position: relative;
}

nav ul li a:hover {
    color: #1db954;
}

.btn-outline {
    border: 1px solid #1db954;
    padding: 8px 20px;
    border-radius: 30px;
    text-decoration: none;
    color: #1db954;
    transition: all 0.3s;
}

nav ul li a:hover::after {
    width: 100%;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.skills-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    margin-top: 20px;
}

.skills-image img {
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .skills-wrapper {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .skills-image img {
        margin: 20px auto 0;
    }
}

/* Mobile Navigation */
/* ===== MODERN MOBILE NAVIGATION ===== */

/* Ensure nav is visible and positioned correctly on mobile */
/* ===== CLEAN MOBILE NAVIGATION ===== */
@media (max-width: 768px) {

    /* Header Container */
    .header-container {
        align-items: center;
        padding: 15px 20px;
    }

    /* Hamburger Menu Toggle */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 25px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1002;
    }

    .menu-toggle span {
        width: 100%;
        height: 3px;
        background-color: white;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    /* Animate hamburger to X */
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    /* Navigation Menu */
    nav {
        position: fixed;
        top: 0;
        right: -100%;
        /* Start off-screen */
        width: 75%;
        max-width: 300px;
        height: 100vh;
        background: #0a0a0a;
        backdrop-filter: blur(10px);
        padding: 80px 20px 30px;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
    }

    nav.active {
        right: 0;
        /* Slide in */
    }

    /* Navigation Links */
    nav .nav-links {
        display: flex;
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    nav .nav-links li {
        opacity: 0;
        transform: translateX(20px);
        animation: slideIn 0.3s forwards;
        animation-delay: calc(0.1s * var(--i));
    }

    nav.active .nav-links li {
        opacity: 1;
        transform: translateX(0);
    }

    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translateX(20px);
        }

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

    nav .nav-links li a {
        color: #ffffff;
        text-decoration: none;
        font-size: 1.2rem;
        font-weight: 500;
        padding: 10px 0;
        display: block;
        transition: color 0.3s, transform 0.3s;
        border-radius: 5px;
    }

    nav .nav-links li a:hover,
    nav .nav-links li a:focus {
        color: #1db954;
        transform: translateX(5px);
        background: rgba(29, 185, 84, 0.1);
    }
}

/* Add this to ensure smooth closing when link is clicked */
nav.active {
    right: 0;
}

/* Hero Section */
#hero {
    display: flex;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
        url('https://riaktech.co.ke/portfolio/assets/images/heross.avif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-content p {
    color: #ccc;
    margin-bottom: 30px;
    font-size: 1.1rem;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.accent {
    color: #1db954;
}

.hero-cta {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary {
    background: #1db954;
    color: black;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: bold;
    display: inline-block;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #17a74a;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(29, 185, 84, 0.3);
}

.btn-secondary {
    border: 1px solid white;
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    color: white;
    transition: all 0.3s;
    font-weight: bold;
    background: transparent;
}

.btn-secondary:hover {
    border-color: #1db954;
    color: #1db954;
    transform: translateY(-2px);
}

/* Sections */
.section {
    padding: 80px 5%;
}

.dark-bg {
    background: #0a0a0a;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 60px;
}

/* About Section */
.about-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
    margin-bottom: 60px;
}

.about-image {
    flex: 1;
    min-width: 300px;
    border-radius: 16px;
    overflow: hidden;
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
}

.about-text {
    flex: 1;
    min-width: 300px;
}

.about-text h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.about-text p {
    color: #ccc;
    margin-bottom: 20px;
    line-height: 1.7;
}

/* Skills Section */
.skills {
    margin-top: 40px;
}

.skills h3 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    text-align: center;
}

.skills-grid {
    display: grid;
    gap: 20px;
}

.skill-item {
    margin-bottom: 20px;
}

.skill-name {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.skill-name span {
    font-weight: 500;
}

.skill-bar {
    height: 10px;
    background: #282828;
    border-radius: 10px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: #1db954;
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

/* Education Section */
.education-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
}

.education-item {
    background: #181818;
    padding: 30px;
    border-radius: 16px;
    transition: all 0.3s;
}

.education-item:hover {
    background: #282828;
    transform: translateY(-5px);
}

.education-item h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #1db954;
}

.degree {
    font-weight: bold;
    margin-bottom: 5px;
}

.date {
    color: #aaa;
    margin-bottom: 15px;
    font-style: italic;
}

.education-item p {
    color: #ccc;
    margin-bottom: 15px;
    line-height: 1.6;
}

.grade {
    color: #1db954;
    font-weight: bold;
}

.download-cv {
    text-align: center;
    margin-top: 40px;
}

/* Interests Section */
.interests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.interest-card {
    background: #181818;
    padding: 30px;
    border-radius: 16px;
    transition: all 0.3s;
    text-align: center;
}

.interest-card:hover {
    background: #282828;
    transform: translateY(-5px);
}

.interest-card img {
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}

.interest-card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.interest-card p {
    color: #ccc;
    line-height: 1.6;
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.project-card {
    background: #181818;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-img {
    height: 200px;
    overflow: hidden;
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

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

.project-info {
    padding: 20px;
}

.project-info h3 {
    margin-bottom: 10px;
}

.project-info p {
    color: #ccc;
    margin-bottom: 15px;
    line-height: 1.6;
}

.tech-stack {
    color: #1db954 !important;
    font-style: italic;
    margin-bottom: 20px !important;
}

.project-link {
    color: #1db954;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.project-link:hover {
    text-decoration: underline;
}

/* Contact Section */
.contact-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.contact-info h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.contact-info p {
    color: #ccc;
    margin-bottom: 30px;
    line-height: 1.6;
}

.contact-methods {
    list-style: none;
}

.contact-methods li {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.contact-icon {
    width: 40px;
    height: 40px;
}

.contact-methods h4 {
    margin-bottom: 5px;
}

.contact-methods a {
    color: #1db954;
    text-decoration: none;
}

.contact-methods a:hover {
    text-decoration: underline;
}

.contact-form-container h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.contact-form {
    background: #181818;
    padding: 30px;
    border-radius: 16px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    margin-bottom: 20px;
}

.half-width {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: #282828;
    border: 1px solid #333;
    border-radius: 8px;
    color: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1db954;
}

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

.submit-btn {
    width: 100%;
    padding: 12px;
    background: #1db954;
    color: black;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: #17a74a;
}

/* Footer */
footer {
    background: #000;
    padding: 60px 5% 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    margin-bottom: 20px;
    color: #fff;
}

.footer-section p {
    color: #ccc;
    margin-bottom: 20px;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: #1db954;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: background 0.3s;
    overflow: hidden;
    /* cut any extra pixels */
}


.footer-icon {
    width: 60%;
    /* scale icon relative to circle */
    height: 60%;
    object-fit: contain;
    /* keeps aspect ratio */
    display: block;
    /* removes inline spacing */
}

.footer-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #222;
    color: #666;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }

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

@media (max-width: 768px) {

    .hero {
        padding: 60px 5%;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        max-width: 100%;
    }

    .hero-cta {
        justify-content: center;
    }

    .about-content {
        flex-direction: column;
        text-align: center;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .hero-content h1 {
        font-size: 1.8rem;
    }

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

    .btn-primary,
    .btn-secondary {
        padding: 10px 20px;
        font-size: 0.9rem;
        width: 100%;
        text-align: center;
    }

    .section {
        padding: 60px 5%;
    }
}

/* = Global Responsive Styles = */
@media (max-width: 1024px) {

    #about,
    #projects,
    #contact {
        padding: 70px 0;
    }
}

@media (max-width: 992px) {
    .footer-col {
        flex: 0 0 50%;
    }
}

@media (max-width: 768px) {

    #about,
    #projects,
    #contact {
        padding: 60px 20px;
    }

    .header-container {
        flex-direction: row;
        text-align: left;
    }

    .menu-toggle {
        display: inline-block;
    }

    .menu-toggle.close {
        display: none;
    }

    #menu:target {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }

    #menu:target~.close {
        display: inline-block;
    }

    #menu:target~.open {
        display: none;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .contact-container,
    .about-content {
        flex-direction: column;
    }

    .contact-info,
    .about-text {
        padding-right: 0;
        margin-bottom: 40px;
        min-width: 100%;
    }

    .interest-card {
        flex: 0 0 calc(50% - 15px);
    }
}

@media (max-width: 576px) {

    #about,
    #projects,
    #contact {
        padding: 50px 15px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .interest-card,
    .footer-col {
        flex: 0 0 100%;
    }

    .footer-col {
        text-align: center;
    }

    .footer-col h3::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .social-links {
        justify-content: center;
    }
}

/* = About Section = */
@media (max-width: 1024px) {
    .about-content {
        gap: 30px;
        margin-top: 35px;
    }

    .about-text,
    .skills {
        min-width: 280px;
    }

    .skill-item {
        margin-bottom: 18px;
    }
}

@media (max-width: 768px) {
    .about-image {
        width: 140px;
        height: 140px;
        margin-bottom: 25px;
    }

    .about-text h3,
    .skills h3 {
        font-size: 1.4rem;
        margin-bottom: 18px;
    }

    .skill-bar {
        height: 8px;
    }
}

@media (max-width: 480px) {
    .about-image {
        width: 120px;
        height: 120px;
        border-width: 3px;
    }

    .about-text h3,
    .skills h3 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    .skill-item {
        margin-bottom: 15px;
    }

    .skill-name {
        font-size: 0.95rem;
    }

    .skill-bar {
        height: 6px;
    }
}

/* = Projects Section = */
@media (max-width: 1024px) {
    .projects-grid {
        gap: 25px;
        margin-top: 35px;
    }

    .project-img {
        height: 180px;
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }

    .project-img {
        height: 160px;
    }

    .project-info {
        padding: 18px;
    }
}

@media (max-width: 576px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 30px;
    }

    .project-img {
        height: 200px;
    }

    .project-info {
        padding: 15px;
    }

    .project-links a {
        display: block;
        margin-bottom: 8px;
        margin-right: 0;
    }
}

@media (max-width: 400px) {
    .project-img {
        height: 160px;
    }
}

/* = Contact Section = */

@media (max-width: 992px) {
    #contact {
        padding: 70px 0;
    }

    .contact-container {
        margin-top: 35px;
        gap: 30px;
    }

    .contact-info {
        padding-right: 30px;
    }
}

@media (max-width: 768px) {
    #contact {
        padding: 60px 20px;
    }

    .contact-container {
        flex-direction: column;
        margin-top: 30px;
    }

    .contact-info {
        padding-right: 0;
        min-width: 100%;
        margin-bottom: 30px;
    }

    .contact-info h3 {
        margin-bottom: 15px;
    }

    .contact-info p {
        margin-bottom: 20px;
    }

    .contact-availability {
        padding: 25px;
        min-width: unset;
        width: calc(100% - 40px);
        margin: 0 20px;
    }

    .contact-form {
        padding: 0 15px;
    }

    .form-group input,
    .form-group textarea {
        padding: 10px;
    }

    .form-group textarea {
        height: 120px;
    }
}

@media (max-width: 480px) {
    #contact {
        padding: 50px 15px;
    }

    .contact-info ul li {
        margin-bottom: 12px;
        font-size: 0.95rem;
    }

    .contact-info ul li i {
        margin-right: 8px;
        font-size: 1.1rem;
    }

    .contact-availability {
        padding: 20px;
        width: calc(100% - 30px);
        margin: 0 15px;
    }

    .contact-form {
        padding: 0 12px;
        min-width: 0;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group textarea {
        height: 100px;
        min-height: 80px;
    }
}

/* Style for the Hamburger Icon */
.menu-toggle {
    display: none;
    /* Hidden on desktop */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 2100;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: 1px;
}

/* Show hamburger on mobile */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
}