/* ============================================
   Nexel CMS - Frontend Stylesheet
   Style: Editorial / Warm & Earthy
   ============================================ */

:root {
    --primary: #0f766e;
    --primary-dark: #0d5f58;
    --primary-light: #14b8a6;
    --primary-50: #f0fdfa;
    --accent: #f59e0b;
    --accent-50: #fffbeb;
    --danger: #dc2626;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    --cream: #faf9f7;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --font: 'Shabnam', 'Tahoma', sans-serif;
    --container: 1240px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--cream);
    color: var(--gray-800);
    font-size: 15px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* ============ Header ============ */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.3s;
}

.site-header.scrolled {
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 80px;
    position: relative;
}

.header-logo {
    flex-shrink: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(15,118,110,0.3);
}

.logo-img {
    height: 44px;
    width: auto;
    display: block;
    object-fit: contain;
}

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

.logo-text strong {
    font-size: 20px;
    font-weight: 800;
    color: var(--gray-900);
}

.logo-text span {
    font-size: 12px;
    color: var(--gray-500);
}

/* Main Nav */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 4px;
    align-items: center;
}

.main-nav ul li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.main-nav ul li a:hover {
    color: var(--primary);
    background: var(--primary-50);
}

.main-nav ul li a.active {
    color: var(--white);
    background: var(--primary);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-toggle,
.nav-toggle {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.search-toggle:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary);
}

.nav-toggle {
    display: none;
}

/* Search Bar */
.search-bar {
    display: none;
    border-top: 1px solid var(--gray-100);
    padding: 16px 0;
    background: var(--white);
}

.search-bar.open {
    display: block;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px 20px;
}

.search-form i {
    color: var(--gray-400);
}

.search-form input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    font-family: var(--font);
    outline: none;
    color: var(--gray-800);
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.2s;
    font-family: var(--font);
    line-height: 1.4;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(15,118,110,0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-accent {
    background: var(--accent);
    color: var(--gray-900);
    box-shadow: 0 4px 12px rgba(245,158,11,0.25);
}

.btn-accent:hover {
    background: #d97706;
    color: var(--white);
}

.btn-light {
    background: var(--white);
    color: var(--primary);
}

.btn-light:hover {
    background: var(--primary-50);
    color: var(--primary-dark);
}

/* ============ Hero ============ */
.hero-section {
    background: linear-gradient(160deg, #0f766e 0%, #134e4a 60%, #0f766e 100%);
    color: var(--white);
    position: relative;
    overflow: hidden;
    padding: 80px 0 100px;
}

.hero-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image: radial-gradient(circle at 25% 25%, var(--white) 1px, transparent 1px),
                      radial-gradient(circle at 75% 75%, var(--white) 1px, transparent 1px);
    background-size: 60px 60px;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 720px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
    backdrop-filter: blur(4px);
}

.hero-badge i {
    color: var(--accent);
}

.hero-content h1 {
    font-size: clamp(26px, 5vw, 52px);
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.hero-content h1 .highlight {
    color: var(--accent);
}

.hero-content p {
    font-size: 18px;
    line-height: 1.8;
    opacity: 0.95;
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    gap: 40px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.hero-stat {
    text-align: center;
}

.hero-stat strong {
    display: block;
    font-size: 32px;
    font-weight: 900;
    color: var(--accent);
}

.hero-stat span {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 4px;
}

/* ============ Section Headers ============ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
}

.section-header h2 {
    font-size: clamp(22px, 3.5vw, 30px);
    font-weight: 800;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.section-header h2 i {
    color: var(--primary);
    font-size: 24px;
}

.section-header p {
    color: var(--gray-500);
    font-size: 14px;
}

/* ============ Post Grid Section ============ */
.section {
    padding: 80px 0;
}

.section-alt {
    background: var(--white);
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.post-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-6px);
}

.post-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.post-card:hover .post-card-image img {
    transform: scale(1.08);
}

.post-card-category {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--accent);
    color: var(--gray-900);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 2;
}

.post-card-category-inline {
    position: static;
    display: inline-block;
    margin-bottom: 16px;
}

.post-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.post-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.post-card-meta i {
    color: var(--primary);
}

.post-card-title {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 10px;
}

.post-card-title-sm {
    font-size: 16px;
    line-height: 1.5;
}

.post-card-title a {
    color: var(--gray-900);
    text-decoration: none;
}

.post-card-title a:hover {
    color: var(--primary);
}

.post-card-excerpt {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.7;
    margin-bottom: 16px;
    flex: 1;
}

.post-card-readmore {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
}

.post-card-readmore:hover {
    color: var(--primary-dark);
    gap: 12px;
}

/* ============ Featured / First post ============ */
.featured-post {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 48px;
}

.featured-post-image {
    min-height: 380px;
}

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

.featured-post-body {
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-post-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--gray-500);
}

.featured-post-meta .category {
    background: var(--primary-50);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
}

.featured-post h3 {
    font-size: clamp(21px, 3.5vw, 32px);
    font-weight: 900;
    line-height: 1.4;
    margin-bottom: 16px;
    color: var(--gray-900);
}

.featured-post h3 a {
    color: inherit;
    text-decoration: none;
}

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

.featured-post p {
    color: var(--gray-600);
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 24px;
}

/* ============ Portfolio Section ============ */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* کارت نمونه‌کار: عکس بالا + متن زیر عکس داخل کارت، کاملاً ثابت (بدون افکت هاور) */
.portfolio-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--white);
    border: 1px solid var(--border-color, #e5e7eb);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.portfolio-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ناحیه تصویر با ارتفاع ثابت */
.portfolio-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--gray-100);
    flex-shrink: 0;
}

/* بدنه متن زیر تصویر — داخل بوردر زیبای کارت */
.portfolio-card-content {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--white);
}

.portfolio-card-category {
    display: inline-block;
    width: fit-content;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-50);
    padding: 4px 12px;
    border-radius: 999px;
}

.portfolio-card-content h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.6;
    margin: 0;
}

.portfolio-card-content p {
    font-size: 13.5px;
    color: var(--gray-500);
    line-height: 1.9;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* لینک «مشاهده پروژه» پایین کارت — ثابت */
.portfolio-card-more {
    margin-top: auto;
    padding-top: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============ Sidebar / Blog layout ============ */
.blog-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: start;
}

.blog-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.blog-list-item {
    display: flex;
    gap: 24px;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    transition: box-shadow 0.3s;
}

.blog-list-item:hover {
    box-shadow: var(--shadow);
}

.blog-list-item-image {
    width: 280px;
    flex-shrink: 0;
    min-height: 220px;
    position: relative;
}

.blog-list-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-list-item-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.blog-list-item .post-card-title {
    font-size: 22px;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 100px;
}

.sidebar-widget {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    margin-bottom: 24px;
}

.sidebar-widget h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-widget h3 i {
    color: var(--primary);
}

.widget-categories {
    list-style: none;
}

.widget-categories li {
    margin-bottom: 4px;
}

.widget-categories a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.widget-categories a:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.widget-categories .count {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
}

.widget-popular {
    list-style: none;
}

.widget-popular li {
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
}

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

.widget-popular a {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
}

.widget-popular .popular-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.6;
}

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

.widget-popular .popular-meta {
    font-size: 12px;
    color: var(--gray-500);
    display: flex;
    gap: 12px;
}

.widget-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.widget-tags a {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.widget-tags a:hover {
    background: var(--primary);
    color: var(--white);
}

/* ============ Single Post ============ */
.single-hero {
    background: linear-gradient(160deg, #0f766e 0%, #134e4a 100%);
    color: var(--white);
    padding: 64px 0 72px;
}

.single-hero .container {
    max-width: 900px;
}

.single-category {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: var(--gray-900);
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 20px;
    text-decoration: none;
}

.single-category:hover {
    color: var(--white);
    background: #d97706;
}

.single-hero h1 {
    font-size: clamp(24px, 4vw, 40px);
    font-weight: 900;
    line-height: 1.4;
    margin-bottom: 24px;
}

.single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 14px;
    opacity: 0.95;
}

.single-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.single-meta i {
    color: var(--accent);
}

.single-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 24px;
    background: var(--white);
    margin-top: -32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    position: relative;
    z-index: 2;
}

.single-content-inner {
    font-size: 17px;
    line-height: 2.1;
    color: var(--gray-700);
}

.single-content-inner img {
    border-radius: var(--radius);
    margin: 24px auto;
}

.single-content-inner h2,
.single-content-inner h3,
.single-content-inner h4 {
    color: var(--gray-900);
    margin: 28px 0 16px;
    font-weight: 800;
    line-height: 1.5;
}

.single-content-inner h2 { font-size: 28px; }
.single-content-inner h3 { font-size: 24px; }

.single-content-inner p {
    margin-bottom: 20px;
}

.single-content-inner ul,
.single-content-inner ol {
    margin: 20px 0;
    padding-right: 28px;
}

.single-content-inner li {
    margin-bottom: 8px;
}

.single-content-inner blockquote {
    background: var(--primary-50);
    border-right: 4px solid var(--primary);
    padding: 24px;
    border-radius: var(--radius-sm);
    margin: 24px 0;
    font-style: italic;
    color: var(--gray-700);
}

.single-content-inner table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

.single-content-inner th,
.single-content-inner td {
    padding: 12px;
    border: 1px solid var(--gray-200);
    text-align: right;
}

.single-content-inner th {
    background: var(--gray-100);
    font-weight: 700;
}

.single-footer {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

.share-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.share-section .share-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--white);
    text-decoration: none;
    transition: transform 0.2s;
}

.share-btn:hover {
    transform: translateY(-3px);
}

.share-telegram { background: #229ed9; }
.share-twitter { background: #1da1f2; }
.share-facebook { background: #1877f2; }
.share-linkedin { background: #0a66c2; }
.share-whatsapp { background: #25d366; }

/* Related Posts */
.related-section {
    margin-top: 0;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ============ Page Hero ============ */
.page-hero {
    background: linear-gradient(160deg, #0f766e 0%, #134e4a 100%);
    color: var(--white);
    padding: 80px 0;
    text-align: center;
}

.page-hero h1 {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    margin-bottom: 12px;
}

.page-hero p {
    font-size: 17px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Page content */
.page-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 24px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-top: -40px;
    position: relative;
    z-index: 2;
}

.page-content-inner {
    font-size: 17px;
    line-height: 2.1;
}

.page-content-inner h2,
.page-content-inner h3 {
    color: var(--gray-900);
    margin: 28px 0 16px;
    font-weight: 800;
}

.page-content-inner p {
    margin-bottom: 20px;
}

/* ============ Pagination ============ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-300);
    text-decoration: none;
    color: var(--gray-700);
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s;
    background: var(--white);
}

.page-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

.page-link.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.empty-state i {
    font-size: 64px;
    color: var(--gray-300);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 22px;
    color: var(--gray-800);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* ============ Footer ============ */
.site-footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 64px 0 0;
    margin-top: 80px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 48px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.footer-logo .logo-icon {
    width: 42px;
    height: 42px;
    font-size: 18px;
}

.footer-logo-img {
    height: 38px;
    width: auto;
    display: block;
    object-fit: contain;
}

.footer-logo .logo-text strong {
    color: var(--white);
    font-size: 18px;
}

.footer-about p {
    font-size: 14px;
    line-height: 1.9;
    color: var(--gray-500);
}

.footer-col h4 {
    color: var(--white);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
    position: relative;
    padding-bottom: 12px;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background: var(--accent);
    border-radius: 3px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--gray-400);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-links a:hover {
    color: var(--white);
    padding-right: 4px;
}

.footer-links .count {
    color: var(--gray-500);
    font-size: 12px;
}

.footer-contact li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-contact i {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 24px 0;
    text-align: center;
    font-size: 13px;
    color: var(--gray-500);
}

/* ============ Back to Top ============ */
.back-to-top {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: all 0.3s;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark);
}

/* ============ Blog Toolbar ============ */
.blog-toolbar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border: 1px solid var(--gray-100);
}

.blog-toolbar .search-form {
    flex: 1;
    min-width: 250px;
    margin: 0;
}

.blog-toolbar .search-form .search-icon-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
}

.blog-toolbar .search-form .search-icon-wrapper i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    z-index: 1;
}

.blog-toolbar .search-form .search-input {
    width: 100%;
    padding: 12px 42px 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    color: var(--gray-800);
    background: var(--white);
}

.blog-toolbar .search-form .search-input:focus {
    border-color: var(--primary);
}

/* ============ Portfolio Filter ============ */
.portfolio-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.filter-btn {
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    font-family: var(--font);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ============ CTA Section ============ */
.cta-section {
    background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
    border-radius: var(--radius-lg);
    padding: 48px;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.1;
    background-image: radial-gradient(circle at 75% 25%, var(--white) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.cta-section .cta-content {
    position: relative;
    z-index: 2;
}

.cta-section .cta-content h2 {
    font-size: 28px;
    font-weight: 900;
    margin-bottom: 8px;
    color: var(--white);
}

.cta-section .cta-content p {
    opacity: 0.9;
    font-size: 16px;
    margin: 0;
}

.cta-section .cta-actions {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ============ Error 404 Page ============ */
.error-page-404 {
    min-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #f0fdfa 0%, #f8fafc 50%, #f1f5f9 100%);
}

.error-page-404 .error-404-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 680px;
}

.error-404-icon {
    font-size: 72px;
    color: #0f766e;
    margin-bottom: 12px;
    display: inline-block;
    filter: drop-shadow(0 8px 24px rgba(15,118,110,0.2));
}

.error-404-number {
    font-size: clamp(90px, 18vw, 150px);
    font-weight: 900;
    line-height: 1.05;
    margin: 8px 0 12px;
    letter-spacing: -6px;
    background: linear-gradient(135deg, #0f766e 0%, #134e4a 50%, #115e59 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

.error-404-content h1 {
    font-size: clamp(22px, 4vw, 26px);
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 14px;
}

.error-404-content .error-404-desc {
    font-size: 15px;
    color: #64748b;
    line-height: 1.9;
    max-width: 480px;
    margin: 0 auto 36px;
}

.error-404-search {
    max-width: 430px;
    margin: 0 auto 40px;
}

.error-404-search-form {
    display: flex;
    gap: 8px;
    background: #ffffff;
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(15,118,110,0.10);
    border: 1px solid #e2e8f0;
}

.error-404-search-form input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    padding: 11px 18px;
    font-family: var(--font);
    font-size: 14px;
    background: transparent;
    color: #1e293b;
}

.error-404-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.error-404-note {
    margin-top: 36px;
    font-size: 13px;
    color: #94a3b8;
}

.error-404-note a {
    color: #0f766e;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid rgba(15,118,110,0.3);
    padding-bottom: 1px;
}

/* ============ Project Details ============ */
.project-details {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-100);
    margin-bottom: 32px;
}

.project-details h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-details h3 i {
    color: var(--primary);
}

.project-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.project-detail-item {
    padding: 14px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.project-detail-label {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.project-detail-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
}

.project-detail-value a {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

/* ============ Responsive ============ */

/* Prevent horizontal scrollbar globally */
body {
    overflow-x: hidden;
}

/* ============ Tablet (≤ 1024px) ============ */
@media (max-width: 1024px) {
    .post-grid,
    .portfolio-grid,
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .blog-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .featured-post {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-content h1 {
        font-size: 40px;
    }
    
    .container {
        padding: 0 20px;
    }
    
    .portfolio-filter {
        gap: 8px;
    }
    
    .portfolio-filter .filter-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ============ Small Tablet / Large Mobile (≤ 768px) ============ */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .header-inner {
        height: 72px;
        gap: 12px;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .header-logo .logo-text span {
        display: none;
    }
    
    .header-logo .logo-icon {
        width: 42px;
        height: 42px;
        font-size: 19px;
    }
    
    .header-logo .logo-img {
        height: 36px;
    }
    
    .header-logo .logo-text strong {
        font-size: 17px;
    }
    
    .main-nav {
        position: fixed;
        top: 72px;
        right: 0;
        width: min(300px, 85vw);
        height: calc(100vh - 72px);
        background: var(--white);
        flex-direction: column;
        justify-content: flex-start;
        padding: 24px;
        box-shadow: var(--shadow-lg);
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1001;
        overflow-y: auto;
    }
    
    .main-nav.open {
        transform: translateX(0);
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 4px;
        width: 100%;
    }
    
    .main-nav ul li a {
        justify-content: flex-start;
        padding: 14px 16px;
        font-size: 16px;
        width: 100%;
    }
    
    /* Nav backdrop overlay */
    .nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
        backdrop-filter: blur(2px);
    }
    
    .nav-overlay.show {
        display: block;
    }
    
    .hero-section {
        padding: 48px 0 64px;
    }
    
    .hero-content h1 {
        font-size: 32px;
        letter-spacing: 0;
    }
    
    .hero-content p {
        font-size: 16px;
    }
    
    .hero-badge {
        font-size: 12px;
        padding: 7px 14px;
        margin-bottom: 18px;
    }
    
    .hero-stats {
        gap: 24px;
        flex-wrap: wrap;
        margin-top: 36px;
        padding-top: 24px;
    }
    
    .hero-stat strong {
        font-size: 26px;
    }
    
    .post-grid,
    .portfolio-grid,
    .related-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-list-item {
        flex-direction: column;
    }
    
    .blog-list-item-image {
        width: 100%;
        min-height: 200px;
        height: 220px;
    }
    
    .blog-list-item-body {
        padding: 20px;
    }
    
    .featured-post-body {
        padding: 32px;
    }
    
    .featured-post h3 {
        font-size: 24px;
    }
    
    .featured-post-image {
        min-height: 280px;
    }
    
    .single-hero {
        padding: 48px 0 56px;
    }
    
    .single-hero h1 {
        font-size: 28px;
    }
    
    .single-content {
        padding: 32px 20px;
        margin-top: -24px;
    }
    
    .single-content-inner {
        font-size: 16px;
        line-height: 2;
    }
    
    .single-content-inner h2 { font-size: 24px; }
    .single-content-inner h3 { font-size: 20px; }
    
    .single-footer {
        padding: 0 20px 48px;
    }
    
    .single-meta {
        gap: 16px;
        font-size: 13px;
    }
    
    .page-hero h1 {
        font-size: 32px;
    }
    
    .page-content {
        padding: 40px 20px;
        margin-top: -24px;
    }
    
    .section {
        padding: 48px 0;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 24px;
    }
    
    .section-header h2 {
        font-size: 26px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .site-footer {
        padding: 48px 0 0;
        margin-top: 48px;
    }
    
    .footer-bottom {
        padding: 20px 0;
    }
    
    .search-form {
        padding: 10px 14px;
    }
    
    .search-form input {
        font-size: 14px;
    }
    
    /* Blog toolbar */
    .blog-toolbar {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .blog-toolbar .search-form {
        min-width: 100% !important;
    }
    
    /* Portfolio filter */
    .portfolio-filter {
        gap: 8px;
        padding: 0 4px;
    }
    
    .portfolio-filter .filter-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Share section */
    .share-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .share-buttons {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* CTA sections */
    .cta-section {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 32px !important;
    }
    
    .cta-section h2 {
        font-size: 24px !important;
    }
    
    /* Tables & code horizontal scroll */
    .single-content-inner table,
    .page-content-inner table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .single-content-inner pre,
    .page-content-inner pre {
        overflow-x: auto;
        white-space: pre-wrap;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .page-link {
        min-width: 40px;
        height: 40px;
    }
}

/* ============ Mobile (≤ 480px) ============ */
@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .header-logo .logo-icon {
        width: 38px;
        height: 38px;
        font-size: 17px;
    }
    
    .header-logo .logo-img {
        height: 32px;
    }
    
    .header-logo .logo-text strong {
        font-size: 16px;
    }
    
    .search-toggle,
    .nav-toggle {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    
    .hero-content h1 {
        font-size: 26px;
    }
    
    .hero-content p {
        font-size: 14px;
        line-height: 1.8;
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .hero-actions .btn {
        width: 100%;
        padding: 12px 20px;
    }
    
    .hero-stats {
        gap: 16px;
        justify-content: space-between;
    }
    
    .hero-stat strong {
        font-size: 22px;
    }
    
    .hero-stat span {
        font-size: 11px;
    }
    
    .section-header h2 {
        font-size: 22px;
    }
    
    .section-header h2 i {
        font-size: 20px;
    }
    
    .post-card-body {
        padding: 20px;
    }
    
    .post-card-title {
        font-size: 17px;
    }
    
    .post-card-meta {
        flex-wrap: wrap;
        gap: 8px 12px;
    }
    
    .blog-list-item-image {
        height: 180px;
        min-height: 180px;
    }
    
    .featured-post h3 {
        font-size: 21px;
    }
    
    .single-hero h1 {
        font-size: 24px;
        line-height: 1.5;
    }
    
    .page-hero h1 {
        font-size: 28px;
    }
    
    .page-hero {
        padding: 48px 0;
    }
    
    .share-buttons {
        justify-content: space-between;
        gap: 8px;
    }
    
    .share-btn {
        width: 40px;
        height: 40px;
        font-size: 15px;
    }
    
    .single-meta {
        gap: 10px;
        font-size: 12px;
    }
    
    .single-meta span {
        gap: 6px;
    }
    
    .empty-state {
        padding: 48px 16px;
    }
    
    .empty-state i {
        font-size: 48px;
    }
    
    .footer-col h4 {
        font-size: 15px;
        margin-bottom: 18px;
    }
    
    .footer-links a {
        font-size: 13px;
    }
    
    .cta-section {
        padding: 28px !important;
    }
    
    .cta-section h2 {
        font-size: 22px !important;
    }
    
    .cta-section a.btn {
        width: 100%;
    }
    
    .back-to-top {
        bottom: 16px;
        left: 16px;
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    .pagination {
        gap: 4px;
    }
    
    .page-link {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        padding: 0 8px;
    }
}

/* Extra refinements inside 480px (added) */
@media (max-width: 480px) {
    .featured-post-body {
        padding: 24px 20px;
    }

    .featured-post-image {
        min-height: 220px;
    }

    .single-content {
        padding: 28px 16px;
        border-radius: var(--radius);
    }

    .page-content {
        padding: 32px 16px;
        border-radius: var(--radius);
    }

    .sidebar-widget {
        padding: 20px;
    }

    .project-details {
        padding: 18px;
    }

    .project-details-grid {
        grid-template-columns: 1fr;
    }

    .error-404-search-form {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .error-404-search-form input {
        width: 100%;
        padding: 12px 16px;
    }

    .error-404-search-form .btn {
        width: 100%;
    }

    .error-404-links {
        flex-direction: column;
        width: 100%;
    }

    .error-404-links .btn {
        width: 100%;
    }

    .portfolio-filter {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        margin-inline: -4px;
        padding-inline: 4px;
    }

    .portfolio-filter .filter-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .blog-toolbar {
        padding: 14px 16px;
    }

    .share-section {
        padding: 18px;
    }

    .cta-section .cta-actions {
        width: 100%;
        flex-direction: column;
    }
}

/* ============ Extra Small (≤ 360px) ============ */
@media (max-width: 360px) {
    .container {
        padding: 0 12px;
    }

    .header-inner {
        height: 64px;
        gap: 8px;
    }

    .main-nav {
        top: 64px;
        height: calc(100vh - 64px);
        width: min(280px, 90vw);
    }

    .header-logo .logo-text strong {
        font-size: 15px;
    }

    .hero-section {
        padding: 40px 0 52px;
    }

    .hero-content h1 {
        font-size: 22px;
    }

    .hero-stats {
        gap: 12px;
    }

    .hero-stat strong {
        font-size: 20px;
    }

    .section {
        padding: 40px 0;
    }

    .section-header h2 {
        font-size: 20px;
    }

    .post-card-body {
        padding: 16px;
    }

    .post-card-title {
        font-size: 16px;
    }

    .btn {
        padding: 11px 18px;
        font-size: 13px;
    }

    .single-hero {
        padding: 40px 0 48px;
    }

    .single-hero h1 {
        font-size: 21px;
    }

    .single-content {
        padding: 24px 14px;
    }

    .page-hero {
        padding: 40px 0;
    }

    .page-hero h1 {
        font-size: 24px;
    }

    .page-content {
        padding: 28px 14px;
    }

    .error-404-number {
        font-size: 80px;
        letter-spacing: -4px;
    }

    .back-to-top {
        bottom: 12px;
        left: 12px;
        width: 40px;
        height: 40px;
    }
}

/* ============ Touch & Accessibility improvements ============ */
@media (hover: none) and (pointer: coarse) {
    .post-card:hover,
    .portfolio-card:hover,
    .btn:hover {
        transform: none;
    }

    .main-nav ul li a,
    .filter-btn,
    .page-link,
    .btn {
        min-height: 44px;
    }

    .search-toggle,
    .nav-toggle,
    .share-btn,
    .back-to-top {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Prevent iOS zoom on input focus */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="search"],
    input[type="email"],
    textarea {
        font-size: 16px !important;
    }
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    .site-header .container,
    .container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .back-to-top {
        bottom: max(16px, env(safe-area-inset-bottom));
        left: max(16px, env(safe-area-inset-left));
    }

    .main-nav {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }
}
/* ============================================
   Dark / Light Theme
   ============================================ */
:root {
    color-scheme: light;
}

html.dark {
    color-scheme: dark;

    /* رنگ اصلی - روشن‌تر برای کنتراست بهتر روی زمینه تیره */
    --primary: #2dd4bf;
    --primary-dark: #14b8a6;
    --primary-light: #5eead4;
    --primary-50: rgba(45, 212, 191, 0.12);
    --accent: #fbbf24;
    --accent-50: rgba(251, 191, 36, 0.12);

    /* وارون کردن طیف خاکستری */
    --gray-900: #f3f4f6;
    --gray-800: #e5e7eb;
    --gray-700: #cbd5e1;
    --gray-600: #9aa8bb;
    --gray-500: #64748b;
    --gray-400: #5b6b80;
    --gray-300: #334155;
    --gray-200: #1e293b;
    --gray-100: #16202e;
    --gray-50: #101826;

    /* سطوح */
    --white: #131c2b;
    --cream: #0b1220;

    /* سایه‌ها */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* ============ Dark: Hero / Page Hero / Single Hero ============ */
html.dark .hero-section {
    background: linear-gradient(160deg, #0c3b37 0%, #062421 60%, #0c3b37 100%);
}

html.dark .page-hero,
html.dark .single-hero {
    background: linear-gradient(160deg, #0c3b37 0%, #062421 100%);
}

/* ============ Dark: Footer ============ */
html.dark .site-footer {
    background: #060b13;
    color: var(--gray-600);
    border-top: 1px solid var(--gray-100);
}

html.dark .footer-about p {
    color: var(--gray-500);
}

html.dark .footer-links a {
    color: var(--gray-600);
}

html.dark .footer-links a:hover {
    color: var(--gray-800);
}

/* ============ Dark: Error 404 ============ */
html.dark .error-page-404 {
    background: linear-gradient(160deg, #0b1220 0%, #0e1626 50%, #101826 100%);
}

html.dark .error-404-icon {
    color: var(--primary);
}

html.dark .error-404-number {
    background: linear-gradient(135deg, #2dd4bf 0%, #0d9488 50%, #0f766e 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

html.dark .error-404-content h1 {
    color: var(--gray-800);
}

html.dark .error-404-content .error-404-desc {
    color: var(--gray-600);
}

html.dark .error-404-search-form {
    background: var(--white);
    border-color: var(--gray-200);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

html.dark .error-404-search-form input {
    color: var(--gray-800);
}

html.dark .error-404-note {
    color: var(--gray-500);
}

/* ============ Dark: Content tweaks ============ */
html.dark img {
    filter: brightness(0.92);
}

html.dark .post-card-category,
html.dark .single-category {
    color: #0b1220;
}

html.dark .single-category:hover {
    color: #0b1220;
    background: var(--accent);
}

/* ============================================
   Theme Toggle Button
   ============================================ */
.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary);
}

.theme-icon-sun {
    display: none;
}

.theme-icon-moon {
    display: inline;
}

html.dark .theme-icon-sun {
    display: inline;
}

html.dark .theme-icon-moon {
    display: none;
}

/* ============================================
   Language Switch Button
   ============================================ */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font);
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}

.lang-switch:hover {
    background: var(--primary-50);
    color: var(--primary);
    border-color: var(--primary);
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumb {
    margin-bottom: 20px;
}

.breadcrumb-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    font-size: 13px;
}

.breadcrumb-item a {
    color: var(--gray-500);
    text-decoration: none;
    transition: color 0.2s;
}

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

.breadcrumb-item.active {
    color: var(--gray-700);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--gray-400);
    font-size: 11px;
    display: flex;
    align-items: center;
}

/* breadcrumb روی زمینه تیره hero */
.single-hero .breadcrumb-item a,
.page-hero .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.75);
}

.single-hero .breadcrumb-item a:hover,
.page-hero .breadcrumb-item a:hover {
    color: #ffffff;
}

.single-hero .breadcrumb-item.active,
.page-hero .breadcrumb-item.active {
    color: #ffffff;
}

.single-hero .breadcrumb-separator,
.page-hero .breadcrumb-separator {
    color: rgba(255, 255, 255, 0.5);
}

/* ============ LTR (English) adjustments ============ */
[dir="ltr"] .footer-col h4::after {
    right: auto;
    left: 0;
}

[dir="ltr"] .single-content-inner ul,
[dir="ltr"] .single-content-inner ol {
    padding-right: 0;
    padding-left: 28px;
}

[dir="ltr"] .single-content-inner blockquote {
    border-right: none;
    border-left: 4px solid var(--primary);
}

[dir="ltr"] .footer-links a:hover {
    padding-right: 0;
    padding-left: 4px;
}

/* ============ Dark: متن روی بخش‌های رنگی سفید بماند ============ */
html.dark .hero-section,
html.dark .page-hero,
html.dark .single-hero,
html.dark .cta-section {
    color: #ffffff;
}

html.dark .footer-logo .logo-text strong {
    color: #ffffff;
}

html.dark .hero-badge {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

html.dark .hero-stat span {
    color: rgba(255, 255, 255, 0.85);
}

html.dark .cta-section .cta-content h2 {
    color: #ffffff;
}

/* ============================================
   Frontend additions: progress bar, TOC, cookie
   consent, search highlight, legacy Quill CSS
   ============================================ */

/* ============ Reading Progress Bar ============ */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    z-index: 9999;
    pointer-events: none;
}

.reading-progress.active {
    height: 4px;
    background: transparent;
}

.reading-progress span {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary, #0f766e), var(--primary-light, #14b8a6));
    transition: width 0.08s linear;
}

/* ============ Table of Contents ============ */
.toc-box {
    background: var(--bg-muted, #f8fafc);
    border: 1px solid var(--border-color, #e5e7eb);
    border-right: 4px solid var(--primary, #0f766e);
    border-radius: 14px;
    padding: 20px 22px;
    margin: 0 0 28px;
}

.toc-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--gray-900, #111827);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-title i {
    color: var(--primary, #0f766e);
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-list li {
    padding: 6px 0;
    border-bottom: 1px dashed var(--border-color, #e5e7eb);
}

.toc-list li:last-child {
    border-bottom: 0;
}

.toc-list li.toc-level-3 {
    padding-right: 20px;
}

.toc-list a {
    color: var(--gray-700, #374151);
    text-decoration: none;
    font-size: 0.92rem;
    transition: color 0.2s ease;
}

.toc-list a:hover {
    color: var(--primary, #0f766e);
}

/* h2/h3 دارای anchor → جلوگیری از مخفی شدن زیر هدر ثابت */
.single-content h2[id],
.single-content h3[id],
.page-content h2[id],
.page-content h3[id] {
    scroll-margin-top: 100px;
}

/* ============ Search Highlight ============ */
mark.search-highlight {
    background: #fef08a;
    color: #713f12;
    padding: 1px 4px;
    border-radius: 4px;
}

html.dark mark.search-highlight {
    background: rgba(254, 240, 138, 0.25);
    color: #fde68a;
}

/* ============ Cookie Consent Banner ============ */
.cookie-consent {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--white, #ffffff);
    color: var(--gray-800, #1f2937);
    border: 1px solid var(--border-color, #e5e7eb);
    box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.2));
    border-radius: 16px;
    padding: 14px 18px;
    max-width: calc(100% - 32px);
    width: max-content;
    opacity: 0;
    transition: bottom 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.45s ease;
}

.cookie-consent.show {
    bottom: 20px;
    opacity: 1;
}

.cookie-text {
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cookie-text i {
    color: var(--primary, #0f766e);
    font-size: 1.05rem;
}

.btn-cookie-accept {
    padding: 8px 20px !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    white-space: nowrap;
}

@media (max-width: 520px) {
    .cookie-consent {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        width: calc(100% - 32px);
    }
}

/* ============ Legacy Quill content (نمونه‌کارهای قبلی) ============ */
/* خروجی قدیمی ویرایشگر Quill بدون استایل‌های quill.snow.css خراب نمایش داده می‌شد */
.single-content pre.ql-syntax,
.page-content pre.ql-syntax,
.single-content-inner pre.ql-syntax {
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px 18px;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.9rem;
    direction: ltr;
    text-align: left;
}

.single-content [data-list="bullet"],
.page-content [data-list="bullet"] {
    list-style: none;
}

.single-content [data-list="bullet"]::before,
.page-content [data-list="bullet"]::before {
    content: '•';
    color: var(--primary, #0f766e);
    font-weight: 700;
    margin-left: 8px;
}

.single-content ul li[data-list]::marker,
.page-content ul li[data-list]::marker {
    content: '';
}

.single-content .ql-align-center,
.page-content .ql-align-center {
    text-align: center;
}

.single-content .ql-align-right,
.page-content .ql-align-right {
    text-align: right;
}

.single-content .ql-align-left,
.single-content .ql-align-justify,
.page-content .ql-align-left,
.page-content .ql-align-justify {
    text-align: left;
    text-align-last: auto;
}

.single-content .ql-indent-1 { padding-right: 3em; }
.single-content .ql-indent-2 { padding-right: 6em; }
.single-content .ql-indent-3 { padding-right: 9em; }

/* ============ Dark: تکمیلی (محتوا، جستجو، تولبار بلاگ) ============ */
html.dark .page-content,
html.dark .single-content,
html.dark .single-content-inner {
    color: var(--gray-700, #cbd5e1);
}

html.dark .blog-toolbar .search-form input,
html.dark .search-bar .search-form input {
    background: var(--gray-100, #16202e);
    color: var(--gray-900, #f3f4f6);
    border-color: var(--gray-300, #334155);
}

html.dark .single-content h2,
html.dark .single-content h3,
html.dark .single-content h4,
html.dark .page-content h2,
html.dark .page-content h3,
html.dark .page-content h4 {
    color: var(--gray-900, #f3f4f6);
}

html.dark .single-content a,
html.dark .page-content a {
    color: var(--primary, #2dd4bf);
}

html.dark .single-content blockquote,
html.dark .page-content blockquote {
    background: var(--gray-100, #16202e);
    border-right-color: var(--primary, #2dd4bf);
    color: var(--gray-700, #cbd5e1);
}

html.dark .single-content table th,
html.dark .page-content table th {
    background: var(--gray-100, #16202e);
    color: var(--gray-900, #f3f4f6);
}

html.dark .single-content table td,
html.dark .single-content table th,
html.dark .page-content table td,
html.dark .page-content table th {
    border-color: var(--gray-300, #334155);
}

html.dark .toc-box {
    background: var(--gray-100, #16202e);
    border-color: var(--gray-200, #1e293b);
}

html.dark .cookie-consent {
    background: var(--white, #131c2b);
    color: var(--gray-800, #e5e7eb);
    border-color: var(--gray-200, #1e293b);
}

html.dark .filter-btn {
    background: var(--gray-100, #16202e);
    color: var(--gray-700, #cbd5e1);
}

html.dark .filter-btn:hover {
    background: var(--gray-200, #1e293b);
    color: var(--gray-900, #f3f4f6);
}

/* ============ Contact Page ============ */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 32px;
    align-items: start;
}

.contact-info-card,
.contact-form-card {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    padding: 28px;
}

.contact-info-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px dashed var(--border-color, #e5e7eb);
}

.contact-info-item:last-child {
    border-bottom: 0;
}

.contact-info-item i {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary-50, #f0fdfa);
    color: var(--primary, #0f766e);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.contact-info-item strong {
    display: block;
    color: var(--gray-900, #111827);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.contact-info-item span,
.contact-info-item a {
    color: var(--gray-500, #6b7280);
    font-size: 0.9rem;
    text-decoration: none;
}

.contact-form-card .form-group {
    margin-bottom: 18px;
}

.contact-form-card label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800, #1f2937);
    margin-bottom: 8px;
}

.contact-form-card input,
.contact-form-card textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 10px;
    background: var(--bg-muted, #f8fafc);
    color: var(--gray-900, #111827);
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form-card input:focus,
.contact-form-card textarea:focus {
    outline: none;
    border-color: var(--primary, #0f766e);
    box-shadow: 0 0 0 3px var(--primary-50, #f0fdfa);
}

.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 860px) {
    .contact-layout {
        grid-template-columns: 1fr;
    }
}

/* ============ Draft preview notice ============ */
.draft-preview-note {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    border-radius: 12px;
    padding: 14px 18px;
    margin: 20px auto 0;
    max-width: 1140px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

html.dark .draft-preview-note {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.4);
    color: #fbbf24;
}

/* ============ Copy link button state ============ */
.share-btn.copied {
    background: var(--success, #16a34a) !important;
    color: #fff !important;
}

/* ============ Dark: کارت نمونه‌کار جدید (عکس بالا، متن پایین) ============ */
html.dark .portfolio-card {
    background: var(--white, #131c2b);
    border-color: var(--gray-200, #1e293b);
}

html.dark .portfolio-card-content {
    background: var(--white, #131c2b);
    border-top-color: var(--gray-200, #1e293b);
}

html.dark .portfolio-card-content h3 {
    color: var(--gray-900, #f3f4f6);
}

html.dark .portfolio-card-content p {
    color: var(--gray-500, #64748b);
}

html.dark .portfolio-card-category {
    background: var(--primary-50, rgba(45, 212, 191, 0.12));
    color: var(--primary, #2dd4bf);
}

html.dark .portfolio-card-image {
    background: var(--gray-100, #16202e);
}
