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

:root {
    --bg: #0a0e13;
    --bg-2: #0d1117;
    --bg-3: #111820;
    --bg-card: #0f1520;
    --bg-card-h: #141d2b;
    --border: #1e2d3d;
    --border-h: #2a3f55;
    --green: #30a46c;
    --green-dim: #1e6645;
    --green-glow: rgba(48, 164, 108, 0.15);
    --amber: #f0a429;
    --red: #e54d4d;
    --text: #cdd9e5;
    --text-dim: #768390;
    --text-dimmer: #444f5a;
    --code-bg: #080d12;

    --purple: #a78bfa;
    --purple-dim: #7c3aed;

    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-serif: 'Fraunces', Georgia, serif;

    --max-w: 1200px;
    --section-pad: 120px;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-h); }

.section-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--green);
    letter-spacing: 0.1em;
    margin-bottom: 16px;
    opacity: 0.85;
}

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 300;
    color: #e8edf2;
    line-height: 1.2;
    margin-bottom: 48px;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--green);
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.cursor-blink {
    animation: blink 1.1s step-end infinite;
    color: var(--green);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.btn-primary {
    display: inline-block;
    padding: 11px 28px;
    background: var(--green);
    color: #020810;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-primary:hover {
    background: #3dbd80;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(48, 164, 108, 0.3);
}

.btn-secondary {
    display: inline-block;
    padding: 11px 28px;
    background: transparent;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    border: 1px solid var(--border-h);
    border-radius: 4px;
    transition: border-color 0.2s, color 0.2s, transform 0.15s;
}

.btn-secondary:hover {
    border-color: var(--green);
    color: var(--green);
    transform: translateY(-1px);
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    background: rgba(48, 164, 108, 0.08);
    color: var(--green);
    border: 1px solid var(--green-dim);
    border-radius: 3px;
    font-family: var(--font-mono);
}

#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 14, 19, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

#navbar.scrolled {
    border-bottom-color: var(--border);
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 40px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: #e8edf2;
    letter-spacing: 0.05em;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 36px;
}

.nav-links a {
    font-size: 13px;
    color: var(--text-dim);
    transition: color 0.2s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--green);
    transition: width 0.2s;
}

.nav-links a:hover {
    color: var(--green);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    z-index: 99;
    padding: 20px 40px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s, opacity 0.25s;
}

.mobile-menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.mobile-menu ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-menu a {
    font-size: 15px;
    color: var(--text);
}

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: 100px 40px 80px;
}

.hero-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(30, 45, 61, 0.4) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(30, 45, 61, 0.4) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 100%);
    pointer-events: none;
}

.hero::before {
    content: '';
    position: absolute;
    top: -200px;
    left: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(48, 164, 108, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    max-width: var(--max-w);
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
}

.hero-terminal {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(48,164,108,0.05);
    animation: fadeSlideUp 0.7s ease both,
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #0c1219;
    border-bottom: 1px solid var(--border);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red    { background: #e54d4d; }
.dot.yellow { background: var(--amber); }
.dot.green  { background: var(--green); }

.terminal-title {
    margin-left: 8px;
    font-size: 12px;
    color: var(--text-dim);
}

.terminal-body {
    padding: 20px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.terminal-line {
    font-size: 13px;
    line-height: 1.6;
}

.t-prompt {
    color: var(--green);
    margin-right: 8px;
    user-select: none;
}

.t-cmd {
    color: #e8edf2;
}

.t-output {
    color: var(--text-dim);
    padding-left: 4px;
    margin-bottom: 6px;
}

.about-text {
    font-size: 13px;
    line-height: 1.7;
    padding-left: 4px;
    color: var(--text);
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 4px;
}

.skill-tag {
    font-size: 11px;
    padding: 3px 9px;
    background: rgba(48, 164, 108, 0.07);
    border: 1px solid var(--green-dim);
    border-radius: 3px;
    color: var(--green);
}

.hero-text {
    animation: fadeSlideUp 0.7s 0.15s ease both;
}

.hero-text-inner {
    display: flex;
    align-items: center;
    gap: 32px;
}

.hero-text-copy {
    flex: 1;
    min-width: 0;
}

.hero-photo-wrap {
    flex-shrink: 0;
    animation: portraitDrift 4s ease-in-out infinite;
}

@keyframes portraitDrift {
    0%, 100% {
        transform: translate3d(0px, 0px, 0px);
    }
    50% {
        transform: translate3d(0px, -4px, 0px);
    }
}

.hero-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--green-dim);
    box-shadow: 0 0 0 4px rgba(48, 164, 108, 0.08), 0 8px 32px rgba(0,0,0,0.4);
    display: block;
    transition: border-color 0.3s, box-shadow 0.3s;
    position: static;
}

.hero-photo:hover {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(48, 164, 108, 0.15), 0 8px 32px rgba(0,0,0,0.4);
}

.hero-name {
    font-family: var(--font-serif);
    font-size: clamp(48px, 6vw, 80px);
    font-weight: 300;
    line-height: 1.0;
    color: #e8edf2;
    margin-bottom: 20px;
}

.hero-name em {
    font-style: italic;
    color: var(--green);
}

.hero-sub {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 36px;
    max-width: 340px;
}

.hero-cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.featured-section {
    padding: var(--section-pad) 40px;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.featured-section::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(48,164,108,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.featured-inner {
    max-width: var(--max-w);
    margin: 0 auto;
}

.featured-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.featured-title {
    font-family: var(--font-mono);
    font-size: clamp(36px, 5vw, 64px);
    font-weight: 700;
    color: var(--green);
    line-height: 1;
    letter-spacing: -0.02em;
}

.featured-subtitle {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 300;
    color: var(--text-dim);
    font-style: italic;
    margin-top: 6px;
}

.featured-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
    padding-top: 8px;
}

.featured-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

.featured-description p {
    color: var(--text);
    line-height: 1.8;
    margin-bottom: 18px;
    font-size: 14px;
}

.featured-description p:last-of-type {
    margin-bottom: 28px;
}

.featured-link {
    color: var(--green);
    font-size: 13px;
    border-bottom: 1px solid var(--green-dim);
    padding-bottom: 2px;
    transition: border-color 0.2s, color 0.2s;
}

.featured-link:hover {
    border-color: var(--green);
}

.featured-code-block {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    position: sticky;
    top: 80px;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #080c10;
    border-bottom: 1px solid var(--border);
}

.code-lang {
    font-size: 11px;
    color: var(--green);
    font-weight: 700;
    letter-spacing: 0.08em;
}

.code-caption {
    font-size: 11px;
    color: var(--text-dimmer);
}

.code-content {
    padding: 20px;
    font-size: 12.5px;
    line-height: 1.75;
    overflow-x: auto;
    color: var(--text);
    white-space: pre;
}

.c-comment { color: #4a5f6f; }
.c-str     { color: var(--amber); }
.c-type    { color: #6eb9f7; }
.c-num     { color: #d5b3ff; }
.c-kw      { color: #e06c75; }

.projects-section {
    padding: var(--section-pad) 40px;
    max-width: calc(var(--max-w) + 80px);
    margin: 0 auto;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 72px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.2s, box-shadow 0.2s;
    will-change: transform;
}

.project-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.project-card:hover {
    border-color: var(--border-h);
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    transform: translateY(-2px);
}

.project-card--no-image .card-body {
    padding-top: 28px;
}

.card-image {
    position: relative;
    aspect-ratio: 16/8;
    overflow: hidden;
    background: var(--bg-3);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7) saturate(0.5);
    transition: filter 0.3s;
}

.project-card:hover .card-image img {
    filter: brightness(0.85) saturate(0.7);
}

.card-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background: linear-gradient(to top, rgba(8,13,18,0.9), transparent);
    font-size: 11px;
    color: var(--text-dim);
}

.card-body {
    padding: 22px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header-row h3 {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 400;
    color: #e8edf2;
    line-height: 1.2;
}

.card-rating {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--amber);
    background: rgba(240, 164, 41, 0.08);
    border: 1px solid rgba(240, 164, 41, 0.3);
    padding: 2px 8px;
    border-radius: 3px;
    white-space: nowrap;
}

.card-wip {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--green);
    background: rgba(48, 164, 108, 0.08);
    border: 1px solid var(--green-dim);
    padding: 2px 8px;
    border-radius: 3px;
}

.card-gh-link {
    color: var(--text-dimmer);
    flex-shrink: 0;
    transition: color 0.2s;
}

.card-gh-link:hover {
    color: var(--green);
}

.card-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.75;
}

.card-desc strong {
    color: var(--text);
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
}

.card-nn-vis {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 16px 8px;
    background: var(--code-bg);
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.nn-layer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 0 8px;
}

.nn-node {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-3);
    border: 1.5px solid var(--green-dim);
    flex-shrink: 0;
}

.nn-node--out {
    border-color: var(--green);
    background: rgba(48,164,108,0.2);
    box-shadow: 0 0 8px rgba(48,164,108,0.3);
}

.nn-lines {
    flex: 1;
    height: 100%;
}

.nn-lines svg {
    width: 100%;
    height: 100%;
}

.other-work {
    border-top: 1px solid var(--border);
    padding-top: 56px;
}

.other-work-title {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--green);
    margin-bottom: 28px;
    letter-spacing: 0.05em;
}

.other-work-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.other-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.other-card:hover {
    border-color: var(--border-h);
    background: var(--bg-card-h);
}

.other-card-name {
    font-size: 14px;
    color: #e8edf2;
    font-weight: 500;
}

.other-card-desc {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
    flex: 1;
}

.other-card-tag {
    font-size: 11px;
    color: var(--green);
    opacity: 0.7;
    margin-top: 4px;
}

.writing-section {
    padding: var(--section-pad) 40px;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
}

.writing-header {
    max-width: var(--max-w);
    margin: 0 auto 48px;
}

.writing-intro {
    font-size: 14px;
    color: var(--text-dim);
    max-width: 560px;
    line-height: 1.8;
}

.writing-intro a {
    color: var(--green);
    border-bottom: 1px solid var(--green-dim);
    padding-bottom: 1px;
    transition: border-color 0.2s;
}

.writing-intro a:hover {
    border-color: var(--green);
}

.writing-grid {
    max-width: var(--max-w);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 20px;
}

.writing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.2s, transform 0.2s;
    display: block;
}

.writing-card:hover {
    border-color: var(--border-h);
    transform: translateY(-2px);
}

.writing-card--featured {
    border-color: var(--green-dim);
    background: linear-gradient(135deg, var(--bg-card) 60%, rgba(48,164,108,0.05));
}

.writing-card--featured:hover {
    border-color: var(--green);
}

.writing-card-inner {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.writing-cat {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.writing-cat--tech {
    color: var(--green);
}

.writing-cat--self {
    color: var(--amber);
}

.writing-card h3 {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 400;
    color: #e8edf2;
    line-height: 1.3;
}

.writing-card p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.7;
    flex: 1;
}

.writing-read {
    font-size: 12px;
    color: var(--green);
    margin-top: auto;
}

.writing-footer {
    max-width: var(--max-w);
    margin: 36px auto 0;
}

.contact-section {
    padding: var(--section-pad) 40px;
    border-top: 1px solid var(--border);
}

.contact-inner {
    max-width: 640px;
    margin: 0 auto;
}

.contact-title {
    font-family: var(--font-serif);
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 300;
    color: #e8edf2;
    margin-bottom: 16px;
    line-height: 1.1;
}

.contact-sub {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.8;
    margin-bottom: 40px;
    max-width: 480px;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
}

.contact-link:hover {
    transform: translateX(4px);
}

.contact-link--email:hover {
    border-color: var(--green);
    color: var(--green);
    background: rgba(48,164,108,0.05);
}

.contact-link--gh:hover {
    border-color: #8b949e;
    color: #c9d1d9;
    background: rgba(139,148,158,0.1);
}

.contact-link--blog:hover {
    border-color: var(--amber);
    color: var(--amber);
    background: rgba(240,164,41,0.05);
}

.contact-link--li:hover {
    border-color: #3b82f6;
    color: #60a5fa;
    background: rgba(59,130,246,0.08);
}

.footer {
    padding: 24px 40px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-dimmer);
}

.footer a {
    color: var(--text-dimmer);
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--green);
}

.footer-sep {
    opacity: 0.4;
}

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1024px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .hero-terminal {
        order: 2;
    }

    .hero-text {
        order: 1;
    }

    .featured-body {
        grid-template-columns: 1fr;
    }

    .featured-code-block {
        position: static;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .other-work-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .writing-grid {
        grid-template-columns: 1fr 1fr;
    }

    .writing-card--featured {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    :root {
        --section-pad: 72px;
    }

    .nav-links {
        display: none;
    }

    .nav-hamburger {
        display: flex;
    }

    .mobile-menu {
        display: block;
    }

    .nav-inner {
        padding: 0 20px;
    }

    .hero {
        padding: 90px 20px 64px;
    }

    .featured-section,
    .projects-section,
    .writing-section,
    .contact-section {
        padding: var(--section-pad) 20px;
    }

    .featured-header {
        flex-direction: column;
    }

    .other-work-grid {
        grid-template-columns: 1fr;
    }

    .writing-grid {
        grid-template-columns: 1fr;
    }

    .writing-card--featured {
        grid-column: auto;
    }

    .footer {
        flex-direction: column;
        gap: 6px;
        padding: 20px;
    }

    .footer-sep {
        display: none;
    }

    .hero-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-text-inner {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .hero-photo {
        width: 110px;
        height: 110px;
        flex-shrink: 0;
    }

    .contact-link {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .hero-name {
        font-size: 40px;
    }

    .featured-title {
        font-size: 40px;
    }
}