/* ============================================================
   Personal Portfolio — Refined Reading Experience
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #fafbfc;
    --surface: #ffffff;
    --border: #e1e4e8;
    --text: #24292f;
    --text-muted: #656d76;
    --accent: #0550ae;
    --accent-soft: rgba(5, 80, 174, 0.06);
    --max-width: 1040px;
    --radius: 10px;
    --font-body: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", Consolas, monospace;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 500; background: var(--text); color: var(--surface); padding: .6rem .9rem; border-radius: 0 0 8px 8px; }
.skip-link:focus { top: 0; }

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; }

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* ── Fade-in on load ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
main { animation: fadeUp 0.6s ease-out; }

/* ============================================================
   Header — Clean & Fixed
   ============================================================ */
.site-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .container { display: flex; justify-content: space-between; align-items: center; min-height: 54px; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-size: 1.05rem; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.logo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #fff; background: linear-gradient(135deg, #0550ae, #8250df); font-size: .9rem; }
.logo:hover { color: var(--accent); text-decoration: none; }
.site-header nav { display: flex; align-items: center; gap: 1.25rem; }
.site-header nav a { color: var(--text-muted); font-size: 0.92rem; font-weight: 500; transition: color 0.2s; }
.site-header nav a:hover { color: var(--text); text-decoration: none; }
.site-header nav a.is-active { color: var(--text); position: relative; }
.site-header nav a.is-active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -.7rem; height: 2px; border-radius: 2px; background: var(--accent); }

.nav-home { color: #0550ae !important; }
.nav-blog { color: #1a7f37 !important; }
.nav-projects { color: #8250df !important; }
.nav-about { color: #bf8700 !important; }
.nav-resume { color: #cf222e !important; font-weight: 600 !important; font-size: 0.92rem !important; }
.nav-resume:hover { color: #a0111f !important; text-decoration: none; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
    padding: 5.5rem 0 4.5rem; display: flex; align-items: center; min-height: 68vh;
    position: relative; overflow: hidden;
    background: url('/static/hero-bg.jpg') center / cover no-repeat;
}
.hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 3rem; }
.hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.2) 100%); z-index: 0; }
.hero-text { flex: 1; position: relative; z-index: 1; }
.eyebrow { color: rgba(255,255,255,.7); font-size: .75rem; font-weight: 700; letter-spacing: .16em; margin-bottom: 1rem; }
.hero-text h1 { font-size: 2.6rem; font-weight: 800; line-height: 1.2; margin-bottom: 0.75rem; letter-spacing: -1px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.hero-text h1 .wave { display: inline-block; animation: wave 2s ease-in-out infinite; }
@keyframes wave { 0%,100%{transform:rotate(0)} 25%{transform:rotate(20deg)} 50%{transform:rotate(0)} 75%{transform:rotate(-20deg)} }
.hero-tagline { font-size: 1.2rem; color: rgba(255,255,255,0.8); margin-bottom: 0.5rem; min-height: 1.8em; }
.hero-tagline .cursor { display: inline-block; width: 2px; height: 1.2em; background: #fff; margin-left: 2px; vertical-align: text-bottom; animation: blink 0.8s step-end infinite; }
@keyframes blink { 50%{opacity:0} }
.hero-bio { font-size: 1.05rem; color: rgba(255,255,255,0.7); margin-bottom: 1.75rem; max-width: 480px; line-height: 1.8; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn-secondary { border-color: rgba(255,255,255,0.6); color: #fff; }
.hero .btn-secondary:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,0.1); text-decoration: none; }

.btn-primary, .btn-secondary {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.65rem 1.5rem; border-radius: 8px; font-weight: 600; font-size: 0.95rem; transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; border: none; }
.btn-primary:hover { background: #033d8b; color: #fff; transform: translateY(-1px); text-decoration: none; }
.btn-secondary { border: 2px solid var(--border); color: var(--text); background: transparent; }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); text-decoration: none; }

.hero-image { flex-shrink: 0; width: 180px; height: 180px; border-radius: 50%; overflow: hidden; border: 3px solid rgba(255,255,255,0.2); position: relative; z-index: 1; }
.hero-image::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid transparent; background: linear-gradient(135deg, #0550ae, #8250df) border-box; -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0); mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.hero-image img { width: 100%; height: 100%; object-fit: cover; }
.hero-stats { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }
.hero-stats div { min-width: 135px; padding: .7rem .85rem; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; background: rgba(0,0,0,.18); backdrop-filter: blur(8px); }
.hero-stats strong, .hero-stats span { display: block; }
.hero-stats strong { color: #fff; font-size: .86rem; }
.hero-stats span { color: rgba(255,255,255,.62); font-size: .75rem; margin-top: .15rem; }

/* ============================================================
   Section Titles
   ============================================================ */
.section { padding: 2.5rem 0; }
.section-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.5rem; letter-spacing: -0.3px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============================================================
   Card (generic)
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.04); transition: box-shadow 0.2s, border-color 0.2s; }
.card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.06); border-color: #c6cdd5; }

/* ============================================================
   Article Cards (blog listing)
   ============================================================ */
.article-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.03); transition: box-shadow 0.2s, transform 0.2s; }
.article-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); transform: translateY(-2px); }
.article-card h3 { margin-bottom: 0.35rem; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.2px; }
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--accent); text-decoration: none; }
.article-card .meta { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }
.article-card .summary { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0.65rem; line-height: 1.7; }
.article-card .tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ============================================================
   Tags
   ============================================================ */
.tag { background: rgba(5, 80, 174, 0.06); color: var(--accent); padding: 0.15rem 0.6rem; border-radius: 4px; font-size: 0.8rem; font-weight: 500; transition: all 0.2s; }
.tag:hover { background: var(--accent); color: #fff; text-decoration: none; }
.tag.cloud { font-size: 0.85rem; padding: 0.3rem 0.8rem; }
.tag.cloud.active { background: var(--accent); color: #fff; }

/* ============================================================
   Article Content — The Reading Experience
   ============================================================ */
.article-content { padding: 1rem 0; }
.article-content h1 { font-size: 1.9rem; font-weight: 800; margin: 2rem 0 1rem; letter-spacing: -0.5px; }
.article-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 0.75rem; padding-left: 0.75rem; border-left: 3px solid var(--accent); color: var(--text); }
.article-content h3 { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 0.6rem; }
.article-content p { margin-bottom: 1.1rem; color: var(--text-muted); line-height: 1.85; }
.article-content strong { color: var(--text); font-weight: 700; }

/* ── Images ── */
.article-content img { max-width: 100%; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin: 1rem 0; }

/* ── Blockquote ── */
.article-content blockquote {
    border-left: 3px solid var(--accent); padding: 0.75rem 1.25rem;
    margin: 1.25rem 0; background: rgba(5, 80, 174, 0.03);
    border-radius: 0 8px 8px 0; color: var(--text-muted);
    font-style: italic; line-height: 1.8;
}

/* ── Code ── */
.article-content code {
    background: #f3f4f6; padding: 0.15rem 0.45rem; border-radius: 3px;
    font-family: var(--font-mono); font-size: 0.88em; color: #cf222e;
}
.article-content pre {
    background: #1b1f24; border: 1px solid #2c313a; border-radius: 10px;
    padding: 1.25rem; overflow-x: auto; margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.article-content pre code { background: none; padding: 0; color: #e6edf3; font-size: 0.9rem; }

/* ── Lists ── */
.article-content ul, .article-content ol { margin: 0.5rem 0 1.25rem 1.5rem; color: var(--text-muted); line-height: 1.8; }
.article-content li { margin-bottom: 0.25rem; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.95rem; }
.article-content th { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 2px solid var(--accent); font-weight: 700; }
.article-content td { padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--border); color: var(--text-muted); }

/* ── Article Nav ── */
.article-nav { display: flex; justify-content: space-between; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

/* ============================================================
   Page Header
   ============================================================ */
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.4rem; letter-spacing: -0.5px; }
.page-header p { color: var(--text-muted); font-size: 1.05rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading .section-title { margin-bottom: 0; }
.section-heading > a { color: var(--accent); font-size: .88rem; font-weight: 600; }
.split-section { display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: center; }
.section-lead { color: var(--text-muted); line-height: 1.8; margin-bottom: 1.25rem; }
.mini-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.mini-metrics div { padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.mini-metrics strong, .mini-metrics span { display: block; }
.mini-metrics strong { color: var(--accent); font-size: 1.35rem; }
.mini-metrics span { color: var(--text-muted); font-size: .8rem; margin-top: .25rem; }

/* ============================================================
   Intro Card (Home)
   ============================================================ */
.intro-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; margin-bottom: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.intro-card h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.6rem; }
.intro-card p { color: var(--text-muted); font-size: 1.05rem; line-height: 1.75; }

/* ============================================================
   Skills Grid
   ============================================================ */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.65rem; }
.skill-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem; text-align: center; transition: all 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.skill-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 3px 10px rgba(0,0,0,0.05); }
.skill-card .icon { font-size: 1.6rem; margin-bottom: 0.3rem; }
.skill-card .name { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   Project Cards
   ============================================================ */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (max-width: 600px) { .projects-grid { grid-template-columns: 1fr; } }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.03); transition: all 0.25s; }
.project-card:hover { text-decoration: none; color: var(--text); }
.project-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.06); }
.project-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }
.project-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.project-card .desc { color: var(--text-muted); font-size: 0.9rem; flex: 1; margin-bottom: 0.9rem; line-height: 1.7; }
.project-links { display: flex; gap: 1rem; font-size: 0.9rem; }

/* ============================================================
   Insights list (Home)
   ============================================================ */
.insight-list { list-style: none; }
.insight-list li { border-bottom: 1px solid var(--border); padding: 0.8rem 0; display: flex; align-items: center; gap: 1rem; transition: padding 0.2s; }
.insight-list li:hover { padding-left: 0.5rem; }
.insight-list .date { color: var(--text-muted); font-size: 0.82rem; white-space: nowrap; min-width: 5.5rem; }
.insight-list .title { color: var(--text); font-size: 1rem; flex: 1; font-weight: 500; }
.insight-list .arrow { color: var(--text-muted); transition: color 0.2s; }
.insight-list li:hover .arrow { color: var(--accent); }

/* ============================================================
   Resume
   ============================================================ */
.resume-header { display: flex; justify-content: space-between; align-items: flex-start; }
.resume-header h1 { font-size: 2.3rem; margin-bottom: .35rem; }
.resume-contact { margin-top: .7rem; font-size: .9rem; }
.resume-contact a { color: var(--accent); }
.resume-layout { display: flex; gap: 2rem; align-items: flex-start; }
.resume-main { flex: 1; }
.resume-side { flex-shrink: 0; margin-top: -110px; }
.resume-avatar { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border); }
.resume-side-card { display: grid; gap: .55rem; width: 160px; margin-top: 1rem; padding: .9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: .82rem; line-height: 1.5; }
.resume-side-card strong { font-size: .86rem; }
.resume-side-card a { color: var(--accent); font-weight: 600; }
.resume-section { margin-bottom: 2rem; }
.resume-section h2 { font-size: 1.2rem; font-weight: 700; border-bottom: 2px solid var(--accent); padding-bottom: 0.4rem; margin-bottom: 0.9rem; }
.resume-item { margin-bottom: 1.1rem; }
.resume-item-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.resume-item h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.15rem; }
.resume-item .date { color: var(--text-muted); font-size: 0.82rem; }
.resume-item p { color: var(--text-muted); line-height: 1.7; }
.resume-item ul { margin: .55rem 0 0 1.2rem; color: var(--text-muted); line-height: 1.7; }
.skill-list { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.skill-item { background: rgba(5, 80, 174, 0.06); color: var(--text); padding: 0.3rem 0.8rem; border-radius: 4px; font-size: 0.88rem; font-weight: 500; }
.about-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.25rem; margin-bottom: 2rem; }
.intro-card { padding: 1.5rem; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 24px rgba(0,0,0,.04); }
.intro-card h2 { margin: .35rem 0 .7rem; }
.intro-card p { color: var(--text-muted); line-height: 1.8; }
.accent-card { background: linear-gradient(145deg, rgba(5,80,174,.08), var(--surface)); }
.strength-list { display: grid; gap: .8rem; margin-top: 1rem; }
.strength-list div { display: grid; gap: .15rem; padding-left: .8rem; border-left: 3px solid var(--accent); }
.strength-list strong { font-size: .92rem; }
.strength-list span { color: var(--text-muted); font-size: .82rem; line-height: 1.5; }
.about-content h2 { margin-top: 2rem; }
.timeline { display: grid; gap: 1rem; margin: 1rem 0 1.5rem; }
.timeline-item { display: grid; grid-template-columns: 125px 1fr; gap: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.timeline-date { color: var(--accent); font-size: .82rem; font-weight: 700; }
.timeline-item h3 { font-size: 1rem; margin-bottom: .3rem; }
.timeline-item p { color: var(--text-muted); line-height: 1.7; }
.workflow-list { margin: 1rem 0 1.5rem 1.3rem; color: var(--text-muted); line-height: 1.9; }
.workflow-list strong { color: var(--text); }
.about-cta { margin-top: 2rem; padding: 1rem 1.2rem; border-radius: 12px; background: rgba(5,80,174,.06); color: var(--text-muted); }
.about-cta a { color: var(--accent); font-weight: 600; }

/* ============================================================
   Policy pages
   ============================================================ */
.policy-content p { margin-bottom: 1rem; color: var(--text-muted); line-height: 1.8; }
.policy-content h2 { font-size: 1.2rem; font-weight: 700; margin: 1.5rem 0 0.6rem; padding-left: 0.6rem; border-left: 3px solid var(--accent); }

/* ============================================================
   Back to Top
   ============================================================ */
#back-to-top { position: fixed; bottom: 2rem; right: 2rem; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 1.1rem; cursor: pointer; opacity: 0; transform: translateY(10px); transition: all 0.3s; pointer-events: none; z-index: 200; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
#back-to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#back-to-top:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   Status pages / Demo fallback
   ============================================================ */
.status-card {
    max-width: 680px;
    margin: 3rem auto;
    padding: clamp(2rem, 6vw, 4rem) 2rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .08);
}
.status-icon { font-size: 3rem; margin-bottom: 1rem; }
.status-card .eyebrow { color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .16em; margin-bottom: .6rem; }
.status-card h1 { margin-bottom: .8rem; }
.status-card > p:not(.eyebrow):not(.status-hint) { color: var(--text-muted); line-height: 1.8; }
.status-actions { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; margin: 1.5rem 0 1rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .65rem 1rem; border-radius: 9px; text-decoration: none; font-weight: 600; }
.button-primary { background: var(--accent); color: var(--surface); }
.button-primary:hover { color: var(--surface); text-decoration: none; filter: brightness(.95); }
.button-secondary { border: 1px solid var(--border); color: var(--text); }
.button-secondary:hover { color: var(--accent); text-decoration: none; border-color: var(--accent); }
.status-hint { color: var(--text-muted); font-size: .82rem; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 2rem 0; margin-top: auto; }
.footer-content { text-align: center; }
.footer-social { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 0.75rem; }
.footer-social a { color: var(--text-muted); font-size: 0.92rem; font-weight: 500; }
.footer-social a:hover { color: var(--accent); text-decoration: none; }
.footer-info p { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 0.25rem; }
.footer-info a { font-size: 0.82rem; color: var(--text-muted); }
.footer-info a:hover { color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 700px) {
    .hero-inner { flex-direction: column-reverse; text-align: center; gap: 1.5rem; }
    .hero { padding: 3.5rem 0 3rem; }
    .hero-text h1 { font-size: 1.9rem; }
    .hero-bio { max-width: 100%; }
    .hero-actions { justify-content: center; }
    .hero-stats { justify-content: center; text-align: left; }
    .hero-image { width: 140px; height: 140px; }
    .site-header .container { flex-direction: column; gap: 0.6rem; }
    .resume-layout { flex-direction: column; }
    .resume-side { margin-top: 0; display: flex; justify-content: center; }
    .resume-avatar { width: 120px; height: 120px; }
    .resume-side-card { width: min(100%, 280px); }
    .resume-item-heading { display: block; }
    .resume-item .date { display: block; margin-top: .2rem; }
    .about-grid { grid-template-columns: 1fr; }
    .timeline-item { grid-template-columns: 1fr; gap: .35rem; }
    .split-section { grid-template-columns: 1fr; gap: 1.25rem; }
    .section-heading { align-items: flex-start; }
    .article-nav { flex-direction: column; gap: 0.5rem; }
    .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
    .site-header .container { align-items: flex-start; gap: .7rem; }
    .site-header nav { width: 100%; justify-content: space-between; gap: .55rem; }
    .site-header nav a { font-size: .8rem; }
    .site-header nav a.is-active::after { bottom: -.45rem; }
    .hero-text h1 { font-size: 1.75rem; }
    .hero-stats div { min-width: 0; flex: 1 1 42%; }
}

/* ============================================================
   Auto Dark Mode (system preference, no interaction needed)
   ============================================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1117;
        --surface: #161b22;
        --border: #30363d;
        --text: #e6edf3;
        --text-muted: #8b949e;
        --accent: #58a6ff;
        --accent-soft: rgba(88, 166, 255, 0.08);
    }
    .site-header { background: rgba(22, 27, 34, 0.92); }
    .site-footer { background: var(--surface); }
    .article-content code { background: #21262d; color: #f0883e; }
    .article-content pre { background: #0d1117; border-color: #30363d; box-shadow: none; }
    .article-content img { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
    .card, .article-card, .project-card, .skill-card, .intro-card { box-shadow: none; }
    .card:hover, .article-card:hover, .project-card:hover { box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.15); }
    .tag { background: rgba(88, 166, 255, 0.1); }
    .skill-item { background: rgba(88, 166, 255, 0.1); }
    .article-content blockquote { background: rgba(88, 166, 255, 0.04); }
    .btn-secondary { border-color: var(--border); color: var(--text); }
    ::-webkit-scrollbar-thumb { background: #484f58; }
    .section-title::after { background: var(--border); }
}
