/* ===== Design tokens ===== */
:root {
    /* base (light) */
    --bg: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --primary: #2563eb;
    --primary-contrast: #ffffff;
    --surface: #f8fafc;
    --surface-2: #eef2ff;
    --border: #e2e8f0;
    --shadow: 0 1px 2px rgba(2, 6, 23, .06), 0 8px 24px rgba(2, 6, 23, .08);
    --radius: 16px;
    --maxw: 72rem;
    --cert-pill-width: clamp(260px, 44ch, 420px);
    --focus: 2px dashed var(--primary);
    --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    --nav-offset: 1rem; /* matches sticky nav height to align section anchors */
    color-scheme: light dark;
    /* respect system by default */
}

/* system dark */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1020;
        --text: #e5e7eb;
        --muted: #a1a1aa;
        --primary: #82aaff;
        --primary-contrast: #000000;
        --surface: #0f172a;
        --surface-2: #111827;
        --border: #1f2937;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .5);
    }
}

/* manual overrides */
:root[data-theme="light"] {
    --bg: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --primary: #2563eb;
    --primary-contrast: #ffffff;
    --surface: #f8fafc;
    --surface-2: #eef2ff;
    --border: #e2e8f0;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0b1020;
    --text: #e5e7eb;
    --muted: #a1a1aa;
    --primary: #82aaff;
    --primary-contrast: #000000;
    --surface: #0f172a;
    --surface-2: #111827;
    --border: #1f2937;
    color-scheme: dark;
}

/* ===== Base + a11y ===== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    accent-color: var(--primary);
}

body {
    margin: 0;
    font-family: var(--font);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    text-rendering: optimizeLegibility;
}

a {
    color: var(--primary);
    text-decoration: none;
    position: relative;
    transition: color .2s ease;
}

a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -.25em;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #38bdf8));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .2s ease, opacity .2s ease;
    opacity: 0;
}

a:hover,
a:focus-visible {
    color: color-mix(in srgb, var(--primary) 80%, #38bdf8 20%);
}

a:hover::after,
a:focus-visible::after {
    transform: scaleX(1);
    opacity: 1;
}

a.btn::after,
a.icon-btn::after,
a.brand::after,
.section-title__link::after,
.badge::after,
.nav-list a::after {
    display: none;
}

.nav-list a {
    position: relative;
    overflow: hidden;
}

.nav-list a::before {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: .2rem;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform .2s ease, opacity .2s ease;
    opacity: 0;
}

.nav-list a:hover::before,
.nav-list a:focus-visible::before,
.nav-list .active a::before {
    transform: scaleX(1);
    opacity: .85;
}

img {
    max-width: 100%;
    height: auto;
}

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 0;
    top: 0;
    transform: translateY(-120%);
    background: var(--primary);
    color: var(--primary-contrast);
    padding: .5rem .75rem;
    border-bottom-right-radius: 10px;
    z-index: 9999;
}

.skip-link:focus {
    transform: translateY(0);
}

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

.section {
    padding-block: clamp(3rem, 6vw, 5rem);
}

section {
    scroll-margin-top: var(--nav-offset);
}

.section-title {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.section-title__icon {
    width: 1.75rem;
    height: 1.75rem;
    color: var(--primary);
    flex-shrink: 0;
}

.section-title__icon--projects {
    width: 2.1rem;
    height: 2.1rem;
    filter: drop-shadow(0 8px 18px rgba(37, 99, 235, .25));
}

.section-title__icon--about {
    width: 2rem;
    height: 2rem;
    filter: drop-shadow(0 10px 20px rgba(56, 189, 248, .25));
}

.section-title__link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .25rem .6rem;
    margin-left: .2rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border) 75%);
    font-size: .85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.section-title__link:hover,
.section-title__link:focus-visible {
    color: var(--primary-contrast);
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: 0 6px 18px rgba(37, 99, 235, .25);
}

/* ===== Header & nav ===== */
header {
    background: linear-gradient(180deg, var(--surface) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}

.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(1.2) blur(8px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1rem;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    color: inherit;
    font-weight: 800;
    letter-spacing: .2px;
    flex: 1 1 auto;
    min-width: 0;
    margin-right: auto;
}

.brand-name {
    white-space: nowrap;
    font-size: clamp(1rem, 3.2vw, 1.35rem);
}

.brand-links {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: 0;
    margin: 0;
    list-style: none;
    flex: 0 0 auto;
    margin-left: auto;
    flex-shrink: 0;
}

.brand-links .icon-btn {
    width: 36px;
    height: 36px;
}

.brand-mark {
    position: relative;
    display: grid;
    place-items: center;
    width: clamp(36px, 3vw, 44px);
    height: clamp(36px, 3vw, 44px);
    border-radius: 50%;
    overflow: hidden;
    isolation: isolate;
    color: var(--primary-contrast);
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: none;
    font-size: .95rem;
    background: color-mix(in srgb, var(--surface) 80%, var(--primary) 20%);
    box-shadow: 0 6px 18px rgba(37, 99, 235, .28), inset 0 0 12px rgba(14, 165, 233, .35);
    animation: brandPulse 3.8s ease-in-out infinite;
    font-size: clamp(.85rem, 2.4vw, 1.05rem);
    z-index: 0;
}

.brand-mark::before {
    content: "";
    position: absolute;
    inset: -60%;
    background: conic-gradient(from 0deg, #2563eb, #6366f1, #0ea5e9, #ef4444, #2563eb);
    animation: brandSpin 8s linear infinite;
    opacity: .9;
    z-index: -2;
    pointer-events: none;
    mix-blend-mode: screen;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 12%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 28% 30%, rgba(255, 255, 255, .6) 0 20%, rgba(255, 255, 255, 0) 60%),
        radial-gradient(circle at 72% 64%, rgba(148, 163, 184, .45) 0 18%, rgba(15, 23, 42, 0) 52%),
        radial-gradient(circle at 32% 75%, rgba(14, 165, 233, .55) 0 12%, rgba(14, 165, 233, 0) 45%),
        radial-gradient(circle at 68% 18%, rgba(239, 68, 68, .48) 0 10%, rgba(239, 68, 68, 0) 42%);
    box-shadow: inset 0 0 22px rgba(15, 23, 42, .4);
    opacity: .9;
    mix-blend-mode: screen;
    z-index: -1;
    pointer-events: none;
    animation: brandDataPulse 5.4s ease-in-out infinite;
}

.nav-list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: clamp(.5rem, 2vw, 1rem);
    padding: 0;
    margin: 0;
    margin-left: auto;
}

.nav-list a {
    text-decoration: none;
    color: inherit;
    padding: .5rem .75rem;
    border-radius: 999px;
}

.nav-list a:hover {
    background: var(--surface);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: 1rem;
}

.menu-toggle .icon-close {
    display: none;
}

.menu-toggle[aria-expanded="true"] .icon-close {
    display: inline;
}

.menu-toggle[aria-expanded="true"] .icon-menu {
    display: none;
}

@media (max-width: 720px) {
    .nav-inner {
        flex-wrap: wrap;
        align-items: center;
        row-gap: .75rem;
    }

    .nav-controls {
        order: 2;
        margin-left: auto;
    }

    .nav-list {
        order: 3;
        width: 100%;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: .25rem;
        padding: .75rem;
        border-radius: 14px;
        background: color-mix(in srgb, var(--bg) 94%, transparent);
        box-shadow: var(--shadow);
        display: flex;
    }

    .has-js .nav-list {
        display: none;
    }

    .has-js .nav-list.is-open {
        display: flex;
    }

    .nav-list a {
        width: 100%;
        padding: .75rem;
        border-radius: 10px;
    }
}

/* theme toggle */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.menu-toggle {
    display: none;
}

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

@media (hover: hover) {
    .icon-btn:hover {
        background: var(--surface);
        border-color: transparent;
        box-shadow: var(--shadow);
        transform: translateY(-1px);
    }
}

.icon-btn:focus-visible {
    background: var(--surface);
    border-color: transparent;
    box-shadow: var(--shadow);
}

.theme-toggle {
    margin-left: .5rem;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

@media (hover: hover) {
    .theme-toggle:hover {
        background: var(--primary);
        color: var(--primary-contrast);
        border-color: transparent;
        box-shadow: var(--shadow);
        transform: translateY(-1px);
    }
}

.theme-toggle:focus-visible {
    background: var(--primary);
    color: var(--primary-contrast);
    border-color: transparent;
    box-shadow: var(--shadow);
}

.theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: inline;
}

/* When following system (no explicit data-theme), prefer showing moon in light context, sun in dark context */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .theme-toggle .icon-moon {
        display: none;
    }

    :root:not([data-theme]) .theme-toggle .icon-sun {
        display: inline;
    }
}

/* ===== Hero ===== */
.hero {
    padding-block: clamp(2rem, 6vw, 4rem);
    display: grid;
    gap: 1rem;
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    line-height: 1.2;
    margin: 0;
}

.lead {
    color: var(--muted);
    margin: 0;
    font-size: clamp(1rem, 2vw, 1.125rem);
}

.animated-name {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
    gap: .06em;
    font-variant-ligatures: none;
    isolation: isolate;
}

.animated-name::before {
    content: "";
    position: absolute;
    inset: -40% -12%;
    background:
        repeating-linear-gradient(90deg, rgba(37, 99, 235, .18) 0 1px, transparent 1px 8px),
        repeating-linear-gradient(0deg, rgba(14, 165, 233, .12) 0 10px, transparent 10px 20px);
    opacity: .35;
    mix-blend-mode: screen;
    filter: blur(.5px);
    animation: dataSweep 6s linear infinite;
    pointer-events: none;
    z-index: -2;
}

.animated-name::after {
    content: "";
    position: absolute;
    inset: 70% -6% -30%;
    border-radius: 999px;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 18%, rgba(14, 165, 233, .35) 0 18%, transparent 42%),
        radial-gradient(circle at 66% 60%, rgba(239, 68, 68, .22) 0 20%, transparent 48%),
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, .38), rgba(14, 116, 144, 0) 65%);
    opacity: .55;
    filter: blur(22px);
    transform: translate3d(0, 0, 0);
    animation: dataGlow 5.5s ease-in-out infinite;
    z-index: -1;
}

.animated-name--hero {
    gap: .1em;
}

.animated-name--hero::after {
    inset: 72% -10% -35%;
    opacity: .72;
}

.animated-name .char {
    position: relative;
    display: inline-block;
    font-weight: 800;
    line-height: 1;
    transform-origin: 50% 80%;
    color: var(--primary);
    letter-spacing: .01em;
    --pulse-duration: 2.8s;
    --pulse-delay: 0s;
    --char-tilt: 0deg;
    animation: charPulse var(--pulse-duration) ease-in-out var(--pulse-delay) infinite;
    will-change: transform;
    z-index: 1;
}

.animated-name .char--space {
    width: .6em;
    animation: none;
    background: none !important;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .animated-name .char {
        color: transparent;
        background: linear-gradient(135deg, #2563eb 0%, #6366f1 25%, #0ea5e9 50%, #ef4444 75%, #2563eb 100%);
        background-size: 280% 280%;
        -webkit-background-clip: text;
        background-clip: text;
        animation:
            charPulse var(--pulse-duration) ease-in-out var(--pulse-delay) infinite,
            gradientShift 6s ease-in-out infinite,
            dataFlicker 2.2s steps(3, end) calc(var(--pulse-delay) * -1) infinite;
    }
}

.animated-name .char:nth-child(3n+1) {
    --pulse-duration: 2.4s;
    --pulse-delay: -.25s;
}

.animated-name .char:nth-child(3n+2) {
    --pulse-duration: 3.3s;
    --pulse-delay: -.6s;
}

.animated-name .char:nth-child(4n+3) {
    --pulse-duration: 2.9s;
    --pulse-delay: -.4s;
}

.animated-name .char:nth-child(5n) {
    --pulse-duration: 3.6s;
    --pulse-delay: -.85s;
}

.animated-name .char:nth-child(odd) {
    --char-tilt: -2.4deg;
}

.animated-name .char:nth-child(even) {
    --char-tilt: 2.9deg;
}

.animated-name .char:nth-child(4n) {
    --char-tilt: -.8deg;
}

@media (prefers-reduced-motion: reduce) {

    .animated-name::before,
    .animated-name::after {
        animation: none;
    }

    .animated-name .char {
        animation: none !important;
        transform: none;
        background-position: 50% 50%;
    }
}

.actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: .75rem;
}

.actions-social {
    display: flex;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 999px;
    padding: .75rem 1rem;
    box-shadow: var(--shadow);
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

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

.btn.ghost {
    background: transparent;
    color: inherit;
    border: 1px solid var(--border);
}

@media (hover: hover) {
    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(2, 6, 23, .15);
    }

    .btn.primary:hover {
        background: color-mix(in srgb, var(--primary) 88%, black);
    }

    .btn.ghost:hover {
        background: color-mix(in srgb, var(--surface) 70%, var(--primary) 10%);
        border-color: var(--primary);
    }
}

.btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(2, 6, 23, .15);
    border-color: var(--primary);
}

.back-to-top:hover,
.back-to-top:focus-visible {
    transform: translateX(-50%);
}

/* ===== About ===== */
.about {
    display: grid;
    gap: 1.25rem;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: 0;
    margin: .25rem 0 0;
    list-style: none;
}

.badge {
    --badge-accent: var(--primary);
    font-size: .875rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: .35rem .6rem;
    border-radius: 999px;
    text-decoration: none;
    color: inherit;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.badge-skill {
    --badge-start: var(--badge-accent);
    --badge-end: color-mix(in srgb, var(--badge-accent) 60%, #ffffff 40%);
    --badge-contrast: #ffffff;
    background: linear-gradient(135deg, var(--badge-start), var(--badge-end));
    border: none;
    color: var(--badge-contrast);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .18);
    letter-spacing: .01em;
    font-weight: 600;
    position: relative;
}

.badge-skill::after {
    content: "";
    position: absolute;
    inset: .1rem;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0));
    opacity: .6;
    pointer-events: none;
}

.badge-skill--data {
    --badge-accent: #2563eb;
}

.badge-skill--ml {
    --badge-accent: #8b5cf6;
}

.badge-skill--time {
    --badge-accent: #0ea5e9;
}

.badge-skill--cluster {
    --badge-accent: #f97316;
}

.badge-skill--craft {
    --badge-accent: #22c55e;
}

.badge-skill--sixsigma {
    --badge-accent: #2563eb;
}

.badge-skill--python {
    --badge-accent: #f59e0b;
}

.badge-skill--numpy {
    --badge-accent: #4f46e5;
}

.badge-skill--pandas {
    --badge-accent: #ec4899;
}

.badge-skill--matplotlib {
    --badge-accent: #6366f1;
}

.badge-skill--seaborn {
    --badge-accent: #38bdf8;
}

.badge-skill--sklearn {
    --badge-accent: #facc15;
}

.badge-skill--tensorflow {
    --badge-accent: #fb7185;
}

.badge-skill--pytorch {
    --badge-accent: #ef4444;
}

.badge-skill--rest {
    --badge-accent: #2563eb;
}

.badge-skill--oop {
    --badge-accent: #14b8a6;
}

.badge-skill--sql {
    --badge-accent: #1d4ed8;
}

.badge-skill--java {
    --badge-accent: #d946ef;
}

.badge-skill--csharp {
    --badge-accent: #9333ea;
}

.badge-skill--c {
    --badge-accent: #0ea5e9;
}

.badge-cert {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding-left: .6rem;
    background: color-mix(in srgb, var(--surface) 85%, var(--badge-accent) 15%);
    border-color: color-mix(in srgb, var(--border) 65%, var(--badge-accent) 35%);
    justify-content: flex-start;
}

.badge-cert__icon {
    width: 1.1rem;
    height: 1.1rem;
    color: var(--badge-accent);
    flex-shrink: 0;
}

#certifications .badges {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: flex-start;
}

#certifications .badge-cert {
    flex: 1 1 clamp(260px, 100%, var(--cert-pill-width));
    inline-size: clamp(260px, 100%, var(--cert-pill-width));
    max-inline-size: 100%;
}

.badge-cert--aws {
    --badge-accent: #7c3aed;
}

.badge-cert--microsoft {
    --badge-accent: #0078d4;
}

.badge-cert--google {
    --badge-accent: #f4b400;
}

.badge-cert--cs50 {
    --badge-accent: #a51c30;
}

.badge-cert__icon {
    color: var(--badge-accent);
}

.badge-cert__icon path,
.badge-cert__icon rect,
.badge-cert__icon circle {
    fill: currentColor;
    stroke: currentColor;
}

.badge-cert .badge-cert__icon {
    color: var(--badge-accent);
}

.badge-cert[aria-label] {
    text-decoration: none;
}

@media (hover: hover) {
    .badge:hover {
        background: color-mix(in srgb, var(--surface-2) 70%, var(--badge-accent) 20%);
        border-color: color-mix(in srgb, var(--badge-accent) 60%, var(--border) 40%);
        box-shadow: 0 8px 22px rgba(15, 23, 42, .15);
        transform: translateY(-2px);
    }
}

/* ===== Projects ===== */
.stage-grid {
    display: grid;
    gap: clamp(1.2rem, 3vw, 1.75rem);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    margin-top: clamp(1.5rem, 4vw, 2rem);
}

.stage-card {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    border-radius: calc(var(--radius) - 4px);
    box-shadow: var(--shadow);
    padding: clamp(1.1rem, 2.5vw, 1.5rem);
    display: grid;
    gap: .75rem;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.stage-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, .18), rgba(99, 102, 241, .18), rgba(14, 165, 233, .12), rgba(239, 68, 68, .12));
    opacity: .85;
    pointer-events: none;
    z-index: -1;
}

.stage-card__header {
    display: grid;
    align-self: start;
    grid-template-columns: auto 1fr;
    gap: .65rem;
    align-items: center;
}

.stage-card__heading {
    display: grid;
    gap: .15rem;
}

.stage-card__meta {
    font-size: .8125rem;
    font-weight: 600;
    text-transform: none;
    font-size: .95rem;
    letter-spacing: .08em;
    color: color-mix(in srgb, var(--muted) 85%, var(--primary) 15%);
}

.stage-card h3 {
    margin: 0;
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
}

.stage-card p {
    margin: 0;
    color: var(--muted);
}

.stage-card__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: .5rem;
}

.stage-card__list li {
    font-size: .95rem;
    line-height: 1.4;
}

.stage-card__list strong {
    color: var(--text);
}

.stage-card__icon {
    inline-size: clamp(42px, 7vw, 52px);
    block-size: clamp(42px, 7vw, 52px);
    border-radius: 18px;
    display: grid;
    place-items: center;
    align-self: start;
    background: linear-gradient(135deg, rgba(37, 99, 235, .25), rgba(14, 165, 233, .2));
    box-shadow: 0 10px 24px rgba(15, 23, 42, .18);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.stage-card__icon svg {
    width: 65%;
    height: 65%;
    fill: none;
    stroke: #f8fafc;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stage-card__icon::after {
    content: "";
    position: absolute;
    inset: 12%;
    border-radius: 16px;
    background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .32), rgba(255, 255, 255, 0) 60%);
    opacity: .7;
    pointer-events: none;
}

.stage-card__icon--frontend {
    background: linear-gradient(135deg, rgba(37, 99, 235, .35), rgba(56, 189, 248, .28));
}

.stage-card__icon--frontend svg rect:first-child {
    stroke-width: 1.6;
}

.stage-card__icon--frontend svg rect {
    fill: rgba(248, 250, 252, .85);
    stroke: none;
}

.stage-card__icon--frontend svg rect:first-child {
    fill: rgba(15, 23, 42, .18);
}

.stage-card__icon--backend {
    background: linear-gradient(135deg, rgba(99, 102, 241, .35), rgba(168, 85, 247, .28));
}

.stage-card__icon--backend svg rect {
    stroke-width: 1.4;
}

.stage-card__icon--backend svg circle {
    fill: rgba(248, 250, 252, .85);
    stroke: none;
}

.stage-card__icon--monitoring {
    background: linear-gradient(135deg, rgba(14, 165, 233, .32), rgba(59, 130, 246, .22));
}

.stage-card__icon--monitoring svg polyline {
    stroke-width: 2.1;
}

.stage-card__icon--monitoring svg rect,
.stage-card__icon--monitoring svg path:last-child {
    stroke-width: 1.5;
    opacity: .8;
}

.stage-card__icon--realtime {
    background: linear-gradient(135deg, rgba(45, 212, 191, .28), rgba(56, 189, 248, .25));
}

.stage-card__icon--realtime svg path {
    stroke-width: 1.8;
}

.stage-card__icon--realtime svg circle {
    fill: rgba(248, 250, 252, .9);
    stroke: none;
}

.stage-card__icon--predictive {
    background: linear-gradient(135deg, rgba(236, 72, 153, .3), rgba(168, 85, 247, .26));
}

.stage-card__icon--predictive svg path:first-child {
    stroke-width: 1.6;
}

.stage-card__icon--predictive svg path,
.stage-card__icon--predictive svg circle {
    stroke-width: 1.5;
}

.stage-card__icon--predictive svg circle {
    fill: rgba(248, 250, 252, .9);
    stroke: none;
}

.stage-card__icon--ops {
    background: linear-gradient(135deg, rgba(37, 99, 235, .32), rgba(239, 68, 68, .28));
}

.stage-card__icon--ops svg path:first-child {
    stroke-width: 1.7;
}

.stage-card__icon--ops svg path:nth-child(2),
.stage-card__icon--ops svg path:nth-child(3) {
    stroke-width: 1.6;
}

.stage-card__icon--ops svg circle {
    fill: rgba(248, 250, 252, .9);
    stroke: none;
}

.stage-card__icon svg path,
.stage-card__icon svg polyline {
    animation: stageIconPulse 4.5s ease-in-out infinite;
}

.stage-card__icon--frontend svg rect:nth-child(2) {
    animation: stageIconPulse 5s ease-in-out infinite;
}

.stage-card__icon--frontend svg rect:nth-child(3) {
    animation: stageIconPulse 4s ease-in-out infinite;
}

.stage-card__icon--frontend svg rect:nth-child(4) {
    animation: stageIconPulse 5.5s ease-in-out infinite;
}

.stage-card__icon--backend svg rect:nth-child(1) {
    animation-delay: -.3s;
}

.stage-card__icon--backend svg rect:nth-child(2) {
    animation-delay: -.6s;
}

.stage-card__icon--backend svg rect:nth-child(3) {
    animation-delay: -.9s;
}

.stage-card__icon--backend svg circle {
    animation: stageIconGlow 3.8s ease-in-out infinite;
}

.stage-card__icon--monitoring svg polyline {
    animation-delay: -.4s;
}

.stage-card__icon--monitoring svg rect,
.stage-card__icon--monitoring svg path {
    animation-delay: -.9s;
}

.stage-card__icon--realtime svg path:nth-child(2) {
    animation-delay: -.2s;
}

.stage-card__icon--realtime svg path:nth-child(3) {
    animation-delay: -.4s;
}

.stage-card__icon--realtime svg path:nth-child(4) {
    animation-delay: -.6s;
}

.stage-card__icon--realtime svg path:nth-child(5) {
    animation-delay: -.8s;
}

.stage-card__icon--predictive svg path:first-child {
    animation: stageIconPulse 5.2s ease-in-out infinite;
}

.stage-card__icon--predictive svg circle {
    animation: stageIconGlow 3.5s ease-in-out infinite;
}

.stage-card__icon--ops svg path:first-child {
    animation: stageIconPulse 4.8s ease-in-out infinite;
}

.stage-card__icon--ops svg circle {
    animation: stageIconGlow 3.6s ease-in-out infinite;
}

.stage-note {
    margin-top: clamp(1.75rem, 4vw, 2.5rem);
    font-size: .95rem;
    color: var(--muted);
}

.stage-note a {
    font-weight: 600;
}

@media (max-width: 640px) {
    .stage-card__list li {
        font-size: .92rem;
    }
}

@keyframes stageIconPulse {

    0%,
    100% {
        transform: translateY(0);
        opacity: 1;
    }

    40% {
        transform: translateY(-6%);
        opacity: .95;
    }

    60% {
        transform: translateY(4%);
        opacity: .88;
    }
}

@keyframes stageIconGlow {

    0%,
    100% {
        opacity: .9;
        transform: scale(1);
    }

    45% {
        opacity: 1;
        transform: scale(1.07);
    }

    70% {
        opacity: .78;
        transform: scale(.96);
    }
}

@keyframes charPulse {

    0%,
    100% {
        transform: rotate(var(--char-tilt)) translateY(0) scale(1);
    }

    28% {
        transform: rotate(calc(var(--char-tilt) * .6)) translateY(-4%) scale(1.15);
    }

    52% {
        transform: rotate(calc(var(--char-tilt) * -1)) translateY(6%) scale(.87);
    }

    76% {
        transform: rotate(calc(var(--char-tilt) * .4)) translateY(-3%) scale(1.08);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes dataFlicker {

    0%,
    100% {
        opacity: 1;
    }

    40% {
        opacity: .9;
    }

    70% {
        opacity: .8;
    }

    80% {
        opacity: 1;
    }
}

@keyframes dataSweep {
    0% {
        transform: translate3d(0, 0, 0);
        background-position: 0 0, 0 0;
    }

    100% {
        transform: translate3d(-3%, -3%, 0);
        background-position: 120px 0, 0 120px;
    }
}

@keyframes dataGlow {

    0%,
    100% {
        opacity: .55;
        filter: blur(22px);
    }

    45% {
        opacity: .78;
        filter: blur(18px);
    }

    70% {
        opacity: .5;
        filter: blur(26px);
    }
}

@keyframes brandSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes brandPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 6px 18px rgba(37, 99, 235, .28), inset 0 0 12px rgba(14, 165, 233, .35);
    }

    45% {
        transform: scale(1.08);
        box-shadow: 0 10px 22px rgba(99, 102, 241, .32), inset 0 0 16px rgba(14, 165, 233, .42);
    }

    70% {
        transform: scale(.96);
        box-shadow: 0 4px 14px rgba(37, 99, 235, .22), inset 0 0 10px rgba(14, 165, 233, .28);
    }
}

@keyframes brandDataPulse {

    0%,
    100% {
        transform: rotate(0deg) scale(1);
        opacity: .9;
    }

    40% {
        transform: rotate(6deg) scale(1.05);
        opacity: 1;
    }

    65% {
        transform: rotate(-4deg) scale(.96);
        opacity: .82;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stage-card__icon svg * {
        animation: none !important;
        transform: none;
    }
}

/* ===== Footer ===== */
footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1rem;
    flex-wrap: wrap;
}

.social {
    display: flex;
    gap: .5rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.back-to-top {
    position: fixed;
    bottom: clamp(1.25rem, 4vw, 2.5rem);
    left: 50%;
    transform: translateX(-50%);
    transform-origin: center;
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    padding: .55rem 1.25rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(12px);
    letter-spacing: .08em;
    font-weight: 600;
    gap: .45rem;
    display: inline-flex;
    align-items: center;
    transition: opacity .25s ease, visibility .25s ease, background-color .2s ease, border-color .2s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    animation: backToTopPulse 6s ease-in-out infinite;
}

@keyframes backToTopPulse {
  0%, 100% { box-shadow: 0 18px 36px rgba(15, 23, 42, 0.35); }
  50% { box-shadow: 0 22px 44px rgba(37, 99, 235, 0.32); }
}

@media (hover: hover) {
  .back-to-top.is-visible:hover,
  .back-to-top.is-visible:focus-visible {
    background: rgba(37, 99, 235, 0.85);
    border-color: rgba(96, 165, 250, 0.5);
    color: #f8fafc;
  }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}


@media (max-width: 720px) {
    .nav-inner {
        padding: .7rem .7rem;
        align-items: center;
        gap: .55rem;
    }

    .brand-group {
        flex: 1 1 auto;
        min-width: 0;
        gap: .45rem;
        flex-wrap: nowrap;
        align-items: center;
    }

    .brand {
        flex: 0 1 auto;
        max-width: calc(100% - 120px);
    }

    .brand-name {
        font-size: clamp(.95rem, 3.2vw, 1.15rem);
    }

    .brand-links {
        gap: .22rem;
        flex-wrap: nowrap;
        margin-left: auto;
    }

    .brand-links .icon-btn {
        width: 28px;
        height: 28px;
    }

    .nav-controls {
        display: flex;
        align-items: center;
        gap: .35rem;
        flex: 0 0 auto;
        margin-left: auto;
    }

    .section {
        padding-block: clamp(2.4rem, 8vw, 3.4rem);
    }

    .hero {
        padding-block: clamp(1.8rem, 7vw, 2.6rem);
    }

    .hero h1 {
        font-size: clamp(1.6rem, 6vw, 2.2rem);
    }

    .lead {
        font-size: .98rem;
        max-width: 60ch;
    }

    .stage-grid {
        gap: 1.2rem;
        grid-template-columns: minmax(0, 1fr);
    }

    .stage-card {
        padding: 1rem;
    }

    .stage-card__icon {
        inline-size: clamp(40px, 10vw, 46px);
        block-size: clamp(40px, 10vw, 46px);
    }
}

@media (max-width: 540px) {
    .brand-group {
        justify-content: space-between;
        gap: .35rem;
    }

    .brand {
        max-width: calc(100% - 100px);
    }

    .brand-name {
        font-size: clamp(.9rem, 3.6vw, 1.05rem);
    }

    .brand-links {
        gap: .16rem;
    }

    .brand-links .icon-btn {
        width: 26px;
        height: 26px;
    }

    .hero h1 {
        font-size: clamp(1.5rem, 7vw, 2rem);
    }

    .animated-name::before {
        inset: -30% -12%;
    }

    .stage-card__list li {
        font-size: .95rem;
    }
}

@media (max-width: 420px) {
    .nav-inner {
        gap: .45rem;
        padding: .55rem .55rem;
    }

    .brand-group {
        gap: .3rem;
        flex-wrap: nowrap;
        align-items: center;
    }

    .brand {
        max-width: calc(100% - 88px);
    }

    .brand-name {
        font-size: clamp(.82rem, 4.5vw, .98rem);
    }

    .brand-links {
        gap: .12rem;
    }

    .brand-links .icon-btn {
        width: 24px;
        height: 24px;
    }

    .container {
        width: min(100% - 1.25rem, var(--maxw));
    }

    .nav-list {
        width: 100%;
        gap: .5rem;
    }

    .hero h1 {
        font-size: clamp(1.4rem, 6.5vw, 1.9rem);
        line-height: 1.15;
    }

    .lead {
        font-size: .95rem;
    }

    .animated-name {
        gap: .03em;
    }

    .animated-name::before {
        inset: -22% -8%;
    }

    .animated-name::after {
        inset: 74% -6% -26%;
    }

    .animated-name .char {
        letter-spacing: 0;
    }

    .stage-card {
        padding: .9rem;
        gap: .6rem;
    }

    .stage-card__icon {
        inline-size: clamp(36px, 9vw, 42px);
        block-size: clamp(36px, 9vw, 42px);
    }

    .stage-card__meta {
        font-size: .75rem;
    }

    .stage-card h3 {
        font-size: clamp(1.05rem, 4.8vw, 1.2rem);
    }
}

@media (max-width: 600px) {
    .container {
        width: min(100% - 1.5rem, var(--maxw));
    }
}

@media (max-width: 540px) {
    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .actions .btn {
        justify-content: center;
        width: 100%;
    }

    .actions .social {
        justify-content: center;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}




@media (max-width: 720px) {
    #certifications .badge-cert {
        flex: 1 1 calc(50% - .5rem);
        inline-size: 100%;
    }
}

@media (max-width: 540px) {
    #certifications .badge-cert {
        flex: 1 1 100%;
        inline-size: 100%;
    }
}


@media (max-width: 720px) {
    #certifications .badges {
        gap: .6rem;
    }

    #certifications .badge-cert {
        flex: 1 1 calc(50% - .6rem);
        inline-size: calc(50% - .6rem);
    }
}

@media (max-width: 540px) {
    #certifications .badge-cert {
        flex: 1 1 100%;
        inline-size: 100%;
    }
}
