:root {
    --bg: #ffffff; --bg-subtle: #fafafa; --bg-hover: #f5f5f5;
    --text: #111111; --text-secondary: #555555; --text-tertiary: #999999; --text-faint: #bbbbbb;
    --border: #e5e5e5; --border-light: #f0f0f0;
    --accent: #000000; --accent-hover: #333333;
    --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: 1100px; --max-w-blog: 680px;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'DM 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: rgba(255,255,255,0.88); 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: 'Instrument Serif', 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: 'Instrument Serif', 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: 'Instrument Serif', 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; }

/* COMMENTS (on post pages) */
.comments { max-width: var(--max-w-blog); margin: 0 auto; padding: 0 2rem 4rem; }
.comments-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; }
.comments-count { font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; background: var(--bg-hover); padding: 0.15rem 0.45rem; border-radius: var(--radius-sm); color: var(--text-tertiary); }
.c-form { margin-bottom: 2rem; }
.c-form textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.9rem 1rem; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; resize: vertical; min-height: 88px; outline: none; transition: border-color var(--transition), box-shadow var(--transition); line-height: 1.6; color: var(--text); background: var(--bg); }
.c-form textarea::placeholder { color: var(--text-faint); }
.c-form textarea:focus { border-color: var(--text-tertiary); box-shadow: 0 0 0 3px rgba(0,0,0,0.03); }
.c-form-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.35rem; margin-bottom: 0.25rem; }
.c-form-charcount { font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: var(--text-faint); transition: color var(--transition); }
.c-form-charcount.warn { color: var(--orange); } .c-form-charcount.over { color: var(--red); }
.c-form-actions { display: flex; gap: 0.6rem; margin-top: 0.4rem; align-items: stretch; }
.c-form input[type="text"] { flex: 1; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0 1rem; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; outline: none; transition: border-color var(--transition); color: var(--text); height: 40px; }
.c-form input::placeholder { color: var(--text-faint); } .c-form input:focus { border-color: var(--text-tertiary); }
.c-form button { background: var(--accent); color: white; border: none; padding: 0 1.4rem; border-radius: var(--radius-md); font-family: 'DM Sans', sans-serif; font-size: 0.84rem; font-weight: 500; cursor: pointer; transition: background var(--transition), transform 0.1s; height: 40px; white-space: nowrap; }
.c-form button:hover { background: var(--accent-hover); } .c-form button:active { transform: scale(0.98); } .c-form button:disabled { opacity: 0.4; cursor: not-allowed; }
.c-message { font-size: 0.82rem; padding: 0.6rem 0.9rem; border-radius: var(--radius-md); margin-bottom: 1rem; display: none; }
.c-message.error { display: block; background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.c-message.success { display: block; background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.c-item { padding: 1.1rem 0; border-bottom: 1px solid var(--border-light); animation: commentIn 0.3s ease-out both; }
.c-item:last-child { border-bottom: none; }
@keyframes commentIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.c-item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem; }
.c-item-author { font-weight: 600; font-size: 0.85rem; } .c-item-date { font-family: 'JetBrains Mono', monospace; font-size: 0.67rem; color: var(--text-faint); }
.c-item p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; font-weight: 300; }
.c-loading { text-align: center; padding: 2rem 0; color: var(--text-faint); font-size: 0.85rem; }
.c-loading-spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--text-tertiary); border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; margin-right: 0.4rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.c-empty { text-align: center; padding: 2.5rem 0 1.5rem; color: var(--text-faint); font-size: 0.88rem; }
.c-empty-icon { font-size: 1.6rem; margin-bottom: 0.5rem; opacity: 0.5; }

/* 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; }
    .comments { padding: 0 1.5rem 3rem; }
    .c-form-actions { flex-direction: column; } .c-form input[type="text"], .c-form button { width: 100%; }
    footer { flex-direction: column; gap: 1rem; text-align: center; padding: 2rem 1.5rem; }
    .disclaimer { padding: 0 1.5rem 1.5rem; text-align: center; }
}
