/* ==========================================================================
   Master Portfolio Design System - Pure Blue & Red Lightsaber Theme
   Created for Youssef Naggar

   Theme: Blue (Primary) + Red (Secondary) in both Light & Dark modes
   Gradients: Pure Blue to Red
   ========================================================================== */
/* Fonts are now preconnected and loaded asynchronously in index.html to prevent render blocking */
:root {
    /* ==========================================================================
       LIGHT MODE
       ========================================================================== */
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --border-color: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #475569;

    /* Blue & Red Theme Tokens */
    --theme-primary: #0284c7;    /* Electric Blue */
    --theme-secondary: #dc2626;  /* Sith Crimson Red */
    --theme-primary-glow: rgba(2, 132, 199, 0.25);
    --theme-secondary-glow: rgba(220, 38, 38, 0.25);

    /* Pure Blue to Red Gradients */
    --theme-gradient: linear-gradient(135deg, #0284c7 0%, #dc2626 100%);
    --theme-gradient-subtle: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(220, 38, 38, 0.08) 100%);
    --theme-conic: conic-gradient(from 0deg, #0284c7, #dc2626, #0284c7);

    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 0 15px rgba(2, 132, 199, 0.05);
    --nav-bg: rgba(255, 255, 255, 0.92);
    --grid-line-color: rgba(2, 132, 199, 0.05);
    --badge-bg: rgba(2, 132, 199, 0.1);
    --badge-border: rgba(2, 132, 199, 0.3);
    --badge-text: #0284c7;
}

.dark-mode {
    /* ==========================================================================
       DARK MODE
       ========================================================================== */
    --bg-main: #06080e;
    --bg-surface: #0c101a;
    --bg-surface-elevated: #111726;
    --border-color: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;

    /* Blue & Red Theme Tokens */
    --theme-primary: #00d2ff;    /* Neon Cyan-Blue */
    --theme-secondary: #ef4444;  /* Sith Red */
    --theme-primary-glow: rgba(0, 210, 255, 0.35);
    --theme-secondary-glow: rgba(239, 68, 68, 0.35);

    /* Pure Blue to Red Gradients */
    --theme-gradient: linear-gradient(135deg, #00d2ff 0%, #ef4444 100%);
    --theme-gradient-subtle: linear-gradient(135deg, rgba(0, 210, 255, 0.06) 0%, rgba(239, 68, 68, 0.06) 100%);
    --theme-conic: conic-gradient(from 0deg, #00d2ff, #ef4444, #00d2ff);

    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 210, 255, 0.12);
    --nav-bg: rgba(6, 8, 14, 0.94);
    --grid-line-color: rgba(0, 210, 255, 0.04);
    --badge-bg: rgba(0, 210, 255, 0.12);
    --badge-border: rgba(0, 210, 255, 0.35);
    --badge-text: #00d2ff;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.65;
    background-image: 
        linear-gradient(var(--grid-line-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line-color) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Typography Hierarchy */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

code, .fira-text, .telemetry-tag, .metric-badge {
    font-family: 'Fira Code', monospace;
}

/* Scalable Vector Icons */
.svg-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.15em;
    fill: currentColor;
    flex-shrink: 0;
}

/* ==========================================================================
   1. COVER PAGE (HEADER)
   ========================================================================== */
header.hero-cover {
    background: linear-gradient(135deg, #07090f 0%, #101424 50%, #080c16 100%);
    color: white;
    padding: 6rem 0 5rem 0;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--badge-border);
}

header.hero-cover::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 65% 35%, var(--theme-primary-glow) 0%, transparent 45%),
                radial-gradient(circle at 35% 65%, var(--theme-secondary-glow) 0%, transparent 45%);
    pointer-events: none;
    animation: ambientShift 14s ease-in-out infinite alternate;
}

@keyframes ambientShift {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.06) rotate(2deg); }
}

.hero-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 3.5rem;
    width: 100%;
}

.profile-image-container {
    position: relative;
    width: 210px;
    height: 210px;
    flex-shrink: 0;
    border-radius: 50%;
    perspective: 1000px;
    z-index: 5;
}

/* Blue & Red Conic Halo */
.profile-image-container::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    background: var(--theme-conic);
    z-index: -1;
    animation: spinRing 10s linear infinite;
    filter: blur(5px);
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.profile-image-container:hover::before {
    opacity: 1;
    filter: blur(9px);
}

@keyframes spinRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.profile-image {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.95);
    object-fit: cover;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    background-color: #0c101a;
}

.profile-text {
    flex: 1;
    text-align: left;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    color: var(--theme-primary);
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    letter-spacing: 0.02em;
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    background-color: var(--theme-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--theme-primary);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.profile-text h1 {
    font-size: 3.2rem;
    margin-bottom: 0.6rem;
    color: #ffffff;
    background: none;
    -webkit-text-fill-color: #ffffff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.profile-headline {
    font-size: 1.18rem;
    color: #cbd5e1;
    font-weight: 500;
    margin-bottom: 1.8rem;
    max-width: 780px;
    line-height: 1.55;
}

.header-cta-group {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--theme-gradient);
    color: #ffffff;
    padding: 0.85rem 1.8rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px var(--theme-primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--theme-primary-glow), 0 0 20px var(--theme-secondary-glow);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 0.85rem 1.6rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-2px);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
nav.main-nav {
    background-color: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

nav.main-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

nav.main-nav ul li {
    padding: 0.9rem 1.2rem;
}

nav.main-nav ul li a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

nav.main-nav ul li a:hover,
nav.main-nav ul li a.active {
    color: var(--theme-primary);
}

/* ==========================================================================
   SECTIONS & CONTAINERS
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

section {
    margin-bottom: 5rem;
    scroll-margin-top: 85px;
}

.section-title {
    font-size: 2.3rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.5rem;
}

.section-title i {
    color: var(--theme-primary);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2.2rem;
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 2.2rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--theme-primary);
    box-shadow: var(--card-shadow), 0 0 20px var(--theme-primary-glow);
}

/* ==========================================================================
   2. ABOUT ME
   ========================================================================== */
.about-bio {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-main);
    margin-bottom: 2rem;
}

.language-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.language-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.4rem;
    border-radius: 9999px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.language-item strong {
    color: var(--theme-primary);
}

/* ==========================================================================
   3. ENTERPRISE EXPERIENCE & INTERNSHIPS (EDITORIAL TIMELINE)
   ========================================================================== */
.experience-log-table {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.experience-log-row {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--theme-primary);
    border-radius: 12px;
    padding: 1.6rem 1.8rem;
    transition: all 0.25s ease;
}

.experience-log-row:hover {
    transform: translateX(4px);
    border-color: var(--theme-primary);
    border-left-color: var(--theme-secondary);
    box-shadow: var(--card-shadow);
}

.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.exp-role {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text-main);
}

.exp-date {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--theme-primary);
    font-weight: 600;
    background: var(--badge-bg);
    padding: 4px 10px;
    border-radius: 6px;
}

.exp-org {
    font-weight: 600;
    color: var(--theme-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
}

.exp-loc {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.88rem;
}

.exp-bullet-list {
    list-style: none;
    margin-top: 0.5rem;
}

.exp-bullet-list li {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.4rem;
    position: relative;
    padding-left: 1.3rem;
}

.exp-bullet-list li::before {
    content: '•';
    position: absolute;
    left: 0.2rem;
    color: var(--theme-primary);
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1.3;
}

.exp-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ==========================================================================
   4. EDUCATION
   ========================================================================== */
.education-card {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.education-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.education-header h3 {
    font-size: 1.4rem;
    color: var(--text-main);
}

.education-school {
    font-size: 1.05rem;
    color: var(--theme-primary);
    font-weight: 600;
}

.education-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.metric-badge {
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    color: var(--theme-primary);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   5. SKILLS
   ========================================================================== */
.skills-matrix {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.skill-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.8rem;
    box-shadow: var(--card-shadow);
}

.skill-panel h3 {
    font-size: 1.15rem;
    margin-bottom: 1.2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.skill-panel h3 i {
    color: var(--theme-primary);
}

.skill-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.tech-chip {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.82rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.tech-chip:hover {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
    box-shadow: 0 0 10px var(--theme-primary-glow);
    transform: translateY(-2px);
}

/* ==========================================================================
   6. PROJECTS
   ========================================================================== */
.projects-stack {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.project-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.2rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
    border-color: var(--theme-primary);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.project-title {
    font-size: 1.6rem;
    color: var(--text-main);
}

.project-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.project-title a:hover {
    color: var(--theme-primary);
}

.project-badge {
    font-family: 'Fira Code', monospace;
    background: var(--theme-gradient-subtle);
    border: 1px solid var(--theme-secondary);
    color: var(--theme-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
}

.project-desc {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.7;
}

.specs-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
}

.specs-box h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--theme-primary);
    margin-bottom: 0.6rem;
}

.specs-box ul {
    list-style: none;
}

.specs-box ul li {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    position: relative;
    padding-left: 1.2rem;
    line-height: 1.5;
}

.specs-box ul li::before {
    content: '⚡';
    position: absolute;
    left: 0;
    font-size: 0.75rem;
}

/* UltraTube Carousel Visual Container (Clean without labels) */
.ultratube-carousel {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 1rem;
    scroll-snap-type: x mandatory;
    background: #090d16;
    border-radius: 14px;
    border: 1px solid var(--border-color);
}

.carousel-slide {
    flex: 0 0 280px;
    scroll-snap-align: start;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.25s ease, border-color 0.25s ease;
    cursor: pointer;
    position: relative;
}

.carousel-slide:hover {
    transform: scale(1.03);
    border-color: var(--theme-primary);
    box-shadow: 0 8px 20px rgba(0, 210, 255, 0.2);
}

.carousel-slide img, .gallery-trigger-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.tags-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.telemetry-tag {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--theme-primary);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
}

.project-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.project-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--theme-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 0.2s ease;
}

.project-links a:hover {
    color: var(--theme-secondary);
    text-shadow: 0 0 8px var(--theme-secondary-glow);
}

/* Collapsible / Read More Buttons */
.read-more-wrapper {
    text-align: center;
    margin-top: 2.5rem;
}

.read-more-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.85rem 2rem;
    border-radius: 9999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--card-shadow);
}

.read-more-btn:hover {
    background: var(--theme-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--theme-primary-glow);
}

/* ==========================================================================
   IMAGE LIGHTBOX / GALLERY MODAL (FULLSCREEN ENLARGED VIEW)
   ========================================================================== */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(6, 8, 14, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-modal.active {
    display: flex;
    opacity: 1;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 85vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    border: 2px solid rgba(0, 210, 255, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--theme-primary-glow);
    animation: zoomIn 0.25s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-close-btn {
    position: absolute;
    top: -45px;
    right: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lightbox-close-btn:hover {
    background: var(--theme-secondary);
    border-color: var(--theme-secondary);
    transform: scale(1.1);
}

.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(12, 16, 26, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.lightbox-nav-btn:hover {
    background: var(--theme-gradient);
    border-color: transparent;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 20px var(--theme-primary-glow);
}

.lightbox-prev-btn {
    left: -70px;
}

.lightbox-next-btn {
    right: -70px;
}

.lightbox-counter {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #cbd5e1;
    background: rgba(12, 16, 26, 0.7);
    padding: 4px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   7. CERTIFICATE SECTION
   ========================================================================== */
.certs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
}

.cert-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cert-card:hover {
    border-color: var(--theme-primary);
    box-shadow: var(--card-shadow), 0 0 15px var(--theme-primary-glow);
}

.cert-img-wrapper {
    height: 180px;
    background: #090d16;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.cert-img-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

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

.cert-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.cert-body h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.cert-body p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 1.2rem;
    flex: 1;
}

.cert-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    gap: 0.8rem;
}

.cert-issuer {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--theme-primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.cert-link {
    font-family: 'Fira Code', monospace;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    color: var(--theme-primary);
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.78rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cert-link:hover {
    background: var(--theme-primary);
    color: #ffffff;
}

/* ==========================================================================
   8. CONTACT ME SECTION & FOOTER
   ========================================================================== */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 1.5rem auto 0 auto;
}

.contact-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1.4rem 1.6rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    cursor: pointer;
}

.contact-card.location-card {
    cursor: default;
}

.contact-card:hover:not(.location-card) {
    transform: translateY(-4px);
    border-color: var(--theme-primary);
    box-shadow: 0 12px 30px var(--theme-primary-glow);
}

.contact-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--badge-bg);
    border: 1px solid var(--badge-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-primary);
    font-size: 1.35rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.contact-card:hover:not(.location-card) .contact-card-icon {
    background: var(--theme-primary);
    color: #ffffff;
    box-shadow: 0 0 15px var(--theme-primary-glow);
}

.contact-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.contact-card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--theme-secondary);
}

.contact-card-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-card-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    opacity: 0.6;
    flex-shrink: 0;
}

.contact-card:hover:not(.location-card) .contact-card-arrow {
    color: var(--theme-primary);
    transform: translate(2px, -2px);
    opacity: 1;
}



/* Certificate Image Zoom Hint */
.cert-img-wrapper {
    position: relative;
    cursor: pointer;
}

.cert-img-wrapper .cert-zoom-hint {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(10, 14, 23, 0.78);
    border: 1px solid var(--border-color);
    color: var(--theme-primary);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.25s ease;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cert-card:hover .cert-img-wrapper .cert-zoom-hint {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 12px var(--theme-primary-glow);
}

/* Floating Theme Toggle Button */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--theme-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 20px var(--theme-primary-glow);
    z-index: 9999;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Floating Language Toggle Button */
.lang-toggle {
    position: fixed;
    bottom: 82px;
    right: 24px;
    background: var(--bg-surface-elevated, #101626);
    color: var(--text-main, #ffffff);
    border: 1px solid var(--theme-primary, #00d2ff);
    border-radius: 9999px;
    padding: 0 14px;
    height: 48px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 12px var(--theme-primary-glow);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lang-toggle:hover {
    transform: scale(1.06) translateY(-2px);
    background: var(--theme-gradient);
    color: #ffffff;
    box-shadow: 0 8px 25px var(--theme-primary-glow);
}

.lang-toggle i {
    font-size: 1.15rem;
    color: var(--theme-primary);
    transition: color 0.3s ease;
}

.lang-toggle:hover i {
    color: #ffffff;
}

.lang-toggle-text {
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   RTL (RIGHT-TO-LEFT) & ARABIC TYPOGRAPHY
   ========================================================================== */
html[dir="rtl"],
html[dir="rtl"] body {
    font-family: 'Alexandria', 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .profile-text,
html[dir="rtl"] .about-bio,
html[dir="rtl"] .card,
html[dir="rtl"] .section-title,
html[dir="rtl"] .exp-header,
html[dir="rtl"] .exp-org,
html[dir="rtl"] .project-card,
html[dir="rtl"] .specs-box,
html[dir="rtl"] .cert-body {
    text-align: right;
}

html[dir="rtl"] .experience-log-row {
    border-left: 1px solid var(--border-color);
    border-right: 4px solid var(--theme-primary);
}

html[dir="rtl"] .experience-log-row:hover {
    transform: translateX(-4px);
    border-right-color: var(--theme-secondary);
}

html[dir="rtl"] .exp-bullet-list li {
    padding-left: 0;
    padding-right: 1.3rem;
}

html[dir="rtl"] .exp-bullet-list li::before {
    left: auto;
    right: 0.2rem;
}

html[dir="rtl"] .specs-box ul li {
    padding-left: 0;
    padding-right: 1.4rem;
}

html[dir="rtl"] .specs-box ul li::before {
    left: auto;
    right: 0;
}

html[dir="rtl"] .contact-card-arrow {
    transform: rotate(90deg);
}

html[dir="rtl"] .contact-card:hover:not(.location-card) .contact-card-arrow {
    transform: rotate(90deg) translate(-2px, -2px);
}

html[dir="rtl"] .project-links {
    justify-content: flex-start;
}

html[dir="rtl"] .cert-issuer {
    direction: ltr;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

html[dir="rtl"] .cert-img-wrapper .cert-zoom-hint {
    right: auto;
    left: 12px;
}

/* Responsive */
@media (max-width: 900px) {
    .profile-section {
        flex-direction: column;
        text-align: center;
        gap: 1.8rem;
    }
    
    .profile-text {
        text-align: center;
    }
    
    .header-cta-group {
        justify-content: center;
    }

    .skills-matrix {
        grid-template-columns: 1fr;
    }

    .lightbox-prev-btn {
        left: 10px;
    }

    .lightbox-next-btn {
        right: 10px;
    }
}


@media (max-width: 600px) {
    section {
        scroll-margin-top: 130px;
    }

    .profile-text h1 {
        font-size: 2.4rem;
    }
    
    nav.main-nav ul {
        flex-wrap: wrap;
        padding: 0.4rem;
    }
    
    nav.main-nav ul li {
        padding: 0.4rem 0.6rem;
    }
    
    .container {
        padding: 2rem 1rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .contact-card {
        padding: 1rem 1.15rem;
        gap: 0.85rem;
    }

    .contact-card-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
        border-radius: 10px;
    }

    .contact-card-value {
        font-size: 0.82rem;
    }
}

@media (max-width: 390px) {
    .container {
        padding: 1.5rem 0.75rem;
    }

    .contact-card {
        padding: 0.85rem 0.95rem;
        gap: 0.75rem;
    }

    .contact-card-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        border-radius: 9px;
    }

    .contact-card-label {
        font-size: 0.68rem;
    }

    .contact-card-value {
        font-size: 0.74rem;
        letter-spacing: -0.01em;
    }
}
