:root {
    color-scheme: dark light;
    --bg: #0e0e0e;
    --surface: #151515;
    --text: #eaeaea;
    --muted: #a8a8a8;
    --border: #2a2a2a;
    --accent: #7cc4ff;
    --accent-soft: rgba(124, 196, 255, 0.12);
    --hover: rgba(255, 255, 255, 0.04);
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #fafaf8;
        --surface: #ffffff;
        --text: #16161a;
        --muted: #55555e;
        --border: #dcdcd6;
        --accent: #0b5cad;
        --accent-soft: rgba(11, 92, 173, 0.09);
        --hover: rgba(0, 0, 0, 0.03);
    }
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 4rem;
}

body {
    margin: 0;
    overflow-x: clip;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--text);
    color: var(--bg);
    padding: 0.5rem 1rem;
    z-index: 100;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

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

.container {
    max-width: 960px;
    padding: 3rem 1.5rem;
    margin: 0 auto;
}

.cover-banner {
    --banner-bg: #0a0f1a;
    --banner-accent: #2dd4bf;
    --banner-text: #ffffff;
    --banner-muted: #8b98ad;
    position: relative;
    display: flex;
    align-items: center;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-top: -3rem;
    height: 240px;
    overflow: hidden;
    background:
        radial-gradient(circle at 85% 20%, rgba(45, 212, 191, 0.16), transparent 45%),
        linear-gradient(135deg, #0a0f1a 0%, #0f1b2d 100%);
    border-bottom: 1px solid var(--border);
}

.cover-text {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem 0 calc(1.5rem + 120px + 4rem);
    box-sizing: border-box;
}

.cover-rule {
    width: 48px;
    height: 4px;
    border-radius: 2px;
    background: var(--banner-accent);
    margin-bottom: 0.9rem;
}

.cover-title {
    font-family: var(--mono);
    font-size: clamp(1.6rem, 4.5vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--banner-text);
}

.cover-sub {
    margin-top: 0.5rem;
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: 600;
    color: var(--banner-accent);
}

.cover-stack {
    margin-top: 0.35rem;
    font-family: var(--mono);
    font-size: clamp(0.8rem, 2vw, 0.95rem);
    color: var(--banner-muted);
}

.cover-graph {
    position: absolute;
    top: 0;
    right: max(1.5rem, calc(50% - 480px));
    height: 100%;
    width: min(46%, 420px);
    opacity: 0.9;
}

.graph-lines path {
    fill: none;
    stroke: var(--banner-accent);
    stroke-width: 1;
    opacity: 0.45;
}

.graph-nodes circle {
    fill: var(--banner-accent);
}

.graph-nodes circle:nth-child(3) {
    filter: drop-shadow(0 0 6px var(--banner-accent));
}

.profile-img {
    position: relative;
    margin-top: -60px;
    border-radius: 50%;
    border: 3px solid var(--bg);
    margin-bottom: 1rem;
    object-fit: cover;
    background: var(--bg);
}

h1,
h2,
h3 {
    font-family: var(--mono);
}

h1 {
    font-size: 2.4rem;
    margin: 0 0 0.25rem;
}

h2 {
    font-size: 1.5rem;
    margin-top: 3.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

h3 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}

p {
    margin: 0.5rem 0;
    color: var(--muted);
}

ul {
    padding-left: 1.25rem;
    color: var(--muted);
}

li {
    margin-bottom: 0.5rem;
}

strong {
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

a:hover {
    border-bottom-color: var(--accent);
}

.meta {
    color: var(--muted);
    margin-bottom: 1rem;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3ecf8e;
}

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

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.links a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.links a:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.links a.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.links a.primary:hover {
    opacity: 0.85;
}

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding: 0.75rem 1.5rem;
    margin: 2rem -1.5rem 0;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.9rem;
    white-space: nowrap;
}

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

.nav a:hover {
    color: var(--text);
    border-bottom-color: transparent;
}

.project {
    position: relative;
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-areas:
        "img content"
        "img meta";
    column-gap: 1.5rem;
    margin: 1rem -1rem;
    padding: 1.25rem 1rem;
    border-radius: 10px;
    transition: background-color 0.2s ease;
}

.project:hover {
    background: var(--hover);
}

.project.featured {
    background: var(--surface);
    border: 1px solid var(--border);
}

.project.featured .project-links a:first-child {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.project.featured .project-links a:first-child:hover {
    opacity: 0.85;
}

.project-img {
    grid-area: img;
    align-self: start;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.project:hover .project-img {
    border-color: var(--muted);
}

.project-meta {
    grid-area: meta;
    min-width: 0;
}

.project-content {
    grid-area: content;
    min-width: 0;
}

.project-content p {
    margin: 0.35rem 0;
}

.badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 600;
    vertical-align: middle;
    color: var(--bg);
    background: var(--accent);
    border-radius: 4px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0;
    margin: 0.75rem 0 0;
    list-style: none;
}

.tags li {
    margin: 0;
    padding: 0.1rem 0.55rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.project-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.project-links a:first-child::after {
    content: "";
    position: absolute;
    inset: 0;
}

.project-links a:not(:first-child) {
    position: relative;
    z-index: 1;
}

.project-links a:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.experience-entry {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 1.25rem;
    border-left: 2px solid var(--border);
}

.experience-entry::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 0.5rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}

.experience-entry h3 {
    margin: 0;
    font-family: inherit;
    font-size: 1rem;
}

.experience-entry ul {
    margin-top: 0.5rem;
}

.exp-meta {
    font-size: 0.9rem;
    color: var(--muted);
}

.cert-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
    padding: 0;
    list-style: none;
}

.cert-list li {
    margin: 0;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.cert-list .exp-meta {
    display: block;
}

.stack-row {
    margin: 1rem 0;
}

.stack-row h3 {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stack-row .tags {
    margin-top: 0.4rem;
}

footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 600px) {
    .cover-banner {
        height: 170px;
    }

    .cover-text {
        padding: 0 1.5rem 50px;
    }

    .cover-graph {
        width: 55%;
        opacity: 0.4;
    }

    .cover-stack {
        display: none;
    }

    .profile-img {
        margin-top: -40px;
    }

    .project {
        grid-template-columns: 1fr;
        grid-template-areas:
            "img"
            "content"
            "meta";
        row-gap: 1rem;
    }

    .nav {
        gap: 1rem;
        scrollbar-width: none;
        mask-image: linear-gradient(to right, #000 85%, transparent);
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.3rem;
    }
}

@media print {
    .cover-banner,
    .nav,
    .links,
    .skip-link {
        display: none;
    }

    .profile-img {
        margin-top: 0;
    }

    :root {
        --bg: #fff;
        --text: #000;
        --muted: #333;
        --surface: #fff;
        --border: #bbb;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.project-content a {
    position: relative;
    z-index: 1;
}
