:root {
    --bg:             #07101e;
    --bg-alt:         #0b1829;
    --surface:        #0f1e35;
    --surface-raised: #162844;
    --border:         rgba(56, 139, 253, 0.1);
    --border-bright:  rgba(56, 139, 253, 0.26);
    --text:           #c9d8f0;
    --muted:          #6b8aaa;
    --blue:           #3b8ef3;
    --blue-light:     #58a6ff;
    --online:         #3fb950;
    --offline:        #f85149;
    --shadow:         0 4px 32px rgba(0, 0, 0, 0.55);
    --radius-xl:      16px;
    --radius-lg:      12px;
    --radius-md:      8px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Arial, sans-serif;
    font-size: 1rem;
    color: var(--text);
    /* Dot-grid — no filter, no blur, GPU-cheap */
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 110% 45% at 50% 0%, rgba(59, 130, 246, 0.1) 0%, transparent 100%),
        radial-gradient(rgba(56, 139, 253, 0.13) 1px, transparent 1px);
    background-size: auto, 28px 28px;
}

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 8rem;
}

.hero {
    display: grid;
    gap: 2rem;
    align-items: center;
    grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.85fr);
    padding: 2.5rem 0 2.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 3rem;
}

/* Only project-card and chat-panel get the card surface */
.project-card,
.chat-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* hero-copy is plain text, no box */
.hero-copy {
    padding: 0;
}

/* hero-panel is a compact side card */
.hero-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    position: relative;
    overflow: hidden;
}

.eyebrow {
    margin: 0 0 0.75rem;
    font-family: "Cascadia Code", "Fira Code", ui-monospace, "Consolas", monospace;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--blue-light);
}

.eyebrow::before {
    content: "// ";
    opacity: 0.45;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.1;
    font-weight: 700;
    color: #dde8ff;
}

h1 {
    font-size: clamp(1.65rem, 2.8vw, 2.2rem);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
}

p,
li {
    line-height: 1.7;
    color: var(--muted);
}

.hero-lead {
    max-width: 58ch;
    margin: 0.85rem 0 0;
    font-size: 0.95rem;
    color: var(--text);
}

.hero-actions,
.chat-actions {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.chat-header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-shrink: 0;
}

.status-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}

.status-reason {
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.68rem;
    color: var(--muted);
    max-width: 16rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-actions {
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.button,
.project-link,
.chat-toggle,
.chat-close {
    border: 0;
    border-radius: var(--radius-md);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.button,
.chat-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.3rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 120ms ease, transform 120ms ease;
}

.button:hover,
.chat-toggle:hover,
.chat-close:hover,
.project-link:hover {
    transform: translateY(-1px);
}

.button--primary {
    background: var(--blue);
    color: #fff;
}

.button--primary:hover {
    background: var(--blue-light);
}

.button--ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-bright);
    transition: background-color 120ms ease, transform 120ms ease;
}

.button--ghost:hover {
    background: rgba(56, 139, 253, 0.08);
}

/* Subtle corner glow — radial-gradient only, no filter */
.hero-panel::after {
    content: "";
    position: absolute;
    bottom: -2.5rem;
    right: -2.5rem;
    width: 10rem;
    height: 10rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.14), transparent 70%);
    pointer-events: none;
}

.hero-points {
    margin: 0.75rem 0 0;
    padding-left: 1.4rem;
}

.hero-points li {
    padding: 0.15rem 0;
    font-size: 0.88rem;
    color: var(--text);
}

.hero-points li::marker {
    color: var(--blue);
}

.projects-section {
    padding-top: 1.2rem;
}

.section-heading {
    margin-bottom: 1.5rem;
}

.section-heading p:last-child {
    max-width: 62ch;
    margin-top: 0.75rem;
}

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

.project-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
    contain: content;
}

.project-media {
    position: relative;
    background: var(--bg-alt);
    aspect-ratio: 16 / 9;
}

.project-media iframe,
.project-fallback,
.project-preview {
    width: 100%;
    height: 100%;
    border: 0;
}

.project-preview {
    position: relative;
    display: block;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg);
}

.project-preview__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 200ms ease, opacity 200ms ease;
}

.project-preview:hover .project-preview__image,
.project-preview:focus-visible .project-preview__image {
    transform: scale(1.04);
    opacity: 0.85;
}

.project-preview__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(7, 16, 30, 0.72));
}

.project-preview__play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3.8rem;
    height: 3.8rem;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: rgba(59, 142, 243, 0.88);
    box-shadow: 0 8px 24px rgba(59, 142, 243, 0.4);
}

.project-preview__play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 54%;
    transform: translate(-50%, -50%);
    border-top: 0.6rem solid transparent;
    border-bottom: 0.6rem solid transparent;
    border-left: 0.95rem solid #fff;
}

.project-preview__label {
    position: absolute;
    left: 0.85rem;
    bottom: 0.85rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-md);
    background: rgba(7, 16, 30, 0.82);
    border: 1px solid var(--border);
    color: var(--blue-light);
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.project-preview:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: -4px;
}

.project-fallback {
    display: grid;
    place-items: center;
    padding: 1rem;
}

.project-content {
    padding: 1.2rem 1.35rem 1.5rem;
}

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

.project-link {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--blue-light);
    background: transparent;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-md);
    transition: background-color 120ms ease, transform 120ms ease;
}

.project-link:hover {
    background: rgba(56, 139, 253, 0.1);
}

.chat-toggle {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 20;
    border-radius: 999px;
    padding: 0.9rem 1.4rem;
    background: var(--blue);
    color: #fff;
    box-shadow: 0 4px 20px rgba(59, 142, 243, 0.35);
}

.chat-toggle:hover {
    background: var(--blue-light);
}

.chat-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 5.75rem;
    z-index: 20;
    display: flex;
    flex-direction: column;
    width: min(400px, calc(100% - 1.25rem));
    height: min(70vh, 600px);
    border-radius: var(--radius-xl);
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.chat-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-alt);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.chat-close {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: rgba(56, 139, 253, 0.08);
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    line-height: 1;
    transition: background-color 120ms ease, color 120ms ease;
}

.chat-close:hover {
    background: rgba(56, 139, 253, 0.16);
    color: var(--text);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.5rem;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-md);
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.status-badge--loading {
    background: rgba(56, 139, 253, 0.08);
    color: var(--muted);
}

.status-badge--online {
    background: rgba(63, 185, 80, 0.12);
    color: var(--online);
    border: 1px solid rgba(63, 185, 80, 0.2);
}

.status-badge--offline {
    background: rgba(248, 81, 73, 0.12);
    color: var(--offline);
    border: 1px solid rgba(248, 81, 73, 0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.message {
    max-width: 86%;
    padding: 0.85rem 1rem;
    border-radius: 14px;
}

.message p {
    margin: 0;
    font-size: 0.92rem;
    color: var(--text);
}

.message--assistant {
    align-self: flex-start;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message--user {
    align-self: flex-end;
    background: var(--blue);
    border-bottom-right-radius: 4px;
}

.message--user p {
    color: #fff;
}

.chat-form {
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--border);
}

.chat-form textarea {
    width: 100%;
    resize: none;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 0.92rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color 120ms ease;
}

.chat-form textarea:focus {
    outline: none;
    border-color: rgba(56, 139, 253, 0.4);
}

.chat-form textarea::placeholder {
    color: var(--muted);
}

.chat-actions {
    justify-content: space-between;
    margin-top: 0.75rem;
}

.chat-note {
    margin: 0;
    max-width: 24ch;
    font-size: 0.78rem;
    color: var(--muted);
}

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

code {
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: rgba(56, 139, 253, 0.1);
    border: 1px solid var(--border);
    font-family: "Cascadia Code", "Fira Code", ui-monospace, "Consolas", monospace;
    font-size: 0.88em;
    color: var(--blue-light);
}

/* ── Nav ─────────────────────────────────────────────── */

.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--blue-light);
    text-decoration: none;
    letter-spacing: 0.04em;
}

.nav-brand:hover {
    color: #fff;
}

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

.nav-link {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: color 120ms ease;
}

.nav-link:hover {
    color: var(--text);
}

.button--sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
}

/* ── Expertise ───────────────────────────────────────── */

.expertise-section {
    padding-bottom: 1rem;
}

.expertise-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.expertise-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.6rem;
    position: relative;
    overflow: hidden;
    transition: border-color 160ms ease;
}

.expertise-card:hover {
    border-color: var(--border-bright);
}

.expertise-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--blue), transparent);
    opacity: 0;
    transition: opacity 160ms ease;
}

.expertise-card:hover::before {
    opacity: 1;
}

.expertise-tag {
    margin: 0 0 0.85rem;
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--blue);
    letter-spacing: 0.14em;
}

.expertise-card h3 {
    margin-bottom: 0.65rem;
    font-size: 1.05rem;
}

.expertise-card p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.65;
}

/* ── Skills ──────────────────────────────────────────── */

.skills-section {
    padding: 1rem 0 2.5rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.skill-tag {
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.76rem;
    color: var(--text);
    white-space: nowrap;
    transition: border-color 120ms ease, color 120ms ease;
    user-select: none;
}

.skill-tag:hover {
    border-color: var(--border-bright);
    color: var(--blue-light);
}

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

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 1rem, 100%);
        padding-top: 1rem;
    }

    .nav-links {
        gap: 0.85rem;
    }

    .nav-link {
        display: none;
    }

    h1 {
        font-size: clamp(2.2rem, 12vw, 3.2rem);
    }

    .chat-panel {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 5.5rem;
        width: auto;
        height: min(72vh, 580px);
    }

    .chat-toggle {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .chat-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .chat-note {
        max-width: none;
    }
}