/* Calm blog: reading pages (generated by _blog/build.mjs) */
@font-face {
    font-family: 'Estedad';
    src: url('../fonts/Estedad-VF.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-latin-VF.woff2') format('woff2');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #f6f4ef;
    --surface: #ffffff;
    --ink: #1c2233;
    --ink-soft: #4a5368;
    --muted: #7a8295;
    --line: #e4e0d6;
    --accent: #4f5fd1;
    --accent-ink: #ffffff;
    --night: #0f1830;
    --night-2: #1d2a52;
    --radius: 18px;
    --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 8px 24px rgba(20, 24, 40, .06);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1324;
        --surface: #151d33;
        --ink: #e9ecf5;
        --ink-soft: #bcc3d6;
        --muted: #8b93a8;
        --line: #26304a;
        --accent: #8f9bff;
        --accent-ink: #0d1324;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Estedad', 'Inter', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    font-size: 17px;
    line-height: 1.95;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, .session-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.sep { display: inline-block; width: 1px; height: .9em; margin: 0 9px; background: currentColor; opacity: .45; vertical-align: -0.1em; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; max-width: 1040px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-family: 'Inter', sans-serif; font-weight: 650; font-size: 19px; }
.nav { display: flex; align-items: center; gap: 18px; font-size: 15px; }
.nav a { color: var(--ink-soft); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.nav .lang-switch { font-size: 14px; border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; }
html[lang="fa"] .lang-switch { font-family: 'Inter', sans-serif; }
html[lang="en"] .lang-switch { font-family: 'Estedad', sans-serif; }
.nav .nav-cta { background: var(--ink); color: var(--bg); padding: 6px 14px; border-radius: 999px; }
.nav .nav-cta:hover { color: var(--bg); opacity: .9; }

/* list page */
.blog-hero { padding: 44px 0 8px; }
.blog-hero h1 { font-size: clamp(30px, 6vw, 42px); line-height: 1.35; margin: 0 0 8px; font-weight: 800; }
.lead { color: var(--ink-soft); font-size: 18.5px; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; padding: 4px 14px; border-radius: 999px; font-size: 15px; }
.cat { padding-top: 28px; scroll-margin-top: 70px; }
.cat h2, .related h2 { font-size: 22px; margin: 0 0 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s ease; }
.card:hover { transform: translateY(-2px); }
.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.card-img { aspect-ratio: 1200 / 630; object-fit: cover; width: 100%; background: var(--night); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 17.5px; line-height: 1.6; }
.card p { margin: 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.85; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: auto; color: var(--muted); font-size: 13px; }
.tag { align-self: flex-start; font-size: 12.5px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 10px; border-radius: 999px; }

/* post */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--muted); padding-top: 22px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); }
.post-header { padding: 14px 0 18px; }
.post-header h1 { font-size: clamp(27px, 5.4vw, 38px); line-height: 1.45; margin: 0 0 10px; font-weight: 800; }
.post-meta { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.post-cover { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: var(--radius); background: var(--night); }

.session-box {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin: 18px 0 26px; padding: 18px 20px; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--night) 0%, var(--night-2) 100%); color: #eef1fb;
    box-shadow: var(--shadow);
}
.session-box-text p { margin: 0; }
.session-box-kicker { font-weight: 700; font-size: 17px; }
.session-box-meta { color: #b9c1dc; font-size: 14.5px; }
.session-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 999px;
    background: #f5f2ea; color: #101830; font-weight: 700; text-decoration: none; font-size: 16px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.session-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.session-btn svg { flex: none; }
[dir="rtl"] .session-btn svg { transform: scaleX(-1); } /* play arrow points forward in RTL */

.prose { padding-bottom: 12px; }
.prose h2 { font-size: 24px; line-height: 1.55; margin: 38px 0 8px; }
.prose h3 { font-size: 19px; line-height: 1.6; margin: 26px 0 4px; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-inline-start: 24px; margin: 0 0 16px; }
[lang="fa"] .prose ol { list-style-type: persian; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--muted); }
.prose blockquote { margin: 20px 0; padding: 12px 18px; border-inline-start: 4px solid var(--accent); background: var(--surface); border-radius: 0 12px 12px 0; color: var(--ink-soft); }
[dir="rtl"] .prose blockquote { border-radius: 12px 0 0 12px; }
.prose figure { margin: 24px 0; }
.prose figure picture { display: block; }
.prose figure img { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--night); }
.prose figcaption { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--muted); text-align: center; }
.prose blockquote p { margin: 0; }
.prose strong { font-weight: 700; }

.related { border-top: 1px solid var(--line); margin-top: 28px; padding: 28px 0 8px; }

/* footer */
.site-footer { margin-top: 48px; border-top: 1px solid var(--line); padding: 22px 0 36px; font-size: 14.5px; color: var(--ink-soft); }
.site-footer p { margin: 0 0 6px; }

/* English pages: Latin type reads better slightly tighter */
html[lang="en"] body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.75; }
html[lang="en"] .post-header h1, html[lang="en"] .blog-hero h1 { font-weight: 750; letter-spacing: -0.01em; line-height: 1.25; }
html[lang="en"] .prose h2, html[lang="en"] .prose h3 { line-height: 1.35; }
html[lang="en"] .card h3 { line-height: 1.4; }

@media (max-width: 520px) {
    body { font-size: 16.5px; }
    .nav { gap: 10px; }
    .nav .nav-cta { padding: 5px 11px; }
    .session-box { padding: 16px; }
    .session-btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .card, .session-btn { transition: none; }
    .card:hover, .session-btn:hover { transform: none; }
}
