    /* <!-- ======================== Skills Section ======================== -->
    <section id="skills" class="skills">
        <div class="container">
            <h2 class="section-title" data-aos="fade-up" data-aos-duration="1000">Skills</h2>
            <p class="section-subtitle" data-aos="fade-up" data-aos-delay="100" data-aos-duration="800">Technical
                expertise across data science, machine learning, and software development.</p>
            <div id="technical-skills-grid" class="skills-grid">
                <div class="skill-category-container">
                    <!-- Skills will be injected by JavaScript -->
                </div>
            </div>
        </div>
    </section>
 */

/*
================================================
Portfolio Stylesheet
Author: Nour Hatem
Version: 14.0 - Timeline Polish
================================================
*/

/* --- CSS Variables for Theming --- */
:root {
    /* Motion (AOS + custom UI; keep perceived motion calm and consistent) */
    --motion-duration: 0.55s;
    --motion-duration-fast: 0.35s;
    --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --motion-stagger: 70ms;
    --bg-primary: #ffffff;
    --bg-primary-rgb: 255, 255, 255;
    --bg-secondary: #f8fafc;
    --bg-hero: #f0f9ff;
    --bg-nav: rgba(255, 255, 255, 0.6);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --border-color: rgba(59, 130, 246, 0.15);
    --shadow-color: rgba(59, 130, 246, 0.15);
    --card-shadow: rgba(59, 130, 246, 0.08);
    --accent-gradient: linear-gradient(45deg, #3b82f6, #818cf8, #a78bfa);
    --accent-gradient-darker: linear-gradient(45deg, #2563eb, #6d28d9);
    --accent-color: #3b82f6;
    --form-bg: #fdfdff;
    --form-border: #e5e7eb;
    --footer-bg: #f5f5f5;
    --footer-text: #475569;
    --preloader-bg: #ffffff;
    --spinner-color: #3b82f6;
    --toast-success-bg: linear-gradient(135deg, #22c55e, #16a34a);
    --toast-error-bg: linear-gradient(135deg, #ef4444, #dc2626);
    --section-pad: clamp(50px, 8vw, 90px);
    --glass-blur-strong: 8px;
    --glass-blur-soft: 5px;
}

.dark-mode {
    --bg-primary: #000000;
    --bg-primary-rgb: 0, 0, 0;
    --bg-secondary: #0a0a0a;
    --bg-hero: #000000;
    --bg-nav: rgba(0, 0, 0, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: rgba(96, 165, 250, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --card-shadow: rgba(0, 0, 0, 0.6);
    --accent-gradient: linear-gradient(45deg, #60a5fa, #818cf8, #c4b5fd);
    --accent-gradient-darker: linear-gradient(45deg, #3b82f6, #7c3aed);
    --accent-color: #60a5fa;
    --form-bg: #0a0a0a;
    --form-border: #1a1a1a;
    --footer-bg: #000000;
    --footer-text: #b0b0b0;
    --preloader-bg: #000000;
    --spinner-color: #60a5fa;
}

/* --- Base Styles & Preloader --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color 0.3s ease;
    width: 100%;
    max-width: 100vw;
}

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--preloader-bg);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--accent-color-translucent, rgba(59, 130, 246, 0.2));
    border-left-color: var(--spinner-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* --- Navigation --- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--bg-nav);
    backdrop-filter: blur(var(--glass-blur-strong));
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    border-bottom: 1px solid transparent;
}

.navbar.scrolled {
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px var(--shadow-color);
    transform: translateY(0);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(14px, 4vw, 28px);
    box-sizing: border-box;
    gap: 16px;
    flex-wrap: nowrap;
    min-width: 0;
}

.nav-logo {
    flex-shrink: 0;
}

.nav-logo .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    line-height: 0;
}

.nav-logo-img {
    height: 36px;
    width: auto;
    max-width: 148px;
    min-width: 80px;
    object-fit: contain;
    object-position: left center;
}

html[dir="rtl"] .nav-logo-img {
    object-position: right center;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    flex-wrap: nowrap;
    min-width: 0;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: relative;
    padding: 5px 0;
    outline: none;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-color);
    transform: translateY(-2px);
}

.nav-link:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
    border-radius: 4px;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-gradient);
    transition: width 0.3s ease;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 5px;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--text-secondary);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 3px;
}

/* --- Theme Switch (Static Button) --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 50px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.theme-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 1.3rem;
    position: relative;
}

.theme-toggle-btn:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.theme-toggle-btn .sun-icon,
.theme-toggle-btn .moon-icon {
    transition: all 0.3s ease;
    position: absolute;
}

/* In dark mode: show sun icon (to switch to light) */
.dark-mode .theme-toggle-btn .sun-icon {
    display: block;
    opacity: 1;
}

.dark-mode .theme-toggle-btn .moon-icon {
    display: none;
    opacity: 0;
}

/* In light mode: show moon icon (to switch to dark) */
body:not(.dark-mode) .theme-toggle-btn .sun-icon {
    display: none;
    opacity: 0;
}

body:not(.dark-mode) .theme-toggle-btn .moon-icon {
    display: block;
    opacity: 1;
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: var(--bg-hero);
    position: relative;
    overflow: hidden;
}

/* Canvas + shapes are out-of-flow so they never steal flex space or center content */
#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    display: block;
}

.hero-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(100px, 12vw, 140px) clamp(20px, 4vw, 40px) 60px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: clamp(30px, 5vw, 60px);
    box-sizing: border-box;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
    /* Stagger handled by .hero-reveal-item after preloader */
    animation: none;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    align-self: start;
    text-align: start;
}

.role-scroller {
    height: 1.5em;
    /* Exactly one line of text */
    overflow: hidden;
    display: inline-flex;
    align-items: flex-start;
    vertical-align: bottom;
    padding-right: 5px;
    /* Prevent gradient clipping */
}

.role-list {
    display: flex;
    flex-direction: column;
    will-change: transform;
    transform: translateY(0);
    transition: transform var(--role-scroll-duration, 0.55s) var(--motion-ease);
}

.role-text {
    height: 1.5em;
    line-height: 1.5em;
    white-space: nowrap;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    text-shadow: 0 4px 15px rgba(59, 130, 246, 0.15);
    /* Subtle premium glow */

    /* Fade effect — duration matches JS role-list transform */
    opacity: 0;
    filter: blur(4px);
    transition:
        opacity var(--role-scroll-duration, 0.55s) var(--motion-ease),
        filter var(--role-scroll-duration, 0.55s) var(--motion-ease);
}

.role-text.active-role {
    opacity: 1;
    filter: blur(0px);
}

.hero-description {
    font-size: clamp(1rem, 2vw, 1.1rem);
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
    max-width: 500px;
}

.hero-contact .contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.hero-contact .contact-item i {
    color: var(--accent-color);
    width: 20px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 20px;
    justify-content: start;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--accent-gradient);
    color: white;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 18px;
    position: relative;
    overflow: hidden;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.social-link:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.cv-download-btn {
    display: inline-flex;
    align-items: center;
    align-self: start;
    gap: 10px;
    padding: 12px 30px;
    background: var(--accent-gradient);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.cv-download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.cv-download-btn i {
    font-size: 1.1rem;
}

.hero-image {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.hero-content {
    flex: 1 1 0;
    min-width: 0;
    max-width: min(100%, 640px);
    text-align: start;
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 1;
    margin-inline-end: auto;
}

/* Post-preloader stagger inside hero copy (works with AOS on parent; LTR/RTL safe — vertical only) */
.hero-content .hero-reveal-item {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
    filter: blur(6px);
    transition:
        opacity var(--motion-duration) var(--motion-ease),
        transform var(--motion-duration) var(--motion-ease),
        filter calc(var(--motion-duration) * 0.85) ease;
    transition-delay: calc(var(--hero-reveal-index, 0) * var(--motion-stagger) + var(--hero-reveal-base, 100ms));
}

body.page-loaded .hero-content .hero-reveal-item {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
    .hero-content .hero-reveal-item {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }
}

/* Skills layout hard rules */
@media (min-width: 768px) and (max-width: 1024px) {
    .skill-category-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skill-items-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (max-width: 767px) {
    .skill-category-container {
        grid-template-columns: 1fr;
    }

    .skill-items-grid--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skill-items-grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .skill-items-grid--orphans {
        max-width: none;
    }

    .skill-orphan-row {
        margin-top: 8px;
    }
}

.hero-glow {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: var(--accent-gradient);
    opacity: 0.15;
    filter: blur(20px);
    z-index: 0;
    pointer-events: none;
    animation: gradient-text 5s linear infinite;
    background-size: 200% auto;
}

.hero-text,
.hero-name-wrapper,
.hero-content-wrapper {
    width: 100%;
    text-align: start;
    margin-left: 0;
    margin-right: 0;
}

/* Stack hero copy + CV in one column so the CV aligns to the same inline edge as social links (LTR/RTL) */
.hero-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.profile-container {
    position: relative;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 20px 40px var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    border: 5px solid var(--bg-primary);
}

.profile-container:hover {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 30px 60px var(--shadow-color);
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(29, 78, 216, 0.1) 100%);
    border-radius: 50%;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
    text-decoration: none;
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    border: 2px solid var(--accent-color);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

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

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.decorative-shape {
    position: absolute;
    border-radius: 50%;
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradient-text 6s linear infinite, float 12s ease-in-out infinite;
    z-index: 0;
    opacity: 0.1;
    will-change: transform;
    pointer-events: none;
}

/* Left glow sits behind the copy column (out of flow; does not push layout) */
.shape-1 {
    width: min(420px, 55vw);
    height: min(420px, 55vw);
    top: 18%;
    left: -12%;
}

.shape-2 {
    width: 300px;
    height: 300px;
    bottom: 15%;
    right: 10%;
    animation-delay: 3s;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-30px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* --- General Section Styles --- */
section {
    padding: clamp(50px, 8vw, 90px) 0;
    transition: background 0.3s ease;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

section:last-of-type {
    border-bottom: none;
}

.section-title {
    text-align: center;
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    /* Padding reserves space for ::after inside the box so following content never overlaps the bar */
    padding-bottom: 1.75rem;
    margin-bottom: clamp(2.75rem, 5vw, 4rem);
    color: var(--text-primary);
    position: relative;
    transition: all 0.3s ease;
    line-height: 1.2;
}

.section-title:hover {
    transform: scale(1.02);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0.65rem;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    transition: width 0.3s ease;
}

.section-title:hover::after {
    width: 100px;
}

.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    /* Tighten gap to subtitle without negative margin (avoids overlap with title padding/bar) */
    margin: 0 auto 3.5rem auto;
}

.section-title-sub {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--text-primary);
    text-align: center;
}

/* --- About Section --- */
.about {
    background: var(--bg-secondary);
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 60px;
    align-items: start;
}

.about-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.8;
    max-width: 65ch;
}

.platform-links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid var(--border-color);
}

.platform-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: relative;
    overflow: hidden;
}

.platform-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.platform-link:hover::before {
    width: 300px;
    height: 300px;
}

.platform-link:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.platform-link i {
    font-size: 1.1rem;
}

.platform-link span {
    font-size: 0.9rem;
}

.education-card {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.education-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.05), transparent);
    transition: left 0.5s;
}

.education-card:hover::before {
    left: 100%;
}

.education-card:hover {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 25px 50px rgba(59, 130, 246, 0.2);
    border-color: var(--accent-color);
}

.education-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.education-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.education-item p {
    color: var(--text-secondary);
    margin-bottom: 5px;
}

/* --- Experience Section (REFINED) --- */
.experience {
    background: var(--bg-primary);
}

.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--border-color);
}

.timeline-progress {
    position: absolute;
    left: 15px;
    top: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent-color), var(--accent-gradient-darker));
    height: 0;
    transition: height 0.3s ease-out;
}

.timeline-item {
    margin-bottom: 40px;
    position: relative;
    padding-left: 50px;
}

.timeline-content {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: relative;
    border: 1px solid var(--border-color);
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 28px;
    left: -43px;
    width: 25px;
    height: 25px;
    background: var(--bg-secondary);
    border-radius: 50%;
    border: 4px solid var(--border-color);
    transition: all 0.3s ease;
}

.timeline-item.in-view .timeline-content::before {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.timeline-content:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 0 25px 50px rgba(59, 130, 246, 0.25);
    border-color: var(--accent-color);
}

.timeline-header {
    margin-bottom: 15px;
}

.timeline-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.company {
    display: block;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.period {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.timeline-body-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    align-items: start;
    margin-top: 15px;
}

.timeline-text-content {
    flex: 1;
}

.timeline-details {
    list-style: none;
    margin: 15px 0;
}

.timeline-details li {
    margin-bottom: 10px;
    color: var(--text-secondary);
    position: relative;
    padding-left: 20px;
}

.timeline-details li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.tech-tag {
    background: var(--accent-gradient);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.tech-tag::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.tech-tag:hover::before {
    width: 200px;
    height: 200px;
}

.tech-tag:hover {
    transform: translateY(-3px) scale(1.1) rotate(2deg);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.4);
}

.tech-tag:active {
    transform: translateY(-1px) scale(1.05);
}

.certificate-image {
    width: 220px;
    height: 160px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--card-shadow);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.certificate-image:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.certificate-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Projects Section --- */
.projects {
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.project-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(var(--glass-blur-strong));
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.dark-mode .project-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.project-card:hover {
    transform: translateY(-12px) perspective(1000px) rotateX(2deg) rotateY(-2deg);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.2);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.2), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.project-card:hover::before {
    opacity: 1;
}

.project-preview-card {
    background: rgba(var(--bg-primary-rgb), 0.7);
    backdrop-filter: blur(var(--glass-blur-soft));
    -webkit-backdrop-filter: blur(var(--glass-blur-soft));
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px var(--card-shadow);
    transition:
        opacity 0.4s var(--motion-ease),
        transform 0.45s var(--motion-ease),
        box-shadow 0.4s var(--motion-ease),
        border-color 0.35s ease,
        filter 0.35s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.project-preview-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px var(--shadow-color);
    border-color: var(--accent-color);
}

.project-preview-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.project-preview-content {
    padding: 20px;
}

.project-preview-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.project-preview-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.project-preview-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

.project-preview-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 6px;
}

.project-preview-link:hover {
    background: var(--accent-gradient);
    color: white;
    transform: translateY(-2px);
}

.project-preview-link i {
    font-size: 0.9rem;
}

.project-preview-type {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.project-preview-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.project-preview-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.project-preview-btn:hover::before {
    width: 300px;
    height: 300px;
}

.project-preview-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.project-preview-btn:active {
    transform: translateY(-1px) scale(1);
}

.project-preview-btn i {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.project-preview-btn:hover i {
    transform: translateX(3px);
}

/* Animation classes for filtering (timing aligned with script.js filter) */
.project-preview-card.fade-out {
    opacity: 0;
    transform: scale(0.97) translate3d(0, 12px, 0);
    filter: blur(2px);
    pointer-events: none;
}

.project-preview-card.hidden {
    display: none;
}

.project-preview-card.fade-in {
    opacity: 1;
    transform: scale(1) translate3d(0, 0, 0);
    filter: blur(0);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(var(--glass-blur-strong));
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease),
        visibility 0s linear var(--motion-duration-fast);
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease),
        visibility 0s linear 0s;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 24px;
    max-width: 900px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    animation: none;
    transform-origin: center center;
    margin: 20px auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.96);
    filter: blur(0);
    transition:
        opacity var(--motion-duration) var(--motion-ease),
        transform var(--motion-duration) var(--motion-ease),
        filter var(--motion-duration-fast) ease;
}

.modal-overlay.active .modal-content.modal-panel--open {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.modal-overlay.active .modal-content.modal-panel--closing {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.98);
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease),
        transform var(--motion-duration-fast) var(--motion-ease);
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 10px;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.modal-content::before {
    content: '';
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradient-text 3s linear infinite;
    z-index: 1;
    display: block;
}

@keyframes modalFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(50px) rotateX(10deg);
        filter: blur(10px);
    }

    50% {
        transform: scale(1.02) translateY(-5px) rotateX(-2deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
        filter: blur(0px);
    }
}

@keyframes modalFadeOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
        filter: blur(0px);
    }

    100% {
        opacity: 0;
        transform: scale(0.8) translateY(30px) rotateX(5deg);
        filter: blur(5px);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    line-height: 1;
    font-weight: 300;
}

.modal-close:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.modal-close::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.modal-close:hover::before {
    width: 60px;
    height: 60px;
}

.modal-body {
    padding: 50px 40px 40px;
    animation: modalContentFadeIn 0.45s var(--motion-ease) 0.08s both;
}

@keyframes modalContentFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.modal-header {
    margin-bottom: 30px;
    animation: modalHeaderSlideIn 0.5s ease 0.3s both;
}

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

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

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.modal-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    transition: transform 0.3s ease;
}

.modal-title:hover {
    transform: scale(1.02);
}

.modal-header .modal-links {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.modal-type {
    display: inline-block;
    background: var(--accent-gradient);
    color: white;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    transition: all 0.3s ease;
}

.modal-type:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.modal-description {
    color: var(--text-secondary);
    line-height: 1.9;
    margin-bottom: 25px;
    font-size: 1.05rem;
    animation: modalContentFadeIn 0.6s ease 0.4s both;
}

.modal-details {
    list-style: none;
    margin-bottom: 25px;
    animation: modalContentFadeIn 0.6s ease 0.5s both;
}

.modal-details li {
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-left: 28px;
    position: relative;
    line-height: 1.7;
    transition: all 0.3s ease;
    animation: modalListItemFadeIn 0.5s ease both;
}

.modal-details li:nth-child(1) {
    animation-delay: 0.6s;
}

.modal-details li:nth-child(2) {
    animation-delay: 0.7s;
}

.modal-details li:nth-child(3) {
    animation-delay: 0.8s;
}

.modal-details li:nth-child(4) {
    animation-delay: 0.9s;
}

.modal-details li:nth-child(5) {
    animation-delay: 1.0s;
}

.modal-details li:nth-child(6) {
    animation-delay: 1.1s;
}

.modal-details li:nth-child(n+7) {
    animation-delay: 1.2s;
}

@keyframes modalListItemFadeIn {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }

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

.modal-details li:hover {
    color: var(--text-primary);
    transform: translateX(5px);
}

.modal-details li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.modal-details li:hover::before {
    transform: translateX(3px) scale(1.2);
    color: var(--accent-gradient);
}

.modal-links {
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    animation: modalContentFadeIn 0.6s ease 0.6s both;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    animation: modalContentFadeIn 0.6s ease 0.7s both;
}

.modal-media {
    margin-top: 25px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--border-color);
    transition: all 0.4s ease;
    animation: modalContentFadeIn 0.6s ease 0.8s both;
    position: relative;
}

.modal-media::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.6s;
}

.modal-media:hover::before {
    left: 100%;
}

.modal-media:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.3);
    border-color: var(--accent-color);
}

.modal-media img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

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

.modal-media-pdf {
    min-height: 70vh;
}

.certificate-pdf-frame {
    width: 100%;
    min-height: 70vh;
    border: 0;
    display: block;
    background: var(--bg-secondary, #f5f5f5);
}

.certificate-pdf-fallback {
    text-align: center;
    padding: 12px;
    margin: 0;
    font-size: 0.95rem;
}

.certificate-pdf-fallback a {
    color: var(--accent-color);
}

/* Image Modal Styles */
.image-modal-content {
    background: var(--bg-primary);
    border-radius: 24px;
    max-width: 90vw;
    max-height: calc(100vh - 40px);
    width: auto;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    animation: none;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 20px auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.96);
    transition:
        opacity var(--motion-duration) var(--motion-ease),
        transform var(--motion-duration) var(--motion-ease);
}

.modal-overlay.active .image-modal-content.modal-panel--open {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}

.modal-overlay.active .image-modal-content.modal-panel--closing {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.98);
    transition:
        opacity var(--motion-duration-fast) var(--motion-ease),
        transform var(--motion-duration-fast) var(--motion-ease);
}

.image-modal-content::-webkit-scrollbar {
    width: 8px;
}

.image-modal-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

.image-modal-content::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 10px;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.image-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.image-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradient-text 3s linear infinite;
    z-index: 1;
}

.image-modal-header {
    padding: 25px 35px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    animation: modalHeaderSlideIn 0.5s ease 0.3s both;
}

.image-modal-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.image-modal-content .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(var(--glass-blur-soft));
}

.image-modal-content .modal-close:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.image-modal-image-container {
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: calc(90vh - 120px);
    overflow: auto;
    animation: modalContentFadeIn 0.6s ease 0.4s both;
    background: var(--bg-secondary);
}

.image-modal-image-container img {
    max-width: 100%;
    max-height: calc(90vh - 120px);
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
    border: 2px solid var(--border-color);
}

.image-modal-image-container img:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 50px rgba(59, 130, 246, 0.3);
    border-color: var(--accent-color);
}

.project-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.dark-mode .project-header {
    color: white;
}

.showcase-icon {
    width: 60px;
    height: 60px;
    background: var(--accent-gradient);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: all 0.3s ease;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.project-card:hover .showcase-icon {
    transform: scale(1.1) rotate(-5deg);
}

.showcase-title h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.project-type {
    background: var(--accent-color);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.project-content {
    padding: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1;
}

.project-links {
    margin-bottom: 20px;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    margin-right: 15px;
    padding: 10px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: relative;
    overflow: visible;
}

.project-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-gradient);
    border-radius: 25px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.project-link:hover::before {
    opacity: 1;
}

.project-link i,
.project-link {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.project-link:hover {
    text-decoration: none;
    color: white !important;
    border-color: transparent;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.project-link:hover i {
    transform: translateX(3px) rotate(5deg);
    color: rgb(255, 255, 255) !important;
}

.project-link:hover {
    color: rgb(255, 255, 255);
}

.project-link:active {
    transform: translateY(-1px) scale(1.02);
}

.presentation-container,
.video-container {
    margin-top: 20px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 16px var(--card-shadow);
    transition: all 0.3s ease;
}

.presentation-container:hover,
.video-container:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Skills Section (Redesigned) --- */
.skills {
    background: var(--bg-primary);
}

.skills-grid {
    display: flex;
    flex-direction: row;
    gap: 25px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}

.skills-grid .skill-category {
    flex: 1;
    min-width: 0;
    max-width: none;
    width: 100%;
}

.skill-category {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    min-width: 0;
}

.skill-category:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px var(--card-shadow);
}

.skill-category-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--text-primary);
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.skill-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    align-items: stretch;
    justify-items: stretch;
    justify-content: start;
    width: 100%;
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 10px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    cursor: pointer;
    width: 100%;
    min-width: 0;
    min-height: 100px;
    aspect-ratio: 1;
    box-sizing: border-box;
    outline: none;
    position: relative;
    overflow: hidden;
}

.skill-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.skill-item:hover::before {
    width: 200px;
    height: 200px;
}

.skill-item:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.skill-item:hover {
    transform: translateY(-8px) scale(1.05) rotate(2deg);
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.4);
}

.skill-item:active {
    transform: translateY(-3px) scale(1.02);
}

.skill-item:hover .skill-name {
    color: var(--text-primary);
}

.dark-mode .skill-item:hover .skill-name {
    color: white;
}

.skill-item:hover .skill-icon {
    color: white;
}

.skill-item:hover .skill-logo {
    filter: brightness(0) invert(1);
}

.skill-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
}

.skill-icon {
    font-size: 2rem;
    color: var(--accent-color);
    transition: all 0.3s ease;
}

.skill-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
}

.skill-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.3;
    transition: all 0.3s ease;
    word-wrap: break-word;
    width: 100%;
}


/* =========================================
   SECTION STYLES: Services, Certs, Contact, Footer, Utilities
   ========================================= */

/* --- Services Section --- */
.services {
    background: var(--bg-secondary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background: rgba(var(--bg-primary-rgb), 0.7);
    backdrop-filter: blur(var(--glass-blur-soft));
    -webkit-backdrop-filter: blur(var(--glass-blur-soft));
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 10px 30px var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px var(--shadow-color);
    border-color: var(--accent-color);
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.service-card:hover::before {
    opacity: 0.04;
}

.service-card > * {
    position: relative;
    z-index: 1;
}

.service-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.1);
    transition: all 0.4s ease;
}

.service-card:hover .service-icon-wrapper {
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 10px 20px var(--shadow-color);
}

.service-icon {
    font-size: 1.8rem;
    color: var(--accent-color);
    transition: all 0.4s ease;
}

.service-card:hover .service-icon {
    color: white;
}

/* Touch devices: prevent sticky hover/transform hijacking scroll */
@media (hover: none) and (pointer: coarse) {
    .service-card {
        transform: none !important;
    }

    .service-card:hover {
        transform: none !important;
        box-shadow: 0 10px 30px var(--card-shadow) !important;
        border-color: var(--border-color) !important;
    }

    .service-card::before,
    .service-card:hover::before {
        opacity: 0.02 !important;
    }

    .service-icon-wrapper,
    .service-card:hover .service-icon-wrapper {
        background: var(--bg-secondary) !important;
        border-color: rgba(59, 130, 246, 0.2) !important;
        box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.1) !important;
    }

    .service-icon,
    .service-card:hover .service-icon {
        color: var(--accent-color) !important;
    }

    .service-cta-btn {
        touch-action: manipulation;
    }
}

.service-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.service-subtitle {
    font-size: 0.95rem;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.5;
}

.service-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-list li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.service-list li i {
    color: var(--accent-color);
    font-size: 0.8rem;
    margin-top: 6px;
    flex-shrink: 0;
}

/* --- Certificates Section --- */
.certificates {
    background: var(--bg-primary);
}

.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.certificate-preview-card {
    background: var(--bg-primary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 20px var(--card-shadow);
    transition: transform 0.28s ease, opacity 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    opacity: 0;
    transform: translateY(12px);
}

.certificate-preview-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.certificate-preview-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.certificate-preview-card:hover::after {
    opacity: 0.04;
}

.certificate-preview-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px var(--shadow-color);
    border-color: var(--accent-color);
}

.certificate-preview-content {
    position: relative;
    z-index: 1;
}

.certificate-preview-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--bg-secondary);
    display: block;
}

.certificate-preview-content {
    padding: 20px;
}

.certificate-preview-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.certificate-preview-issuer {
    display: block;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.certificate-preview-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.certificate-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}

.certificate-preview-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-color);
}

/* --- Contact Section --- */
.contact {
    background: var(--bg-secondary);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 60px;
    align-items: start;
}

.contact-info {
    background: var(--bg-primary);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--card-shadow);
    border: 1px solid var(--border-color);
}

.contact-info .contact-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.contact-info .contact-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.contact-info .contact-item i {
    font-size: 1.8rem;
    color: var(--accent-color);
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.contact-info .contact-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.contact-info .contact-item p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.social-links-contact {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.social-links-contact .social-link {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
}

.contact-form {
    background: var(--bg-primary);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--card-shadow);
    border: 1px solid var(--border-color);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

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

.form-row input,
.form-row textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--form-border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
    background: var(--form-bg);
    color: var(--text-primary);
    box-sizing: border-box;
}

.form-row input::placeholder,
.form-row textarea::placeholder {
    color: var(--text-secondary);
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: var(--bg-primary);
}

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

.form-actions {
    margin-top: 10px;
}

.form-actions button,
.submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    outline: none;
}

.form-actions button:hover,
.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px var(--shadow-color);
}

.form-actions button:focus-visible,
.submit-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.form-actions button:disabled,
.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* --- Footer --- */
.footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 60px 0 20px 0;
}

.footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-logo {
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    margin-bottom: 15px;
    display: inline-block;
}

.footer-about p {
    max-width: 300px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.footer-links h3,
.footer-social h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}

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

.footer-links ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 10px;
    display: inline-block;
    transition: all 0.3s ease;
}

.footer-links ul li a:hover {
    color: var(--accent-color);
    transform: translateX(5px);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* --- Shine Effect --- */
.social-link::before,
.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.social-link:hover::before,
.submit-btn:hover::before {
    left: 100%;
}

/* --- Toast Notification --- */
#toast {
    visibility: hidden;
    min-width: 280px;
    max-width: 90%;
    /* No default success color — only .success / .error set background (avoids red→green flash when .error is removed on hide) */
    background: rgba(45, 45, 52, 0.95);
    color: #ffffff;
    text-align: center;
    border-radius: 16px;
    padding: 18px 24px;
    position: fixed;
    z-index: 1001;
    right: 30px;
    bottom: 30px;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.6;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(100px) scale(0.8);
    border: 2px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(var(--glass-blur-soft));
    -webkit-backdrop-filter: blur(var(--glass-blur-soft));
    overflow: hidden;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .navbar,
    .project-card,
    .project-preview-card,
    .service-card,
    .modal-overlay,
    #toast {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

@media (max-width: 768px) {
    .project-card,
    .project-preview-card,
    .service-card,
    .modal-overlay,
    #toast {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* =========================================
   SKILLS FINAL OVERRIDES (LOCKED LAYOUT)
   ========================================= */
#skills .skill-item {
    min-height: 98px !important;
    aspect-ratio: auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 12px 10px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(148, 163, 184, 0.28) !important;
    background: linear-gradient(180deg, rgba(31, 41, 55, 0.95), rgba(17, 24, 39, 0.95)) !important;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease, background 0.28s ease !important;
}

#skills .skill-item:hover {
    transform: translateY(-6px) scale(1.03) !important;
    border-color: rgba(96, 165, 250, 0.9) !important;
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.32) !important;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.22), rgba(30, 41, 59, 0.95)) !important;
}

#skills .skill-icon-wrapper {
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
}

#skills .skill-logo {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    transition: transform 0.28s ease, filter 0.28s ease !important;
}

#skills .skill-icon {
    font-size: 1.6rem !important;
    color: #60a5fa !important;
    transition: transform 0.28s ease, color 0.28s ease, filter 0.28s ease !important;
}

#skills .skill-name {
    font-size: clamp(10px, 1.15vw, 11px) !important;
    line-height: 1.2 !important;
    color: #93c5fd !important;
    text-align: center !important;
    -webkit-line-clamp: 1 !important;
    line-clamp: 1 !important;
    transition: color 0.28s ease !important;
}

#skills .skill-item:hover .skill-name {
    color: #ffffff !important;
}

#skills .skill-item:hover .skill-icon {
    color: #ffffff !important;
    transform: scale(1.14) rotate(-3deg) !important;
    filter: drop-shadow(0 3px 10px rgba(96, 165, 250, 0.55)) !important;
}

#skills .skill-item:hover .skill-logo {
    transform: scale(1.1) !important;
    filter: brightness(1.15) saturate(1.12) !important;
}

#skills .skill-items-grid--2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
}

#skills .skill-items-grid--3 {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
}

@media (max-width: 768px) {
    #skills .skill-items-grid--2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    #skills .skill-items-grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

#toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

#toast.show::before {
    animation: toastProgress 4s linear forwards;
}

@keyframes toastProgress {
    to { transform: scaleX(1); }
}

#toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: toastBounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toastBounceIn {
    0% { opacity: 0; transform: translateY(100px) scale(0.5) rotate(-5deg); }
    50% { transform: translateY(-10px) scale(1.05) rotate(2deg); }
    100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

#toast.success {
    background: var(--toast-success-bg);
    color: #ffffff;
    box-shadow: 0 15px 40px rgba(34, 197, 94, 0.4);
}

#toast.error {
    background: var(--toast-error-bg);
    color: #ffffff;
    box-shadow: 0 15px 40px rgba(239, 68, 68, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* --- Scroll To Top --- */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, 16px, 0) scale(0.92);
    transition:
        opacity var(--motion-duration) var(--motion-ease),
        visibility 0s linear var(--motion-duration),
        transform var(--motion-duration) var(--motion-ease);
    z-index: 1000;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: 200% auto;
    animation: gradient-text 4s linear infinite;
    pointer-events: none;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1);
    pointer-events: auto;
    transition:
        opacity var(--motion-duration) var(--motion-ease),
        visibility 0s linear 0s,
        transform var(--motion-duration) var(--motion-ease);
}

.scroll-to-top:hover {
    transform: scale(1.2) rotate(360deg);
    box-shadow: 0 10px 25px var(--shadow-color);
}

/* Project Tabs (Apple-style Segmented Control) */
.project-tabs-container {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.project-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 6px;
    gap: 4px;
    border: 1px solid var(--border-color);
    position: relative;
}

/* Sliding pill: positioned via JS; keep behind tab labels */
.project-tab-indicator {
    position: absolute;
    top: 6px;
    left: 6px;
    height: calc(100% - 12px);
    border-radius: 12px;
    z-index: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.68, -0.55, 0.27, 1.55), width 0.35s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    visibility: hidden;
}

.project-tab {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: relative;
    z-index: 1;
    white-space: nowrap;
}

.project-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px var(--shadow-color);
    background-size: 200% auto;
    animation: gradient-text 4s linear infinite;
}

.project-tab:hover:not(.active) {
    background: var(--bg-primary);
    color: var(--accent-color);
}

.projects-grid-wrapper {
    width: 100%;
    position: relative;
}

.projects-empty-state {
    text-align: center;
    padding: 48px 24px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.05rem;
    font-weight: 500;
}

.projects-empty-state.hidden {
    display: none;
}

.project-preview-thumb {
    position: relative;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
}

.project-preview-thumb .project-preview-image {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.project-preview-thumb .project-preview-fallback {
    display: none;
}

.project-preview-thumb:has(.project-preview-image.is-broken) .project-preview-fallback {
    display: flex;
}

.project-preview-thumb:has(.project-preview-image.is-broken) .project-preview-image {
    display: none;
}

.project-preview-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid var(--border-color);
    color: var(--accent-color);
    font-size: clamp(2.5rem, 8vw, 3.5rem);
}

.project-modal-placeholder {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.45), rgba(15, 23, 42, 0.85));
    border-radius: 16px;
    font-size: clamp(3rem, 10vw, 4rem);
    color: var(--accent-color);
}

/* =========================================
   CUSTOM SCROLLBAR (Theme-matched)
   ========================================= */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3b82f6, #818cf8);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2563eb, #6d28d9);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 var(--bg-secondary);
}

/* =========================================
   SERVICE CTA BUTTON
   ========================================= */
.service-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 25px;
    padding: 12px 24px;
    margin-top: 25px;
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    align-self: flex-start;
    letter-spacing: 0.02em;
}

.service-cta-btn i {
    transition: transform 0.3s ease;
}

.service-cta-btn:hover {
    background: var(--accent-gradient);
    background-size: 200% auto;
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.service-cta-btn:hover i {
    transform: translateX(4px);
}

/* Service card must be full-height flex column for CTA to push to bottom */
.service-card {
    display: flex;
    flex-direction: column;
}

/* =========================================
   SKILLS 2×2 GRID (4 categories, even layout)
   ========================================= */
.skill-category-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    width: 100%;
    min-width: 0;
}

.skills-grid {
    display: block;
}

/* =========================================
   PROJECTS GRID — Dynamic, No Empty Gaps
   ========================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
    min-height: 200px;
}

/* Override: when 2 cards visible, keep them balanced */
.projects-grid:has(.project-preview-card:not(.hidden):nth-child(2):last-child),
.projects-grid:has(.project-preview-card:not(.hidden):nth-child(1):last-child) {
    grid-template-columns: repeat(2, minmax(300px, 560px));
    justify-content: center;
}

/* Hidden base state (used by JS filter) */
.project-preview-card.hidden {
    display: none;
}

/* =========================================
   CERTIFICATES — PDF Preview Fallback
   ========================================= */
.certificate-pdf-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(129, 140, 248, 0.12));
    border-bottom: 1px solid var(--border-color);
    color: var(--accent-color);
    font-size: 2.5rem;
}

.certificate-pdf-placeholder span {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.certificate-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.certificate-thumb .certificate-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.certificate-image-fallback {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.9));
    color: var(--accent-color);
    font-size: 2.25rem;
}

.certificate-image-fallback span {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.certificate-thumb:has(.certificate-preview-image.is-broken) .certificate-image-fallback {
    display: flex;
}

.certificate-thumb:has(.certificate-preview-image.is-broken) .certificate-preview-image {
    display: none;
}

.certificate-modal-thumb {
    position: relative;
    width: 100%;
    min-height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.certificate-modal-img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 70vh;
    object-fit: contain;
}

.certificate-modal-fallback {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    text-align: center;
    color: var(--accent-color);
    font-size: 3rem;
}

.certificate-modal-fallback span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 320px;
}

.certificate-modal-thumb:has(.certificate-modal-img.is-broken) .certificate-modal-fallback {
    display: flex;
}

.certificate-modal-thumb:has(.certificate-modal-img.is-broken) .certificate-modal-img {
    display: none;
}

/* =========================================
   CERTIFICATES SECTION — Mobile Typography
   ========================================= */
.certificate-preview-title {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 6px;
}

.certificate-preview-issuer {
    font-size: clamp(0.78rem, 2vw, 0.85rem);
}

.certificate-preview-description {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    line-height: 1.55;
}

/* =========================================
   RESPONSIVE DESIGN (Media Queries)
   ========================================= */

@media (max-width: 1200px) {
    .skill-category-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {

    /* Navigation - Dark solid background on mobile */
    .navbar {
        background: var(--bg-primary) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 2px 20px var(--shadow-color);
    }

    .navbar.scrolled {
        background: var(--bg-primary) !important;
    }

    .nav-container {
        /* Menu is position:fixed — only logo + .nav-right remain in flex; space-between was pinning logo to the far edge */
        justify-content: flex-start;
        padding: 0 14px;
        gap: 12px;
    }

    .nav-right {
        margin-inline-start: auto;
        gap: 12px;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--bg-primary);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px var(--card-shadow);
        padding: 20px 0;
        height: calc(100vh - 70px);
        overflow-y: auto;
        /* Prevent overflow on small landscape screens */
        border-top: 1px solid var(--border-color);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 10px 0;
    }

    .nav-link {
        padding: 10px 20px;
        display: block;
    }

    .hamburger {
        display: flex;
    }

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

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    /* Container padding */
    .container {
        padding: 0 15px;
    }

    /* Hero Section - Mobile Layout: Name → Image → Title */
    .hero {
        min-height: auto;
        padding: 0;
        align-items: flex-start;
    }

    .hero-container {
        display: flex;
        flex-direction: column;
        text-align: center;
        gap: 0;
        padding: 100px 15px 60px;
        align-items: center;
    }

    .hero-content {
        display: contents;
    }

    .hero-text {
        display: contents;
    }

    .hero-name-wrapper {
        order: 1;
        margin-bottom: 20px;
        width: 100%;
        text-align: center;
    }

    .hero-image {
        order: 2;
        width: 100%;
        display: flex;
        justify-content: center;
        margin: 20px 0;
    }

    .hero-content-wrapper {
        order: 3;
        width: 100%;
        margin-top: 20px;
        text-align: center;
    }

    .hero-title {
        /* Inherits fluid typography clamp rules */
        line-height: 1.2;
        word-wrap: break-word;
        margin-bottom: 0px;
    }

    .hero-subtitle {
        /* Inherits fluid typography clamp rules */
        line-height: 1.4;
        margin-top: 0;
        margin-bottom: 20px;
        align-self: center;
        justify-content: center;
        margin-inline: auto;
        text-align: center;
    }

    .hero-subtitle .role-scroller {
        margin-inline: auto;
    }

    .hero-description {
        margin-left: auto;
        margin-right: auto;
        /* Inherits fluid typography clamp rules */
        line-height: 1.6;
        max-width: 100%;
        padding: 0 10px;
    }

    .hero-contact {
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
    }

    .hero-contact .contact-item {
        justify-content: center;
        font-size: 0.9rem;
    }

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

    .profile-container {
        width: 250px;
        height: 250px;
        margin: 0 auto;
    }

    .cv-download-btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
        margin: 0 auto;
        align-self: center;
    }

    .decorative-shape {
        display: none;
    }

    /* About Section */
    .about-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .about-text p {
        font-size: 1rem;
        line-height: 1.7;
        word-wrap: break-word;
    }

    .education-card {
        padding: 20px;
        margin: 0;
    }

    .education-card h3 {
        font-size: 1.2rem;
    }

    .education-item h4 {
        font-size: 1rem;
        word-wrap: break-word;
    }

    .education-item p {
        font-size: 0.9rem;
    }

    /* Experience Section */
    .timeline {
        padding: 0;
    }

    .timeline-item {
        padding-left: 40px;
        margin-bottom: 30px;
    }

    .timeline-content {
        padding: 20px;
        margin: 0;
        overflow: hidden;
    }

    .timeline-content::before {
        left: -33px;
        width: 20px;
        height: 20px;
    }

    .timeline-header h3 {
        font-size: 1.2rem;
        line-height: 1.3;
        word-wrap: break-word;
    }

    .company {
        font-size: 1rem;
        display: block;
        word-wrap: break-word;
    }

    .period {
        font-size: 0.85rem;
        padding: 3px 10px;
        display: inline-block;
        margin-top: 5px;
    }

    .timeline-details {
        margin: 10px 0;
        padding: 0;
    }

    .timeline-details li {
        font-size: 0.9rem;
        margin-bottom: 8px;
        line-height: 1.5;
        word-wrap: break-word;
        padding-left: 20px;
    }

    .tech-stack {
        gap: 6px;
        margin-top: 10px;
        flex-wrap: wrap;
    }

    .tech-tag {
        font-size: 0.75rem;
        padding: 5px 12px;
        white-space: nowrap;
    }

    .timeline-body-content {
        grid-template-columns: 1fr !important;
        gap: 20px;
        margin-top: 15px;
    }

    .timeline-text-content {
        order: 1;
        width: 100%;
        overflow: hidden;
    }

    .certificate-image {
        order: 2;
        width: 100% !important;
        max-width: 100% !important;
        height: auto;
        min-height: 200px;
        margin: 20px auto 0;
    }

    .certificate-image img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    /* Projects Section */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .project-preview-card {
        margin-bottom: 0;
        overflow: hidden;
    }

    .project-preview-image {
        height: 180px;
        object-fit: cover;
    }

    .project-preview-content {
        padding: 15px;
    }

    .project-preview-title-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .project-preview-title {
        font-size: 1.1rem;
        line-height: 1.3;
        word-wrap: break-word;
    }

    .project-preview-type {
        font-size: 0.7rem;
        padding: 3px 10px;
    }

    .project-preview-links {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Services Section Mobile */
    .services-grid {
        grid-template-columns: 1fr;
    }

    .services-grid:has(.center-card:last-child:nth-child(odd)) .center-card {
        max-width: 100%;
    }

    /* Projects Section Mobile */
    .project-tabs-container {
        padding: 0 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
        justify-content: flex-start;
        mask-image: linear-gradient(to right, black 90%, transparent);
        /* Smooth fade */
    }

    .project-tabs-container::-webkit-scrollbar {
        display: none;
        /* Hide scrollbar Chrome/Safari */
    }

    .project-tabs {
        border-radius: 12px;
        flex-wrap: nowrap;
    }

    .project-tab {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .project-preview-link {
        font-size: 0.8rem;
        padding: 3px 8px;
    }

    .project-preview-description {
        font-size: 0.85rem;
        line-height: 1.5;
        word-wrap: break-word;
    }

    .project-preview-btn {
        font-size: 0.9rem;
        padding: 8px;
    }

    /* Skills Section */
    .skill-category-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .skills-grid {
        padding: 0;
    }

    .skill-category-title {
        font-size: 1.2rem;
        word-wrap: break-word;
    }

    .skill-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }

    .skill-item {
        min-height: 100px;
        padding: 12px;
        width: auto;
        max-width: none;
        box-sizing: border-box;
    }

    .skill-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    .skill-icon {
        font-size: 1.5rem;
    }

    .skill-name {
        font-size: 0.75rem;
        word-wrap: break-word;
        text-align: center;
    }

    .platform-links {
        flex-direction: column;
        gap: 10px;
    }

    .platform-link {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }

    /* Certificates Section */
    .certificates-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .certificate-preview-card {
        overflow: hidden;
    }

    .certificate-preview-image {
        height: 180px;
    }

    .certificate-preview-content {
        padding: 15px;
    }

    .certificate-preview-title {
        font-size: 1.1rem;
        line-height: 1.3;
        word-wrap: break-word;
    }

    .certificate-preview-issuer {
        font-size: 0.8rem;
    }

    .certificate-preview-description {
        font-size: 0.85rem;
        line-height: 1.5;
        word-wrap: break-word;
    }

    /* Contact Section */
    .contact-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .contact-info {
        padding: 25px;
        margin: 0;
    }

    .contact-info .contact-item {
        margin-bottom: 20px;
        padding-bottom: 20px;
        flex-wrap: wrap;
    }

    .contact-info .contact-item i {
        font-size: 1.5rem;
        flex-shrink: 0;
    }

    .contact-info .contact-item h4 {
        font-size: 1rem;
        word-wrap: break-word;
    }

    .contact-info .contact-item p {
        font-size: 0.9rem;
        word-wrap: break-word;
        line-height: 1.5;
    }

    .contact-form {
        padding: 25px;
        margin: 0;
    }

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

    .form-row input,
    .form-row textarea {
        padding: 12px;
        font-size: 0.95rem;
        width: 100%;
        box-sizing: border-box;
    }

    .form-actions {
        margin-top: 10px;
    }

    .form-actions button,
    .submit-btn {
        padding: 12px;
        font-size: 0.95rem;
        width: 100%;
    }

    /* Footer */
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }

    .footer-about p {
        max-width: 100%;
    }

    .footer-links,
    .footer-social {
        text-align: center;
    }

    /* General */
    .section-title {
        font-size: 2.2rem;
        padding: 0 10px 1.5rem;
        margin-bottom: 2.75rem;
        line-height: 1.2;
        word-wrap: break-word;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 2.5rem;
        line-height: 1.5;
        word-wrap: break-word;
        padding: 0 10px;
    }

    section {
        padding: 60px 0;
        overflow-x: hidden;
    }

    /* Modal */
    .modal-body {
        padding: 25px;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .modal-description {
        font-size: 0.9rem;
    }

    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
        top: 15px;
        right: 15px;
    }

    .image-modal-header {
        padding: 15px 20px;
    }

    .image-modal-header h3 {
        font-size: 1.1rem;
    }

    .image-modal-image-container {
        padding: 15px;
    }

    /* Toast */
    #toast {
        right: 15px;
        bottom: 15px;
        left: 15px;
        min-width: auto;
        max-width: calc(100% - 30px);
        font-size: 15px;
        font-weight: 500;
        padding: 14px 16px;
        line-height: 1.4;
    }

    /* Scroll to top */
    .scroll-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 16px;
    }

    [dir="rtl"] .scroll-to-top {
        right: auto;
        left: 20px;
    }
}

@media (max-width: 480px) {

    /* Container */
    .container {
        padding: 0 12px;
    }

    /* Hero Section */
    .hero-container {
        padding: 90px 12px 50px;
        gap: 25px;
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .hero-description {
        font-size: 0.95rem;
        padding: 0 5px;
    }

    .hero-image {
        margin: 15px 0;
    }

    .profile-container {
        width: 200px;
        height: 200px;
    }

    .cv-download-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        width: fit-content;
        max-width: min(82vw, 240px);
        justify-content: center;
        text-align: center;
        line-height: 1.35;
    }

    /* Navigation */
    .nav-container {
        padding: 0 12px 0 14px;
    }

    .nav-logo-img {
        height: 32px;
        max-width: 136px;
        min-width: 88px;
    }

    .theme-toggle-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .hamburger {
        padding: 3px;
    }

    /* Sections */
    .section-title {
        font-size: 1.8rem;
        padding: 0 5px 1.35rem;
        margin-bottom: 2.25rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
        margin-bottom: 2rem;
        padding: 0 5px;
    }

    section {
        padding: 50px 0;
    }

    /* About */
    .about-text p {
        font-size: 0.95rem;
    }

    .education-card {
        padding: 15px;
    }

    /* Experience */
    .timeline-item {
        padding-left: 30px;
    }

    .timeline-content {
        padding: 15px;
    }

    .timeline-content::before {
        left: -25px;
        width: 18px;
        height: 18px;
    }

    .timeline-header h3 {
        font-size: 1.1rem;
    }

    .timeline-details li {
        font-size: 0.85rem;
    }

    .certificate-image {
        min-height: 180px;
    }

    /* Projects */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .project-preview-image {
        height: 160px;
    }

    .project-preview-content {
        padding: 12px;
    }

    .project-preview-title {
        font-size: 1rem;
    }

    .project-preview-description {
        font-size: 0.8rem;
    }

    /* Skills */
    .skill-category {
        padding: 20px 15px;
    }

    .skill-category-title {
        font-size: 1.1rem;
    }

    .skill-item {
        min-height: 90px;
        padding: 10px;
        width: 100%;
    }

    .skill-icon-wrapper {
        width: 35px;
        height: 35px;
    }

    .skill-icon {
        font-size: 1.3rem;
    }

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

    /* Certificates */
    .certificate-preview-image {
        height: 160px;
    }

    .certificate-preview-content {
        padding: 12px;
    }

    /* Contact */
    .contact-info {
        padding: 20px 15px;
    }

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

    .form-row input,
    .form-row textarea {
        padding: 10px;
        font-size: 0.9rem;
    }

    /* Footer */
    .footer {
        padding: 40px 0 15px 0;
    }

    .footer-container {
        gap: 25px;
        margin-bottom: 30px;
        padding: 0 15px;
    }

    .footer-logo {
        font-size: 24px;
    }

    /* Modal */
    .modal-body {
        padding: 20px 15px;
    }

    .modal-title {
        font-size: 1.3rem;
    }

    .modal-close {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    /* Toast */
    #toast {
        right: 10px;
        left: 10px;
        bottom: 10px;
        max-width: calc(100% - 20px);
        font-size: 14px;
        font-weight: 500;
        padding: 12px 14px;
        line-height: 1.4;
    }
}

/* =========================================
   BILINGUAL SYSTEM (Language Switcher)
   ========================================= */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
}

.lang-btn {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', 'Cairo', sans-serif;
}

.lang-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.lang-btn.active {
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradient-text 4s linear infinite;
    color: white;
    border-color: transparent;
}

.lang-divider {
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.4;
    user-select: none;
}

/* =========================================
   ARABIC / RTL SUPPORT
   ========================================= */
[dir="rtl"] {
    font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Navbar follows document dir: LTR = logo start-left; RTL = logo start-right (no forced LTR flex). */
[dir="rtl"] .nav-menu {
    direction: rtl;
    flex-direction: row;
}

[dir="rtl"] .nav-menu li a {
    direction: rtl;
}

[dir="rtl"] .nav-right {
    flex-direction: row;
}

[dir="rtl"] .hero-contact .contact-item i {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .timeline-item {
    padding-left: 0;
    padding-right: 60px;
}

[dir="rtl"] .timeline::before {
    left: auto;
    right: 20px;
}

[dir="rtl"] .timeline-content::before {
    left: auto;
    right: -33px;
}

[dir="rtl"] .modal-details li {
    padding-left: 0;
    padding-right: 24px;
}

[dir="rtl"] .modal-details li::before {
    left: auto;
    right: 0;
    content: '◂';
}

[dir="rtl"] .service-list li {
    direction: rtl;
}

[dir="rtl"] .footer-links ul li a:hover {
    transform: translateX(-5px);
}

[dir="rtl"] .service-cta-btn i {
    transform: scaleX(-1);
}

[dir="rtl"] .service-cta-btn:hover i {
    transform: scaleX(-1) translateX(4px);
}

[dir="rtl"] .project-link:hover i {
    transform: translateX(-3px) rotate(-5deg);
}

[dir="rtl"] .lang-switcher {
    margin-right: 0;
    margin-left: 10px;
    direction: rtl;
}

[dir="rtl"] .nav-container {
    flex-direction: row;
}

[dir="rtl"] .nav-right {
    margin-inline-start: auto;
    margin-inline-end: 0;
}

[dir="rtl"] .timeline-details li {
    padding-left: 0;
    padding-right: 20px;
}

[dir="rtl"] .timeline-details li::before {
    left: auto;
    right: 0;
}

/* =========================================
   READING PROGRESS BAR
   ========================================= */
.reading-progress {
    position: fixed;
    top: 70px;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradient-text 3s linear infinite;
    z-index: 10000;
    will-change: transform;
    transform: scaleX(0);
    transform-origin: left center;
    transition: none;
    border-radius: 0 2px 2px 0;
}

[dir="rtl"] .reading-progress {
    left: auto;
    right: 0;
    border-radius: 2px 0 0 2px;
    transform-origin: right center;
}

[dir="rtl"] .scroll-to-top {
    right: auto;
    left: 30px;
}

/* =========================================
   SKILL LEVEL BARS
   ========================================= */
.skill-level-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.skill-level-fill {
    height: 100%;
    width: 0;
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradient-text 3s linear infinite;
    border-radius: 2px;
    transition: width 1.05s var(--motion-ease);
}

.skill-level-fill.skill-level-inview {
    width: var(--skill-pct, 0%);
}

.skills-static-bars .skill-level-fill {
    transition: none !important;
}

.skill-level-label {
    font-size: 0.65rem;
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.skill-item:hover .skill-level-bar {
    background: rgba(255,255,255,0.2);
}

.skill-item:hover .skill-level-label {
    color: rgba(255,255,255,0.9);
}

/* =========================================
   SMOOTH THEME TRANSITION
   ========================================= */
.navbar, .hero, section, .footer,
.skill-category, .service-card, .project-preview-card,
.certificate-preview-card, .contact-info, .contact-form,
.education-card, .timeline-content, .modal-content,
.image-modal-content {
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, color 0.4s ease;
}

/* Applied briefly on theme toggle so surfaces don’t snap */
html.theme-transitioning :where(
    body, .navbar, .hero, section, .footer,
    .skill-category, .service-card, .project-preview-card,
    .certificate-preview-card, .contact-info, .contact-form,
    .education-card, .timeline-content,
    .platform-link, .theme-toggle-btn, .lang-btn,
    .project-tabs, .project-tab, .form-row input, .form-row textarea,
    .nav-menu, .hamburger .bar, .reading-progress
) {
    transition:
        background-color 0.45s var(--motion-ease),
        background 0.45s var(--motion-ease),
        border-color 0.45s var(--motion-ease),
        box-shadow 0.45s var(--motion-ease),
        color 0.45s var(--motion-ease),
        fill 0.45s var(--motion-ease);
}

/* =========================================
   RTL RESPONSIVE OVERRIDES
   ========================================= */
@media (max-width: 768px) {
    .lang-switcher {
        margin-left: 5px;
        margin-right: 5px;
    }

    .lang-btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    [dir="rtl"] .timeline-item {
        padding-right: 40px;
    }

    [dir="rtl"] .timeline-content::before {
        right: -25px;
    }

}

@media (max-width: 480px) {
    [dir="rtl"] .timeline-item {
        padding-right: 30px;
    }
}

/* RTL mobile menu fix */
@media (max-width: 768px) {
    [dir="rtl"] .nav-menu {
        flex-direction: column;
        left: auto;
        right: -100%;
    }

    [dir="rtl"] .nav-menu.active {
        right: 0;
        left: auto;
    }
}

/* =========================================
   PERFORMANCE: fewer simultaneous infinite repaints
   (background-position on gradients forces constant compositor work)
   Keep motion on hero headline + role scroller only.
   ========================================= */
:where(
    .nav-link::after,
    .social-link,
    .cv-download-btn,
    .hero-glow,
    .section-title::after,
    .tech-tag,
    .project-preview-btn,
    .modal-content::-webkit-scrollbar-thumb,
    .modal-content::before,
    .modal-title,
    .modal-type,
    .showcase-icon,
    .project-link::before,
    .certificate-preview-btn,
    .submit-btn,
    .form-actions button,
    .footer-logo,
    .scroll-to-top,
    .project-tab.active,
    .reading-progress,
    .skill-level-fill,
    .lang-btn.active,
    .image-modal-content::-webkit-scrollbar-thumb,
    .image-modal-content::before,
    .image-modal-header h3
) {
    animation: none;
    background-position: 0% 50%;
}

.decorative-shape {
    animation: float 12s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {

    .gradient-text,
    .role-text {
        animation: none;
        background-position: 0% 50%;
    }

    .decorative-shape {
        animation: none;
    }
}
