:root {
    --bg: #F8F6F3;
    --card: #FFFFFF;
    --stone: #F5F2EF;
    --border-subtle: rgba(0, 0, 0, 0.06);
    --text-primary: #0A0A0A;
    --text-secondary: #4E4E4E;
    --text-muted: #777169;
    --action: #0A0A0A;
    --action-fg: #FFFFFF;
    --accent: #22C55E;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.05);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0A0A0A; --card: #161616; --stone: #262420;
        --border-subtle: rgba(255, 255, 255, 0.08);
        --text-primary: #F2F0EC; --text-secondary: #8A8A8A; --text-muted: #5A5A5A;
        --action: #F2F0EC; --action-fg: #0A0A0A; --accent: #34D399;
        --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.3);
        --shadow-2: 0 2px 8px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.4);
    }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Nunito Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--bg); color: var(--text-primary);
    line-height: 1.7; letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--text-primary); text-decoration: none; transition: opacity .15s ease; }
a:hover { opacity: .7; }
.container { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* Header */
header { padding: 20px 0; border-bottom: 1px solid var(--border-subtle); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 16px; letter-spacing: -.01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; display: block; }
.brand-name .muted { color: var(--text-muted); }
.nav-links { display: flex; gap: 18px; font-size: 14px; color: var(--text-secondary); align-items: center; flex-wrap: wrap; }

/* Language switcher */
.lang-switch { position: relative; font-size: 14px; }
.lang-switch summary { cursor: pointer; list-style: none; color: var(--text-secondary); white-space: nowrap; }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch ul {
    position: absolute; inset-inline-end: 0; top: 130%; z-index: 30;
    background: var(--card); border: 1px solid var(--border-subtle); border-radius: 12px;
    box-shadow: var(--shadow-2); padding: 8px; margin: 0; list-style: none;
    max-height: 320px; overflow-y: auto; min-width: 170px;
    columns: 1;
}
.lang-switch li { margin: 0; }
.lang-switch li a { display: block; padding: 6px 10px; border-radius: 8px; font-size: 14px; color: var(--text-primary); }
.lang-switch li a:hover { background: var(--stone); opacity: 1; }
.lang-switch li a[aria-current="true"] { font-weight: 800; }

/* Blog hub */
.blog-hero { padding: 56px 0 24px; }
.back-link, .breadcrumb a { font-size: 14px; color: var(--text-muted); }
.blog-hero h1 { font-size: clamp(32px, 5vw, 46px); line-height: 1.1; letter-spacing: -.02em; font-weight: 900; margin: 14px 0 14px; }
.lead { font-size: 18px; color: var(--text-secondary); margin: 0 0 8px; }
.post-list { display: grid; gap: 14px; padding-bottom: 24px; }
.post-card { background: var(--card); border: 1px solid var(--border-subtle); border-radius: 16px; box-shadow: var(--shadow-1); }
.post-card-link { display: block; padding: 22px; }
.post-card h2 { margin: 0 0 8px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.post-card p { margin: 0 0 12px; font-size: 15px; color: var(--text-secondary); }
.post-meta { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }

/* Article */
.article { padding: 40px 0 8px; }
.breadcrumb { margin-bottom: 20px; }
.article-head h1 { font-size: clamp(28px, 4.5vw, 42px); line-height: 1.12; letter-spacing: -.02em; font-weight: 900; margin: 12px 0 12px; }
.article-meta { font-size: 13px; color: var(--text-muted); margin: 0 0 18px; }
.article-head .lead { font-size: 19px; color: var(--text-secondary); margin-bottom: 28px; }
.toc { background: var(--stone); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 18px 22px; margin-bottom: 8px; }
.toc-title { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.toc ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.toc a { color: var(--text-secondary); font-size: 14px; }
.article-body { padding-top: 12px; }
.article-body h2 { font-size: clamp(22px, 3vw, 28px); letter-spacing: -.015em; font-weight: 800; margin: 36px 0 12px; scroll-margin-top: 80px; }
.article-body p { font-size: 17px; color: var(--text-primary); margin: 0 0 16px; }

/* Article figure (app screenshot) */
.article-figure { margin: 8px 0 28px; text-align: center; }
.article-figure img {
    width: 100%; max-width: 280px; height: auto; display: inline-block;
    border-radius: 18px; border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-2); background: #000;
}
@media (min-width: 720px) {
    .article-figure { float: inline-end; width: 240px; margin: 4px 0 16px 28px; }
    [dir="rtl"] .article-figure { margin: 4px 28px 16px 0; }
}

/* FAQ */
.article-faq { margin-top: 44px; }
.article-faq h2 { font-size: 26px; font-weight: 800; margin-bottom: 14px; }
.faq { display: grid; gap: 10px; }
details.faq-item { background: var(--card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 16px 18px; }
details.faq-item[open] { box-shadow: var(--shadow-1); }
details.faq-item summary { font-weight: 700; font-size: 16px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after { content: "+"; font-size: 20px; color: var(--text-muted); }
details.faq-item[open] summary::after { content: "–"; }
details.faq-item p { margin: 10px 0 0; color: var(--text-secondary); font-size: 15px; }

/* Related */
.related { margin-top: 44px; }
.related h2 { font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.related-card { background: var(--card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-1); }
.related-card h3 { margin: 0; font-size: 16px; font-weight: 700; }

/* CTA */
.cta-block { padding: 56px 0; }
.cta-card { background: var(--stone); border: 1px solid var(--border-subtle); border-radius: 20px; padding: 36px; text-align: center; }
.cta-card h2 { font-size: 26px; font-weight: 800; margin: 0 0 10px; letter-spacing: -.015em; }
.cta-card p { color: var(--text-secondary); font-size: 16px; max-width: 480px; margin: 0 auto 22px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 14px 26px; border-radius: 9999px; font-weight: 700; font-size: 15px; border: 1px solid transparent; cursor: pointer; transition: transform .15s ease, opacity .15s ease; }
.btn:hover { transform: translateY(-1px); opacity: .92; }
.btn-primary { background: var(--action); color: var(--action-fg); box-shadow: var(--shadow-1); }

/* Footer */
footer { border-top: 1px solid var(--border-subtle); padding: 36px 0; color: var(--text-muted); font-size: 13px; }
.footer-row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--text-secondary); }

/* RTL */
[dir="rtl"] .toc ul { padding-inline-start: 18px; }
[dir="rtl"] .post-meta { letter-spacing: 0; }

@media (max-width: 640px) {
    .nav-links { gap: 12px; font-size: 13px; }
    .blog-hero { padding: 40px 0 16px; }
    .article { padding: 28px 0 8px; }
    .article-body p { font-size: 16px; }
}
