/* ==========================================================================
   Eslam Salim — Portfolio / CV
   Structure: tokens · base · layout · components · sections · motion · print
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
    --bg: #0a0f1f;
    --bg-alt: #0d1428;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-solid: #131a2e;
    --surface-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(148, 163, 184, 0.16);
    --border-strong: rgba(148, 163, 184, 0.3);
    --text: #f1f5f9;
    --text-muted: #9aa8bd;
    --primary: #38bdf8;
    --primary-ink: #0b1220;
    --accent: #818cf8;
    --success: #22c55e;
    --ms: #f59e0b;
    --glow: rgba(56, 189, 248, 0.28);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    --nav-bg: rgba(10, 15, 31, 0.72);

    --font-heading: 'Outfit', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-code: 'Fira Code', ui-monospace, monospace;

    --container: 1180px;
    --nav-h: 72px;
    --radius: 18px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme='light'] {
    --bg: #f5f7fb;
    --bg-alt: #eaeff7;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --surface-hover: #f8fafc;
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.22);
    --text: #0f172a;
    --text-muted: #4b5a70;
    --primary: #0369a1;
    --primary-ink: #ffffff;
    --accent: #4f46e5;
    --ms: #b45309;
    --glow: rgba(3, 105, 161, 0.22);
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    --nav-bg: rgba(245, 247, 251, 0.78);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 12px);
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    line-height: 1.2;
    color: var(--text);
}

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

ul,
ol {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    background: none;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 6px;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

.highlight {
    color: var(--primary);
}

.gradient-text {
    background: linear-gradient(120deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.skip-link {
    position: fixed;
    top: -60px;
    inset-inline-start: 16px;
    z-index: 3000;
    background: var(--primary);
    color: var(--primary-ink);
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 12px;
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    z-index: 2000;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transform-origin: left;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 26px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.97rem;
    border: 1px solid transparent;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s, border-color 0.25s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(120deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 8px 24px var(--glow);
}

.btn-primary:hover {
    box-shadow: 0 12px 32px var(--glow);
}

.btn-outline {
    border-color: var(--border-strong);
    color: var(--text);
    background: var(--surface);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-whatsapp {
    background: #25d366;
    color: #fff;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.28);
}

.btn-whatsapp:hover {
    background: #1ebe5a;
}

.btn-sm {
    padding: 9px 18px;
    font-size: 0.88rem;
}

.icon-btn {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ---------- Navbar ---------- */
.navbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--nav-h);
    z-index: 1000;
    display: flex;
    align-items: center;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
}

.navbar.is-scrolled {
    background: var(--nav-bg);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom-color: var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.nav-menu {
    margin-inline-start: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a {
    position: relative;
    display: block;
    padding: 8px 14px;
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 10px;
    transition: color 0.2s;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 2px;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s var(--ease);
}

.nav-links a:hover,
.nav-links a.is-active {
    color: var(--text);
}

.nav-links a.is-active::after,
.nav-links a:hover::after {
    transform: scaleX(1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-btn {
    display: none;
}

.icon-sun {
    display: none;
}

:root[data-theme='light'] .icon-sun {
    display: inline;
}

:root[data-theme='light'] .icon-moon {
    display: none;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding: calc(var(--nav-h) + 56px) 0 56px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.orb-1 {
    width: 520px;
    height: 520px;
    top: -140px;
    left: -120px;
    background: radial-gradient(circle, var(--primary), transparent 70%);
    animation: drift 14s ease-in-out infinite alternate;
}

.orb-2 {
    width: 480px;
    height: 480px;
    right: -120px;
    bottom: -60px;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    animation: drift 18s ease-in-out infinite alternate-reverse;
}

:root[data-theme='light'] .orb {
    opacity: 0.28;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 72%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 72%);
    opacity: 0.55;
}

@keyframes drift {
    to {
        transform: translate(40px, 30px) scale(1.12);
    }
}

.hero-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: 64px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 26px;
}

.pulse-dot {
    position: relative;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
}

.pulse-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--success);
    opacity: 0;
    animation: ping 2s ease-out infinite;
}

@keyframes ping {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.hero-hello {
    font-family: var(--font-code);
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 4px;
}

.hero-title {
    font-size: clamp(2.8rem, 6.4vw, 4.8rem);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.05;
}

.hero-role {
    margin-top: 10px;
    font-family: var(--font-heading);
    font-size: clamp(1.3rem, 2.6vw, 1.75rem);
    font-weight: 600;
    color: var(--text);
}

.hero-rotator {
    margin-top: 14px;
    font-family: var(--font-code);
    font-size: 1.02rem;
    color: var(--text-muted);
    min-height: 1.7em;
}

.rotator-word {
    color: var(--primary);
}

.caret {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    margin-inline-start: 3px;
    vertical-align: text-bottom;
    background: var(--primary);
    animation: blink 1s steps(1) infinite;
}

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

.hero-description {
    margin-top: 22px;
    max-width: 580px;
    font-size: 1.08rem;
    color: var(--text-muted);
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 34px;
}

.hero-socials {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.hero-socials a {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    transition: transform 0.25s var(--ease), color 0.2s, border-color 0.2s;
}

.hero-socials a:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-3px);
}

.hero-visual {
    position: relative;
    justify-self: center;
    width: min(100%, 400px);
}

.photo-card {
    position: relative;
    aspect-ratio: 4 / 4.6;
    border-radius: 28px;
    padding: 6px;
    background: linear-gradient(145deg, var(--primary), var(--accent) 60%, transparent);
    box-shadow: var(--shadow), 0 0 80px var(--glow);
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 46% 12%;
    border-radius: 23px;
    background: var(--surface-solid);
}

.chip {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    animation: floaty 6s ease-in-out infinite;
}

.chip img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.chip-1 {
    top: 8%;
    inset-inline-start: -34px;
}

.chip-2 {
    top: 42%;
    inset-inline-end: -26px;
    animation-delay: 1.6s;
}

.chip-3 {
    bottom: 7%;
    inset-inline-start: -22px;
    animation-delay: 3s;
}

@keyframes floaty {
    50% {
        transform: translateY(-10px);
    }
}

/* ---------- Stats strip ---------- */
.stats-strip {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin-top: 64px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.stat {
    display: flex;
    flex-direction: column-reverse;
    gap: 2px;
    padding: 24px 20px;
    text-align: center;
}

.stat+.stat {
    border-inline-start: 1px solid var(--border);
}

.stat dt {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat dd {
    margin: 0;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: clamp(1.9rem, 3.6vw, 2.6rem);
    font-weight: 700;
    line-height: 1.1;
    background: linear-gradient(120deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-variant-numeric: tabular-nums;
}

/* ---------- Sections ---------- */
.section {
    padding: 104px 0;
}

.section.alt-bg {
    background: var(--bg-alt);
    border-block: 1px solid var(--border);
}

.section-head {
    max-width: 720px;
    margin: 0 auto 56px;
    text-align: center;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    font-family: var(--font-code);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary);
}

.section-title {
    font-size: clamp(1.9rem, 4vw, 2.7rem);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.section-sub {
    margin-top: 14px;
    color: var(--text-muted);
}

/* Cursor spotlight on cards */
.spot {
    position: relative;
    overflow: hidden;
}

.spot::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 60%);
    transition: opacity 0.3s;
}

.spot:hover::before {
    opacity: 1;
}

.spot>* {
    position: relative;
}

/* ---------- About ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 56px;
    align-items: center;
}

/* Grid items must be allowed to shrink, otherwise the code card widens the page on phones */
.about-grid>*,
.hero-layout>* {
    min-width: 0;
}

.about-text p {
    margin-bottom: 18px;
    color: var(--text-muted);
    font-size: 1.04rem;
}

.about-text .lead {
    font-size: 1.22rem;
    color: var(--text);
}

.about-text strong {
    color: var(--text);
    font-weight: 600;
}

.about-text strong.highlight {
    color: var(--primary);
}

.facts {
    margin-top: 26px;
    display: grid;
    gap: 12px;
}

.facts li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    color: var(--text-muted);
    font-size: 0.98rem;
}

.facts i {
    margin-top: 5px;
    width: 18px;
    color: var(--primary);
    text-align: center;
}

.facts a {
    color: var(--primary);
    font-weight: 600;
}

.facts a:hover {
    text-decoration: underline;
}

.code-card {
    background: #12161f;
    border: 1px solid #272d3a;
    border-radius: 16px;
    box-shadow: var(--shadow);
    font-family: var(--font-code);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: #181d28;
    border-bottom: 1px solid #272d3a;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f56;
}

.dot.yellow {
    background: #ffbd2e;
}

.dot.green {
    background: #27c93f;
}

.file-name {
    margin-left: 10px;
    font-size: 0.78rem;
    color: #8b95a7;
}

.card-body {
    padding: 22px 22px 24px;
    overflow-x: auto;
    font-size: 0.86rem;
    line-height: 1.75;
    color: #d4d9e3;
}

.card-body code {
    font-family: inherit;
}

.keyword {
    color: #7fb4ff;
}

.string {
    color: #f0a98a;
}

.class-name {
    color: #56d4bb;
}

.function {
    color: #e6d58b;
}

.strengths {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 64px;
}

.strength {
    padding: 26px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: transform 0.3s var(--ease), border-color 0.3s;
}

.strength:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.strength>i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 16px;
}

.strength h3 {
    font-size: 1.08rem;
    margin-bottom: 8px;
}

.strength p {
    font-size: 0.93rem;
    color: var(--text-muted);
}

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

.skill-card {
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}

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

.skill-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 18px;
    border-radius: 12px;
    font-size: 1.15rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.skill-card h3 {
    font-size: 1.12rem;
    margin-bottom: 16px;
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-list li {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color 0.2s, border-color 0.2s;
}

.skill-card:hover .skill-list li {
    color: var(--text);
    border-color: var(--border-strong);
}

/* ---------- Store buttons & tags (shared) ---------- */
.app-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.store {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.25s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}

.store:hover {
    transform: translateY(-2px);
    color: var(--primary-ink);
    border-color: transparent;
}

.store--play:hover {
    background: #34a853;
    color: #fff;
}

.store--apple:hover {
    background: #111827;
    color: #fff;
}

:root[data-theme='dark'] .store--apple:hover {
    background: #f1f5f9;
    color: #0b1220;
}

.store--web:hover {
    background: var(--primary);
    color: var(--primary-ink);
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.project-tech li {
    padding: 3px 9px;
    border-radius: 6px;
    font-family: var(--font-code);
    font-size: 0.74rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 11%, transparent);
}

/* ---------- Featured: Material Stations ---------- */
.featured {
    position: relative;
    padding: 36px;
    margin-bottom: 56px;
    border-radius: 26px;
    border: 1px solid color-mix(in srgb, var(--ms) 45%, var(--border));
    background:
        radial-gradient(900px circle at 0% 0%, color-mix(in srgb, var(--ms) 14%, transparent), transparent 55%),
        var(--surface);
    box-shadow: var(--shadow);
}

.featured-head {
    display: flex;
    gap: 28px;
    align-items: center;
}

.featured-logo {
    flex-shrink: 0;
    width: 124px;
    height: 124px;
    object-fit: contain;
    padding: 10px;
    border-radius: 24px;
    background: #fff;
    border: 1px solid var(--border);
}

.badge-featured {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--ms);
    background: color-mix(in srgb, var(--ms) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--ms) 35%, transparent);
}

.featured-intro h3 {
    margin: 12px 0 6px;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
}

.featured-tagline {
    color: var(--text-muted);
    max-width: 640px;
}

.featured-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.flow {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 32px 0 24px;
    counter-reset: step;
}

.flow li {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px dashed var(--border-strong);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
}

.flow li:not(:last-child)::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    inset-inline-end: -13px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    font-size: 0.7rem;
    color: var(--ms);
    background: var(--bg);
    border-radius: 50%;
    width: 14px;
    text-align: center;
}

.flow .step-n {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.82rem;
    color: #fff;
    background: var(--ms);
}

.ms-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.ms-app {
    display: flex;
    gap: 16px;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    transition: border-color 0.3s, transform 0.3s var(--ease);
}

.ms-app:hover {
    border-color: color-mix(in srgb, var(--ms) 60%, var(--border));
    transform: translateY(-3px);
}

.ms-app>img {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 15px;
    object-fit: cover;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.ms-body {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.ms-body h4 {
    font-size: 1.05rem;
}

.ms-body h4 small,
.app-card h3 small {
    margin-inline-start: 6px;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
}

.ms-body p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.ms-body .app-links {
    margin-top: auto;
    padding-top: 4px;
}

/* ---------- App cards ---------- */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 24px;
}

.app-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 26px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}

.app-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.app-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 16px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
}

.app-cat {
    display: block;
    margin-bottom: 2px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--primary);
}

.app-card h3 {
    font-size: 1.28rem;
}

.app-card>p {
    flex-grow: 1;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.link-groups {
    display: grid;
    gap: 10px;
}

.link-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.link-label {
    min-width: 76px;
    font-family: var(--font-code);
    font-size: 0.74rem;
    color: var(--text-muted);
}

.more-link {
    margin-top: 40px;
    text-align: center;
    color: var(--text-muted);
}

.more-link a {
    color: var(--primary);
    font-weight: 600;
}

.more-link a:hover {
    text-decoration: underline;
}

/* ---------- Timeline ---------- */
.timeline {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    padding-inline-start: 38px;
}

.timeline::before {
    content: '';
    position: absolute;
    inset-inline-start: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: linear-gradient(var(--primary), var(--accent), transparent);
}

.timeline-item {
    position: relative;
    margin-bottom: 28px;
}

.timeline-dot {
    position: absolute;
    inset-inline-start: -38px;
    top: 26px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-alt);
    border: 3px solid var(--primary);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 18%, transparent);
}

.timeline-card {
    padding: 28px 30px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color 0.3s, transform 0.3s var(--ease);
}

.timeline-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.timeline-date {
    font-family: var(--font-code);
    font-size: 0.82rem;
    color: var(--primary);
}

.timeline-tag {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--success);
    background: color-mix(in srgb, var(--success) 14%, transparent);
}

.timeline-card h3 {
    font-size: 1.3rem;
}

.company {
    display: block;
    margin: 4px 0 14px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
}

.timeline-card p {
    color: var(--text-muted);
    margin-bottom: 14px;
}

.job-highlights {
    display: grid;
    gap: 8px;
}

.job-highlights li {
    position: relative;
    padding-inline-start: 22px;
    color: var(--text-muted);
    font-size: 0.96rem;
}

.job-highlights li::before {
    content: '';
    position: absolute;
    inset-inline-start: 2px;
    top: 0.62em;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--primary);
    transform: rotate(45deg);
}

.job-highlights a {
    color: var(--primary);
    font-weight: 600;
}

.job-highlights a:hover {
    text-decoration: underline;
}

/* ---------- Contact ---------- */
.contact-panel {
    position: relative;
    padding: 64px 40px;
    border-radius: 30px;
    text-align: center;
    border: 1px solid var(--border-strong);
    background:
        radial-gradient(700px circle at 15% 0%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 60%),
        radial-gradient(700px circle at 90% 100%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
        var(--surface);
}

.contact-title {
    font-size: clamp(2rem, 4.6vw, 3.1rem);
    letter-spacing: -1px;
    margin-bottom: 14px;
}

.contact-sub {
    max-width: 560px;
    margin: 0 auto;
    color: var(--text-muted);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 900px;
    margin: 44px auto 36px;
    text-align: start;
}

.contact-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 16px;
    align-items: center;
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    transition: transform 0.25s var(--ease), border-color 0.25s;
}

.contact-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.contact-card>i {
    grid-row: 1 / 3;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.1rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.contact-label {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.contact-value {
    font-size: 0.93rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

/* ---------- Footer & back-to-top ---------- */
.footer {
    padding: 28px 0 36px;
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-muted);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

.to-top {
    position: fixed;
    inset-inline-end: 22px;
    bottom: 22px;
    z-index: 900;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 10px 26px var(--glow);
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s var(--ease);
}

.to-top.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* ---------- Scroll reveal (only when JS is active) ---------- */
.js .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Language buttons ---------- */
.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 0.88rem;
    font-weight: 600;
    transition: border-color 0.2s, color 0.2s;
}

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

/* Tech names and numbers stay left-to-right inside an RTL page */
.skill-list li,
.project-tech li,
.chip,
.code-card,
.stat-number,
.timeline-date {
    direction: ltr;
    unicode-bidi: isolate;
}

.stat-number {
    display: inline-block;
}

.code-card {
    text-align: left;
}

/* ---------- Arabic (RTL) ---------- */
:root[lang='ar'] {
    --font-heading: 'Cairo', 'Outfit', system-ui, sans-serif;
    --font-body: 'Cairo', 'Inter', system-ui, sans-serif;
}

:root[lang='ar'] body {
    line-height: 1.85;
}

:root[lang='ar'] h1,
:root[lang='ar'] h2,
:root[lang='ar'] h3,
:root[lang='ar'] h4 {
    line-height: 1.4;
}

/* Letter-spacing and uppercase break Arabic letter joining */
:root[lang='ar'] *,
:root[lang='ar'] *::before,
:root[lang='ar'] *::after {
    letter-spacing: 0 !important;
    text-transform: none !important;
}

:root[lang='ar'] .hero-hello,
:root[lang='ar'] .eyebrow,
:root[lang='ar'] .hero-rotator,
:root[lang='ar'] .link-label {
    font-family: var(--font-body);
}

:root[lang='ar'] .hero-title {
    line-height: 1.25;
}

:root[lang='ar'] .scroll-progress {
    transform-origin: right;
}

:root[lang='ar'] .rotator-word {
    transition: opacity 0.3s ease;
}

:root[lang='ar'] .flow li:not(:last-child)::after {
    content: '\f053';
}

:root[lang='ar'] .timeline-card:hover {
    transform: translateX(-4px);
}

:root[lang='ar'] .contact-value {
    direction: ltr;
    text-align: right;
}

:root[lang='ar'] .section-sub,
:root[lang='ar'] .hero-description {
    line-height: 1.9;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .strengths {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .flow {
        grid-template-columns: repeat(2, 1fr);
    }

    .flow li:nth-child(2)::after {
        display: none;
    }
}

@media (max-width: 900px) {
    .hero-layout {
        grid-template-columns: 1fr;
        gap: 48px;
        text-align: center;
    }

    .hero-visual {
        order: -1;
        width: min(78%, 300px);
    }

    .hero-description {
        margin-inline: auto;
    }

    .hero-buttons,
    .hero-socials {
        justify-content: center;
    }

    .chip-1 {
        inset-inline-start: -18px;
    }

    .chip-2 {
        inset-inline-end: -14px;
    }

    .chip-3 {
        inset-inline-start: -10px;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .stats-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat:nth-child(3) {
        border-inline-start: 0;
    }

    .stat:nth-child(n + 3) {
        border-top: 1px solid var(--border);
    }

    /* Mobile menu */
    .menu-btn {
        display: inline-grid;
    }

    .nav-cta {
        display: none;
    }

    .nav-menu {
        position: fixed;
        inset: var(--nav-h) 0 auto 0;
        margin: 0;
        padding: 14px 24px 24px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        transform: translateY(-12px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s, transform 0.25s var(--ease), visibility 0.25s;
    }

    .nav-menu.is-open {
        transform: none;
        opacity: 1;
        visibility: visible;
    }

    .nav-links {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    .nav-links a {
        padding: 14px 8px;
        font-size: 1.02rem;
        border-bottom: 1px solid var(--border);
    }

    .nav-links a::after {
        display: none;
    }

    .nav-links a.is-active {
        color: var(--primary);
    }
}

@media (max-width: 700px) {
    .section {
        padding: 76px 0;
    }

    .featured {
        padding: 24px 20px;
    }

    .featured-head {
        flex-direction: column;
        text-align: center;
    }

    .featured-links {
        justify-content: center;
    }

    .ms-grid {
        grid-template-columns: 1fr;
    }

    .apps-grid {
        grid-template-columns: 1fr;
    }

    .strengths {
        grid-template-columns: 1fr;
    }

    .contact-panel {
        padding: 44px 20px;
    }

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

    .logo-text {
        display: none;
    }

    .timeline {
        padding-inline-start: 30px;
    }

    .timeline-dot {
        inset-inline-start: -30px;
    }

    .timeline-card {
        padding: 22px 20px;
    }
}

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

    .flow li::after {
        display: none;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .chip-2 {
        display: none;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ---------- Print (Download CV → Save as PDF) ---------- */
@media print {
    @page {
        size: A4;
        margin: 14mm 12mm;
    }

    :root,
    :root[data-theme='dark'],
    :root[data-theme='light'] {
        --bg: #fff;
        --bg-alt: #fff;
        --surface: #fff;
        --surface-solid: #fff;
        --border: #d6dbe3;
        --border-strong: #b8c0cc;
        --text: #111827;
        --text-muted: #374151;
        --primary: #0369a1;
        --accent: #4338ca;
        --ms: #b45309;
        --glow: transparent;
        --shadow: none;
    }

    html {
        font-size: 12.5px;
    }

    body {
        background: #fff;
    }

    .navbar,
    .scroll-progress,
    .skip-link,
    .to-top,
    .hero-bg,
    .hero-visual,
    .chip,
    .hero-buttons,
    .hero-socials,
    .more-link,
    .contact-actions,
    .about-visual,
    .strengths,
    .flow,
    .caret,
    .hero-rotator,
    .hero-hello,
    .status-pill,
    .footer-note,
    .spot::before {
        display: none !important;
    }

    .js .reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    .gradient-text,
    .stat-number {
        background: none;
        -webkit-text-fill-color: currentColor;
        color: var(--primary);
    }

    .hero {
        padding: 0 0 12px;
    }

    .hero-layout,
    .about-grid {
        display: block;
        text-align: start;
    }

    .hero-title {
        font-size: 2.6rem;
    }

    .hero-description {
        margin: 10px 0 0;
        max-width: none;
    }

    .stats-strip {
        margin-top: 18px;
    }

    .stat {
        padding: 10px;
    }

    .section {
        padding: 22px 0;
        border: 0 !important;
    }

    .section-head {
        margin-bottom: 18px;
        text-align: start;
        break-after: avoid;
    }

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

    .skills-grid,
    .apps-grid {
        gap: 12px;
    }

    .skill-card,
    .app-card,
    .timeline-card,
    .featured,
    .ms-app,
    .contact-card {
        box-shadow: none;
        break-inside: avoid;
        padding: 14px 16px;
    }

    .featured {
        margin-bottom: 18px;
    }

    .featured-head {
        gap: 16px;
    }

    .featured-logo {
        width: 72px;
        height: 72px;
    }

    .ms-grid {
        gap: 10px;
    }

    .contact-panel {
        padding: 18px 0;
        border: 0;
        background: none;
        text-align: start;
    }

    .contact-grid {
        margin: 16px 0 0;
    }

    .footer {
        padding: 10px 0 0;
    }

    a {
        color: inherit;
    }

    .store {
        padding: 4px 9px;
        font-size: 0.74rem;
    }
}
