:root {
    --bg: #0a0e17;
    --bg-alt: #111827;
    --bg-card: #151d2e;
    --border: #1f2937;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --primary: #06b6d4;
    --primary-hover: #0891b2;
    --primary-glow: rgba(6, 182, 212, 0.15);
    --accent: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --font: 'Inter', system-ui, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --header-h: 72px;
    --container: 1120px;
    --transition: 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

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

.container-narrow { max-width: 760px; }

.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: #000;
    border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-weight: 600;
}
.logo:hover { color: var(--text); }
.logo-mark {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--primary);
    background: var(--primary-glow);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.site-nav a {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
.site-nav a:hover,
.site-nav a.is-active { color: var(--text); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    transition: var(--transition);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-primary {
    background: var(--primary);
    color: #0a0e17;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #0a0e17;
}
.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

/* Hero */
.hero {
    padding: 4rem 0 5rem;
    background:
        radial-gradient(ellipse 80% 60% at 50% -20%, var(--primary-glow), transparent),
        var(--bg);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
    margin: 0 0 1rem;
    font-weight: 700;
}

.hero-lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 540px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.hero-stats span {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.code-window {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.code-window-bar {
    display: flex;
    gap: 6px;
    padding: 0.75rem 1rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
}
.code-window-bar span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}
.code-window-bar span:nth-child(1) { background: #ef4444; }
.code-window-bar span:nth-child(2) { background: #f59e0b; }
.code-window-bar span:nth-child(3) { background: #10b981; }

.code-window pre {
    margin: 0;
    padding: 1.25rem;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.7;
}
.code-kw { color: var(--accent); }
.code-str { color: var(--primary); }

/* Sections */
.section {
    padding: 5rem 0;
}
.section-alt {
    background: var(--bg-alt);
}
.section-header {
    margin-bottom: 3rem;
}
.section-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.section-tag {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.section-header h2 {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    margin: 0;
    font-weight: 700;
}
.section-subtitle {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* About */
.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 3rem;
}
.about-text p { color: var(--text-muted); margin-top: 0; }
.about-text p + p { margin-top: 1rem; }

.about-highlights {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.about-highlights li {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.about-highlights strong {
    display: block;
    margin-bottom: 0.25rem;
}
.about-highlights span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-item {
    position: relative;
    padding-bottom: 2.5rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0.35rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--bg-alt);
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-content time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.timeline-content h3 {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.15rem;
}
.timeline-content p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}
.skill-group {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.skill-group h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
}

.tag-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tag-list li {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
}
.tag-list-sm li { font-size: 0.75rem; padding: 0.25rem 0.6rem; }

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}
.project-card {
    padding: 1.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition), transform var(--transition);
}
.project-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.project-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
}
.project-card h3 {
    margin: 0.5rem 0;
    font-size: 1.15rem;
}
.project-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 1rem;
}

/* Blog */
.page-hero {
    padding: 4rem 0 2rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
}
.page-hero h1 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    margin: 0.5rem 0;
}
.page-hero-lead {
    color: var(--text-muted);
    max-width: 560px;
    margin: 0;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}
.blog-card {
    padding: 1.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}
.blog-card time {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
}
.blog-card h2,
.blog-card h3 {
    margin: 0.75rem 0;
    font-size: 1.15rem;
    line-height: 1.35;
}
.blog-card h2 a,
.blog-card h3 a { color: var(--text); }
.blog-card h2 a:hover,
.blog-card h3 a:hover { color: var(--primary); }
.blog-card p {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 1rem;
}
.card-link {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Blog preview (index) */
.blog-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}
.blog-preview-list li + li {
    border-top: 1px solid var(--border);
}
.blog-preview-list a {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    color: var(--text);
    transition: background var(--transition);
}
.blog-preview-list a:hover {
    background: var(--bg-alt);
    color: var(--text);
}
.blog-preview-list time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.blog-preview-title {
    font-weight: 500;
    line-height: 1.4;
}
.blog-preview-list a:hover .blog-preview-title {
    color: var(--primary);
}
.blog-preview-arrow {
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: transform var(--transition), color var(--transition);
}
.blog-preview-list a:hover .blog-preview-arrow {
    color: var(--primary);
    transform: translateX(3px);
}
.blog-preview-empty {
    margin: 0;
    padding: 1.25rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

@media (max-width: 600px) {
    .blog-preview-list a {
        grid-template-columns: 1fr auto;
        gap: 0.5rem 1rem;
    }
    .blog-preview-list time {
        grid-column: 1 / -1;
    }
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Post single */
.post-header {
    padding: 3rem 0 2rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
}
.back-link {
    display: inline-block;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}
.back-link:hover { color: var(--primary); }
.post-header time {
    display: block;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.post-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin: 0;
    line-height: 1.2;
}

.post-content {
    padding: 3rem 0;
    font-size: 1.05rem;
    line-height: 1.8;
}
.post-content h2, .post-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}
.post-content p { color: var(--text-muted); }
.post-content ul, .post-content ol {
    color: var(--text-muted);
    padding-left: 1.5rem;
}
.post-content code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: var(--bg-card);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}
.post-content pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    overflow-x: auto;
}
.post-content pre code {
    background: none;
    padding: 0;
}
.post-content img {
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

/* Comments */
.comments-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.comment-item {
    padding: 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.comment-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}
.comment-meta time { color: var(--text-muted); }
.comment-item p { margin: 0; color: var(--text-muted); }
.empty-comments { color: var(--text-muted); margin-bottom: 2rem; }

/* Forms */
.contact-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
}
.contact-form,
.comment-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.form-row label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.form-row input,
.form-row textarea,
.form-row select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition);
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    outline: none;
    border-color: var(--primary);
}
.form-row textarea { resize: vertical; min-height: 120px; }
.form-actions { display: flex; flex-direction: column; gap: 0.75rem; }
.form-feedback {
    font-size: 0.9rem;
    margin: 0;
    min-height: 1.4em;
}
.form-feedback.is-success { color: var(--success); }
.form-feedback.is-error { color: var(--danger); }

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.info-card {
    padding: 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.info-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}
.info-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Footer */
.site-footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
}
.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
}
.footer-name { font-weight: 700; margin: 0; }
.footer-role {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.footer-copy {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
    .hero-grid,
    .about-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }
    .hero-visual { order: -1; }
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .site-nav {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        flex-direction: column;
        padding: 1.5rem;
        background: var(--bg-alt);
        border-bottom: 1px solid var(--border);
        transform: translateY(-120%);
        opacity: 0;
        pointer-events: none;
        transition: transform var(--transition), opacity var(--transition);
    }
    .site-nav.is-open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    .section { padding: 3.5rem 0; }
    .section-header-row { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
