/* ===== Variables & Base ===== */
:root {
    --bg: #0b0d10;
    --bg-soft: #11151a;
    --text: #e8eef2;
    --muted: #9aa7b2;
    --brand: #2ecc71;
    --brand-2: #19b9ff;
    --card: rgba(255, 255, 255, .06);
    --border: rgba(255, 255, 255, .12);
    --shadow: 0 10px 30px rgba(0, 0, 0, .25);
    --radius: 16px;
    --maxw: 1120px;
    --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #fafafa;
        --bg-soft: #fff;
        --text: #0f1720;
        --muted: #5b6773;
        --card: rgba(0, 0, 0, .04);
        --border: rgba(0, 0, 0, .08);
        --shadow: 0 10px 30px rgba(0, 0, 0, .08);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 80% -20%, rgba(25, 185, 255, .18), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(46, 204, 113, .18), transparent 60%),
        var(--bg);
    line-height: 1.6;
    overflow-x: hidden;
}

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

.container {
    width: min(100% - 32px, var(--maxw));
    margin-inline: auto;
}

/* ===== Background Particles (canvas sits behind) ===== */
#particles {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(180deg, color-mix(in oklab, var(--bg) 90%, transparent), transparent);
}

/* ===== Progress Bar ===== */
#progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    z-index: 1000;
    box-shadow: 0 0 12px rgba(25, 185, 255, .6);
}

/* ===== Nav ===== */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: color-mix(in oklab, var(--bg) 80%, transparent);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 0;
}

.brand {
    display: flex;
    gap: .6rem;
    align-items: center;
    font-weight: 700;
    letter-spacing: .2px;
}

.brand .logo {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border-radius: 10px;
    color: #fff;
    font-family: "JetBrains Mono", monospace;
    box-shadow: var(--shadow);
}

.nav-links {
    display: flex;
    gap: 1.1rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    opacity: .85;
    padding: .4rem .7rem;
    border-radius: 10px;
    transition: opacity .2s var(--ease), background .2s var(--ease);
}

.nav-links a:hover {
    opacity: 1;
    background: var(--card);
}

.menu-btn {
    display: none;
    font-size: 1.25rem;
    border: 1px solid var(--border);
    background: var(--card);
    padding: .5rem .7rem;
    border-radius: 10px;
}

.theme-toggle {
    border: 1px solid var(--border);
    background: var(--card);
    padding: .45rem .6rem;
    border-radius: 10px;
    cursor: pointer;
}

@media (max-width: 820px) {
    .menu-btn {
        display: inline-flex;
    }

    .nav-links {
        position: fixed;
        inset: 64px 16px auto;
        display: none;
        flex-direction: column;
        gap: .6rem;
        padding: .8rem;
        background: var(--bg-soft);
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: var(--shadow);
    }

    .nav-links.open {
        display: flex;
    }
}

/* ===== Hero ===== */
.hero {
    padding: clamp(3rem, 4vw + 2rem, 6rem) 0 2rem;
    position: relative;
    isolation: isolate;
}

.hi {
    margin: 0 0 .25rem;
    color: var(--muted);
    text-transform: lowercase;
    letter-spacing: .5px;
}

.gradient-text {
    margin: .15rem 0 .6rem;
    font-size: clamp(2.2rem, 2.8vw + 1.2rem, 3.8rem);
    line-height: 1.05;
    letter-spacing: .2px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--brand));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shine 8s linear infinite;
    text-shadow: 0 0 24px color-mix(in oklab, var(--brand-2) 30%, transparent);
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

/* typewriter width lock */
.typewrap {
    display: inline-grid;
    position: relative;
    margin: -.2rem 0 1.1rem;
    min-height: 1.4em;
}

.type,
.type-ghost {
    grid-area: 1 / 1;
    white-space: nowrap;
    font-family: "JetBrains Mono", monospace;
    font-weight: 600;
    opacity: .9;
}

.type-ghost {
    visibility: hidden;
}

.type::after {
    content: "";
    display: inline-block;
    width: .6ch;
    height: 1.1em;
    margin-left: .1ch;
    background: currentColor;
    opacity: .7;
    animation: blink 1s steps(1) infinite;
    vertical-align: -0.1em;
}

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

/* blobs (soft background) */
.blobs {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    filter: blur(30px);
}

.blob {
    position: absolute;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--brand), transparent 60%),
        radial-gradient(circle at 70% 70%, var(--brand-2), transparent 55%);
    opacity: .35;
    transform: translate(-50%, -50%) scale(1);
    animation: float 18s var(--ease) infinite alternate;
    will-change: transform;
}

.b1 {
    left: 15%;
    top: 10%;
    animation-delay: 0s;
}

.b2 {
    left: 85%;
    top: 0%;
    animation-delay: 3s;
}

.b3 {
    left: 60%;
    top: 80%;
    animation-delay: 6s;
}

@keyframes float {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        transform: translate(-48%, -52%) scale(1.15);
    }
}

.hero-inner {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 2rem;
    align-items: center;
}

.lead {
    color: var(--muted);
    margin: 0 0 1.4rem;
    font-size: clamp(1rem, 1.1vw + .8rem, 1.15rem);
}

.hero-cta {
    display: flex;
    gap: .8rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    font-weight: 700;
    padding: .85rem 1.05rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}

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

.btn.primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #0b0d10;
    border-color: transparent;
}

.btn.ghost {
    background: var(--card);
}

.mini-counters {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.pill {
    border: 1px solid var(--border);
    background: var(--bg);
    padding: .7rem .9rem;
    border-radius: 12px;
}

.pill strong {
    display: block;
    font-size: .95rem;
}

.pill span {
    color: var(--muted);
    font-size: .85rem;
}

/* ===== Avatar card (updated frame + glow) ===== */
.hero-card {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, color-mix(in oklab, var(--bg-soft) 80%, transparent), transparent), var(--card);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    transform: translateZ(0);
}

.avatar-wrap {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1/1;
    height: 220px;
    border-radius: 18px;
    padding: 10px;
    background: linear-gradient(180deg, color-mix(in oklab, var(--bg-soft) 85%, transparent), transparent), var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 0;
    /* create stacking context */
}

.avatar-wrap::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: conic-gradient(from 120deg, var(--brand), var(--brand-2), var(--brand));
    filter: blur(28px);
    opacity: .35;
    animation: spin 18s linear infinite;
    z-index: 1;
    /* behind the image */
    pointer-events: none;
}

@keyframes spin {
    to {
        transform: rotate(1turn);
    }
}

.avatar {
    position: relative;
    z-index: 2;
    /* above both pseudo-elements */
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 38%;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
    /* keep the mask commented unless you want the fade */
    /* -webkit-mask-image: radial-gradient(120% 120% at 55% 45%, #000 75%, transparent 100%);
     mask-image: radial-gradient(120% 120% at 55% 45%, #000 75%, transparent 100%); */
}

.avatar-wrap::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--text) 6%, transparent),
        inset 0 0 24px rgba(0, 0, 0, .25);
    z-index: 1;
    /* behind the image */
    pointer-events: none;
}

@media (max-width: 980px) {
    .avatar-wrap {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .avatar-wrap {
        height: 180px;
    }
}

@media (pointer: fine) {
    .avatar {
        transition: transform .25s var(--ease);
        transform-style: preserve-3d;
    }

    .avatar-wrap:hover .avatar {
        transform: translateZ(0) scale(1.02);
    }
}

.quick {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .45rem;
}

.quick li {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.quick i {
    opacity: .9;
}

/* scroll hint */
.scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    width: 26px;
    height: 44px;
    border: 2px solid color-mix(in oklab, var(--text) 50%, transparent);
    border-radius: 18px;
    opacity: .6;
}

.scroll-hint .wheel {
    position: absolute;
    left: 50%;
    top: 8px;
    width: 4px;
    height: 8px;
    transform: translateX(-50%);
    background: color-mix(in oklab, var(--text) 70%, transparent);
    border-radius: 4px;
    animation: wheel 1.6s ease-in-out infinite;
}

@keyframes wheel {
    0% {
        transform: translate(-50%, 0);
    }

    60% {
        transform: translate(-50%, 12px);
    }

    100% {
        transform: translate(-50%, 0);
    }
}

@media (max-width: 980px) {
    .hero-inner {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .hero-cta .btn {
        width: 100%;
        justify-content: center;
    }

    .mini-counters {
        gap: .5rem;
    }
}

/* ===== Sections ===== */
section {
    padding: clamp(2.2rem, 2.6vw + 1.2rem, 4rem) 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 0 1.2rem;
    font-size: clamp(1.4rem, 1.2vw + 1rem, 1.8rem);
}

.section-title .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 0 0 6px color-mix(in oklab, var(--brand) 20%, transparent);
}

.muted {
    color: var(--muted);
}

/* ===== Services ===== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 1020px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.svc {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: var(--shadow);
    transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}

.svc:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: color-mix(in oklab, var(--brand) 35%, var(--border));
}

.svc i {
    font-size: 1.3rem;
    opacity: .9;
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    margin-left: .5rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(var(--brand), var(--brand-2));
    border-radius: 2px;
    opacity: .6;
}

.t-item {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1.2rem;
}

.t-item::before {
    content: "";
    position: absolute;
    left: 3px;
    top: .35rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-soft);
    border: 2px solid var(--brand);
}

.t-item h4 {
    margin: 0 0 .1rem;
}

.t-item .when {
    font-size: .9rem;
    color: var(--muted);
}

/* ===== Contact ===== */
.contact-card {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: var(--radius);
    padding: 1.2rem;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 880px) {
    .contact-card {
        grid-template-columns: 1fr;
    }
}

form .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .7rem;
}

@media (max-width: 620px) {
    form .row {
        grid-template-columns: 1fr;
    }
}

input,
textarea {
    width: 100%;
    padding: .9rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

input:focus,
textarea:focus {
    border-color: color-mix(in oklab, var(--brand) 40%, var(--border));
    box-shadow: 0 0 0 6px color-mix(in oklab, var(--brand) 15%, transparent);
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.note {
    font-size: .9rem;
    color: var(--muted);
}

/* ===== Footer ===== */
footer {
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .8rem;
    padding: 1.2rem 0;
    flex-wrap: wrap;
}

.links {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}

.social {
    display: flex;
    gap: .6rem;
}

.social a {
    display: inline-flex;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
    text-decoration: none;
}

.chip-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    text-decoration: none;
    font-weight: 600;
    font-size: .92rem;
    padding: .5rem .7rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
}

.credit {
    color: var(--muted);
    font-size: .92rem;
}

/* ===== Reveal animations ===== */
[data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .6s var(--ease), transform .6s var(--ease);
}

[data-reveal].visible {
    opacity: 1;
    transform: none;
}

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

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
    }
}

#projects {
    padding: 5rem 0;
}

.projects-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.project {
    padding: 1.6rem;
    border-radius: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    transition: transform .3s ease;
}

.project:hover {
    transform: translateY(-6px);
}

.project-links {
    margin-top: 1rem;
}

.project .btn {
    font-size: .9rem;
}