:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface-hover: #1a1a26;
    --border: #1e1e2e;
    --text: #e2e2e8;
    --text-muted: #8888a0;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --green: #22c55e;
    --green-soft: rgba(34, 197, 94, 0.12);
    --amber: #f59e0b;
    --amber-soft: rgba(245, 158, 11, 0.12);
    --coral: #f472b6;
    --coral-soft: rgba(244, 114, 182, 0.1);
    --mono: 'Space Mono', monospace;
    --sans: 'DM Sans', sans-serif;
}

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

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* ─── Noise overlay ─── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

/* ─── Hero ─── */
.hero {
    min-height: 50vh;
    display: flex;
    align-items: center;
    padding: 6rem 2rem 4rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40%; right: -20%;
    width: 700px; height: 700px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    filter: blur(80px);
    opacity: 0.4;
    animation: float 12s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-40px, 30px) scale(1.1); }
}

.hero-inner {
    max-width: 820px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero-label {
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.hero-label::before {
    content: '';
    width: 24px; height: 1px;
    background: var(--accent);
}

.hero h1 {
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

.hero h1 .highlight {
    background: linear-gradient(135deg, var(--accent), var(--coral));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-bio {
    font-size: 1.12rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 2rem;
}

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

.hero-links a {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.2s;
}

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

/* ─── Section layout ─── */
.section {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 2rem 5rem;
}

.section-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ─── Project cards ─── */
.project {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    position: relative;
}

.project:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.06);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.project h3 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.project-type {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    white-space: nowrap;
}

.type-agentic {
    color: var(--accent);
    background: var(--accent-soft);
}

.type-dl {
    color: var(--green);
    background: var(--green-soft);
}

.type-ml {
    color: var(--amber);
    background: var(--amber-soft);
}

.type-product {
    color: var(--coral);
    background: var(--coral-soft);
}

.type-research {
    color: #b8956a;
    background: rgba(184, 149, 106, 0.10);
}

.project-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.tech-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}

.tech-tag {
    font-family: var(--mono);
    font-size: 0.68rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
}

.project-details {
    margin-bottom: 1.5rem;
}

.project-details h4 {
    font-size: 0.82rem;
    font-family: var(--mono);
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.detail-list {
    list-style: none;
    padding: 0;
}

.detail-list li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.55rem;
    font-size: 0.92rem;
    color: var(--text);
}

.detail-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.8rem;
}

.project-links {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.project-links a {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--accent);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 5px;
    transition: all 0.2s;
}

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

/* ─── Project figure ─── */
.project-figure {
    margin: 1.5rem 0;
}
.project-figure img,
.project-figure video {
    width: 100%;
    border-radius: 4px;
    display: block;
}
.project-figure figcaption {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

/* ─── Side-by-side video pair ─── */
.video-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .video-pair { grid-template-columns: 1fr; }
}

.project-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem;
    font-style: italic;
}

.link-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Architecture diagram ─── */
.arch-diagram {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.8;
    overflow-x: auto;
    white-space: pre;
}

.arch-diagram .node { color: var(--accent); }
.arch-diagram .arrow { color: var(--text-muted); }
.arch-diagram .label { color: var(--green); }

/* ─── Embed container ─── */
.embed-container {
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.embed-container iframe {
    width: 100%;
    height: 650px;
    border: none;
    display: block;
}

/* ─── Experience / Education cards ─── */
.compact-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 640px) {
    .compact-section {
        grid-template-columns: 1fr;
    }
}

.compact-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.75rem;
}

.compact-card h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.compact-card .meta {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.compact-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ─── Footer ─── */
footer {
    text-align: center;
    padding: 3rem 2rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

/* ─── Animations ─── */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.6s ease forwards;
}

@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}

.project:nth-child(1) { animation-delay: 0.1s; }
.project:nth-child(2) { animation-delay: 0.2s; }
.project:nth-child(3) { animation-delay: 0.3s; }
.project:nth-child(4) { animation-delay: 0.4s; }
.project:nth-child(5) { animation-delay: 0.5s; }

/* ─── Status badge ─── */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--green);
    margin-bottom: 1rem;
}

.status::before {
    content: '';
    width: 6px; height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

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