/* =========================================================
   Aurora theme · glass cards, moving glows, 3D hover
   Dark is the default; light is a soft pastel version.
   ========================================================= */

:root,
:root[data-theme="dark"] {
  --bg: #07060d;
  --bg-2: #0d0b18;
  --text: #f4f2fb;
  --muted: #a9a4bf;
  --faint: #6f6a86;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);

  --glass: rgba(22, 19, 38, 0.55);
  --glass-strong: rgba(28, 24, 48, 0.72);
  --glass-hi: rgba(255, 255, 255, 0.06);
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.65), 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 24px 60px -18px rgba(124, 92, 255, 0.45), 0 4px 14px -4px rgba(0, 0, 0, 0.6);

  --violet: #8b5cf6;
  --teal: #2dd4bf;
  --pink: #f472b6;
  --accent: #a78bfa;
  --accent-2: #5eead4;
  --grad: linear-gradient(110deg, #a78bfa 0%, #60a5fa 45%, #5eead4 100%);
  --grad-warm: linear-gradient(110deg, #f472b6 0%, #a78bfa 55%, #60a5fa 100%);

  --blob-1: rgba(139, 92, 246, 0.55);
  --blob-2: rgba(45, 212, 191, 0.38);
  --blob-3: rgba(244, 114, 182, 0.32);
  --grid-line: rgba(255, 255, 255, 0.035);

  --inline-code: rgba(167, 139, 250, 0.16);
  --code-bg: rgba(10, 9, 20, 0.86);

  --c-issue: #fda4af;   --c-issue-bg: rgba(244, 63, 94, 0.16);
  --c-feature: #93c5fd; --c-feature-bg: rgba(59, 130, 246, 0.16);
  --c-snippet: #c4b5fd; --c-snippet-bg: rgba(139, 92, 246, 0.18);
  --c-solution: #6ee7b7; --c-solution-bg: rgba(16, 185, 129, 0.16);
  --c-functional: #fcd34d; --c-functional-bg: rgba(245, 158, 11, 0.16);
  --c-concept: #67e8f9; --c-concept-bg: rgba(6, 182, 212, 0.16);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f4fb;
  --bg-2: #eef1fb;
  --text: #17142a;
  --muted: #5d5878;
  --faint: #8d88a6;
  --line: rgba(23, 20, 42, 0.09);
  --line-strong: rgba(23, 20, 42, 0.18);

  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-hi: rgba(255, 255, 255, 0.7);
  --shadow: 0 10px 34px -14px rgba(76, 58, 140, 0.28), 0 2px 6px -2px rgba(76, 58, 140, 0.12);
  --shadow-hover: 0 24px 56px -20px rgba(109, 72, 230, 0.38), 0 4px 12px -4px rgba(76, 58, 140, 0.16);

  --accent: #6d28d9;
  --accent-2: #0f9488;
  --grad: linear-gradient(110deg, #7c3aed 0%, #2563eb 50%, #0d9488 100%);
  --grad-warm: linear-gradient(110deg, #db2777 0%, #7c3aed 55%, #2563eb 100%);

  --blob-1: rgba(167, 139, 250, 0.45);
  --blob-2: rgba(94, 234, 212, 0.4);
  --blob-3: rgba(249, 168, 212, 0.42);
  --grid-line: rgba(23, 20, 42, 0.04);

  --inline-code: rgba(109, 40, 217, 0.09);
  --code-bg: #12101f;

  --c-issue: #be123c;   --c-issue-bg: rgba(244, 63, 94, 0.12);
  --c-feature: #1d4ed8; --c-feature-bg: rgba(59, 130, 246, 0.12);
  --c-snippet: #6d28d9; --c-snippet-bg: rgba(139, 92, 246, 0.13);
  --c-solution: #047857; --c-solution-bg: rgba(16, 185, 129, 0.13);
  --c-functional: #b45309; --c-functional-bg: rgba(245, 158, 11, 0.14);
  --c-concept: #0e7490; --c-concept-bg: rgba(6, 182, 212, 0.13);

  color-scheme: light;
}

:root {
  --radius: 20px;
  --radius-sm: 12px;
  --blur: 18px;
  --font-head: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .4s var(--ease), color .4s var(--ease);
}
::selection { background: rgba(167, 139, 250, .35); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; position: relative; }
.muted { color: var(--muted); }

/* ---------- Aurora background ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(1200px 700px at 50% -10%, var(--bg-2), var(--bg) 70%); }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .9; will-change: transform; }
.b1 { width: 620px; height: 620px; background: var(--blob-1); top: -180px; left: -140px; animation: drift1 22s ease-in-out infinite alternate; }
.b2 { width: 560px; height: 560px; background: var(--blob-2); top: 18%; right: -180px; animation: drift2 26s ease-in-out infinite alternate; }
.b3 { width: 520px; height: 520px; background: var(--blob-3); bottom: -220px; left: 25%; animation: drift3 30s ease-in-out infinite alternate; }
.grid-overlay { position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, #000 20%, transparent 75%); }
@keyframes drift1 { to { transform: translate(140px, 90px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-160px, 120px) scale(.92); } }
@keyframes drift3 { to { transform: translate(120px, -140px) scale(1.15); } }

/* ---------- Glass base ---------- */
.glass,
.card, .follow, .ask, .stat, .hl-card, .project, .pager a, .hero-panel, .article-shell, .about-panel {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
}

/* ---------- Header ---------- */
.site-header { position: sticky; top: 14px; z-index: 20; margin-top: 14px; }
.bar { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 12px 0 14px; border-radius: 999px; background: var(--glass-strong); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em; min-width: 0; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 0.78rem; font-weight: 800; box-shadow: 0 0 22px -4px var(--violet); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.93rem; padding: 7px 14px; border-radius: 999px; transition: color .2s, background .2s; }
.nav a:hover { color: var(--text); background: var(--glass-hi); }
.nav a.active { color: var(--text); background: var(--glass-hi); box-shadow: inset 0 0 0 1px var(--line-strong); }
.icon-btn { position: relative; width: 38px; height: 38px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--text); cursor: pointer; font-size: 1rem; overflow: hidden; transition: transform .3s var(--ease), border-color .2s; }
.icon-btn:hover { transform: rotate(20deg); border-color: var(--accent); }
.icon-btn span { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .45s var(--ease), opacity .3s; }
:root[data-theme="dark"] .i-sun { transform: translateY(120%); opacity: 0; }
:root[data-theme="light"] .i-moon { transform: translateY(-120%); opacity: 0; }

main.wrap { padding-top: 44px; padding-bottom: 80px; min-height: 70vh; }

/* ---------- Reveal + tilt ---------- */
.reveal { opacity: 0; transform: translateY(18px) scale(.985); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.tilt { transform-style: preserve-3d; transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; will-change: transform; }
.tilt:hover { box-shadow: var(--shadow-hover), inset 0 1px 0 var(--glass-hi); border-color: var(--line-strong); }
.tilt::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .10), transparent 45%); }
.tilt:hover::after { opacity: 1; }

/* ---------- Hero ---------- */
.hero { margin-bottom: 34px; }
.hero-panel { position: relative; overflow: hidden; padding: 40px 38px 34px; }
.hero-panel::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgba(167, 139, 250, .7), rgba(94, 234, 212, .25) 40%, transparent 65%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.hero-top { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.avatar { position: relative; width: 92px; height: 92px; flex: 0 0 auto; border-radius: 50%; padding: 3px; background: var(--grad-warm); box-shadow: 0 0 40px -8px var(--violet); animation: float 6s ease-in-out infinite; }
.avatar > * { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; object-fit: cover; background: var(--bg-2); color: var(--text); font-family: var(--font-head); font-weight: 800; font-size: 1.9rem; letter-spacing: -0.03em; }
.status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); padding: 5px 12px; border-radius: 999px; background: var(--glass-hi); border: 1px solid var(--line); }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: pulse 2.2s infinite; }
.eyebrow { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-2); letter-spacing: .06em; text-transform: uppercase; margin-top: 8px; }
.hero h1 { font-family: var(--font-head); font-weight: 800; letter-spacing: -0.045em; font-size: clamp(2.3rem, 7vw, 4.1rem); line-height: 1.02; margin: 22px 0 14px; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% auto; animation: shine 8s linear infinite; }
.hero p.lead { max-width: 60ch; color: var(--muted); font-size: 1.08rem; margin: 0 0 22px; }
.link-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pill-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; text-decoration: none; color: var(--text); font-size: 0.9rem; font-weight: 500; background: var(--glass-hi); border: 1px solid var(--line-strong); transition: transform .25s var(--ease), border-color .2s, box-shadow .25s; }
.pill-link:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px -10px var(--violet); }
.pill-link.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 10px 28px -12px var(--violet); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.stats > div { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--glass-hi); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stats b { display: block; font-family: var(--font-head); font-size: 1.55rem; letter-spacing: -0.03em; color: var(--text); text-transform: none; }

/* ---------- Toolbar ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.section-title h2 { font-family: var(--font-head); font-size: 1.35rem; letter-spacing: -0.02em; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line-strong); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--text); padding: 6px 14px; border-radius: 999px; font: inherit; font-size: 0.86rem; cursor: pointer; transition: border-color .2s, transform .2s, background .2s; }
.chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.chip.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 22px -12px var(--violet); }
.chip small { opacity: 0.7; margin-left: 6px; font-family: var(--font-mono); }
.search { flex: 1 1 220px; max-width: 300px; padding: 9px 16px 9px 38px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text); font: inherit; font-size: 0.92rem;
  background: var(--glass) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a9a4bf' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") no-repeat 14px center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(167, 139, 250, .18); }

/* ---------- Post cards ---------- */
.post-list { display: grid; gap: 16px; }
.card { position: relative; display: block; text-decoration: none; color: inherit; padding: 22px 24px 20px; overflow: hidden; }
.card::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 3px; background: var(--grad); opacity: .0; transition: opacity .3s; }
.card:hover::before { opacity: 1; }
.card h2 { font-family: var(--font-head); font-size: 1.32rem; line-height: 1.3; letter-spacing: -0.02em; margin: 10px 0 8px; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 0.96rem; line-height: 1.6; }
.card .arrow { position: absolute; right: 22px; top: 20px; color: var(--faint); transition: transform .3s var(--ease), color .3s; }
.card:hover .arrow { transform: translate(4px, -4px); color: var(--accent); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--muted); font-family: var(--font-mono); }
.meta > span + span::before { content: '·'; margin-right: 10px; opacity: .5; }
.badge { padding: 3px 11px; border-radius: 999px; font-weight: 600; font-family: var(--font-body); font-size: 0.74rem; letter-spacing: .01em; border: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 30%, transparent); }
.meta > .badge + span::before { content: none; }
.t-issue { color: var(--c-issue); background: var(--c-issue-bg); }
.t-feature { color: var(--c-feature); background: var(--c-feature-bg); }
.t-snippet { color: var(--c-snippet); background: var(--c-snippet-bg); }
.t-solution { color: var(--c-solution); background: var(--c-solution-bg); }
.t-concept { color: var(--c-concept); background: var(--c-concept-bg); }
.t-functional { color: var(--c-functional); background: var(--c-functional-bg); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 0.74rem; color: var(--muted); font-family: var(--font-mono); padding: 2px 9px; border-radius: 999px; background: var(--glass-hi); border: 1px solid var(--line); }
.tag::before { content: '#'; opacity: .55; }
.empty { text-align: center; padding: 48px 0; color: var(--muted); }

.latest-label { display: none; }
@media (min-width: 960px) {
  .post-list > .card:first-child .latest-label { display: inline-block; position: absolute; right: 54px; top: 22px; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
}

/* ---------- Article ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; color: var(--muted); text-decoration: none; font-size: 0.92rem; padding: 6px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: color .2s, border-color .2s; }
.back:hover { color: var(--text); border-color: var(--accent); }
.article-shell { padding: 38px 40px 34px; }
.article h1 { font-family: var(--font-head); font-weight: 800; letter-spacing: -0.035em; font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.12; margin: 14px 0 14px; }
.article .tags { margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 30; background: var(--grad); box-shadow: 0 0 12px var(--violet); }

.prose h2 { font-family: var(--font-head); font-size: 1.5rem; letter-spacing: -0.025em; margin: 2.1em 0 .55em; }
.prose h3 { font-family: var(--font-head); font-size: 1.15rem; letter-spacing: -0.01em; margin: 1.7em 0 .45em; }
.prose p, .prose li { max-width: 70ch; }
.prose li { margin-bottom: .3em; }
.prose strong { color: var(--text); }
.prose hr { border: 0; height: 1px; margin: 2.4em 0; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.prose code { font-family: var(--font-mono); font-size: 0.85em; background: var(--inline-code); padding: 2px 7px; border-radius: 7px; }
.prose blockquote { margin: 1.5em 0; padding: 14px 20px; border-radius: var(--radius-sm); background: var(--glass-hi); border: 1px solid var(--line); border-left: 3px solid var(--accent); color: var(--text); }
.prose blockquote p { margin: .3em 0; }
.table-wrap { margin: 1.5em 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-x: auto; background: var(--glass-hi); }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 0; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose th { background: var(--glass-hi); font-weight: 600; white-space: nowrap; }
.prose img { max-width: 100%; border-radius: var(--radius-sm); }

.codeblock { margin: 1.6em 0; border-radius: 16px; overflow: hidden; background: var(--code-bg); border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .8); }
.codebar { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; background: rgba(255, 255, 255, .03); border-bottom: 1px solid rgba(255, 255, 255, .06); color: #8f8aa8; font-family: var(--font-mono); font-size: 0.74rem; }
.codebar .dots { display: inline-flex; gap: 6px; margin-right: 12px; vertical-align: middle; }
.codebar .dots i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.codebar .dots i:nth-child(1) { background: #ff5f57; } .codebar .dots i:nth-child(2) { background: #febc2e; } .codebar .dots i:nth-child(3) { background: #28c840; }
.copy { background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12); color: #ddd8f0; border-radius: 8px; padding: 3px 12px; font: inherit; cursor: pointer; transition: border-color .2s, background .2s; }
.copy:hover { border-color: #a78bfa; background: rgba(167, 139, 250, .15); }
.codeblock pre { margin: 0; overflow-x: auto; }
.codeblock pre code, .codeblock pre code.hljs { display: block; background: transparent; padding: 18px 20px; font-size: 0.84rem; line-height: 1.65; color: #ece9f7; border-radius: 0; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 40px; }
.pager a { position: relative; padding: 16px 20px; text-decoration: none; color: var(--text); font-size: 0.93rem; font-weight: 500; }
.pager small { display: block; color: var(--muted); font-family: var(--font-mono); font-size: 0.74rem; margin-bottom: 4px; }
.pager .next { text-align: right; grid-column: 2; }
.share { margin-top: 30px; }

/* ---------- Questions + Follow ---------- */
.ask { margin-top: 28px; padding: 26px 28px; }
.ask h2, .follow h2 { font-family: var(--font-head); font-size: 1.3rem; letter-spacing: -0.02em; margin: 0 0 6px; }
.ask p, .follow p { margin: 0 0 14px; }
.giscus-wrap { min-height: 120px; }
.follow { position: relative; overflow: hidden; margin-top: 28px; padding: 26px 28px; }
.follow::after { content: ''; position: absolute; width: 260px; height: 260px; right: -80px; top: -120px; border-radius: 50%; background: var(--blob-1); filter: blur(60px); opacity: .5; pointer-events: none; }
.sub-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.sub-form input { flex: 1 1 220px; max-width: 340px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--text); font: inherit; font-size: 0.95rem; }
.sub-form input:focus { outline: none; border-color: var(--accent); }

/* ---------- About ---------- */
.about-panel { position: relative; overflow: hidden; padding: 38px 38px 32px; }
.about .eyebrow-line { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-2); letter-spacing: .06em; text-transform: uppercase; }
.about h1 { font-family: var(--font-head); font-weight: 800; font-size: clamp(2.1rem, 6vw, 3.3rem); letter-spacing: -0.04em; line-height: 1.05; margin: 10px 0 16px; }
.about .prose p { max-width: 70ch; color: var(--text); opacity: .92; }
.about .link-row { margin-top: 20px; }
.print-btn { font: inherit; font-size: 0.9rem; cursor: pointer; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-top: 26px; }
.stat { position: relative; padding: 18px 20px; }
.stat b { display: block; font-family: var(--font-head); font-size: 2rem; letter-spacing: -0.04em; line-height: 1.1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 0.85rem; color: var(--muted); }

.a-sec { margin-top: 46px; }
.a-sec h2 { display: flex; align-items: center; gap: 14px; font-family: var(--font-head); font-size: 1.35rem; letter-spacing: -0.02em; margin: 0 0 18px; }
.a-sec h2::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

.hl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.hl-card { position: relative; padding: 20px 22px; overflow: hidden; }
.hl-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad); }
.hl-card h3 { margin: 0 0 6px; font-family: var(--font-head); font-size: 1.05rem; letter-spacing: -0.01em; }
.hl-card p { margin: 0; color: var(--muted); font-size: 0.93rem; line-height: 1.55; }

.timeline { position: relative; margin-left: 6px; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: linear-gradient(var(--violet), var(--teal), transparent); }
.job { position: relative; }
.job::before { content: ''; position: absolute; left: -35px; top: 7px; width: 14px; height: 14px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 4px var(--bg), 0 0 18px var(--violet); }
.job-head h3 { margin: 0; font-family: var(--font-head); font-size: 1.22rem; letter-spacing: -0.02em; }
.job-head .meta { margin: 4px 0 12px; }
.bullets { margin: 0 0 8px; padding-left: 20px; }
.bullets li { margin-bottom: 6px; font-size: 0.96rem; max-width: 72ch; }
.bullets li::marker { color: var(--accent); }
.projects { margin-top: 20px; }
.projects h4 { margin: 0 0 12px; font-size: 0.76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.project { position: relative; padding: 18px 22px; margin-bottom: 14px; }
.project-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-bottom: 8px; }
.project-head b { font-family: var(--font-head); font-size: 1.05rem; }

.skill-group { margin-bottom: 16px; }
.skill-group h3 { font-size: 0.76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.skill-group .chips .chip, .about .chips .chip { cursor: default; }

.cert { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-bottom: 1px dashed var(--line-strong); }
.cert:last-child { border-bottom: 0; }
.cert span { font-size: 0.9rem; }

/* ---------- Footer ---------- */
.site-footer { padding: 30px 0 44px; color: var(--muted); font-size: 0.86rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding-top: 24px; border-top: 1px solid var(--line); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* ---------- Animations ---------- */
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
@keyframes shine { to { background-position: 200% center; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* No backdrop-filter support: use solid surfaces */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .card, .follow, .ask, .stat, .hl-card, .project, .pager a, .hero-panel, .article-shell, .about-panel { background: var(--glass-strong); }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .site-header { top: 10px; margin-top: 10px; }
  .bar { height: 54px; padding: 0 8px 0 10px; }
  .brand span:last-child { display: none; }
  .nav a { padding: 6px 11px; }
  main.wrap { padding-top: 28px; }
  .hero-panel, .article-shell, .about-panel { padding: 26px 20px 22px; border-radius: 18px; }
  .avatar { width: 74px; height: 74px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stats > div { padding: 10px 10px; font-size: 0.7rem; }
  .stats b { font-size: 1.15rem; }
  .card { padding: 18px 18px 16px; }
  .card .arrow { display: none; }
  .search { max-width: none; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; text-align: left; }
  .blob { filter: blur(70px); }
  .b1 { width: 380px; height: 380px; } .b2 { width: 340px; height: 340px; } .b3 { width: 320px; height: 320px; }
}

/* ---------- Print (About → Save as PDF) ---------- */
@media print {
  .aurora, .site-header, .site-footer, .print-btn, .link-row, .progress { display: none !important; }
  :root { --text: #000; --muted: #444; --line: #ccc; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .glass, .card, .follow, .ask, .stat, .hl-card, .project, .about-panel, .hero-panel, .article-shell { background: #fff !important; box-shadow: none !important; backdrop-filter: none !important; border-color: #ccc !important; }
  .stat b, .grad-text { color: #000 !important; background: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .stat, .hl-card, .project { break-inside: avoid; }
  main { padding-top: 0; }
}

/* =========================================================
   Reading mode (post pages)
   The fancy look stays on Home and About. When a post is open,
   the background calms down and the article sits on a solid,
   easy-to-read surface.
   ========================================================= */
:root[data-theme="dark"] { --read-bg: #12111a; --read-text: #e7e4f0; --read-muted: #a7a2bb; }
:root[data-theme="light"] { --read-bg: #ffffff; --read-text: #26233a; --read-muted: #5d5878; }

body.reading .aurora .blob { opacity: .28; animation-play-state: paused; }
body.reading .aurora .grid-overlay { display: none; }

/* Reader controls: text size and column width are CSS variables,
   so changing them reflows the page (unlike browser pinch zoom). */
:root { --read-scale: 1; --read-width: 880px; }
:root[data-read-wide="1"] { --read-width: 1160px; }

body.reading .article-shell {
  background: var(--read-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: var(--line);
  max-width: var(--read-width);
  margin: 0 auto;
  padding: 48px 56px 40px;
  touch-action: pan-x pan-y;   /* two-finger pinch on the article = text size */
}
body.reading .back, body.reading .ask, body.reading .follow, body.reading .pager { max-width: var(--read-width); margin-left: auto; margin-right: auto; }
body.reading .back { display: flex; width: fit-content; margin-left: max(0px, calc((100% - var(--read-width)) / 2)); }
body.reading .ask, body.reading .follow { background: var(--read-bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.reading .follow::after { display: none; }

body.reading .article h1 { color: var(--read-text); font-size: calc(clamp(1.7rem, 4.2vw, 2.5rem) * var(--read-scale)); }
body.reading .prose { color: var(--read-text); font-size: calc(1.06rem * var(--read-scale)); line-height: 1.85; letter-spacing: .003em; }
body.reading .prose p, body.reading .prose li { max-width: 72ch; }
:root[data-read-wide="1"] body.reading .prose p, :root[data-read-wide="1"] body.reading .prose li { max-width: none; }
body.reading .prose p { margin: 0 0 1.15em; }
body.reading .prose h2 { margin-top: 2.3em; color: var(--read-text); }
body.reading .prose h3 { color: var(--read-text); }
body.reading .prose blockquote { background: transparent; border-color: var(--line); border-left-color: var(--accent); }
body.reading .table-wrap { background: transparent; }
body.reading .prose th { background: color-mix(in srgb, var(--read-text) 5%, transparent); }
body.reading .meta, body.reading .tag { color: var(--read-muted); }

/* Narrow desktops and phones in "Desktop site" mode (~980px):
   use the full width instead of leaving big empty sides. */
@media (max-width: 1100px) {
  body.reading main.wrap { max-width: none; padding-left: 16px; padding-right: 16px; }
  body.reading .article-shell { max-width: none; padding: 36px 32px 32px; }
  body.reading .back, body.reading .ask, body.reading .follow, body.reading .pager { max-width: none; }
  body.reading .back { margin-left: 0; }
  body.reading .prose p, body.reading .prose li { max-width: none; }
}

@media (max-width: 640px) {
  body.reading main.wrap { padding-left: 8px; padding-right: 8px; padding-top: 20px; }
  body.reading .article-shell { padding: 22px 16px 22px; border-radius: 18px; }
  body.reading .prose { font-size: calc(1.02rem * var(--read-scale)); line-height: 1.75; }
  body.reading .article h1 { font-size: calc(1.55rem * var(--read-scale)); line-height: 1.25; }
  body.reading .prose pre { margin-left: -6px; margin-right: -6px; }
}

/* Floating reader toolbar (post pages only) */
.reader-bar {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  display: none; align-items: center; gap: 2px; padding: 5px;
  border-radius: 999px; background: var(--pop-bg, var(--read-bg));
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.28);
  font: 600 .85rem/1 Inter, system-ui, sans-serif; color: var(--read-text);
}
body.reading .reader-bar { display: flex; }
.reader-bar button {
  min-width: 40px; height: 36px; padding: 0 10px; border: 0; border-radius: 999px;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.reader-bar button:hover, .reader-bar button:focus-visible { background: color-mix(in srgb, var(--read-text) 10%, transparent); outline: none; }
.reader-bar .rb-size { min-width: 56px; font-variant-numeric: tabular-nums; color: var(--read-muted); font-weight: 500; }
.reader-bar .rb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.reader-bar .rb-small { font-size: .78rem; }
.reader-bar .rb-big { font-size: 1.05rem; }
.reader-bar button[aria-pressed="true"] { color: var(--accent); }
@media (max-width: 1100px) { .reader-bar .rb-width, .reader-bar .rb-sep { display: none; } }
@media (max-width: 640px) { .reader-bar { right: 10px; bottom: 10px; } }
@media print { .reader-bar { display: none !important; } }

/* =========================================================
   Layout: hero grid, and a wider two-column home on desktop
   ========================================================= */
.hero-panel { display: grid; grid-template-columns: 1fr; grid-template-areas: "avatar" "main" "stats"; gap: 0; }
.hero-panel > .avatar { grid-area: avatar; }
.hero-main { grid-area: main; }
.hero-panel > .stats { grid-area: stats; }
.hero-main .status { margin-top: 18px; }
.hero-main h1 { margin-top: 16px; }

@media (min-width: 960px) {
  .wrap { max-width: 1160px; padding: 0 32px; }

  /* Hero: text on the left, avatar and stats on the right */
  .hero-panel {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "main avatar" "main stats";
    column-gap: 48px;
    align-items: start;
    padding: 52px 52px 46px;
  }
  .hero-main .status { margin-top: 0; }
  .hero-panel > .avatar { justify-self: center; width: 168px; height: 168px; padding: 4px; margin-bottom: 26px; }
  .hero-panel > .avatar > * { font-size: 3.2rem; }
  .hero-panel > .stats { grid-template-columns: 1fr; margin-top: 0; gap: 10px; align-self: end; }
  .hero-panel > .stats > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; }
  .hero-panel > .stats b { font-size: 1.25rem; }
  .hero h1 { font-size: clamp(3rem, 5.2vw, 4.4rem); }

  /* Posts: two columns, the newest post full width */
  .post-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .post-list > .card { display: flex; flex-direction: column; }
  .post-list > .card p { flex: 1; }
  .post-list > .card:first-child { grid-column: 1 / -1; padding: 30px 34px 26px; }
  .post-list > .card:first-child h2 { font-size: 1.7rem; }
  .post-list > .empty { grid-column: 1 / -1; }

  .follow { padding: 30px 34px; }

  /* About: text panel and stats side by side feel */
  .about-panel { padding: 50px 52px 44px; }
  .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* About: avatar beside the intro on desktop, above it on phones */
.about-avatar { margin-bottom: 20px; }
@media (min-width: 960px) {
  .about-panel { padding-right: 300px; }
  .about-avatar { position: absolute; right: 64px; top: 50%; width: 180px; height: 180px; padding: 4px; margin: -90px 0 0; }
  .about-avatar > * { font-size: 3.4rem; }
}

/* ---------- Colour theme picker ---------- */
:root[data-theme="dark"] { --pop-bg: rgba(16, 14, 28, .97); }
:root[data-theme="light"] { --pop-bg: rgba(255, 255, 255, .98); }
.palette-wrap { position: relative; }
.palette-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 10px -2px var(--violet); position: static !important; inset: auto !important; display: block !important; margin: auto; }
#palette-toggle { display: grid; place-items: center; }
#palette-toggle:hover { transform: scale(1.06); }
.palette-pop { position: absolute; right: 0; top: calc(100% + 12px); width: 210px; padding: 10px; border-radius: 18px; background: var(--pop-bg); z-index: 40;
  animation: popIn .22s var(--ease); transform-origin: top right; }
.palette-pop[hidden] { display: none; }
.palette-title { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 4px 8px 8px; }
.palette-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 12px; background: none; color: var(--text); font: inherit; font-size: .92rem; cursor: pointer; text-align: left; transition: background .2s, border-color .2s; }
.palette-opt:hover { background: var(--glass-hi); }
.palette-opt.on { border-color: var(--line-strong); background: var(--glass-hi); }
.palette-opt.on::after { content: '✓'; margin-left: auto; color: var(--accent); font-weight: 700; }
.palette-opt .sw { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .nav a { padding: 6px 9px; } .icon-btn { width: 34px; height: 34px; margin-left: 4px; } }
