/* ============ Liquid Glass — Ahmed Khaled Portfolio ============ */
:root {
    --bg: #05070f;
    --blob-1: #1d4ed8;
    --blob-2: #7c3aed;
    --blob-3: #0891b2;
    --accent: #5b9bff;
    --accent-2: #a78bfa;
    --accent-solid: #2f6bff;
    --text: #f5f7ff;
    --text-2: #c3cbe0;
    --text-3: #8b95b0;
    --glass: rgba(255, 255, 255, 0.07);
    --glass-strong: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.16);
    --hl: rgba(255, 255, 255, 0.35);
    --hl-low: rgba(255, 255, 255, 0.05);
    --shadow: rgba(0, 0, 0, 0.45);
    --glow: rgba(120, 160, 255, 0.28);
    --ok: #4ade80;
    --blob-opacity: 0.55;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #eaf0fb;
    --blob-1: #60a5fa;
    --blob-2: #002fd8;
    --blob-3: #67e8f9;
    --accent: #1f5fe0;
    --accent-2: #7c3aed;
    --accent-solid: #1f5fe0;
    --text: #0c1226;
    --text-2: #3a4560;
    --text-3: #66718c;
    --glass: rgba(255, 255, 255, 0.5);
    --glass-strong: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.75);
    --hl: rgba(255, 255, 255, 0.95);
    --hl-low: rgba(60, 80, 140, 0.08);
    --shadow: rgba(40, 60, 120, 0.18);
    --glow: rgba(255, 255, 255, 0.9);
    --ok: #16a34a;
    --blob-opacity: 0.6;
    color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }

body {
    font-family: "Inter", -apple-system, "SF Pro Display", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Living background ---------- */
.bg-stage { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
    position: absolute; border-radius: 50%; filter: blur(90px);
    opacity: var(--blob-opacity); transition: background 0.5s, opacity 0.5s;
    will-change: transform;
}
.blob.b1 { width: 46vmax; height: 46vmax; background: var(--blob-1); top: -12%; left: -10%; animation: drift1 26s ease-in-out infinite alternate; }
.blob.b2 { width: 40vmax; height: 40vmax; background: var(--blob-2); top: 30%; right: -14%; animation: drift2 32s ease-in-out infinite alternate; }
.blob.b3 { width: 34vmax; height: 34vmax; background: var(--blob-3); bottom: -14%; left: 22%; animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(12vw, 14vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-14vw, -10vh) scale(0.9); } }
@keyframes drift3 { to { transform: translate(10vw, -12vh) scale(1.2); } }

/* ---------- Glass primitive ---------- */
.glass {
    position: relative;
    background: var(--glass);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow:
        inset 0 1.5px 0 var(--hl),
        inset 0 -1px 0 var(--hl-low),
        inset 1px 0 0 var(--hl-low),
        0 14px 40px -12px var(--shadow);
    isolation: isolate;
    overflow: hidden;
    transition: transform 0.45s cubic-bezier(.2, .8, .2, 1), background 0.3s, box-shadow 0.3s, border-color 0.3s;
}
/* specular light that follows the pointer */
.glass::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, -30%), var(--glow), transparent 65%);
    opacity: 0; transition: opacity 0.35s;
}
.glass:hover::before { opacity: 1; }
/* static top sheen */
.glass::after {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.14) 0%, transparent 38%, transparent 70%, rgba(255, 255, 255, 0.05) 100%);
}
.glass:hover { background: var(--glass-strong); }

.card { border-radius: 28px; padding: 28px; }
.lift:hover { transform: translateY(-6px); }

/* ---------- Layout ---------- */
.wrap { width: min(1120px, 92%); margin-inline: auto; }
section { padding: 96px 0; position: relative; }
.sec-head { text-align: center; margin-bottom: 56px; }
.sec-head h2 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.sec-head p { color: var(--text-3); max-width: 600px; margin: 16px auto 0; font-size: 1.05rem; }
.grad {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
h3.sub { font-size: 1.4rem; font-weight: 700; text-align: center; margin: 64px 0 28px; letter-spacing: -0.01em; }

/* reveal on scroll (only when JS is running) */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2, .8, .2, 1); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Buttons / pills ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 13px 26px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
    cursor: pointer; color: var(--text);
}
.btn-primary {
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent-solid) 85%, white), var(--accent-solid));
    color: #fff; border-color: rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.5), inset 0 -8px 16px rgba(0, 0, 40, 0.25), 0 10px 30px -8px var(--accent-solid);
}
.btn-primary:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--accent-solid) 75%, white), var(--accent-solid)); }
.chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
    border-radius: 999px; font-size: 0.85rem; color: var(--text-2);
}
.chip i { color: var(--accent); }

/* ---------- Navbar ---------- */
.navbar {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100;
    width: min(94%, 880px); border-radius: 32px; padding: 8px 12px 8px 22px;
    transition: transform 0.4s, border-radius 0.3s, background 0.3s, width 0.4s;
}
.navbar.scrolled { width: min(94%, 820px); background: var(--glass-strong); }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; }
.nav-links { display: none; align-items: center; gap: 2px; }
.nav-link {
    padding: 8px 15px; font-size: 0.88rem; font-weight: 500; color: var(--text-2);
    border-radius: 999px; transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.nav-link:hover { color: var(--text); background: var(--hl-low); }
.nav-link.active { color: var(--text); }
.nav-tools { display: flex; align-items: center; gap: 4px; }
.icon-btn {
    width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
    color: var(--text-2); background: none; border: 0; cursor: pointer; font-size: 1rem;
    transition: background 0.25s, color 0.25s, transform 0.3s;
}
.icon-btn:hover { background: var(--glass-strong); color: var(--accent); }
.nav-social { display: none; gap: 2px; }
#mobile-menu { overflow: hidden; height: 0; visibility: hidden; }
.menu-inner { display: flex; flex-direction: column; gap: 4px; padding: 12px 6px 8px; position: relative; touch-action: none; }
.menu-btn { display: grid; }

@media (min-width: 900px) {
    .nav-links, .nav-social { display: flex; }
    .menu-btn { display: none; }
    #mobile-menu { display: none; }
}

/* ---------- Hero ---------- */
#home { min-height: 100vh; padding-top: 130px; display: flex; align-items: center; }
.hero-grid { display: grid; gap: 56px; align-items: center; }
.hero-photo { display: flex; justify-content: center; order: 1; }
.hero-copy { order: 2; text-align: center; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.photo-frame { position: relative; }
.photo {
    width: clamp(230px, 60vw, 380px); aspect-ratio: 1; border-radius: 44px; padding: 10px;
}
.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 34px; transition: transform 0.8s; }
.photo:hover img { transform: scale(1.05); }
.float-icon {
    position: absolute; width: 50px; height: 50px; display: grid; place-items: center;
    border-radius: 18px; color: var(--accent); font-size: 1.05rem;
    animation: bob 5s ease-in-out infinite;
}
.float-icon.i1 { top: -14px; right: -14px; }
.float-icon.i2 { top: 46%; left: -22px; animation-delay: -1.5s; }
.float-icon.i3 { bottom: -14px; right: 40px; animation-delay: -3s; }
@keyframes bob { 50% { transform: translateY(-9px); } }

.status { padding: 8px 18px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; display: inline-flex; align-items: center; gap: 10px; color: var(--text-2); }
.ping { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.ping::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok); animation: ping 1.8s ease-out infinite; }
@keyframes ping { to { transform: scale(3.2); opacity: 0; } }

.hero-copy h1 { font-size: clamp(2.6rem, 7vw, 4.4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.typing-text { font-size: 1.5rem; font-weight: 600; color: var(--text-3); min-height: 2.2rem; }
.cursor { display: inline-block; width: 3px; height: 1.4rem; vertical-align: -3px; background: var(--accent); margin-left: 3px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { color: var(--text-3); max-width: 540px; font-size: 1.08rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.tech-label { font-size: 0.85rem; font-weight: 500; color: var(--text-3); margin-bottom: 12px; }
.tech-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tech-row img { height: 20px; width: auto; border-radius: 4px; }

@media (min-width: 1024px) {
    .hero-grid { grid-template-columns: 1.1fr 1fr; }
    .hero-photo { order: 2; }
    .hero-copy { order: 1; text-align: left; align-items: flex-start; }
    .btn-row, .tech-row { justify-content: flex-start; }
}

/* ---------- About ---------- */
.about-card { display: grid; gap: 28px; align-items: center; padding: 28px; border-radius: 36px; }
.about-img { height: 260px; border-radius: 26px; overflow: hidden; }
.about-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }
.about-img:hover img { transform: scale(1.08); }
.about-text { display: flex; flex-direction: column; gap: 14px; color: var(--text-3); }
.about-text .big { color: var(--text-2); font-size: 1.1rem; }
.about-text .big b { display: block; font-size: 1.9rem; letter-spacing: -0.02em; margin-bottom: 4px; }
.about-text strong { color: var(--text); font-weight: 600; }
@media (min-width: 800px) { .about-card { grid-template-columns: 1fr 2fr; } }

.info-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.info { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 26px 14px; border-radius: 26px; }
.orb {
    width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%;
    font-size: 1.2rem; color: var(--accent); background: var(--glass-strong);
    box-shadow: inset 0 1.5px 0 var(--hl), inset 0 -6px 12px var(--hl-low), 0 6px 16px -6px var(--shadow);
}
.info small { display: block; color: var(--text-3); font-size: 0.78rem; }
.info p { font-weight: 600; font-size: 0.95rem; word-break: break-word; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.skill { text-align: center; }
.skill > i { font-size: 1.9rem; color: var(--accent); margin-bottom: 14px; }
.skill h3 { font-size: 1.2rem; margin-bottom: 8px; }
.skill p { font-size: 0.9rem; color: var(--text-3); margin-bottom: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tag {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
    font-size: 0.85rem; font-weight: 500; color: var(--text-2);
    background: var(--hl-low); border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--hl-low);
}
.tag i { color: var(--accent); }

.philo-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.philo { padding: 24px; border-radius: 26px; }
.philo h4 { display: flex; align-items: center; gap: 12px; font-size: 1.05rem; margin-bottom: 10px; }
.philo .orb { width: 42px; height: 42px; font-size: 1rem; flex: none; }
.philo p { color: var(--text-3); font-size: 0.9rem; }
.tags.big .tag { padding: 10px 20px; font-size: 0.9rem; }

/* ---------- Projects ---------- */
.projects { display: grid; gap: 36px; }
.project { border-radius: 36px; display: grid; padding: 12px; }
.project-img { position: relative; min-height: 260px; border-radius: 26px; overflow: hidden; }
.project-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s; }
.project:hover .project-img img { transform: scale(1.07); }
.project-num {
    position: absolute; top: 16px; left: 16px; width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 50%; font-weight: 700; color: var(--accent);
}
.project-body { padding: 30px 26px; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.project-body .kicker { color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.project-body h3 { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -0.02em; }
.project-body p { color: var(--text-3); line-height: 1.7; }
.project-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
@media (min-width: 960px) {
    .project { grid-template-columns: 1fr 1fr; }
    .project.rev .project-img { order: 2; }
}

/* ---------- Timeline ---------- */
.tl-grid { display: grid; gap: 28px; }
.tl { padding: 32px; border-radius: 32px; }
.tl > h2 { display: flex; align-items: center; gap: 12px; font-size: 1.5rem; margin-bottom: 28px; }
.tl > h2 i { color: var(--accent); }
.timeline { position: relative; border-left: 1px solid var(--glass-border); padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: -1px; top: 0; width: 1px; height: 80px; background: linear-gradient(var(--accent), transparent); }
.tl-item { position: relative; }
.tl-dot {
    position: absolute; left: -38px; top: 8px; width: 15px; height: 15px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 0 5px var(--glass-strong), 0 0 18px var(--accent);
}
.tl-item h3 { font-size: 1.15rem; }
.tl-item h3 span { color: var(--text-3); font-weight: 400; font-size: 0.95rem; }
.tl-org { color: var(--accent); font-weight: 500; margin-top: 2px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 0.85rem; color: var(--text-3); margin-top: 8px; }
.meta i { color: var(--accent); margin-right: 6px; }
.tl-item ul { list-style: disc; padding-left: 20px; margin-top: 16px; color: var(--text-3); display: grid; gap: 8px; font-size: 0.93rem; }
.tl-item > p:last-child { margin-top: 16px; color: var(--text-3); font-size: 0.93rem; }
@media (min-width: 900px) { .tl-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Pricing ---------- */
.price-note { color: #f87171 !important; font-style: italic; font-size: 0.85rem !important; margin-top: 8px !important; }
:root[data-theme="light"] .price-note { color: #dc2626 !important; }
.price-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: stretch; padding-top: 14px; }
.plan { display: flex; flex-direction: column; border-radius: 30px; padding: 32px 26px; overflow: visible; }
.plan.pop { border-color: var(--accent); box-shadow: inset 0 1.5px 0 var(--hl), 0 0 0 1px var(--accent), 0 20px 50px -14px var(--accent-solid); }
.badge {
    position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    padding: 5px 16px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; color: #fff; white-space: nowrap;
    background: var(--accent-solid); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 16px -4px var(--accent-solid);
}
.plan-icon { text-align: center; font-size: 2.8rem; color: var(--accent); margin-bottom: 14px; }
.plan h3 { text-align: center; font-size: 1.4rem; margin-bottom: 8px; }
.plan .desc { text-align: center; font-size: 0.88rem; color: var(--text-3); min-height: 62px; }
.price { text-align: center; margin: 18px 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.plan ul { display: grid; gap: 12px; margin-bottom: 26px; flex-grow: 1; font-size: 0.9rem; color: var(--text-2); }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li i { color: var(--ok); margin-top: 5px; font-size: 0.8rem; }
.plan .btn { width: 100%; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 36px; }
.contact-card { padding: 26px; border-radius: 26px; text-align: center; display: block; }
.contact-card i { font-size: 1.3rem; color: var(--accent); margin-bottom: 10px; }
.contact-card h4 { font-size: 1rem; }
.contact-card p { font-size: 0.88rem; color: var(--text-3); word-break: break-word; }
.socials { display: flex; justify-content: center; gap: 14px; margin-bottom: 36px; }
.socials a { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; font-size: 1.15rem; }
.socials a:hover { color: var(--accent); }
.center { text-align: center; }

/* ---------- Footer ---------- */
footer { padding: 32px 0 40px; text-align: center; color: var(--text-3); font-size: 0.9rem; }
footer .wrap { padding: 18px; border-radius: 999px; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Fallback & motion ---------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass { background: var(--glass-strong); }
}
@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; }
}

/* ================= Elastic / tactile interactions ================= */
/* transforms are driven by spring physics in script.js, so CSS must never ease them */
.elastic {
    transition-property: background, color, box-shadow, border-color !important;
    touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-user-drag: none;   /* vertical page scroll still works over buttons */
    will-change: transform;
}

/* --- Draggable theme switch --- */
.switch {
    position: relative; flex: none; width: 68px; height: 38px; margin: 0 4px; padding: 0;
    border-radius: 999px; border: 1px solid var(--glass-border); color: var(--text-3);
    --tint: color-mix(in srgb, var(--accent-solid) calc(var(--p, 1) * 55%), transparent);
    background-color: var(--glass);
    background-image: linear-gradient(var(--tint), var(--tint));
    box-shadow: inset 0 2px 8px var(--shadow), inset 0 1px 0 var(--hl-low);
    cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.switch:active { cursor: grabbing; }
.switch i { position: absolute; top: 50%; margin-top: -7px; font-size: 13px; line-height: 14px; pointer-events: none; }
.sw-sun { left: 11px; }
.sw-moon { right: 11px; }
.knob {
    position: absolute; top: 3px; left: 0; width: 30px; height: 30px; border-radius: 50%;
    pointer-events: none; will-change: transform;
    background: linear-gradient(160deg, #fff, rgba(255, 255, 255, 0.78));
    box-shadow: inset 0 1px 0 #fff, 0 4px 12px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.1);
}

/* --- Liquid segmented navigation --- */
.nav-links, #mobile-menu { position: relative; touch-action: none; }
.nav-link { position: relative; z-index: 1; user-select: none; -webkit-user-select: none; }
.nav-link:hover { background: transparent; color: var(--text); }
.nav-indicator {
    position: absolute; top: 0; left: 0; z-index: 0; border-radius: 999px; pointer-events: none;
    background: var(--glass-strong); border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px) saturate(160%); -webkit-backdrop-filter: blur(10px) saturate(160%);
    box-shadow: inset 0 1.5px 0 var(--hl), inset 0 -6px 12px var(--hl-low), 0 6px 18px -6px var(--shadow);
    transition: background 0.25s, box-shadow 0.25s; will-change: transform, width, height;
}
.nav-indicator.grabbed {
    background: var(--glass);
    box-shadow: inset 0 1.5px 0 var(--hl), inset 0 0 14px var(--hl-low), 0 12px 28px -8px var(--shadow);
}
.dragging, .dragging * { cursor: grabbing !important; }

.nav-link { -webkit-user-drag: none; -webkit-touch-callout: none; }
.menu-inner .nav-link { will-change: transform, opacity, filter; }

/* Email always stays on a single line; font scales down with the card width if needed */
.info, .contact-card { container-type: inline-size; }
.info p.email, .contact-card p.email {
    white-space: nowrap; word-break: normal; overflow-wrap: normal;
    font-size: 0.78rem;                                   /* fallback */
    font-size: clamp(0.62rem, 5.4cqw, 0.95rem);
}
.contact-card p.email { font-size: clamp(0.62rem, 5.2cqw, 0.88rem); }