/* * ==========================================
 * CORE VARIABLES & RESET
 * ==========================================
 */
:root {
    --bg-color: #FCFBF4;
    --text-main: #111111;
    --text-muted: #666666;
    --accent: #F2980F;
    --surface: rgba(255, 255, 255, 0.6);
    --surface-border: rgba(0, 0, 0, 0.05);
    --glass-blur: blur(12px);
    --easing: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden; /* Prevent horizontal scrollbar */
    -webkit-font-smoothing: antialiased;
    width: 100%;
    max-width: 100%;
}

/* Ambient Background Noise */
.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Gradient Orbs */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -2;
    opacity: 0.4;
}
.orb-1 { top: -10%; right: -5%; width: 600px; height: 600px; background: radial-gradient(circle, #ffecc7 0%, transparent 70%); }
.orb-2 { bottom: -10%; left: -10%; width: 500px; height: 500px; background: radial-gradient(circle, #e0e7ff 0%, transparent 70%); }


/* Navigation */
.htmlmenu-wrapper {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.htmlmenu-container {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255,255,255,0.9);
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border-radius: 999px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    pointer-events: auto;
    transition: all 0.5s ease;
    width: auto; /* Allow auto width based on content */
    max-width: 90%;
    position: relative; /* Anchor for absolute dropdown */
}

.htmlmenu-container:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    scale: 1.05;
    transition: all 0.5s ease;
}

.htmlmenu-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    padding-left: 8px;
    flex-shrink: 0;
}

.profilepicture {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.htmlmenu-logo:hover .profilepicture {
    border-color: var(--accent);
}

.Namepic {
    font-family: 'Titan One', cursive;
    font-size: 18px;
    color: var(--text-main);
    margin: 0;
    padding-bottom: 2px;
    transition: color 0.5s ease;
}

.Namepic:hover {
    color: var(--accent);
    transition: color 0.5s ease;
}

/* Hamburger Toggle Logic */
.htmlmenu-toggle { display: none; }

.menu-trigger {
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}
.menu-trigger:hover { background: rgba(0,0,0,0.03); }

.menu-trigger span {
    width: 20px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: 0.3s var(--easing);
}

/* Push the hamburger to the far right of the menu container */
.htmlmenu-container .menu-trigger { margin-left: auto; }

/* --- DROPDOWN & SUBMENUS --- */

/* Main Dropdown Wrapper */
.nav-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 12px;
    min-width: 240px; /* Slightly wider */
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.9);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: 0.2s ease-in-out;
}

/* Show Dropdown when Hamburger is Checked */
.htmlmenu-toggle:checked ~ .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* List Styles */
.nav-list, .submenu {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.nav-list li {
    position: relative; /* Important for positioning submenus */
}

/* Link Items */
.nav-item {
    display: flex;
    pointer-events: auto !important;
    justify-content: space-between; /* Push arrow to right */
    align-items: center;
    padding: 10px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255,255,255,0.9);
    color: var(--accent);
}

/* Arrow Icon */
.arrow {
    font-size: 18px;
    line-height: 1;
    margin-left: 10px;
    color: #999;
}

/* --- SUBMENU LOGIC (Desktop Flyout) --- */

/* Hidden by default */
.submenu {
    position: absolute;
    top: 0;
    left: 100%; /* Position to the right of parent */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 12px;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.9);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: 0.2s ease-in-out;
    margin-left: 8px; /* Gap between menus */
}

/* RTL Submenu positioning */
body.rtl .submenu {
    left: auto;
    right: 100%; /* Position to the left of parent in RTL */
    margin-left: 0;
    margin-right: 8px; /* Gap between menus */
    transform: translateX(10px);
}

/* Show Submenu on Hover (Desktop) */
@media (min-width: 1025px) {
    .has-submenu:hover > .submenu {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }
}

/* Hamburger Animation */
.htmlmenu-toggle:checked + label span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.htmlmenu-toggle:checked + label span:nth-child(2) { opacity: 0; }
.htmlmenu-toggle:checked + label span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* MAIN ANIMATION CONTAINER (Hello World) */
#main-heading {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: baseline; 
    align-self: center;
    width: 100%;
    text-align: center;
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    margin: 0;
    padding: 0;
    font-size: clamp(2rem, 3.5vw, 4rem); 
    font-weight: 800;
    letter-spacing: -0.02em;
    z-index: 10;
    pointer-events: none; 
}

#changing-text {
    display: inline-block; /* Allows width to work */
    width: 500px;
    height: auto;          /* Set this wide enough for your longest word */
    text-align: right;     /* Anchors the text to the right side */
    vertical-align: bottom; /* Keeps it aligned with the static text */
    flex: 1;            /* Takes up 50% of the space */
    padding-right: 10px; /* Add a little gap between words */
    justify-self: end;
    min-width: 0;
    color: var(--accent);
    filter: drop-shadow(0 30px 70px rgba(242,152,15,0.55));
}

#static-text {
    flex: 1;           /* Takes up the other 50% */
    text-align: left;  /* Anchors text to the "seam" */
    white-space: nowrap; /* Prevents "World" from breaking */
    width: 500px;
    height: auto;
    padding-left: 10px;
    /* Ensure the element can receive filter effects and provide fallbacks for compatibility */
    display: inline-block;
    -webkit-filter: drop-shadow(0 30px 70px rgba(242,152,15,0.55));
    filter: drop-shadow(0 30px 70px rgba(242,152,15,0.55));
    /* Text-shadow fallback for browsers/platforms where filter drop-shadow doesn't apply to text */
    text-shadow: 0 12px 36px rgba(242,152,15,0.45);
}

/* SplitType Line Masking */
.line { overflow: hidden; display: block; }
.line-inner { display: inline-block; transform: translateY(100%); }


/* REVEALED CONTENT */
#content-to-fade-in {
    opacity: 0;
    padding-top: 15vh; /* Initial gap */
    padding-bottom: 100px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Grid Layout for Sections */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    padding: 0 24px;
    margin-top: 0px;
    width: 100%;
    box-sizing: border-box; /* Crucial for preventing overlap */
}

/* HERO SECTION */
.hero-section {
    grid-column: span 12;
    text-align: left;
    margin-bottom: 96px;
    position: relative;
    padding-right: 620px;
}

.changing-text-creativity {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    color: var(--text-main);
    transition: color 0.5s ease;
}

.changing-text-creativity:hover {
    color: var(--accent);
    transition: color 0.5s ease;
}

.subtitle-hero {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 40px;
    transition: color 0.5s ease;
}

.subtitle-hero:hover {
    color: var(--text-main);
    transition: color 0.5s ease;
}

/* Button Styling */
.btn-group { display: flex; gap: 16px; flex-wrap: wrap; }

.btn {
    background: #1a1a1a;
    color: white;
    padding: 14px 28px;
    border-radius: 99px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    background: var(--accent);
}

.btn-outline {
    background: transparent;
    border: 2px solid rgba(0,0,0,0.1);
    color: var(--text-main);
}
.btn-outline:hover {
    border-color: var(--text-main);
    background: transparent;
    transform: translateY(-2px);
}

/* LATEST PROJECT BUTTON */
.btn-latest {
    margin-top: 20px;
    background: white;
    color: var(--text-main);
    padding: 16px 24px;
    border-radius: 16px;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
}
.btn-latest span { font-size: 0.9em; color: var(--text-muted); font-weight: 400; transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); }
.btn-latest:hover {
    border-color: var(--accent);
    transform: scale(1.01);
    filter: drop-shadow(0 30px 70px rgba(242,152,15,0.55));
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.btn-latest {
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* ABOUT CARD */
.about-card {
    grid-column: span 7;
    background: white;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.05);
    border: 1px solid var(--surface-border);
    transition: all 0.5s ease;
}

.about-card:hover {
    filter: drop-shadow(0 30px 70px rgba(242,152,15,0.55));
    transform: translateY(-5px);
    transition: all 0.5s ease;
}


.about-title-wrapper {
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: 700;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #444;
}

/* CONTACT CARD */
.contact-card {
    grid-column: span 5;
    background: #111;
    color: white;
    border-radius: 24px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    position: relative;
    overflow: visible;
    transition: all 0.5s ease;
    min-height: 300px;

}

.contact-card:hover {
    filter: drop-shadow(0 30px 70px rgba(242,152,15,0.8));
    transform: translateY(-5px);
    transition: all 0.5s ease;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.contact-card::before {
    content: '';
    position: absolute;
    top: -50%; right: -50%;
    width: 100%; height: 100%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
    opacity: 0.15;
    filter: blur(40px);
}

.contact-card:hover .text {
    transition: 0.3s ease;
}

.hover-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85em;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.05em;
    animation: pulse-glow 2s ease-in-out infinite;
    margin: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
    z-index: 5;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.6;
        text-shadow: 0 0 10px rgba(242, 152, 15, 0.5);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 20px rgba(242, 152, 15, 0.8);
    }
}

.contact-card:hover .hover-hint {
    opacity: 0;
    animation: none;
}

.contact-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    position: relative;
}

.contact-links {
    display: none;
}

.contact-link {
    display: none;
}

/* The Terminal Window Container */
.terminal-window {
    background-color: #1e1e1e; /* VS Code Dark Gray */
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.45);
    width: 520px; 
    height: 380px; 
    overflow: hidden;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    position: absolute; 
    right: 24px;
    top: 6%;
    border: 1px solid rgba(0,0,0,0.35);
    z-index: 50;
    transition: all 0.5s ease;
}

.terminal-window:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 70px rgba(0,0,0,0.55);
    transition: all 0.5s ease;
}

/* The Top Bar */
.terminal-header {
    background-color: #252526;
    padding: 10px 15px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #333;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.red { background-color: #ff5f56; }
.yellow { background-color: #ffbd2e; }
.green { background-color: #27c93f; }

/* The Code Area */
#code-content {
    padding: 15px;
    height: calc(100% - 40px);
    overflow: hidden; /* Hides scrollbar but allows JS to scroll */
    color: #d4d4d4;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Keeps typing at bottom initially */
}

/* Individual Lines */
.code-line {
    display: flex;
    white-space: pre; /* Keeps indentation */
    margin-bottom: 2px;
}

.line-number {
    color: #858585;
    min-width: 30px;
    text-align: right;
    margin-right: 15px;
    user-select: none;
}

.code-text {
    color: #9cdcfe; /* Light Blue text */
}

/* Blinking Cursor */
.cursor {
    color: #F2980F;
    animation: blink 1s step-end infinite;
    font-weight: bold;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ----- Intro lock + menu reveal ----- */
/* Prevent scrolling while hero intro runs */
.no-scroll { overflow: hidden; height: 100vh; }

/* While hero is locked, disable primary interactive controls */
body.hero-locked .btn,
body.hero-locked .btn-latest,
body.hero-locked .menu-trigger {
    pointer-events: none;
    opacity: 0.7;
}

/* Menu is hidden during intro; will receive .show to reveal */
.htmlmenu-wrapper {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none; /* ensure it can't be clicked while hidden */
    transition: opacity 420ms var(--easing), transform 420ms var(--easing);
}

.htmlmenu-wrapper.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Small visual nudge when unlocking */
body.hero-locked .htmlmenu-container { filter: blur(0.0); }



@media (max-width: 900px) {


}

/* ===== PROJECT HALL SECTION ===== */

/* Project Hall Container */
.project-hall {
    grid-column: span 12;
    margin-bottom: 96px;
}

/* Project Hall Header (centered title & subtitle) */
.project-hall-header {
    text-align: center;
    margin-bottom: 60px;
}

.project-hall-title {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: var(--text-main);
    margin: 0 0 16px 0;
    transition: 0.5s ease;
}

.project-hall-title:hover {
    color: var(--accent);
    scale: 1.05;
    transition: 0.5s ease;
}

.project-hall-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 400;
    margin: 0;
    transition: color 0.5s ease;
}

.project-hall-subtitle:hover {
    color: var(--text-main);
    transition: color 0.5s ease;
}

/* Project Hall Grid */
.project-hall-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

@media (max-width: 1200px) {
    .project-hall-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .project-hall-grid {

/* Additional mobile adjustments: menu alignment, dropdown anchoring, and about-card expansion */
@media (max-width: 900px) {
    /* Mobile menu: capsule spans full viewport width minus 40px (20px gutters) and sits 15px from the top */
    .htmlmenu-wrapper {
        justify-content: center;
        top: 15px; /* move slightly down on mobile */
    }

    .htmlmenu-container {
        width: calc(100% - 40px); /* full width minus 20px gutters each side */
        max-width: calc(100% - 40px);
        margin: 0 20px;
        justify-content: space-between; /* logo left, trigger right */
        padding: 8px 12px;
    }

    /* Ensure the hamburger sits at the far right inside the capsule */
    .htmlmenu-container .menu-trigger { margin-left: auto; }

    /* Anchor the dropdown to the left of the menu container on mobile */
    .nav-dropdown {
        right: auto;
        left: 0;
        margin-top: 10px;
    }

    /* About card should be allowed to grow vertically on small screens */
    .about-card {
        max-height: none;
        height: auto;
        overflow: visible;
    }
    .about-text {
        white-space: normal;
        overflow: visible;
    }
}
        grid-template-columns: 1fr;
    }
}

/* Individual Project Card */
.project-card {
    background: white;
    border-radius: 24px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--surface-border);
    transition: all 0.5s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card:hover {
    filter: drop-shadow(0 30px 70px rgba(242, 152, 15, 0.55));
    transform: translateY(-5px);
    transition: all 0.5s ease;
}

.project-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 24px 24px 0 0;
}

.project-card-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.project-card-desc {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 0 0 20px 0;
    line-height: 1.5;
    flex: 1;
}

/* Expand Button */
.project-expand-btn {
    align-self: flex-start;
    background: #1a1a1a;
    color: white;
    padding: 10px 20px;
    border-radius: 99px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.project-expand-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    background: var(--accent);
}

/* ===== PROJECT MODAL (POPUP) ===== */

/* --- PROJECT HALL STYLES --- */
.project-hall {
    grid-column: span 12;
    margin-top: 40px;
    margin-bottom: 100px;
}

.project-hall-header {
    text-align: center;
    margin-bottom: 40px;
}

.project-hall-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-main);
}

.project-hall-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.project-hall-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 900px) {
    .project-hall-grid { grid-template-columns: 1fr; }
}

.project-card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.05);
    border: 1px solid var(--surface-border);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.project-card-img {
    width: 30%;
    height: auto;
    object-fit: cover;
    align-self: center;
    padding-top: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--surface-border);
}

.project-card-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.project-card-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.project-expand-btn {
    background: #111;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
    transition: all 0.3s ease;
}

.project-expand-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}


.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    
    display: flex; 
    align-items: center;
    justify-content: center;
    
    /* Start Hidden */
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Ensures clicks pass through when hidden */
    
    /* Backdrop Styles */
    background: rgba(0, 0, 0, 0.0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    
    /* Smooth Transition for closing */
    /* We use 'step-end' on visibility to ensure it hides AFTER the fade out finishes */
    transition: 
        opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        backdrop-filter 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.5s step-end; 
}

.project-modal.active {
    /* Show It */
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Enable clicks */
    
    /* Active Backdrop */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    transition: 
        opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        backdrop-filter 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s step-start; 
}

.project-modal-content {
    background: white;
    width: 900px;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 30px;
    padding: 40px;
    position: relative;
    box-shadow: 0 30px 80px rgba(0,0,0,0.3);
    
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    overflow-y: auto;

    /* Start State: Invisible, slightly down, smaller */
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    
    /* Smooth Apple-style ease */
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active State: Slide Up & Fade In */
.project-modal.active .project-modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Closing State: Fade Out & Drop Down */
.project-modal.closing .project-modal-content {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

.project-modal.closing {
    background: rgba(0, 0, 0, 0.0);
    backdrop-filter: blur(0px);
}

/* Modal Inner Elements */
.project-modal-left { display: flex; flex-direction: column; gap: 20px; }
.project-modal-title { font-size: 2rem; font-weight: 800; margin: 0; line-height: 1.1; }
.project-modal-img { 
    width: 30%; height: auto; object-fit: cover; 
    border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
    background-color: #eee;
}

.project-modal-actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.modal-action-btn {
    width: 100%; padding: 16px; border-radius: 12px; font-weight: 600;
    font-size: 1rem; cursor: pointer; border: none; transition: all 0.2s ease;
}
.modal-action-btn.primary { background: #111; color: white; }
.modal-action-btn.primary:hover { background: var(--accent); transform: translateY(-2px); }
.modal-action-btn.secondary { background: #f0f0f0; color: #333; }
.modal-action-btn.secondary:hover { background: #e0e0e0; transform: translateY(-2px); }

.project-modal-right { padding-top: 10px; }
.modal-subtitle { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 15px; font-weight: 600; }
.modal-description-text { font-size: 1.1rem; line-height: 1.8; color: #333; }

.project-modal-close {
    position: absolute; top: 25px; right: 25px; width: 40px; height: 40px;
    background: #f5f5f5; border: none; border-radius: 50%; font-size: 24px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    transition: all 0.3s ease; z-index: 10; color: #333;
}
.project-modal-close:hover { background: #111; color: white; transform: rotate(90deg); }

@media (max-width: 800px) {
    .project-modal-content { grid-template-columns: 1fr; padding: 30px 20px; gap: 20px; }
}

.simple-footer {
    grid-column: span 12;
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
    border-top: 1px solid var(--surface-border);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
    
.simple-footer .heart {
    color: #e25555;
    display: inline-block;
    animation: heartbeat 1.5s ease infinite;
}



/* * ==========================================
 * RESPONSIVE (MOBILE FIXES)
 * ==========================================
 */
@media (max-width: 1024px) {
    /* Fix horizontal overflow on small screens */
    html, body { overflow-x: hidden; width: 100%; max-width: 100%; }

    /* 1. Stack the Hero Section Vertically */
    .hero-section {
        display: flex !important; /* Force flex to override grid */
        flex-direction: column;   /* Stack Top-to-Bottom */
        text-align: center;
        gap: 40px;
        padding: 0 20px;
        min-height: auto;
        margin-top: 60px;
        padding-right: 20px !important;
    }

    .simple-footer {
    grid-column: span 12;
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
    border-top: 1px solid var(--surface-border);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
    
    .simple-footer .heart {
        color: #e25555;
        display: inline-block;
        animation: heartbeat 1.5s ease infinite;
    }
    

    
    @keyframes heartbeat {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.2); }
    }
        
    /* 2. Center the Content */
    .hero-content {
        max-width: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    /* 3. Fix the Terminal Position & Width */
    .hero-visual {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 20px;
    }
    
    .terminal-window {
        position: static !important; /* Reset absolute positioning */
        max-width: 100%;
        width: 100%;
        height: 280px;   /* Slightly shorter on mobile */
        margin: 0;
        transform: none !important; /* Remove 3D effect on mobile */
        right: auto;
        top: auto;
    }
    
    #main-heading {
        display: flex;
        flex-direction: column;
        gap: 0px;
        align-items: center;
        justify-content: center;
        width: 100%;
        text-align: center;
        position: fixed;
        top: 50%;
        left: 0;
        right: 0;
        transform: translateY(-50%);
        margin: 0;
        padding: 0;
        font-size: clamp(2rem, 3.5vw, 4rem); 
        font-weight: 800;
        letter-spacing: -0.02em;
        z-index: 10;
        pointer-events: none; 
    }

    #changing-text {
        display: block;
        width: 100%;
        height: auto;
        text-align: center;
        color: var(--accent);
    }
    
    #static-text {
        flex: 0 0 auto;
        width: 100%;
        text-align: center;
        padding: 0;
        filter: drop-shadow(0 30px 70px rgba(242,152,15,0.55));
    }
    
    /* 5. Center Buttons */
    .btn-group {
        justify-content: center;
        width: 100%;
    }
    
    .btn-latest {
        margin: 30px auto 0;
    }
    
    /* 6. Navigation Fixes */
    .htmlmenu-container {
        padding: 8px 16px;
        width: 80%;
    }
    
    /* Mobile Dropdown Styling  */
    .nav-dropdown {
        position: fixed;
        width: 90vw;
        right: 50%;
        transform: translateX(50%) translateY(-10px);
        display: block !important;
        pointer-events: auto !important;
        top: 80px;
        max-height: 70vh;
        overflow-y: auto;
        z-index: 9999;
    }

    .htmlmenu-toggle:checked ~ .nav-dropdown {
        transform: translateX(50%) translateY(0);
    }

    /* Submenu on mobile */
    .submenu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        background: rgba(0,0,0,0.03);
        margin: 0;
        padding-left: 15px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
    }

    /* Show submenu when active/toggled */
    .has-submenu:hover > .submenu,
    .has-submenu:active > .submenu {
        display: block;
    }
    
    .about-card, .contact-card {
        grid-column: span 12;
        width: 100%;
    }
    
    .contact-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: auto;
        padding: 40px 20px;
        gap: 20px;
    }
    
    .contact-card > div:first-child {
        text-align: center;
        width: 100%;
    }
    
    /* Contact card social icons - make them square on mobile */
    .contact-card .main {
        width: 11em;
        height: 11em;
        margin-top: 10px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 1fr;
        gap: 0.5rem;
        align-items: center;
        justify-items: center;
    }

    .contact-card .card {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: scale(1) !important;
        background: rgba(255, 255, 255, 0.1) !important;
        display: flex !important;
        margin-bottom: -7px !important;
    }

    /* Force the icons (SVG/i) inside to show */
    .contact-card .card svg, 
    .contact-card .card i, 
    .contact-card .card path,
    .contact-card .card .hourglass {
        opacity: 1 !important;
        visibility: visible !important;
        fill: white !important; /* Forces SVG color */
        color: white !important; /* Forces FontAwesome color */
    }

    /* Keep the specific colors for Instagram/Gmail/Github */
    .card .instagram { fill: #cc39a4 !important; }
    .card .gmail { fill: #F2980F !important; }
    .card .github { fill: white !important; }

    /* Hide the 'Hover to reveal' hint */
    .contact-card .text {
        display: none !important;
    }



    /* Prevent horizontal scrolling for small screens and fix marquee spacing */
    .marquee {
        width: 100%;
        margin-left: 0;
        padding: 20px 0;
    }

    .marquee__inner {
        gap: 0.75rem;
    }

    .button {
        /* Move it up slightly to avoid overlapping mobile navigation bars */
        bottom: 20px;
        right: 20px;
        
        /* Disable the expanding hover effect on mobile */
        /* It feels glitchy on touch because 'hover' stays active after tapping */
        width: 50px !important;
        height: 50px !important;
        border-radius: 50% !important;
    }

    .button:hover {
        width: 50px !important; /* Keep it a circle on mobile */
    }

    .button:hover::before {
        display: none !important; /* Hide the text label on mobile */
    }

    .button:hover .svgIcon {
        transform: none !important; /* Keep the arrow visible on mobile */
    }
}

.main_back {
    position: absolute;
    border-radius: 10px;
    transform: rotate(90deg);
    width: 11em;
    height: 11em;
    background: radial-gradient(
        circle,
        rgba(242, 152, 15, 0.4) 0%,
        rgba(0, 0, 0, 0) 60%
    );
    z-index: -2;
}
.main {
    display: flex;
    flex-wrap: wrap;
    width: 14em;
    align-items: center;
    justify-content: center;
    z-index: 10;
    position: relative;
    margin: auto;
    max-width: 100%;
}

@media (max-width: 768px) {
    .main {
        width: 12em;
    }
}
.card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    transition: 0.4s ease-in-out, 0.2s background-color ease-in-out;
    background: rgba(0, 0, 0, 0.596);
    filter: drop-shadow(0 30px 70px rgba(242,152,15,0.15));
    backdrop-filter: blur(5px);
    border: 1px solid transparent;
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    cursor: pointer;
    transform: scale(0.8);
}
.card svg,
.card i,
.card .hourglass {
    opacity: 0;
    transition: 0.2s ease-in-out;
}
.card .instagram {
    fill: #cc39a4;
}
.card .github {
    fill: black;
}
.card .gmail {
    fill: #F2980F;
}
.card i {
    color: #F2980F;
    font-size: 24px;
}
.card .hourglass {
    font-size: 24px;
    color: #888;
}
/* Layout */
.card:nth-child(1) {
    border-top-left-radius: 10px;
}
.card:nth-child(3) {
    border-top-right-radius: 10px;
}
.card:nth-child(7) {
    border-bottom-left-radius: 10px;
}
.card:nth-child(9) {
    border-bottom-right-radius: 10px;
}
.main:hover .card {
    margin: 0.2em;
    border-radius: 10px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}
.main:hover .main_back {
    opacity: 0;
}
.main:hover .text {
    opacity: 0;
    z-index: -3;
}
.main:hover .card svg,
.main:hover .card i,
.main:hover .card .hourglass {
    opacity: 1;
}
/* Instagram hover */
.card:nth-child(1):hover {
    background-color: #cc39a4;
}
.card:nth-child(1):hover .instagram {
    fill: white;
}
/* GitHub hover */
.card:nth-child(2):hover {
    background-color: black;
}
.card:nth-child(2):hover .github {
    fill: white;
}
/* Gmail hover */
.card:nth-child(3):hover {
    background-color: #F2980F;
}
.card:nth-child(3):hover .gmail {
    fill: white;
}
/* Hourglass cards hover */
.card:nth-child(4):hover,
.card:nth-child(5):hover,
.card:nth-child(6):hover,
.card:nth-child(7):hover,
.card:nth-child(8):hover,
.card:nth-child(9):hover {
    background-color: rgba(255, 255, 255, 0.3);
}
.text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85em;
    transition: 0.4s ease-in-out;
    color: #F2980F;
    text-align: center;
    font-weight: bold;
    letter-spacing: 0.02em;
    z-index: 3;
    animation: pulse-glow 2s ease-in-out infinite;
    margin: 0;
    width: 90%;
}
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(242, 152, 15, 0.5);
    }
    50% {
        opacity: 0.8;
        text-shadow: 0 0 20px rgba(242, 152, 15, 0.8);
    }
  }
.main:hover .text {
    opacity: 0;
    animation: none;
}
.social-link {
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}


/*SLIDING ICONS */ 
.marquee {
  grid-column: span 12;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  overflow: hidden; /* This is crucial to hide the 'spawning' */
  display: flex;
  flex-direction: column;
  padding: 40px 0;
  position: relative;
}

.marquee_header {
  font-size: 35px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 40px;
  width: 100%;
}

.marquee__inner {
  display: flex;
  width: max-content; /* Force it to stay in one long line */
  gap: 1.5rem;
  will-change: transform;
}

.marquee__inner.reverse {
  margin-top: 20px;
  will-change: transform;
}

.marquee__group {
  display: flex;
  gap: 1.5rem;
  flex-shrink: 0;
  align-items: center;
}

.marquee__group span {
  white-space: nowrap;
  background: #000000;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.marquee__group span img.marquee-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: brightness(1) saturate(1);
}

.marquee__group span i {
  font-size: 1.2rem;
  min-width: 20px;
  transition: all 0.3s ease;
}

/* Brand colors for each icon */
.marquee__group span:nth-child(1) img { filter: brightness(1) saturate(1); } /* Java */
.marquee__group span:nth-child(2) img { filter: brightness(1) saturate(1); } /* Python */
.marquee__group span:nth-child(3) img { filter: brightness(1) saturate(1); } /* HTML */
.marquee__group span:nth-child(4) img { filter: brightness(1) saturate(1); } /* CSS */
.marquee__group span:nth-child(5) i { color: #F7DF1E; } /* JavaScript - Yellow */

/* IDE colors for reverse marquee */
.marquee__inner.reverse .marquee__group span:nth-child(1) img { filter: brightness(1) saturate(1); } /* Intellij */
.marquee__inner.reverse .marquee__group span:nth-child(2) img { filter: brightness(1) saturate(1); } /* Pycharm */
.marquee__inner.reverse .marquee__group span:nth-child(3) img { filter: brightness(1) saturate(1); } /* Visual Studio */
.marquee__inner.reverse .marquee__group span:nth-child(4) img { filter: brightness(1) saturate(1); } /* VS Code */
.marquee__inner.reverse .marquee__group span:nth-child(5) img { filter: brightness(1) saturate(1); } /* Git */

.marquee__group span:hover {
  background: var(--accent);
  cursor: pointer;
  transform: translateY(-3px);
  transition: all 0.3s ease;
}

/* ===== SCROLL BAR ===== */
/* 1. The width of the entire scrollbar */
::-webkit-scrollbar {
  width: 10px;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

/* 2. The background of the scrollbar area (The Track) */
::-webkit-scrollbar-track {
  background: var(--bg-color); 
}

/* 3. The draggable part (The Thumb) */
::-webkit-scrollbar-thumb {
  background: #d1d1d1; /* A subtle grey */
  border-radius: 10px;
  border: 2px solid var(--bg-color); /* Creates a 'padding' effect around the thumb */
}

/* 4. Hover effect on the thumb */
::-webkit-scrollbar-thumb:hover {
  background: var(--accent); /* Switches to your orange accent color on hover */
  box-shadow: 0 0 10px rgba(242, 152, 15, 0.5);
}

/* ===== SCROLL UP BUTTON ===== */
/* From Uiverse.io by vinodjangid07 */ 
.button {
  /* --- POSITIONING LOGIC --- */
  position: fixed;   /* Stays in the same spot on screen */
  bottom: 30px;      /* Distance from bottom */
  right: 30px;       /* Distance from right */
  z-index: 2000;     /* Keeps it above all other elements */
  
  /* --- YOUR ORIGINAL STYLES --- */
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: rgb(20, 20, 20);
  border: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Updated shadow to match your site's orange accent */
  box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1), 0px 0px 0px 4px rgba(242, 152, 15, 0.1); 
  cursor: pointer;
  transition-duration: 0.3s;
  overflow: hidden;
}

/* --- THE REST OF YOUR ANIMATION CODE --- */

.button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 2000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: rgb(20, 20, 20);
  border: none;
  
  /* Start completely removed from layout */
  display: none; 
  
  align-items: center;
  justify-content: center;
  box-shadow: 0px 0px 0px 4px rgba(242, 152, 15, 0.2);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px) scale(0.8);
}

/* This class will be added by JS when the intro is finished */
.button.ready {
  display: flex;
}

/* Only show when intro is finished AND user has scrolled down */
body:not(.hero-locked) .button.ready.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Ensure icons and text stay white */
.svgIcon { width: 12px; transition: 0.3s; z-index: 2; }
.svgIcon path { fill: white; }
.button::before {
  position: absolute;
  bottom: -20px;
  content: "Back to Top";
  color: white;
  font-size: 0px;
  transition: 0.3s;
}

.button:hover {
  width: 140px;
  border-radius: 50px;
  background-color: var(--accent);
}

.button:hover .svgIcon { transform: translateY(-200%); }
.button:hover::before { font-size: 13px; bottom: 15px; }

@media (hover: none) {
    .card:active, .main:active .card {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Language selector */

/* Language Selector Styling */
.lang-wrapper {
    position: relative;
    margin-left: 10px;
    display: flex;
    align-items: center;
}

.lang-toggle { display: none; }

.lang-trigger {
    width: 55px; /* Circular pill */
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.3s var(--easing);
}

.lang-trigger:hover {
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.lang-flag-current {
    width: 20px;
    height: auto;
    border-radius: 2px;
}

.lang-arrow {
    font-size: 8px;
    color: var(--text-muted);
    transition: transform 0.3s;
}

/* Dropdown connected pills */
.lang-dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: 0.3s var(--easing);
}

.lang-toggle:checked ~ .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-toggle:checked ~ .lang-trigger .lang-arrow {
    transform: rotate(180deg);
}

.lang-option {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255,255,255,0.9);
    padding: 8px 16px;
    border-radius: 999px; /* Pill design */
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.lang-option img { width: 18px; border-radius: 2px; }
.lang-option span { font-size: 14px; font-weight: 500; color: var(--text-main); }

.lang-option:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

.lang-option:hover span { color: white; }

/* Responsive Fixes for Language Selector */
/* 1. Fix Cut-off Hero/About Text (Line-height & Padding) */
#changing-text, 
.changing-text-creativity, 
.about-title-wrapper span {
    line-height: 1.4 !important; /* Give space for Arabic diacritics */
    padding-bottom: 15px;       /* Prevent bottom clipping */
    display: inline-block;
}

/* 2. Marquee Layout Fix (Strict LTR for calculations) */
.marquee, .marquee__inner {
    direction: ltr !important; /* Prevents the 'stacking' glitch in your pic */
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* 3. Modal & Project Card Fixes */
body.rtl .project-modal-content {
    direction: rtl;
    text-align: right;
}

body.rtl .project-modal-close {
    right: auto;
    left: 20px; /* Moves 'X' to the left in Arabic */
}

body.rtl .modal-action-btn {
    text-align: center;
}

/* Fix 'QuickClip' text alignment in cards */
body.rtl .project-card-content {
    text-align: right;
}

/* Fix 'Released my new portfolio' button dot position */
body.rtl .btn-latest {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* Mirror Hero layout for Arabic */
body.rtl .hero-section {
    padding-right: 0 !important;
    padding-left: 620px !important;
    text-align: right !important;
}

/* Mirror the terminal box position */
body.rtl .terminal-window {
    right: auto !important;
    left: 24px !important;
}

/* Ensure the 'latest update' button content aligns right */
body.rtl .Latest-project-button-herosection {
    flex-direction: row-reverse;
    text-align: right;
}

/* Fix text clipping for Arabic diacritics */
body.rtl .changing-text-creativity, 
body.rtl #changing-text {
    line-height: 1.4;
    padding-bottom: 0.2em;
}

/* Fix Arabic text clipping */
#changing-text, 
.changing-text-creativity, 
.about-title-wrapper span {
    line-height: 1.4 !important;
    padding-bottom: 10px;
}

/* Stabilize Marquees during direction change */
.marquee, .marquee__inner {
    direction: ltr !important;
}

/* Mirror Latest Update button dot and alignment */
body.rtl .Latest-project-button-herosection {
    flex-direction: row-reverse;
    text-align: right;
}

/* Move Modal close button in RTL */
body.rtl .project-modal-close {
    right: auto !important;
    left: 20px !important;
}

/* RTL Mobile Specific Fixes */
@media (max-width: 1024px) {
    /* 1. Hero Section Layout */
    body.rtl .hero-section {
        padding-left: 20px !important;  /* Remove the 620px desktop padding */
        padding-right: 20px !important;
        text-align: center !important;  /* Center text for better mobile UX */
        display: flex !important;
        flex-direction: column;
        align-items: center;
    }

    /* 2. Terminal Window Centering */
    body.rtl .terminal-window {
        position: static !important;
        margin: 20px auto 0 auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        max-width: 520px;
    }

    /* 3. Latest Update Button Fix */
    body.rtl .btn-latest {
        margin: 20px auto 0 auto !important; /* Center the button */
        flex-direction: row-reverse; /* Keep dot on the correct side for RTL */
        justify-content: center;
    }

    /* 4. Navigation Dropdown Fix */
    body.rtl .nav-dropdown {
        right: 50% !important;
        left: auto !important;
        transform: translateX(50%) translateY(-10px);
    }

    body.rtl .htmlmenu-toggle:checked ~ .nav-dropdown {
        transform: translateX(50%) translateY(0);
    }

    /* 5. Submenu Indicator Mirroring */
    body.rtl .nav-item .arrow {
        transform: rotate(180deg);
        margin-left: 0;
        margin-right: 10px;
    }

    /* 6. Language Dropdown Positioning */
    body.rtl .lang-dropdown {
        right: auto;
        left: 0;
    }
}

/* Fix for diacritics clipping on all screens in Arabic */
body.rtl #changing-text, 
body.rtl .changing-text-creativity, 
body.rtl .about-title-wrapper span {
    line-height: 1.4 !important;
    overflow: visible !important;
}