:root {
    --bg-color: #0f172a;
    /* Slate 900 */
    --second-bg-color: #1e293b;
    /* Slate 800 */
    --text-color: #f1f5f9;
    /* Slate 100 */
    --main-color: #38bdf8;
    /* Sky 400 */
    --font-en: 'Outfit', sans-serif;
    --font-ar: 'Cairo', sans-serif;
}

::selection {
    background: var(--main-color);
    color: var(--bg-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    border: none;
    outline: none;
    scroll-behavior: smooth;
    font-family: var(--font-en);
}

[lang="ar"] * {
    font-family: var(--font-ar);
}

html {
    font-size: 62.5%;
    overflow-x: hidden;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 9%;
    background: rgba(15, 23, 42, 0.9);
    /* Slate 900 with transparency */
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.logo {
    font-size: 2.5rem;
    color: var(--text-color);
    font-weight: 600;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar a {
    font-size: 1.7rem;
    color: var(--text-color);
    margin-left: 4rem;
    transition: .3s;
}

.navbar a:hover,
.navbar a.active {
    color: var(--main-color);
}

.header-right {
    display: flex;
    align-items: center;
}

.lang-btn {
    padding: 0.8rem 1.5rem;
    background: transparent;
    border: 2px solid var(--main-color);
    color: var(--main-color);
    border-radius: 8px;
    font-size: 1.6rem;
    cursor: pointer;
    transition: .3s;
    margin-left: 2rem;
}

.lang-btn:hover {
    background: var(--main-color);
    color: var(--bg-color);
}

#menu-icon {
    font-size: 3.6rem;
    color: var(--text-color);
    display: none;
    margin-left: 2rem;
}

/* Home Section */
section {
    min-height: 100vh;
    padding: 10rem 9% 2rem;
}

.home {
    display: flex;
    justify-content: center;
    align-items: center;
}

.home-content h3 {
    font-size: 3.2rem;
    font-weight: 700;
}

#typing-text {
    color: var(--main-color);
    position: relative;
}

#typing-text::after {
    content: "";
    position: absolute;
    right: -5px;
    /* Adjust for LTR */
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 80%;
    background-color: var(--text-color);
    animation: blink 0.7s infinite;
}

[dir="rtl"] #typing-text::after {
    right: auto;
    left: -5px;
    /* Adjust for RTL */
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.home-content h3:nth-of-type(2) {
    margin-bottom: 2rem;
}

span {
    color: var(--main-color);
}

.home-content h1 {
    font-size: 5.6rem;
    font-weight: 700;
    line-height: 1.3;
}

.home-img {
    margin-left: 5rem;
}

.img-box {
    width: 35rem;
    height: 35rem;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--main-color);
    box-shadow: 0 0 20px var(--main-color);
}

/* Restoring placeholder-img for About section */
.placeholder-img {
    width: 100%;
    height: 100%;
    background: var(--second-bg-color);
}

/* Hero Icons Animation */
.hero-icons-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 20%, transparent 70%); */
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-icon {
    position: absolute;
    font-size: 4rem;
    color: var(--main-color);
    background: var(--bg-color);
    /* To hide lines behind if needed, or just transparent */
    border-radius: 50%;
    box-shadow: 0 0 1rem var(--main-color);
    padding: 1rem;
    /* Background circle for icon */
    background: var(--second-bg-color);

    /* Position Logic */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(calc(var(--i) * 51.4deg)) translate(13rem) rotate(calc(var(--i) * -51.4deg));

    /* Animation */
    animation: floatIcon 3s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.5s);
}

.hero-icon.main-icon {
    font-size: 6rem;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 0 2rem var(--main-color);
    animation: pulseIcon 2s ease-in-out infinite;
    background: var(--main-color);
    color: var(--bg-color);
}

@keyframes floatIcon {

    0%,
    100% {
        margin-top: 0;
    }

    50% {
        margin-top: -1.5rem;
    }
}

@keyframes pulseIcon {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 2rem var(--main-color);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 4rem var(--main-color);
    }
}

.home-content p {
    font-size: 1.6rem;
}

.social-media a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 4rem;
    height: 4rem;
    background: transparent;
    border: .2rem solid var(--main-color);
    border-radius: 50%;
    font-size: 2rem;
    color: var(--main-color);
    margin: 3rem 1.5rem 3rem 0;
    transition: .5s ease;
}

.social-media a:hover {
    background: var(--main-color);
    color: var(--second-bg-color);
    box-shadow: 0 0 1rem var(--main-color);
}

.btn {
    display: inline-block;
    padding: 1rem 2.8rem;
    background: var(--main-color);
    border-radius: 4rem;
    box-shadow: 0 0 1rem var(--main-color);
    font-size: 1.6rem;
    color: var(--second-bg-color);
    letter-spacing: .1rem;
    font-weight: 600;
    transition: .5s ease;
}

.btn:hover {
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--main-color);
    color: var(--main-color);
    margin-left: 1rem;
}

/* About Section */
.about {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    background: var(--second-bg-color);
}

.about-img {
    flex: 1 1 30rem;
    text-align: center;
}

.about-img .about-hero-img {
    width: 25rem;
    height: 25rem;
    border-radius: 50%;
    margin: 0 auto;
    border: .2rem solid var(--main-color);
    object-fit: cover;
    box-shadow: 0 0 2rem var(--main-color);
    transition: 0.5s ease;
}

.about-img .about-hero-img:hover {
    box-shadow: 0 0 4rem var(--main-color);
    transform: scale(1.05);
}

.about-content {
    flex: 1 1 40rem;
}

.heading {
    text-align: center;
    font-size: 4.5rem;
}

.about-content h2 {
    text-align: left;
    line-height: 1.2;
}

.about-content h3 {
    font-size: 2.6rem;
}

.about-content p {
    font-size: 1.6rem;
    margin: 2rem 0 3rem;
    white-space: pre-line;
}

/* Skills Section */
.skills h2 {
    margin-bottom: 5rem;
}

.skills-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(30rem, 1fr));
    gap: 2rem;
}

.skill-box {
    background: var(--second-bg-color);
    padding: 3rem 2rem 4rem;
    border-radius: 2rem;
    text-align: center;
    border: .2rem solid var(--bg-color);
    transition: .5s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.skill-box:hover {
    border-color: var(--main-color);
    transform: scale(1.02);
}

.skill-box i {
    font-size: 7rem;
    color: var(--main-color);
}

.skill-box h3 {
    font-size: 2.6rem;
    margin-bottom: 1.5rem;
}

.skill-level {
    background: var(--bg-color);
    border-radius: 1rem;
    height: 1rem;
    width: 100%;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--main-color);
    border-radius: 1rem;
    box-shadow: 0 0 .5rem var(--main-color);
    transition: 1s ease;
}

.percentage {
    font-size: 1.6rem;
    color: var(--text-color);
    font-weight: 600;
}

/* Projects Section */
.projects {
    background: var(--second-bg-color);
}

.projects h2 {
    margin-bottom: 4rem;
}

.projects-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: stretch;
    gap: 2.5rem;
}

.projects-subtitle {
    text-align: center;
    font-size: 1.6rem;
    margin-top: -3rem;
    /* Pull closer to heading */
    margin-bottom: 4rem;
    color: var(--text-color);
}

.project-box {
    background: var(--second-bg-color);
    border-radius: 2rem;
    box-shadow: 0 0 1rem var(--bg-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: .5s ease;
}

.project-box:hover {
    box-shadow: 0 0 2rem var(--main-color);
    transform: scale(1.02);
}

.project-box img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: top;
    transition: transform 0.5s ease;
}

.project-box:hover img {
    transform: scale(1.1);
}

.project-info {
    padding: 3rem 2rem;
    text-align: center;
}

.project-info h4 {
    font-size: 2.6rem;
    margin-bottom: 1rem;
}

.project-info p {
    font-size: 1.6rem;
    margin-bottom: 2rem;
    color: var(--text-color);
    line-height: 1.6;
}

/* Contact Section */
.contact h2 {
    margin-bottom: 3rem;
}

.contact form {
    max-width: 70rem;
    margin: 1rem auto;
    text-align: center;
    margin-bottom: 3rem;
}

.contact form .input-box {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.contact form .input-box input,
.contact form textarea {
    width: 100%;
    padding: 1.5rem;
    font-size: 1.6rem;
    color: var(--text-color);
    background: var(--second-bg-color);
    border-radius: .8rem;
    margin: .7rem 0;
}

.contact form .input-box input {
    width: 49%;
}

.contact form textarea {
    resize: none;
}

.contact form .btn {
    margin-top: 2rem;
    cursor: pointer;
}

/* Message Section */
.messages-section {
    background: var(--bg-color);
    padding-top: 2rem;
}

.messages-container {
    max-width: 70rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.message-box {
    background: var(--second-bg-color);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease;
}

.message-box:hover {
    transform: translateY(-2px);
    border-color: var(--main-color);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.message-header h4 {
    font-size: 1.8rem;
    color: var(--main-color);
}

.message-header span {
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.7;
}

.message-box p {
    font-size: 1.5rem;
    color: var(--text-color);
    line-height: 1.6;
    white-space: pre-wrap;
    /* Preserve line breaks in messages */
}

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 2rem 9%;
    background: var(--second-bg-color);
}

.footer-text p {
    font-size: 1.6rem;
}

.footer-iconTop a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: .8rem;
    background: var(--main-color);
    border-radius: .8rem;
    transition: .5s ease;
}

.footer-iconTop a:hover {
    box-shadow: 0 0 1rem var(--main-color);
}

.footer-iconTop a i {
    font-size: 2.4rem;
    color: var(--second-bg-color);
}

/* Media Queries */
@media (max-width: 1200px) {
    html {
        font-size: 55%;
    }
}

@media (max-width: 991px) {
    .header {
        padding: 2rem 3%;
    }

    section {
        padding: 10rem 3% 2rem;
    }

    .projects-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer {
        padding: 2rem 3%;
    }
}

@media (max-width: 768px) {
    #menu-icon {
        display: block;
    }

    .navbar {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        padding: 1rem 3%;
        background: var(--bg-color);
        border-top: .1rem solid rgba(0, 0, 0, .2);
        box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .2);
        display: none;
    }

    .navbar.active {
        display: block;
    }

    .navbar a {
        display: block;
        font-size: 2rem;
        margin: 3rem 0;
    }

    .home {
        flex-direction: column;
    }

    .home-content h3 {
        font-size: 2.6rem;
    }

    .home-content h1 {
        font-size: 5rem;
    }

    .home-img {
        margin-top: 4rem;
        margin-left: 0;
    }

    .about {
        flex-direction: column-reverse;
    }

    .about-img {
        margin-top: 4rem;
    }

    .projects-container {
        grid-template-columns: 1fr;
    }
}

/* RTL Override */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .navbar a {
    margin-left: 0;
    margin-right: 4rem;
}

[dir="rtl"] .lang-btn {
    margin-left: 0;
    margin-right: 2rem;
}

[dir="rtl"] .home-img {
    margin-left: 0;
    margin-right: 5rem;
}

[dir="rtl"] .social-media a {
    margin: 3rem 0 3rem 1.5rem;
}

[dir="rtl"] .btn-outline {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .about-content {
    text-align: right;
}

[dir="rtl"] .about-content h2 {
    text-align: right;
}

[dir="rtl"] .home-img {
    margin-right: 0;
    margin-top: 4rem;
}
}

@media (max-width: 617px) {
    .contact form .input-box input {
        width: 100%;
    }
}

@media (max-width: 450px) {
    html {
        font-size: 50%;
    }

    .contact form .input-box input {
        width: 100%;
    }
}

/* Adjust btn-box layout */