/* ============================================================
   MRRECIPE Blog — Public Stylesheet
   نسخه: 3.0.0
   ساختار: @layer-based (predictable cascade)
   ============================================================ */

@layer tokens, reset, base, layout, components, post-content, responsive, preferences;


/* ═══════════════════════════════════════════════════════════════
   LAYER: tokens — Design System
   ═══════════════════════════════════════════════════════════════ */
@layer tokens {
    :root {
        /* ── Brand: نارنجی آجری گرم (غذا) ── */
        --brand-50:  #fff8f1;
        --brand-100: #ffedd5;
        --brand-200: #fed7aa;
        --brand-300: #fdba74;
        --brand-400: #fb923c;
        --brand-500: #ea580c;   /* primary */
        --brand-600: #c2410c;
        --brand-700: #9a3412;

        /* ── Herb: سبز ریحان (success) ── */
        --herb-50:  #ecfdf5;
        --herb-500: #16a34a;
        --herb-600: #15803d;

        /* ── Info: آبی روشن (links, focus) ── */
        --info-50:  #eff6ff;
        --info-100: #dbeafe;
        --info-500: #0284c7;
        --info-600: #0369a1;

        /* ── Neutral: warm ink ── */
        --ink-50:  #fafaf9;
        --ink-100: #f5f5f4;
        --ink-200: #e7e5e4;
        --ink-300: #d6d3d1;
        --ink-400: #a8a29e;
        --ink-500: #78716c;
        --ink-600: #57534e;
        --ink-700: #44403c;
        --ink-800: #292524;
        --ink-900: #1c1917;

        /* ── Semantic ── */
        --primary:      var(--brand-500);
        --primary-dark: var(--brand-600);
        --secondary:    var(--herb-500);
        --accent:       var(--info-500);

        --bg-light:   var(--brand-50);
        --surface:    #fffbf6;
        --surface-2:  #fef8f0;
        --text-dark:  var(--ink-900);
        --text-gray:  var(--ink-500);
        --text-muted: var(--ink-400);
        --border:     var(--ink-200);

        /* ── Shadows ── */
        --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.04);
        --shadow-sm: 0 2px 8px rgba(28, 25, 23, 0.06);
        --shadow-md: 0 8px 24px rgba(28, 25, 23, 0.08);
        --shadow-lg: 0 20px 60px rgba(28, 25, 23, 0.12);
        --shadow-brand: 0 8px 24px rgba(234, 88, 12, 0.25);

        /* ── Geometry ── */
        --radius-sm: 8px;
        --radius:    14px;
        --radius-lg: 20px;
        --radius-xl: 28px;

        /* ── Motion ── */
        --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
        --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);
        --transition: all 0.35s var(--ease-soft);

        /* ── Layout ── */
        --container: 1200px;
        --header-h:  68px;
    }
}


/* ═══════════════════════════════════════════════════════════════
   LAYER: reset
   ═══════════════════════════════════════════════════════════════ */
@layer reset {
    *, *::before, *::after {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
        scroll-behavior: smooth;
    }

    img, video, svg {
        max-width: 100%;
        display: block;
    }

    button {
        font: inherit;
        cursor: pointer;
    }

    input, textarea, select {
        font: inherit;
    }

    ul, ol {
        list-style: none;
    }

    /* Screen-reader-only */
    .sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}


/* ═══════════════════════════════════════════════════════════════
   LAYER: base
   ═══════════════════════════════════════════════════════════════ */
@layer base {
    body {
        font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
        background: #ffffff;
        color: var(--text-dark);
        line-height: 1.75;
        font-size: 15px;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    a {
        color: inherit;
        text-decoration: none;
    }

    /* Skip to content */
    .skip-to-content {
        position: absolute;
        top: -100px;
        right: 1rem;
        z-index: 9999;
        background: var(--primary);
        color: #fff;
        padding: 0.7rem 1.2rem;
        border-radius: 0 0 var(--radius) var(--radius);
        font-weight: 700;
        transition: top 0.2s ease;
    }
    .skip-to-content:focus {
        top: 0;
        outline: 3px solid var(--brand-300);
        outline-offset: 2px;
    }

    /* Focus visible */
    :focus-visible {
        outline: 3px solid var(--brand-300);
        outline-offset: 2px;
        border-radius: 4px;
    }
}


/* ═══════════════════════════════════════════════════════════════
   LAYER: layout
   ═══════════════════════════════════════════════════════════════ */
@layer layout {
    .blog-container {
        max-width: var(--container);
        margin: 0 auto;
        padding: 0 1.5rem;
    }

    .blog-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 2.5rem;
        align-items: start;
    }
}


/* ═══════════════════════════════════════════════════════════════
   LAYER: components
   ═══════════════════════════════════════════════════════════════ */
@layer components {

    /* ─── Header ──────────────────────────────────────────── */
    .blog-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(255, 251, 246, 0.92);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid rgba(231, 229, 228, 0.7);
    }

    .blog-header-inner {
        display: flex;
        align-items: center;
        gap: 1.5rem;
        padding: 0.85rem 1.5rem;
        max-width: 1280px;
        margin: 0 auto;
        flex-wrap: nowrap;
    }

    .blog-logo {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        flex-shrink: 0;
        order: 1;
    }

    .blog-logo .logo-mark {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 900;
        font-size: 0.95rem;
        letter-spacing: -0.5px;
        box-shadow: var(--shadow-brand);
        flex-shrink: 0;
    }

    .blog-logo .logo-text {
        display: flex;
        flex-direction: column;
        line-height: 1.2;
    }

    .blog-logo .logo-text strong {
        font-weight: 900;
        font-size: 1rem;
        color: var(--text-dark);
    }

    .blog-logo .logo-text small {
        font-size: 0.72rem;
        color: var(--text-muted);
        font-weight: 600;
    }

    .blog-nav {
        display: flex;
        gap: 0.4rem;
        align-items: center;
        order: 2;
    }

    .blog-nav a {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-gray);
        transition: var(--transition);
        padding: 0.5rem 0.85rem;
        border-radius: 10px;
        white-space: nowrap;
    }

    .blog-nav a:hover {
        color: var(--primary);
        background: var(--brand-50);
    }

    .blog-nav a i {
        font-size: 1.05rem;
    }

    .blog-search {
        position: relative;
        margin-right: auto;
        flex: 1 1 auto;
        max-width: 340px;
        min-width: 0;
        order: 3;
    }

    .blog-search i {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
        font-size: 1rem;
        pointer-events: none;
    }

    .blog-search input {
        width: 100%;
        padding: 0.6rem 2.5rem 0.6rem 1rem;
        border: 1.5px solid var(--border);
        border-radius: 999px;
        background: var(--surface-2);
        font-family: inherit;
        font-size: 0.88rem;
        color: var(--text-dark);
        transition: var(--transition);
    }

    .blog-search input:focus {
        outline: none;
        border-color: var(--primary);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
    }

    .blog-search input::placeholder {
        color: var(--text-muted);
    }

    .blog-menu-toggle {
        display: none;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-dark);
        cursor: pointer;
        padding: 0.4rem;
        border-radius: 10px;
        order: 4;
        flex-shrink: 0;
        transition: var(--transition);
    }

    .blog-menu-toggle:hover {
        background: var(--brand-50);
        color: var(--primary);
    }


    /* ─── Hero ─────────────────────────────────────────────── */
    .blog-hero {
        padding: 80px 0 60px;
        text-align: center;
        position: relative;
        overflow: hidden;
        background:
            radial-gradient(1000px 400px at 80% -10%, rgba(234, 88, 12, 0.08), transparent 60%),
            radial-gradient(800px 300px at 10% 110%, rgba(22, 163, 74, 0.07), transparent 60%),
            linear-gradient(180deg, var(--brand-50) 0%, #ffffff 100%);
    }

    .blog-hero::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image: radial-gradient(rgba(234, 88, 12, 0.08) 1px, transparent 1px);
        background-size: 22px 22px;
        mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 70%);
        -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 70%);
        z-index: 0;
        pointer-events: none;
    }

    .blog-hero > .blog-container {
        position: relative;
        z-index: 1;
    }

    .blog-hero-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.45rem 1rem;
        background: var(--brand-100);
        border: 1px solid var(--brand-200);
        border-radius: 999px;
        color: var(--brand-700);
        font-size: 0.82rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }

    .blog-hero h1 {
        font-size: clamp(1.7rem, 3.5vw, 2.6rem);
        font-weight: 900;
        letter-spacing: -0.5px;
        line-height: 1.4;
        color: var(--text-dark);
        margin-bottom: 0.8rem;
    }

    .blog-hero p {
        font-size: 1.02rem;
        color: var(--text-gray);
        max-width: 620px;
        margin: 0 auto;
        line-height: 1.9;
    }


    /* ─── Featured Post ───────────────────────────────────── */
    .blog-featured {
        padding: 40px 0 0;
    }

    .featured-card {
        display: grid;
        grid-template-columns: 1.1fr 1fr;
        gap: 0;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        overflow: hidden;
        box-shadow: var(--shadow-sm);
        transition: var(--transition);
        align-items: stretch;
    }

    .featured-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-3px);
        border-color: rgba(234, 88, 12, 0.35);
    }

    /* کانتینر تصویر با پس‌زمینه‌ی بلور */
    .featured-media {
        position: relative;
        aspect-ratio: 16 / 11;
        min-height: 380px;
        overflow: hidden;
        isolation: isolate;
        background: linear-gradient(135deg, var(--brand-50) 0%, var(--brand-100) 100%);
    }

    .featured-media::before {
        content: '';
        position: absolute;
        inset: -30px;
        background-image: var(--cover-bg, none);
        background-size: cover;
        background-position: center;
        filter: blur(40px) saturate(1.3);
        opacity: 0.4;
        transform: scale(1.1);
        z-index: 0;
        pointer-events: none;
    }

    .featured-media img {
        position: relative;
        z-index: 1;
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center;
        transition: transform 0.6s var(--ease-soft);
        will-change: transform;
    }

    .featured-card:hover .featured-media img {
        transform: scale(1.025);
    }

    .featured-media.no-image::before {
        display: none;
    }

    .featured-badge {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: var(--primary);
        color: #fff;
        padding: 0.35rem 0.9rem;
        border-radius: 999px;
        font-size: 0.75rem;
        font-weight: 700;
        box-shadow: var(--shadow-brand);
        z-index: 2;
    }

    .featured-body {
        padding: 2rem 2rem 2rem 2.5rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 0.8rem;
    }

    .featured-body h2 {
        font-size: 1.5rem;
        font-weight: 900;
        line-height: 1.5;
        color: var(--text-dark);
        letter-spacing: -0.3px;
    }

    .featured-body h2 a:hover {
        color: var(--primary);
    }

    .featured-body p {
        color: var(--text-gray);
        font-size: 0.95rem;
        line-height: 1.9;
    }

    .btn-read {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        align-self: flex-start;
        background: var(--primary);
        color: #fff;
        padding: 0.7rem 1.5rem;
        border-radius: 12px;
        font-weight: 700;
        font-size: 0.92rem;
        transition: var(--transition);
        margin-top: 0.5rem;
    }

    .btn-read:hover {
        background: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: var(--shadow-brand);
        color: #fff;
    }

    .post-category-inline {
        display: inline-block;
        color: var(--primary);
        font-size: 0.82rem;
        font-weight: 700;
        letter-spacing: 0.2px;
    }


    /* ─── Categories ──────────────────────────────────────── */
    .blog-categories {
        padding: 40px 0 20px;
    }

    .categories-scroll {
        display: flex;
        gap: 0.6rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        scrollbar-width: thin;
        scrollbar-color: var(--ink-300) transparent;
        -webkit-overflow-scrolling: touch;
    }

    .categories-scroll::-webkit-scrollbar {
        height: 5px;
    }
    .categories-scroll::-webkit-scrollbar-thumb {
        background: var(--ink-300);
        border-radius: 10px;
    }

    .cat-pill {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1.1rem;
        border: 1.5px solid var(--border);
        background: #fff;
        border-radius: 999px;
        font-size: 0.87rem;
        font-weight: 700;
        color: var(--text-gray);
        white-space: nowrap;
        transition: var(--transition);
        cursor: pointer;
        flex-shrink: 0;
    }

    .cat-pill span {
        background: var(--surface-2);
        color: var(--text-muted);
        font-size: 0.75rem;
        padding: 0.1rem 0.5rem;
        border-radius: 999px;
        font-weight: 700;
    }

    .cat-pill:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    .cat-pill.active {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
    }

    .cat-pill.active span {
        background: rgba(255, 255, 255, 0.25);
        color: #fff;
    }


    /* ─── Posts Grid ──────────────────────────────────────── */
    .blog-content {
        padding: 30px 0 80px;
    }

    .posts-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }

    .post-card {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        overflow: hidden;
        transition: var(--transition);
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .post-card:hover {
        transform: translateY(-4px);
        border-color: rgba(234, 88, 12, 0.35);
        box-shadow: var(--shadow-md);
    }

    .post-cover {
        position: relative;
        aspect-ratio: 16 / 10;
        background: linear-gradient(135deg, var(--brand-100), var(--brand-50));
        overflow: hidden;
        display: block;
    }

    .post-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.5s var(--ease-soft);
    }

    .post-card:hover .post-cover img {
        transform: scale(1.05);
    }

    .post-cover .post-category {
        position: absolute;
        bottom: 0.7rem;
        right: 0.7rem;
        background: rgba(28, 25, 23, 0.85);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        color: #fff;
        font-size: 0.72rem;
        font-weight: 700;
        padding: 0.3rem 0.75rem;
        border-radius: 999px;
        z-index: 1;
    }

    .post-body {
        padding: 1.2rem 1.2rem 1.3rem;
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        flex: 1;
        min-width: 0;
    }

    .post-body h3 {
        font-size: 1.05rem;
        font-weight: 800;
        line-height: 1.6;
        color: var(--text-dark);
    }

    .post-body h3 a:hover {
        color: var(--primary);
    }

    .post-body p {
        color: var(--text-gray);
        font-size: 0.88rem;
        line-height: 1.85;
        flex: 1;
    }

    .post-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.9rem;
        font-size: 0.78rem;
        color: var(--text-muted);
        font-weight: 600;
        padding-top: 0.6rem;
        border-top: 1px solid var(--ink-100);
    }

    .post-meta span {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
    }

    .post-meta i {
        font-size: 0.9rem;
        color: var(--primary);
    }

    .empty-state {
        text-align: center;
        padding: 4rem 1rem;
        color: var(--text-muted);
        grid-column: 1 / -1;
    }

    .empty-state i {
        font-size: 3rem;
        color: var(--border);
        margin-bottom: 1rem;
        display: block;
    }


    /* ─── Pagination ──────────────────────────────────────── */
    .blog-pagination {
        display: flex;
        justify-content: center;
        gap: 0.4rem;
        margin-top: 3rem;
        flex-wrap: wrap;
    }

    .page-btn {
        min-width: 42px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1.5px solid var(--border);
        background: #fff;
        border-radius: 12px;
        font-weight: 700;
        font-size: 0.9rem;
        color: var(--text-gray);
        transition: var(--transition);
        padding: 0 0.5rem;
    }

    .page-btn:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    .page-btn.active {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
        box-shadow: var(--shadow-brand);
    }

    .page-btn.disabled {
        opacity: 0.4;
        pointer-events: none;
    }


    /* ─── Sidebar ─────────────────────────────────────────── */
    .blog-sidebar {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        position: sticky;
        top: calc(var(--header-h) + 22px);
    }

    .sidebar-widget {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 1.3rem 1.3rem 1.4rem;
    }

    .widget-title {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.98rem;
        font-weight: 800;
        color: var(--text-dark);
        margin-bottom: 1rem;
        padding-bottom: 0.7rem;
        border-bottom: 2px solid var(--ink-100);
        position: relative;
    }

    .widget-title::after {
        content: '';
        position: absolute;
        bottom: -2px;
        right: 0;
        width: 40px;
        height: 2px;
        background: linear-gradient(90deg, var(--brand-500), var(--herb-500));
        border-radius: 2px;
    }

    .widget-title i {
        color: var(--primary);
        font-size: 1.05rem;
    }

    .widget-search {
        display: flex;
        gap: 0.4rem;
    }

    .widget-search input {
        flex: 1;
        padding: 0.65rem 0.9rem;
        border: 1.5px solid var(--border);
        border-radius: 10px;
        background: var(--surface-2);
        font-family: inherit;
        font-size: 0.88rem;
        transition: var(--transition);
        min-width: 0;
    }

    .widget-search input:focus {
        outline: none;
        border-color: var(--primary);
        background: #fff;
        box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
    }

    .widget-search button {
        background: var(--primary);
        color: #fff;
        border: none;
        padding: 0 0.95rem;
        border-radius: 10px;
        cursor: pointer;
        transition: var(--transition);
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .widget-search button:hover {
        background: var(--primary-dark);
    }

    .widget-categories {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 0.3rem;
    }

    .widget-categories li a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.6rem 0.75rem;
        border-radius: 10px;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-gray);
        transition: var(--transition);
    }

    .widget-categories li a:hover {
        background: var(--brand-50);
        color: var(--primary);
        transform: translateX(-3px);
    }

    .widget-categories li a em {
        background: var(--surface-2);
        color: var(--text-muted);
        font-style: normal;
        font-size: 0.75rem;
        padding: 0.1rem 0.55rem;
        border-radius: 999px;
        font-weight: 700;
    }

    .widget-categories li a:hover em {
        background: var(--primary);
        color: #fff;
    }

    .widget-popular {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }

    .widget-popular li {
        display: flex;
        gap: 0.7rem;
        align-items: flex-start;
        padding-bottom: 0.8rem;
        border-bottom: 1px dashed var(--ink-100);
    }

    .widget-popular li:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .pop-num {
        font-weight: 900;
        font-size: 1.05rem;
        color: var(--primary);
        line-height: 1;
        padding-top: 0.2rem;
        opacity: 0.5;
        flex-shrink: 0;
        direction: ltr;
    }

    .widget-popular li a {
        font-size: 0.88rem;
        font-weight: 600;
        color: var(--text-dark);
        line-height: 1.7;
        transition: var(--transition);
    }

    .widget-popular li a:hover {
        color: var(--primary);
    }

    .sidebar-cta {
        background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
        color: #fff;
        border-radius: var(--radius);
        padding: 1.8rem 1.4rem;
        text-align: center;
        position: relative;
        overflow: hidden;
    }

    .sidebar-cta::before {
        content: '';
        position: absolute;
        top: -40%;
        right: -30%;
        width: 180px;
        height: 180px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        pointer-events: none;
    }

    .sidebar-cta > i {
        font-size: 2rem;
        display: inline-block;
        margin-bottom: 0.6rem;
        position: relative;
        z-index: 1;
    }

    .sidebar-cta h4 {
        font-size: 1rem;
        font-weight: 800;
        margin-bottom: 0.4rem;
        position: relative;
        z-index: 1;
    }

    .sidebar-cta p {
        font-size: 0.85rem;
        opacity: 0.9;
        margin-bottom: 1rem;
        position: relative;
        z-index: 1;
        line-height: 1.7;
    }

    .btn-cta-side {
        display: inline-block;
        background: #fff;
        color: var(--primary);
        padding: 0.6rem 1.6rem;
        border-radius: 10px;
        font-weight: 800;
        font-size: 0.9rem;
        transition: var(--transition);
        position: relative;
        z-index: 1;
    }

    .btn-cta-side:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        color: var(--primary-dark);
    }


    /* ─── Ads ─────────────────────────────────────────────── */
    .blog-ad {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
        transition: var(--transition);
        margin: 1.5rem 0;
    }

    .blog-ad:hover {
        transform: translateY(-3px);
        border-color: var(--primary);
        box-shadow: var(--shadow-md);
    }

    .blog-ad-body {
        display: flex;
        gap: 1rem;
        padding: 1.1rem 1.2rem;
        align-items: flex-start;
    }

    .blog-ad-img {
        width: 80px;
        height: 80px;
        border-radius: 10px;
        overflow: hidden;
        flex-shrink: 0;
        background: linear-gradient(135deg, var(--brand-100), var(--brand-50));
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .blog-ad-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .blog-ad-img i {
        font-size: 2rem;
        color: var(--primary);
    }

    .blog-ad-content {
        flex: 1;
        min-width: 0;
    }

    .blog-ad-content h4 {
        font-size: 1rem;
        font-weight: 800;
        color: var(--text-dark);
        margin-bottom: 0.35rem;
        line-height: 1.5;
    }

    .blog-ad-content p {
        font-size: 0.88rem;
        color: var(--text-gray);
        line-height: 1.8;
        margin-bottom: 0.6rem;
    }

    .blog-ad-content .blog-ad-cta {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        background: var(--primary);
        color: #fff;
        padding: 0.5rem 1.1rem;
        border-radius: 9px;
        font-size: 0.82rem;
        font-weight: 700;
        transition: var(--transition);
    }

    .blog-ad-content .blog-ad-cta:hover {
        background: var(--primary-dark);
        color: #fff;
        transform: translateX(-3px);
    }

    .blog-sidebar .blog-ad,
    .post-sidebar .blog-ad {
        margin: 0;
    }

    .blog-sidebar .blog-ad-body {
        flex-direction: column;
        padding: 1rem;
    }

    .blog-sidebar .blog-ad-img {
        width: 100%;
        height: 120px;
    }

    .blog-hero-ad {
        max-width: var(--container);
        margin: 30px auto 0;
        padding: 0 1.5rem;
    }

    .blog-hero-ad .blog-ad {
        margin: 0 0 12px;
    }

    .blog-hero-ad .blog-ad:last-child {
        margin-bottom: 0;
    }

    .blog-ad-between {
        grid-column: 1 / -1;
        margin: 8px 0;
    }


    /* ─── Footer ──────────────────────────────────────────── */
    .blog-footer {
        background: var(--ink-900);
        color: var(--ink-400);
        padding: 3.5rem 0 1.5rem;
        margin-top: 4rem;
    }

    .blog-footer-grid {
        display: grid;
        grid-template-columns: 1.5fr 1fr 1fr;
        gap: 3rem;
        padding-bottom: 2rem;
        border-bottom: 1px solid rgba(168, 162, 158, 0.15);
    }

    .footer-col h4 {
        color: #fff;
        font-size: 1rem;
        font-weight: 800;
        margin-bottom: 1rem;
    }

    .footer-col p {
        font-size: 0.88rem;
        line-height: 1.9;
        max-width: 360px;
    }

    .footer-col ul {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .footer-col ul a {
        color: var(--ink-400);
        font-size: 0.88rem;
        transition: var(--transition);
        display: inline-block;
    }

    .footer-col ul a:hover {
        color: var(--brand-400);
        transform: translateX(-3px);
    }

    .blog-footer-bottom {
        padding-top: 1.5rem;
        text-align: center;
        font-size: 0.82rem;
        color: var(--ink-500);
    }


    /* ─── Scroll to Top ──────────────────────────────────── */
    .scroll-top-btn {
        position: fixed;
        left: 24px;
        bottom: 24px;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--primary);
        color: #fff;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.4rem;
        cursor: pointer;
        z-index: 999;
        box-shadow: var(--shadow-brand);
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease,
                    background-color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .scroll-top-btn.visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .scroll-top-btn:hover {
        background: var(--primary-dark);
        transform: translateY(-4px);
        box-shadow: 0 12px 28px rgba(234, 88, 12, 0.45);
    }

    .scroll-top-btn:focus-visible {
        outline: 3px solid rgba(234, 88, 12, 0.4);
        outline-offset: 3px;
    }

    .scroll-top-btn i {
        line-height: 1;
        pointer-events: none;
    }
}


/* ═══════════════════════════════════════════════════════════════
   LAYER: post-content — صفحه‌ی پست (single post)
   ═══════════════════════════════════════════════════════════════ */
@layer post-content {

    .single-post-wrap {
        padding: 40px 0 80px;
        background: #fff;
    }

    .single-post-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 3rem;
        align-items: start;
        max-width: var(--container);
        margin: 0 auto;
        padding: 0 1.5rem;
    }

    .post-breadcrumb {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.85rem;
        color: var(--text-muted);
        margin-bottom: 1.5rem;
    }

    .post-breadcrumb a {
        color: var(--primary);
        font-weight: 600;
        transition: var(--transition);
    }

    .post-breadcrumb a:hover {
        color: var(--primary-dark);
    }

    .post-breadcrumb .sep {
        color: var(--border);
    }

    .post-breadcrumb .current {
        color: var(--text-dark);
        font-weight: 700;
    }

    .post-header {
        margin-bottom: 2rem;
    }

    .post-header .post-category-inline {
        display: inline-block;
        background: var(--brand-100);
        color: var(--brand-700);
        padding: 0.35rem 0.9rem;
        border-radius: 999px;
        font-size: 0.78rem;
        font-weight: 700;
        margin-bottom: 1rem;
        border: 1px solid var(--brand-200);
    }

    .post-header h1 {
        font-size: clamp(1.5rem, 3vw, 2.2rem);
        font-weight: 900;
        line-height: 1.5;
        color: var(--text-dark);
        margin-bottom: 1rem;
        letter-spacing: -0.4px;
    }

    .post-header .post-lead {
        font-size: 1.05rem;
        line-height: 2;
        color: var(--text-gray);
        padding-right: 1rem;
        border-right: 3px solid var(--secondary);
        margin-bottom: 1.5rem;
    }

    .post-meta-bar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 1.2rem;
        padding: 0.9rem 1rem;
        background: var(--surface-2);
        border-radius: 12px;
        font-size: 0.85rem;
        color: var(--text-gray);
        font-weight: 600;
    }

    .post-meta-bar .meta-item {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }

    .post-meta-bar i {
        color: var(--primary);
        font-size: 1rem;
    }

    .post-cover-large {
        width: 100%;
        aspect-ratio: 16 / 9;
        background: linear-gradient(135deg, var(--brand-100), var(--brand-50));
        border-radius: var(--radius-lg);
        overflow: hidden;
        margin-bottom: 2rem;
        box-shadow: var(--shadow-md);
    }

    .post-cover-large img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* ─── محتوای مقاله ─── */
    .post-content {
        font-size: 1.02rem;
        line-height: 2.1;
        color: var(--ink-700);
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: break-word;
        max-width: 100%;
        min-width: 0;
    }

    .post-content > * + * {
        margin-top: 1.2rem;
    }

    .post-content * {
        max-width: 100%;
    }

    .post-content h2 {
        font-size: 1.5rem;
        font-weight: 900;
        color: var(--text-dark);
        margin-top: 2.5rem;
        margin-bottom: 1rem;
        padding-right: 1rem;
        position: relative;
        letter-spacing: -0.2px;
    }

    .post-content h2::before {
        content: '';
        position: absolute;
        right: 0;
        top: 0.35rem;
        bottom: 0.35rem;
        width: 4px;
        border-radius: 4px;
        background: linear-gradient(180deg, var(--brand-500), var(--herb-500));
    }

    .post-content h3 {
        font-size: 1.2rem;
        font-weight: 800;
        color: var(--text-dark);
        margin-top: 1.8rem;
        margin-bottom: 0.6rem;
    }

    .post-content p {
        margin-bottom: 1rem;
    }

    .post-content strong {
        color: var(--text-dark);
        font-weight: 800;
    }

    .post-content ul,
    .post-content ol {
        padding-right: 1.5rem;
        margin: 1rem 0;
    }

    .post-content ul {
        list-style: none;
        padding-right: 0;
    }

    .post-content ul li {
        position: relative;
        padding-right: 1.8rem;
        margin-bottom: 0.6rem;
    }

    .post-content ul li::before {
        content: '✓';
        position: absolute;
        right: 0;
        top: 0.2rem;
        width: 1.25rem;
        height: 1.25rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.7rem;
        font-weight: 900;
        color: #fff;
        background: linear-gradient(135deg, var(--brand-500), var(--herb-500));
        border-radius: 50%;
    }

    .post-content ol {
        list-style: none;
        counter-reset: pcount;
        padding-right: 0;
    }

    .post-content ol li {
        position: relative;
        padding-right: 2.2rem;
        margin-bottom: 0.6rem;
        counter-increment: pcount;
    }

    .post-content ol li::before {
        content: counter(pcount);
        position: absolute;
        right: 0;
        top: 0.15rem;
        width: 1.55rem;
        height: 1.55rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.78rem;
        font-weight: 800;
        color: var(--brand-700);
        background: var(--brand-100);
        border: 1px solid var(--brand-200);
        border-radius: 50%;
    }

    .post-content a {
        color: var(--info-500);
        font-weight: 700;
        border-bottom: 1.5px dashed rgba(2, 132, 199, 0.4);
        transition: var(--transition);
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .post-content a:hover {
        color: var(--info-600);
        border-bottom-style: solid;
    }

    .post-content blockquote {
        background: var(--ink-50);
        border-right: 4px solid var(--primary);
        padding: 1.2rem 1.4rem;
        border-radius: 12px;
        color: var(--text-dark);
        font-style: italic;
        margin: 1.5rem 0;
    }

    .post-content img {
        border-radius: 14px;
        margin: 1.5rem 0;
        box-shadow: var(--shadow-sm);
        height: auto;
    }

    .post-content img,
    .post-content video,
    .post-content embed,
    .post-content object,
    .post-content svg {
        max-width: 100% !important;
        height: auto !important;
    }

    .post-content iframe {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9;
        border-radius: 12px;
    }

    .post-content table {
        width: 100%;
        border-collapse: collapse;
        margin: 1.5rem 0;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: var(--shadow-sm);
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    .post-content table::-webkit-scrollbar {
        height: 6px;
    }

    .post-content table::-webkit-scrollbar-thumb {
        background: var(--ink-300);
        border-radius: 10px;
    }

    .post-content th,
    .post-content td {
        padding: 0.7rem 1rem;
        border: 1px solid var(--border);
        text-align: right;
    }

    .post-content th {
        background: var(--surface-2);
        font-weight: 800;
        color: var(--text-dark);
    }

    .post-content code {
        background: var(--ink-100);
        color: #be185d;
        padding: 0.15rem 0.5rem;
        border-radius: 6px;
        font-size: 0.88rem;
        direction: ltr;
        display: inline-block;
        white-space: pre-wrap;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .post-content pre {
        background: var(--ink-900);
        color: #a5f3fc;
        padding: 1rem 1.2rem;
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        direction: ltr;
        text-align: left;
        line-height: 1.8;
        font-size: 0.85rem;
    }

    .post-content pre code {
        background: transparent;
        color: inherit;
        padding: 0;
        display: block;
        white-space: pre;
        word-break: normal;
        direction: ltr;
        text-align: left;
    }

    .post-content > :first-child {
        margin-top: 0;
    }
    .post-content > :last-child {
        margin-bottom: 0;
    }

    /* ─── Post Boxes ─── */
    .post-box {
        border-radius: 14px;
        padding: 1.3rem 1.5rem;
        margin: 1.8rem 0;
        font-size: 0.98rem;
        line-height: 1.95;
    }

    .post-box strong {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 800;
    }

    .post-box p {
        margin: 0;
    }

    .post-box-info {
        background: linear-gradient(135deg, var(--brand-50), var(--herb-50));
        border: 1px solid var(--brand-200);
        border-right: 4px solid var(--primary);
        color: var(--brand-700);
    }

    .post-box-info strong {
        color: var(--brand-700);
    }

    .post-box-formula {
        background: var(--ink-900);
        color: #a5f3fc;
        text-align: center;
        padding: 1.5rem;
    }

    .post-box-formula code {
        font-family: 'Menlo', 'Consolas', monospace;
        font-size: 0.95rem;
        direction: ltr;
        display: block;
        color: #7dd3fc;
        line-height: 1.8;
        white-space: pre-wrap;
        word-break: break-word;
        overflow-wrap: anywhere;
        background: transparent;
        padding: 0;
    }

    .post-box-success {
        background: var(--herb-50);
        border-right: 4px solid var(--herb-500);
    }
    .post-box-success strong { color: #047857; }

    .post-box-warning {
        background: #fffbeb;
        border-right: 4px solid #f59e0b;
    }
    .post-box-warning strong { color: #b45309; }

    .post-box-danger {
        background: #fef2f2;
        border-right: 4px solid #dc2626;
    }
    .post-box-danger strong { color: #b91c1c; }


    /* ─── Tags ─── */
    .post-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin: 2.5rem 0;
        padding-top: 1.5rem;
        border-top: 1px solid var(--border);
    }

    .post-tag {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        background: var(--surface-2);
        border: 1px solid var(--border);
        color: var(--text-gray);
        padding: 0.4rem 0.9rem;
        border-radius: 999px;
        font-size: 0.82rem;
        font-weight: 700;
        transition: var(--transition);
    }

    .post-tag:hover {
        background: var(--brand-50);
        border-color: var(--primary);
        color: var(--primary);
        transform: translateY(-2px);
    }

    /* ─── Share ─── */
    .post-share {
        display: flex;
        align-items: center;
        gap: 0.7rem;
        flex-wrap: wrap;
        padding: 1.2rem 1.3rem;
        background: var(--surface-2);
        border-radius: 14px;
        margin: 2rem 0;
    }

    .post-share-label {
        font-weight: 800;
        font-size: 0.9rem;
        color: var(--text-dark);
        margin-left: 0.5rem;
    }

    .share-btn {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.15rem;
        color: #fff;
        transition: var(--transition);
        cursor: pointer;
        border: none;
    }

    .share-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
    }

    .share-btn.telegram { background: #0088cc; }
    .share-btn.whatsapp { background: #25d366; }
    .share-btn.twitter  { background: #000; }
    .share-btn.linkedin { background: #0a66c2; }
    .share-btn.copy     { background: var(--text-gray); }

    /* ─── Author ─── */
    .author-box {
        display: flex;
        gap: 1.2rem;
        align-items: flex-start;
        background: linear-gradient(135deg, var(--brand-50), var(--info-50));
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 1.5rem;
        margin: 2.5rem 0;
        flex-wrap: wrap;
    }

    .author-avatar {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 900;
        font-size: 1.5rem;
        flex-shrink: 0;
        box-shadow: var(--shadow-brand);
    }

    .author-info {
        flex: 1 1 200px;
        min-width: 0;
    }

    .author-info h4 {
        font-size: 1rem;
        font-weight: 800;
        color: var(--text-dark);
        margin-bottom: 0.2rem;
    }

    .author-info .author-role {
        font-size: 0.82rem;
        color: var(--primary);
        font-weight: 700;
        margin-bottom: 0.6rem;
    }

    .author-info p {
        font-size: 0.9rem;
        line-height: 1.85;
        color: var(--text-gray);
        margin: 0;
    }

    /* ─── Related ─── */
    .related-section {
        margin-top: 3rem;
        padding-top: 2.5rem;
        border-top: 2px solid var(--ink-100);
    }

    .related-section h3 {
        font-size: 1.3rem;
        font-weight: 900;
        color: var(--text-dark);
        margin-bottom: 1.5rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .related-section h3 i {
        color: var(--primary);
    }

    .related-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.2rem;
    }

    .related-card {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 14px;
        overflow: hidden;
        transition: var(--transition);
        display: flex;
        flex-direction: column;
    }

    .related-card:hover {
        transform: translateY(-4px);
        border-color: var(--primary);
        box-shadow: var(--shadow-md);
    }

    .related-card .rc-cover {
        aspect-ratio: 16 / 10;
        background: linear-gradient(135deg, var(--brand-100), var(--brand-50));
        overflow: hidden;
        display: block;
    }

    .related-card .rc-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.5s var(--ease-soft);
    }

    .related-card:hover .rc-cover img {
        transform: scale(1.05);
    }

    .related-card .rc-body {
        padding: 1rem 1rem 1.1rem;
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .related-card .rc-cat {
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--primary);
    }

    .related-card h4 {
        font-size: 0.92rem;
        font-weight: 800;
        line-height: 1.55;
        color: var(--text-dark);
    }

    .related-card h4 a:hover {
        color: var(--primary);
    }

    .related-card .rc-meta {
        font-size: 0.75rem;
        color: var(--text-muted);
        font-weight: 600;
        margin-top: auto;
        padding-top: 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.4rem;
    }

    /* ─── Post Sidebar (single) ─── */
    .post-sidebar {
        position: sticky;
        top: calc(var(--header-h) + 22px);
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .toc-widget {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 1.2rem 1.3rem 1.3rem;
    }

    .toc-widget h4 {
        font-size: 0.95rem;
        font-weight: 800;
        color: var(--text-dark);
        margin-bottom: 0.9rem;
        padding-bottom: 0.6rem;
        border-bottom: 2px solid var(--ink-100);
        display: flex;
        align-items: center;
        gap: 0.5rem;
        position: relative;
    }

    .toc-widget h4::after {
        content: '';
        position: absolute;
        bottom: -2px;
        right: 0;
        width: 40px;
        height: 2px;
        background: linear-gradient(90deg, var(--brand-500), var(--herb-500));
    }

    .toc-widget h4 i {
        color: var(--primary);
    }

    .toc-list {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
    }

    .toc-list li a {
        display: block;
        padding: 0.45rem 0.7rem;
        border-radius: 8px;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-gray);
        transition: var(--transition);
        border-right: 3px solid transparent;
    }

    .toc-list li a:hover {
        background: var(--brand-50);
        color: var(--primary);
        border-right-color: var(--primary);
    }

    .toc-list li.toc-h3 a {
        padding-right: 1.3rem;
        font-size: 0.82rem;
        font-weight: 500;
    }

    /* ─── Reading Progress ─── */
    .reading-progress {
        position: fixed;
        top: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--brand-500), var(--herb-500));
        z-index: 1100;
        width: 0%;
        transition: width 0.1s linear;
        box-shadow: 0 0 8px rgba(234, 88, 12, 0.4);
    }

    /* ─── 404 ─── */
    .not-found-wrap {
        padding: 100px 1.5rem;
        text-align: center;
        max-width: 600px;
        margin: 0 auto;
    }

    .not-found-wrap > i {
        font-size: 5rem;
        color: var(--border);
        display: block;
        margin-bottom: 1.5rem;
    }

    .not-found-wrap h1 {
        font-size: 1.8rem;
        font-weight: 900;
        margin-bottom: 1rem;
        color: var(--text-dark);
    }

    .not-found-wrap p {
        color: var(--text-gray);
        margin-bottom: 2rem;
        line-height: 1.9;
    }

    .not-found-wrap .btn-back {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        background: var(--primary);
        color: #fff;
        padding: 0.8rem 1.8rem;
        border-radius: 12px;
        font-weight: 700;
        transition: var(--transition);
    }

    .not-found-wrap .btn-back i {
        font-size: 1.1rem;
        display: inline-flex;
        margin: 0;
        color: inherit;
    }

    .not-found-wrap .btn-back:hover {
        background: var(--primary-dark);
        transform: translateY(-3px);
        box-shadow: var(--shadow-brand);
    }
}


/* ═══════════════════════════════════════════════════════════════
   LAYER: responsive
   ═══════════════════════════════════════════════════════════════ */
@layer responsive {

    /* ── تبلت بزرگ (≤ 1024px) ───────────────────────────── */
    @media (max-width: 1024px) {
        .blog-layout {
            grid-template-columns: minmax(0, 1fr) 280px;
            gap: 2rem;
        }

        .featured-card {
            grid-template-columns: 1fr 1fr;
        }

        .featured-body h2 { font-size: 1.3rem; }

        .single-post-layout {
            grid-template-columns: 1fr;
            gap: 2rem;
        }

        .post-sidebar { position: static; }

        .related-grid { grid-template-columns: repeat(2, 1fr); }
    }

    /* ── تبلت کوچک / موبایل بزرگ (≤ 860px) ─────────────── */
    @media (max-width: 860px) {
        .blog-header-inner {
            padding: 0.75rem 1rem;
            gap: 0.8rem;
            flex-wrap: wrap;
            align-items: center;
        }

        .blog-logo { order: 1; }

        .blog-menu-toggle {
            display: flex;
            order: 3;
            margin-right: auto;
            align-items: center;
            justify-content: center;
        }

        .blog-search {
            order: 4;
            flex: 1 1 100%;
            max-width: none;
            margin-right: 0;
        }

        .blog-nav {
            order: 5;
            flex: 1 1 100%;
            display: none;
            flex-direction: column;
            align-items: stretch;
            gap: 0.3rem;
            padding: 0.6rem 0 0.2rem;
            border-top: 1px solid var(--border);
            margin-top: 0.5rem;
        }

        .blog-nav.open { display: flex; }

        .blog-nav a {
            padding: 0.6rem 0.9rem;
            justify-content: flex-start;
        }

        .blog-layout { grid-template-columns: 1fr; }
        .blog-sidebar { position: static; }

        .featured-card { grid-template-columns: 1fr; }
        .featured-media { min-height: 280px; aspect-ratio: 16 / 10; }
        .featured-body { padding: 1.5rem; }
    }

    /* ── موبایل (≤ 640px) ───────────────────────────────── */
    @media (max-width: 640px) {
        .blog-hero { padding: 60px 0 45px; }
        .blog-hero h1 { font-size: 1.5rem; }
        .blog-hero p { font-size: 0.92rem; }

        .posts-grid { grid-template-columns: 1fr; }

        .featured-media { min-height: 220px; }
        .featured-body h2 { font-size: 1.15rem; }

        .blog-footer-grid {
            grid-template-columns: 1fr;
            gap: 2rem;
        }

        .blog-pagination { gap: 0.3rem; }
        .page-btn {
            min-width: 38px;
            height: 38px;
            font-size: 0.85rem;
        }

        .blog-logo .logo-text small { display: none; }

        .scroll-top-btn {
            width: 42px;
            height: 42px;
            left: 16px;
            bottom: 16px;
            font-size: 1.2rem;
        }

        .blog-hero-ad {
            margin-top: 20px;
            padding: 0 1rem;
        }

        .blog-ad-between { margin: 4px 0; }

        .single-post-wrap { padding: 25px 0 50px; }
        .single-post-layout { padding: 0 1rem; gap: 1.5rem; }

        .post-header h1 { font-size: 1.35rem; }
        .post-header .post-lead { font-size: 0.95rem; }

        .post-meta-bar {
            gap: 0.7rem;
            font-size: 0.78rem;
            padding: 0.7rem 0.8rem;
        }

        .post-content { font-size: 0.96rem; line-height: 1.95; }
        .post-content h2 { font-size: 1.25rem; margin-top: 2rem; }
        .post-content h3 { font-size: 1.08rem; }

        .post-content table { font-size: 0.82rem; }
        .post-content th,
        .post-content td { padding: 0.55rem 0.7rem; }

        .post-content blockquote {
            padding: 0.9rem 1.05rem;
            font-size: 0.92rem;
        }

        .post-box {
            padding: 1rem 1.1rem;
            font-size: 0.92rem;
        }

        .post-cover-large {
            border-radius: 14px;
            margin-bottom: 1.3rem;
        }

        .post-tags { gap: 0.4rem; margin: 1.8rem 0; }
        .post-tag { font-size: 0.76rem; padding: 0.35rem 0.75rem; }

        .post-share { gap: 0.5rem; padding: 0.9rem; }
        .post-share-label {
            width: 100%;
            margin: 0 0 0.2rem 0;
            font-size: 0.85rem;
        }
        .share-btn { width: 40px; height: 40px; font-size: 1.05rem; }

        .author-box { padding: 1.1rem; gap: 0.85rem; }
        .author-avatar { width: 50px; height: 50px; font-size: 1.15rem; }
        .author-info h4 { font-size: 0.95rem; }
        .author-info p { font-size: 0.85rem; }

        .related-section { margin-top: 2rem; padding-top: 1.8rem; }
        .related-section h3 { font-size: 1.1rem; }

        .post-sidebar { gap: 1.1rem; }
        .toc-widget,
        .sidebar-widget { padding: 1rem 1.1rem; }

        .blog-ad-body { flex-direction: column; padding: 1rem; }
        .blog-ad-img { width: 100%; height: 120px; }

        .related-grid { grid-template-columns: 1fr; }
    }

    /* ── موبایل کوچک (≤ 400px) ─────────────────────────── */
    @media (max-width: 400px) {
        .blog-container { padding: 0 1rem; }

        .blog-logo .logo-mark {
            width: 38px;
            height: 38px;
            font-size: 0.85rem;
        }
        .blog-logo .logo-text strong { font-size: 0.9rem; }

        .blog-search input {
            font-size: 0.82rem;
            padding: 0.55rem 2.2rem 0.55rem 0.9rem;
        }

        .single-post-layout { padding: 0 0.7rem; }
        .post-header h1 { font-size: 1.12rem; }
        .post-meta-bar {
            font-size: 0.72rem;
            gap: 0.5rem;
            padding: 0.6rem 0.7rem;
        }
        .share-btn { width: 36px; height: 36px; font-size: 0.95rem; }
        .post-content { font-size: 0.92rem; }
        .post-content h2 { font-size: 1.1rem; }
        .post-content h3 { font-size: 1rem; }
        .post-content table { font-size: 0.76rem; }
        .post-content th,
        .post-content td { padding: 0.45rem 0.55rem; }
    }
}


/* ═══════════════════════════════════════════════════════════════
   LAYER: preferences — reduced motion, print, dark
   ═══════════════════════════════════════════════════════════════ */
@layer preferences {

    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after {
            animation-duration: 0.01ms !important;
            transition-duration: 0.01ms !important;
        }

        html { scroll-behavior: auto; }

        .scroll-top-btn {
            transition: opacity 0.15s ease, visibility 0.15s ease;
            transform: none !important;
        }
        .scroll-top-btn.visible { transform: none !important; }
        .scroll-top-btn:hover { transform: none !important; }
    }

    /* چاپ */
    @media print {
        .blog-header,
        .blog-footer,
        .blog-sidebar,
        .post-sidebar,
        .post-share,
        .blog-ad,
        .scroll-top-btn,
        .blog-pagination,
        .related-section {
            display: none !important;
        }

        body {
            background: #fff;
            color: #000;
            font-size: 12pt;
        }

        .post-content { max-width: 100%; }
        .post-content a { color: #000; border: none; }
        .post-content a::after { content: " (" attr(href) ")"; font-size: 0.85em; }
    }
}