/* ══════════════════════════════════════════════════
   Ahmed Nasr — Personal Website Design System
   Light Theme · Premium Aesthetic
   ══════════════════════════════════════════════════ */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design Tokens ── */
:root {
    --bg-primary: #fafcfd;
    --bg-secondary: #f0f5f8;
    --bg-tertiary: #e6eef3;
    --bg-card: #ffffff;
    --text-primary: #1a1e2e;
    --text-secondary: #4a5568;
    --text-muted: #8494a7;
    --accent: #2a8faf;
    --accent-dim: #1e7a96;
    --accent-light: #3da5c7;
    --accent-glow: rgba(42, 143, 175, 0.10);
    --accent-bg: rgba(42, 143, 175, 0.05);
    --border: rgba(0, 0, 0, 0.06);
    --border-accent: rgba(42, 143, 175, 0.22);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.10);
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'Instrument Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-dim) var(--bg-secondary);
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection {
    background: var(--accent);
    color: #fff;
}

/* Subtle grain texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

/* ══════════ NAVIGATION ══════════ */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.4s ease;
    background: transparent;
}

nav.scrolled {
    background: rgba(250, 252, 253, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.nav-logo span { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

/* ══════════ HERO ══════════ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    position: relative;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 70% 40%, rgba(42, 143, 175, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 40% 60% at 20% 80%, rgba(42, 143, 175, 0.04) 0%, transparent 60%);
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black, transparent);
}

.hero-content {
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4rem;
    align-items: center;
}

.hero-text {
    max-width: 680px;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 0.2s;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(3rem, 7vw, 5.5rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 0.4s;
}

.hero h1 em {
    font-style: italic;
    color: var(--accent);
}

.hero-desc {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 650px;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 0.6s;
}

.hero-domains {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 0.7s;
}

.hero-domain-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.3rem 0.7rem;
    border-radius: 3px;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid rgba(42, 143, 175, 0.18);
    letter-spacing: 0.02em;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 0.85s;
}

/* Hero Image */
.hero-image-wrapper {
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 0.5s;
}

.hero-image-container {
    position: relative;
    width: 280px;
    height: 280px;
}

.hero-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid var(--bg-card);
    box-shadow: var(--shadow-xl);
}

.hero-image-container::after {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1.5px solid var(--border-accent);
    pointer-events: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-light);
    box-shadow: 0 0 30px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.hero-scroll {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeUp 0.8s ease forwards 1.2s;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    animation: scrollPulse 2s ease infinite;
}

/* ══════════ SECTION BASE ══════════ */
section { padding: 7rem 2rem; position: relative; }
.section-container { max-width: 1000px; margin: 0 auto; }
.section-header { margin-bottom: 4rem; }

.section-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.section-divider {
    width: 60px;
    height: 1.5px;
    background: var(--accent);
    margin-top: 1.5rem;
}

/* ══════════ ABOUT / PROFILE ══════════ */
#about {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.profile-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 0.35rem 0.85rem;
    border-radius: 3px;
    border: 1px solid var(--border-accent);
    color: var(--accent);
    background: var(--accent-bg);
    letter-spacing: 0.04em;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.about-text p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 1.02rem;
}
.about-text p strong {
    color: var(--text-primary);
    font-weight: 600;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-number {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--accent);
    line-height: 1;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    letter-spacing: 0.03em;
}

/* ══════════ RESEARCH FOCUS ══════════ */
.research-statement {
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.2vw, 1.45rem);
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 800px;
    margin-bottom: 3.5rem;
    font-style: italic;
}

.research-statement strong {
    color: var(--text-primary);
    font-style: normal;
}

.domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3.5rem;
}

.domain-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.75rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.domain-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.domain-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.domain-card:hover::before { opacity: 1; }

.domain-icon { font-size: 1.4rem; margin-bottom: 0.75rem; }
.domain-card h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-primary); }
.domain-card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.65; }

/* ── Thesis Block ── */
.thesis-block {
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 8px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    margin-bottom: 3.5rem;
    box-shadow: var(--shadow-md);
}

.thesis-block::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.thesis-label { font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 0.75rem; }
.thesis-title { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 1rem; line-height: 1.4; color: var(--text-primary); }
.thesis-desc { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.8; margin-bottom: 1.25rem; }
.thesis-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.thesis-tag {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.3rem 0.65rem;
    border-radius: 3px;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid rgba(42, 143, 175, 0.15);
}

/* ── Role Titles ── */
.role-titles-label { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 1rem; }
.role-titles-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.role-title-chip {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.55rem 1.2rem;
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.role-title-chip:hover { border-color: var(--accent-dim); color: var(--accent); }

/* ══════════ EXPERIENCE ══════════ */
.timeline { position: relative; padding-left: 2.5rem; }
.timeline::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: linear-gradient(to bottom, var(--accent), var(--border), transparent); }

.timeline-item { position: relative; margin-bottom: 3rem; padding-bottom: 3rem; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: none; margin-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: -2.5rem; top: 0.5rem; width: 9px; height: 9px; border-radius: 50%; background: var(--bg-primary); border: 2px solid var(--accent); transform: translateX(-4px); }

.timeline-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.timeline-role { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 0.25rem; color: var(--text-primary); }
.timeline-company { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 1rem; }
.timeline-company span { color: var(--text-muted); font-size: 0.85rem; }

.timeline-details { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.timeline-details li { color: var(--text-secondary); font-size: 0.92rem; padding-left: 1.25rem; position: relative; line-height: 1.7; }
.timeline-details li::before { content: '→'; position: absolute; left: 0; color: var(--accent-dim); }
.timeline-details li strong { color: var(--text-primary); font-weight: 600; }

/* ══════════ SKILLS ══════════ */
#skills {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }

.skill-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.skill-group:hover { border-color: var(--border-accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.skill-group-title { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 1rem; color: var(--accent); }

.skill-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 0.35rem 0.75rem;
    border-radius: 3px;
    background: var(--accent-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}
.skill-tag:hover { border-color: var(--accent-dim); color: var(--accent); background: rgba(42, 143, 175, 0.08); }

/* ══════════ EDUCATION ══════════ */
.edu-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.edu-card:hover { border-color: var(--border-accent); box-shadow: var(--shadow-md); }
.edu-degree { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 0.3rem; color: var(--text-primary); }
.edu-school { color: var(--accent); font-weight: 600; font-size: 0.95rem; margin-bottom: 0.5rem; }
.edu-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); margin-bottom: 1rem; }
.edu-desc { color: var(--text-secondary); font-size: 0.92rem; }

/* ══════════ PUBLICATIONS ══════════ */
#publications {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.pub-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2rem;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.pub-card:hover { border-color: var(--border-accent); box-shadow: var(--shadow-md); }
.pub-title { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 0.75rem; line-height: 1.4; color: var(--text-primary); }
.pub-authors { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.5rem; }
.pub-authors strong { color: var(--accent); font-weight: 600; }
.pub-venue { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }
.pub-status {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid rgba(42, 143, 175, 0.2);
    margin-top: 0.75rem;
}

/* ══════════ EXTRAS ══════════ */
.extras-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.extra-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.extra-card:hover { border-color: var(--border-accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.extra-year { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); margin-bottom: 0.5rem; }
.extra-title { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 0.5rem; color: var(--text-primary); }
.extra-desc { color: var(--text-secondary); font-size: 0.9rem; }

/* ══════════ CONTACT ══════════ */
#contact { text-align: center; padding-bottom: 4rem; }
#contact .section-header { display: flex; flex-direction: column; align-items: center; }
.contact-text { color: var(--text-secondary); font-size: 1.1rem; max-width: 500px; margin: 0 auto 2.5rem; }
.contact-links { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
.contact-link:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-md); }
.contact-link svg { width: 16px; height: 16px; }

/* ══════════ FOOTER ══════════ */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    background: var(--bg-secondary);
}

/* ══════════ ANIMATIONS ══════════ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 768px) {
    nav { padding: 1rem 1.25rem; }
    .nav-links {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(250, 252, 253, 0.97);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        z-index: 999;
    }
    .nav-links.active { display: flex; }
    .nav-links a { font-size: 1.2rem; color: var(--text-primary); }
    .nav-toggle { display: flex; z-index: 1001; }
    .nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .nav-toggle.active span:nth-child(2) { opacity: 0; }
    .nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    section { padding: 4.5rem 1.25rem; }
    .about-grid, .extras-grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .skills-grid, .domains-grid { grid-template-columns: 1fr; }
    .hero-scroll { display: none; }
    .thesis-block { padding: 1.75rem; }

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .hero-image-wrapper {
        order: -1;
        display: flex;
        justify-content: center;
    }
    .hero-image-container {
        width: 200px;
        height: 200px;
    }
    .hero-domains { justify-content: center; }
    .hero-cta { justify-content: center; }
}
