/* =============================================
   Ziham Zuhair Portfolio — Production CSS
   ============================================= */

:root {
    --bg-main: #ffffff;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --nav-bg: rgba(255, 255, 255, 0.9);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;

    
    --primary: #111827; /* Near black */
    --primary-hover: #374151;
    --accent-blue: #2563eb;
    --accent-blue-light: #eff6ff;
    
    --dot-1: #10b981;
    --dot-2: #8b5cf6;
    --dot-3: #3b82f6;
    --dot-4: #ec4899;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.05), 0 8px 10px -6px rgba(0,0,0,0.01);
    
    --transition-slow: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-main: #020617;
    --bg-light: #0f172a;
    --bg-card: #0f172a;
    --nav-bg: rgba(2, 6, 23, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: #1e293b;
    --primary: #f8fafc;
    --primary-hover: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5), 0 8px 10px -6px rgba(0,0,0,0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-secondary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

p {
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
}

.bg-light {
    background-color: var(--bg-light);
}

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

.section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 3rem; /* Reduced from 4rem for better flow */
    letter-spacing: -0.02em;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent-blue);
    border-radius: 2px;
}

/* Offscreen sections: skip rendering until near viewport */
.about, .skills, .experience, .projects, .education, .contact {
    content-visibility: auto;
    contain-intrinsic-size: 0 600px;
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    line-height: 1.2;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.8rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 50px;
    transition: var(--transition-fast);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--bg-main);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-light);
    border-color: var(--text-primary);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #ffffff;
}

.lg-btn {
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: var(--transition-fast);
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    will-change: padding, box-shadow;
}

.navbar.scrolled {
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    list-style: none;
    gap: 3rem;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: var(--transition-fast);
    position: relative;
    padding-bottom: 5px;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.btn-light-pill {
    padding: 0.8rem 2rem;
    background-color: #e5e7eb;
    color: #0f172a;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    margin-left: auto;
}
.btn-light-pill:hover {
    background-color: #d1d5db;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    padding-top: 100px;
    padding-left: 5%;
    padding-right: 5%;
    max-width: 1500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    background: transparent;
}

/* Background gradient from the SARAH image */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 10% 40%, rgba(224, 242, 254, 0.7) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(224, 242, 254, 0.4) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

.particles-layer {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden;
}

#particle-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

.grid-crosshairs {
    position: absolute;
    top: 80px; left: 5%; right: 5%; bottom: -80px;
    background: 
        linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 49.9%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0) 50.1%, rgba(0,0,0,0) 100%),
        linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 49.9%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0) 50.1%, rgba(0,0,0,0) 100%);
    z-index: 0;
    pointer-events: none;
}

.grid-crosshairs::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 8px; height: 8px;
    background: var(--bg-card);
    border: 1px solid #ccc;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.hero-content {
    position: relative;
    z-index: 2;
    padding-right: 2rem;
}

.hero-title {
    font-size: clamp(2rem, 3.5vw, 3.2rem);
    font-weight: 300;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
    color: var(--primary);
    text-transform: uppercase;
}
.hero-title strong {
    font-weight: 800;
}

.hero-desc {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
    max-width: 500px;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.btn-black-pill {
    padding: 1rem 2.5rem;
    background-color: var(--text-primary);
    color: var(--bg-main);
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}
.btn-black-pill:hover {
    background-color: var(--primary-hover);
    color: var(--bg-main);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.icon-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
    font-size: 1.2rem;
}

.icon-circle:hover {
    background: var(--bg-light);
}

.hero-tags {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
.hero-tags i {
    color: var(--text-primary);
    font-size: 1rem;
}

@media (max-width: 992px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 150px;
    }
    .hero-content {
        padding-right: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* Hero Image & Orbital Ring */
.hero-image-wrap {
    position: relative;
    width: 450px;
    height: 450px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

@media (max-width: 500px) {
    .hero-image-wrap {
        width: 300px;
        height: 300px;
    }
}

.hero-image {
    width: 80%;
    height: 80%;
    object-fit: cover;
    border-radius: 50%;
    z-index: 2;
    filter: grayscale(100%);
    transition: filter 0.5s ease;
}

.hero-image:hover {
    filter: grayscale(0%);
}

.orbital-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px dashed rgba(0,0,0,0.1);
    border-radius: 50%;
    animation: spin 40s linear infinite;
    z-index: 1;
}

.dot {
    position: absolute;
    border-radius: 50%;
    z-index: 3;
}

.dot-1 { width: 15px; height: 15px; background: var(--dot-1); top: 10%; left: 20%; animation: float 4s ease-in-out infinite; }
.dot-2 { width: 10px; height: 10px; background: var(--dot-2); bottom: 15%; right: 15%; animation: float 5s ease-in-out infinite reverse; }
.dot-3 { width: 20px; height: 20px; background: var(--dot-3); top: 40%; right: -5%; animation: float 6s ease-in-out infinite; }
.dot-4 { width: 12px; height: 12px; background: var(--dot-4); bottom: 5%; left: 30%; animation: float 3s ease-in-out infinite reverse; }

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes float { 
    50% { transform: translateY(-15px); } 
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.about-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.stat-item {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.stat-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.stat-number {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-weight: 500;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .about-grid { grid-template-columns: 1fr; }
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.skill-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.skill-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--text-primary);
    transform: translateY(-5px);
}

.skill-icon {
    font-size: 2rem;
    color: var(--accent-blue);
    margin-bottom: 1.5rem;
    background: var(--accent-blue-light);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
}

.skill-card h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.skill-tags span {
    background: var(--bg-light);
    color: var(--text-primary);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.skill-card:hover .skill-tags span {
    background: var(--bg-card);
    border-color: #d1d5db;
}

/* Experience Timeline — Centered & Alternating */
.timeline {
    position: relative;
    max-width: 1100px;
    margin: 4rem auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--border-color) 10%, var(--border-color) 90%, transparent);
}

.timeline-item {
    position: relative;
    width: 50%;
    margin-bottom: 2rem;
    padding: 0 40px;
    box-sizing: border-box;
}

/* Weave cards together: Every card after the first pulls up */
.timeline-item:nth-child(n+2) {
    margin-top: -120px;
}

/* Alternate Left/Right */
.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}

.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
}

.timeline-dot {
    position: absolute;
    top: 25px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 5px solid var(--bg-main);
    box-shadow: 0 0 0 2px var(--accent-blue-light);
    z-index: 10;
    transition: var(--transition-fast);
}

.timeline-item:nth-child(odd) .timeline-dot {
    right: -12px;
}

.timeline-item:nth-child(even) .timeline-dot {
    left: -12px;
}

.timeline-item:hover .timeline-dot {
    background: var(--text-primary);
    transform: scale(1.4);
    box-shadow: 0 0 15px var(--accent-blue);
}

/* Pulsing effect for the timeline markers */
.timeline-dot::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: var(--accent-blue);
    transform: translate(-50%, -50%);
    animation: timelinePulse 2s infinite;
    z-index: -1;
    opacity: 0.5;
}

@keyframes timelinePulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

.timeline-content {
    background: var(--bg-card);
    padding: 1.5rem 2rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-slow);
    position: relative;
    text-align: left;
}

.timeline-item:hover .timeline-content {
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-blue);
    transform: translateY(-5px);
}

.timeline-date {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: var(--bg-light);
    color: var(--text-primary);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.timeline-title {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.timeline-company {
    color: var(--accent-blue);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.timeline-projects {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.timeline-roles {
    list-style: none;
    padding: 0;
    color: var(--text-secondary);
}

.timeline-roles li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

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

/* Projects Showcase */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
}
.project-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
    padding: 4rem 2rem 3rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
    border-color: var(--text-primary);
}
.project-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 6px;
    background: var(--accent-blue);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}
.project-card:hover::before {
    transform: scaleX(1);
}
.project-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.project-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.project-tags {
    margin-top: auto;
    padding-top: 2rem;
    display: flex;
    gap: 0.5rem;
}
.project-tags span {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-weight: 500;
}

/* Education */
.edu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.edu-card {
    text-align: center;
    background: var(--bg-card);
    padding: 3rem 2rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.edu-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

.edu-icon {
    font-size: 2.5rem;
    color: var(--accent-blue);
    margin-bottom: 1.5rem;
}

.edu-card h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* Contact Section */
.contact-box {
    background: var(--primary);
    color: var(--bg-main);
    border-radius: 30px;
    padding: 3.5rem 2rem; /* Reduced from 5rem 3rem */
    text-align: center;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.contact-box::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    opacity: 0.2;
    top: -150px;
    right: -150px;
    border-radius: 50%;
}

.contact-title {
    color: var(--bg-main);
    font-size: 2.5rem;
    margin-bottom: 2rem; /* Reduced from 3rem */
}

.contact-methods {
    display: flex;
    justify-content: center;
    gap: 2rem; /* Reduced from 3rem */
    margin-bottom: 2.5rem; /* Reduced from 3rem */
    flex-wrap: wrap;
}

.contact-method {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 1.5rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-fast);
    min-width: 200px;
}

.contact-method:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-5px);
}

.contact-method i {
    font-size: 2rem;
    color: var(--accent-blue);
    transition: var(--transition-fast);
}

.contact-method a {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bg-main); /* Match main box color for visibility */
    text-decoration: none;
    transition: var(--transition-fast);
}

.contact-method:hover a {
    color: var(--accent-blue);
}

.contact-method:hover i {
    color: var(--accent-blue);
    transform: scale(1.1);
}

.contact-method i {
    font-size: 2rem;
    color: var(--bg-light);
    transition: var(--transition-fast);
}

footer {
    text-align: center;
    padding-top: 4rem;
    color: var(--text-secondary);
}

/* Scroll Animations */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: var(--transition-slow);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    transform: translateX(-40px);
}
.reveal-left.active {
    transform: translateX(0);
}

.reveal-right {
    transform: translateX(40px);
}
.reveal-right.active {
    transform: translateX(0);
}

@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero { padding-left: 2rem; padding-right: 2rem; grid-template-columns: 1fr; text-align: center; }
    .hero-actions { justify-content: center; }
    .hero-tags { justify-content: center; }
    .hero-image-wrap { margin: 0 auto; order: -1; }
    .contact-box { padding: 3rem 1.5rem; }

    /* Timeline Mobile Reset */
    .timeline::before { left: 20px; transform: none; }
    .timeline-item { width: 100%; padding-left: 50px; padding-right: 0; text-align: left !important; margin-top: 0 !important; margin-bottom: 3rem; }
    .timeline-item:nth-child(even) { left: 0; }
    .timeline-dot { left: 8px !important; right: auto !important; }
}
