:root {
    --bg: #ffffff; --bg-subtle: #f6f8fc; --bg-hover: #eef1f7;
    --text: #14161c; --text-secondary: #4f5564; --text-tertiary: #6f7686; --text-faint: #9aa0ad;
    --border: #e7e9f0; --border-light: #eef0f5;
    --accent: #0b7d72; --accent-hover: #6a4cf5; --accent-2: #6a4cf5; --accent-soft: #e0f4f0; --accent-line: #b5e3d9;
    --green: #15803d; --green-bg: #f0fdf4;
    --orange: #c2410c; --orange-bg: #fff7ed;
    --red: #dc2626; --red-bg: #fef2f2;
    --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-full: 100px;
    --shadow-subtle: 0 1px 3px rgba(0,0,0,0.04);
    --transition: 0.2s ease;
    --max-w: 820px; --max-w-blog: 680px;
    --nav-bg: rgba(255,255,255,0.88); --green-line: #bbf7d0; --red-line: #fecaca;
    color-scheme: light;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--bg:#1b1f2a;--bg-subtle:#212633;--bg-hover:#2a3040;--text:#f2f4f8;--text-secondary:#c3c8d3;--text-tertiary:#8f96a6;--text-faint:#6c7383;--border:#303646;--border-light:#272d3b;--accent:#43dcc8;--accent-hover:#a892ff;--accent-2:#a892ff;--accent-soft:#183c3d;--accent-line:#2f6660;--green:#4ade80;--green-bg:rgba(74,222,128,.1);--green-line:rgba(74,222,128,.3);--orange:#fb923c;--orange-bg:rgba(251,146,60,.1);--red:#f87171;--red-bg:rgba(248,113,113,.1);--red-line:rgba(248,113,113,.3);--nav-bg:rgba(27,31,42,.85);color-scheme:dark}:root:not([data-theme="light"]) .theme-toggle .sun{display:block}:root:not([data-theme="light"]) .theme-toggle .moon{display:none}:root:not([data-theme="light"]) .article-body img{background:#fff;border-radius:var(--radius-md);padding:0.75rem}:root:not([data-theme="light"]) .article-body pre{border:1px solid var(--border);background:#151924}}
:root[data-theme="dark"]{--bg:#1b1f2a;--bg-subtle:#212633;--bg-hover:#2a3040;--text:#f2f4f8;--text-secondary:#c3c8d3;--text-tertiary:#8f96a6;--text-faint:#6c7383;--border:#303646;--border-light:#272d3b;--accent:#43dcc8;--accent-hover:#a892ff;--accent-2:#a892ff;--accent-soft:#183c3d;--accent-line:#2f6660;--green:#4ade80;--green-bg:rgba(74,222,128,.1);--green-line:rgba(74,222,128,.3);--orange:#fb923c;--orange-bg:rgba(251,146,60,.1);--red:#f87171;--red-bg:rgba(248,113,113,.1);--red-line:rgba(248,113,113,.3);--nav-bg:rgba(27,31,42,.85);color-scheme:dark}
:root[data-theme="dark"] .theme-toggle .sun{display:block}:root[data-theme="dark"] .theme-toggle .moon{display:none}:root[data-theme="dark"] .article-body img{background:#fff;border-radius:var(--radius-md);padding:0.75rem}:root[data-theme="dark"] .article-body pre{border:1px solid var(--border);background:#151924}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Work Sans', -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
::selection { background: var(--text); color: var(--bg); }

/* NAV */
nav { position: sticky; top: 0; z-index: 100; background: var(--nav-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); padding: 0 2rem; transition: box-shadow var(--transition); }
nav.scrolled { box-shadow: var(--shadow-subtle); }
.nav-inner { max-width: var(--max-w); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; height: 58px; }
.nav-logo { font-family: 'Newsreader', Georgia, serif; font-size: 1.35rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; transition: opacity var(--transition); }
.nav-logo:hover { opacity: 0.7; }
.nav-links { display: flex; gap: 1.75rem; align-items: center; }
.nav-links a { font-size: 0.85rem; color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: color var(--transition); position: relative; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 1.5px; background: var(--text); border-radius: 1px; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; width: 28px; height: 20px; position: relative; z-index: 110; }
.nav-toggle span { display: block; width: 100%; height: 1.5px; background: var(--text); position: absolute; left: 0; transition: all 0.3s ease; }
.nav-toggle span:nth-child(1) { top: 0; } .nav-toggle span:nth-child(2) { top: 9px; } .nav-toggle span:nth-child(3) { top: 18px; }
.nav-toggle.open span:nth-child(1) { top: 9px; transform: rotate(45deg); } .nav-toggle.open span:nth-child(2) { opacity: 0; } .nav-toggle.open span:nth-child(3) { top: 9px; transform: rotate(-45deg); }

/* FOOTER */
footer { max-width: var(--max-w); margin: 0 auto; padding: 2.5rem 2rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-tertiary); }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--text-secondary); text-decoration: none; transition: color var(--transition); font-size: 0.8rem; }
.footer-links a:hover { color: var(--text); }
.disclaimer { max-width: var(--max-w); margin: 0 auto; padding: 0 2rem 2rem; font-size: 0.72rem; color: var(--text-faint); line-height: 1.6; }

/* ARTICLE */
.article { max-width: var(--max-w-blog); margin: 0 auto; padding: 2.5rem 2rem 2rem; }
.article-back { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--text-tertiary); text-decoration: none; margin-bottom: 2rem; transition: color var(--transition); }
.article-back:hover { color: var(--text); }
.article h1 { font-family: 'Newsreader', Georgia, serif; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 400; letter-spacing: -0.025em; line-height: 1.2; margin-bottom: 1rem; }
.article .post-meta { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 2rem; flex-wrap: wrap; }
.post-date { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-tertiary); letter-spacing: 0.02em; }
.post-tag { font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; padding: 0.14rem 0.48rem; border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--text-secondary); text-transform: lowercase; }
.article-lead { font-size: 1.1rem; color: var(--text-secondary); line-height: 1.8; font-weight: 300; font-style: italic; margin-bottom: 2rem; border-left: 3px solid var(--border); padding-left: 1.25rem; }

.article-body { font-size: 1rem; line-height: 1.85; color: var(--text-secondary); }
.article-body p { margin-bottom: 1.25rem; }
.article-body h2 { font-family: 'Newsreader', Georgia, serif; font-size: 1.5rem; font-weight: 400; color: var(--text); margin: 2.5rem 0 1rem; letter-spacing: -0.01em; }
.article-body h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 2rem 0 0.75rem; }
.article-body a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.article-body a:hover { color: var(--text-secondary); }
.article-body code { font-family: 'JetBrains Mono', monospace; font-size: 0.85em; background: var(--bg-subtle); padding: 0.15rem 0.4rem; border-radius: 4px; border: 1px solid var(--border-light); }
.article-body pre { background: #1a1a1a; color: #e0e0e0; padding: 1.25rem; border-radius: var(--radius-md); overflow-x: auto; margin: 1.5rem 0; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; line-height: 1.65; }
.article-body pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.article-body blockquote { border-left: 3px solid var(--border); padding-left: 1.25rem; margin: 1.5rem 0; color: var(--text-tertiary); font-style: italic; }
.article-body ul, .article-body ol { margin: 1rem 0 1.25rem 1.5rem; }
.article-body li { margin-bottom: 0.4rem; }
.article-body img, .article-body svg { max-width: 100%; height: auto; border-radius: var(--radius-md); margin: 1.5rem 0; display: block; }
.article-body .img-caption { font-size: 0.78rem; color: var(--text-faint); text-align: center; margin-top: -1rem; margin-bottom: 1.5rem; }
.article-body .embed-yt { position: relative; width: 100%; padding-bottom: 56.25%; margin: 1.5rem 0; border-radius: var(--radius-md); overflow: hidden; background: #000; }
.article-body .embed-yt iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.85rem; }
.article-body th { text-align: left; font-weight: 600; color: var(--text); padding: 0.6rem 0.75rem; border-bottom: 2px solid var(--border); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.article-body td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.article-body tr:last-child td { border-bottom: none; }

/* MOBILE OVERLAY */
.mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.15); z-index: 99; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.mobile-overlay.open { opacity: 1; pointer-events: auto; }

/* RESPONSIVE */
@media (max-width: 768px) {
    nav { padding: 0 1.25rem; }
    .nav-toggle { display: block; }
    .nav-links { position: fixed; top: 0; right: -100%; width: 260px; height: 100vh; background: var(--bg); flex-direction: column; padding: 5rem 2rem 2rem; gap: 1.5rem; border-left: 1px solid var(--border); transition: right 0.3s ease; box-shadow: -4px 0 20px rgba(0,0,0,0.06); align-items: flex-start; }
    .nav-links.open { right: 0; } .nav-links a { font-size: 1rem; }
    .article { padding: 1.5rem 1.5rem 2rem; }
    footer { flex-direction: column; gap: 1rem; text-align: center; padding: 2rem 1.5rem; }
    .disclaimer { padding: 0 1.5rem 1.5rem; text-align: center; }
}

/* THEME TOGGLE */
.nav-logo { order: 0; } .nav-links { order: 1; margin-left: auto; } .theme-toggle { order: 2; margin-left: 1.5rem; } .nav-toggle { order: 3; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 50%; background: none; color: var(--text-secondary); cursor: pointer; transition: color var(--transition), border-color var(--transition); }
.theme-toggle:hover { color: var(--text); border-color: var(--text-tertiary); }
.theme-toggle svg { width: 15px; height: 15px; }
.theme-toggle .sun { display: none; }
@media (max-width: 768px) { .theme-toggle { margin-left: auto; margin-right: 1rem; } }

/* ---- aligned with the main site: Newsreader + Work Sans, teal/violet accents ---- */
.nav-logo { font-weight: 600; font-size: 1.08rem; letter-spacing: -0.01em; }
.nav-logo:hover { opacity: 1; color: var(--accent); }
.nav-links a.active::after { height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.article h1 { font-weight: 500; letter-spacing: -0.015em; }
.article-body h2 { font-weight: 600; }
.article-back { color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.article-back:hover { color: var(--accent-2); }
.article-lead { border-left: 3px solid transparent; border-image: linear-gradient(180deg, var(--accent), var(--accent-2)) 1; color: var(--text-secondary); }
.post-tag { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.article-body a { color: var(--accent); text-decoration-color: var(--accent-line); text-decoration-thickness: 1px; }
.article-body a:hover { color: var(--accent-2); }
.article-body blockquote { border-left-color: var(--accent-line); }
.c-form textarea:focus, .c-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.c-form button { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--bg); }
.c-form button:hover { background: linear-gradient(90deg, var(--accent), var(--accent-2)); filter: brightness(1.08); }
.footer-links a:hover { color: var(--accent); }
