/*
Theme Name: Mostafa Aghabagheri
Theme URI: https://229-415.ir/
Author: Mostafa Aghabagheri
Author URI: https://229-415.ir/
Description: قالب مدرن و خفن برای وبلاگ فناوری. کاملاً محلی، بدون CDN. ۷ تم رنگی کامل + انیمیشن‌های پیشرفته اسکرول.
Version: 7.5.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: mostafa
Tags: blog, rtl-language-support, custom-colors, custom-menu, featured-images, dark-mode
*/

/* =========================================================
   CSS Variables - Full Theme Color System
   ========================================================= */
:root {
  --primary: #3b82f6;
  --primary-rgb: 59, 130, 246;
  --primary-hover: #2563eb;
  --secondary: #8b5cf6;
  --secondary-rgb: 139, 92, 246;
  --accent: #06b6d4;
  --accent-rgb: 6, 182, 212;

  --bg-body: #0a0e1a;
  --bg-card: #131a2b;
  --bg-card-hover: #1a2336;
  --bg-header: rgba(10, 14, 26, 0.85);
  --bg-footer: #070b14;
  --bg-input: #1a2336;
  --bg-hover: #1e293b;
  --bg-elevated: #1a2336;

  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-heading: #f8fafc;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.25);

  --glow: 0 0 40px rgba(var(--primary-rgb), 0.25);
  --glow-strong: 0 0 60px rgba(var(--primary-rgb), 0.4);
  --shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 8px 30px -8px rgba(0, 0, 0, 0.5);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --transition: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  --header-height: 70px;
}

/* ===== Color Themes - Full Palette Change ===== */
[data-theme="emerald"] {
  --primary: #10b981;
  --primary-rgb: 16, 185, 129;
  --primary-hover: #059669;
  --secondary: #14b8a6;
  --secondary-rgb: 20, 184, 166;
  --accent: #34d399;
  --accent-rgb: 52, 211, 153;
  --bg-body: #0a1410;
  --bg-card: #0f1f18;
  --bg-card-hover: #142a20;
  --bg-header: rgba(10, 20, 16, 0.88);
  --bg-footer: #07120c;
  --bg-elevated: #142a20;
}

[data-theme="violet"] {
  --primary: #a855f7;
  --primary-rgb: 168, 85, 247;
  --primary-hover: #9333ea;
  --secondary: #c084fc;
  --secondary-rgb: 192, 132, 252;
  --accent: #e879f9;
  --accent-rgb: 232, 121, 249;
  --bg-body: #0f0a1a;
  --bg-card: #1a1228;
  --bg-card-hover: #241833;
  --bg-header: rgba(15, 10, 26, 0.88);
  --bg-footer: #0a0614;
  --bg-elevated: #241833;
}

[data-theme="rose"] {
  --primary: #f43f5e;
  --primary-rgb: 244, 63, 94;
  --primary-hover: #e11d48;
  --secondary: #fb7185;
  --secondary-rgb: 251, 113, 133;
  --accent: #fda4af;
  --accent-rgb: 253, 164, 175;
  --bg-body: #1a0a10;
  --bg-card: #261018;
  --bg-card-hover: #331520;
  --bg-header: rgba(26, 10, 16, 0.88);
  --bg-footer: #14060c;
  --bg-elevated: #331520;
}

[data-theme="amber"] {
  --primary: #f59e0b;
  --primary-rgb: 245, 158, 11;
  --primary-hover: #d97706;
  --secondary: #fbbf24;
  --secondary-rgb: 251, 191, 36;
  --accent: #fcd34d;
  --accent-rgb: 252, 211, 77;
  --bg-body: #1a1408;
  --bg-card: #241c0e;
  --bg-card-hover: #2e2412;
  --bg-header: rgba(26, 20, 8, 0.88);
  --bg-footer: #120e06;
  --bg-elevated: #2e2412;
}

[data-theme="cyan"] {
  --primary: #06b6d4;
  --primary-rgb: 6, 182, 212;
  --primary-hover: #0891b2;
  --secondary: #22d3ee;
  --secondary-rgb: 34, 211, 238;
  --accent: #67e8f9;
  --accent-rgb: 103, 232, 249;
  --bg-body: #06141a;
  --bg-card: #0c1e26;
  --bg-card-hover: #122830;
  --bg-header: rgba(6, 20, 26, 0.88);
  --bg-footer: #040e12;
  --bg-elevated: #122830;
}

[data-theme="indigo"] {
  --primary: #6366f1;
  --primary-rgb: 99, 102, 241;
  --primary-hover: #4f46e5;
  --secondary: #818cf8;
  --secondary-rgb: 129, 140, 248;
  --accent: #a5b4fc;
  --accent-rgb: 165, 180, 252;
  --bg-body: #0a0a1a;
  --bg-card: #12122b;
  --bg-card-hover: #1a1a38;
  --bg-header: rgba(10, 10, 26, 0.88);
  --bg-footer: #060612;
  --bg-elevated: #1a1a38;
}

/* Light Mode */
[data-mode="light"] {
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-header: rgba(255, 255, 255, 0.9);
  --bg-footer: #e2e8f0;
  --bg-input: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-elevated: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-heading: #0f172a;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 8px 30px -8px rgba(0, 0, 0, 0.1);
  --glow: 0 0 40px rgba(var(--primary-rgb), 0.15);
}

/* =========================================================
   Fonts - Local
   ========================================================= */
@font-face {
  font-family: 'Vazirmatn';
  src: url('assets/fonts/vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('assets/fonts/vazirmatn/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('assets/fonts/vazirmatn/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('assets/fonts/vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('assets/fonts/vazirmatn/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}

/* =========================================================
   Reset & Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.75;
  overflow-x: hidden;
  transition: background 0.5s ease, color 0.5s ease;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(var(--primary-rgb), 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 10%, rgba(var(--secondary-rgb), 0.08) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
ul, ol { list-style: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }

/* =========================================================
   Layout
   ========================================================= */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  position: relative;
  z-index: 1;
}
.section { padding: 4.5rem 0; }
.section-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: 2.75rem;
  position: relative;
}
.section-title::after {
  content: '';
  display: block;
  width: 70px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  margin: 0.85rem auto 0;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.5);
}

/* =========================================================
   Header + Mega Menu
   ========================================================= */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: all var(--transition);
}
.site-header.scrolled {
  box-shadow: 0 4px 30px rgba(0,0,0,0.3);
  border-bottom-color: rgba(var(--primary-rgb), 0.2);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1rem;
}
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  white-space: nowrap;
}
.site-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(var(--primary-rgb), 0.35);
}
.site-logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navigation with Dropdowns */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  height: 100%;
}
.main-nav > li,
.main-nav > a,
.nav-item {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}
.main-nav a,
.nav-item > a {
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-xs);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.25s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.main-nav a:hover,
.main-nav a.active,
.nav-item:hover > a {
  color: var(--text-heading);
  background: rgba(var(--primary-rgb), 0.12);
}
.nav-item .arrow {
  font-size: 0.65rem;
  opacity: 0.6;
  transition: transform 0.25s;
}
.nav-item:hover .arrow { transform: rotate(180deg); }

/* Dropdown */
.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.96);
  transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: var(--shadow);
  z-index: 100;
}
.nav-item:hover > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px) scale(1);
}
.dropdown a {
  display: block;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
}
.dropdown a:hover {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--text-heading);
  padding-right: 1.2rem;
}

/* Nested submenu */
.dropdown .has-sub {
  position: relative;
}
.dropdown .sub-dropdown {
  position: absolute;
  right: 100%;
  top: -0.5rem;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateX(8px);
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
}
.dropdown .has-sub:hover > .sub-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}
.icon-btn:hover {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
}
.icon-btn svg { width: 19px; height: 19px; }

/* Color Panel — above nav row so swatches are clickable */
.color-switcher { position: relative; z-index: 1300; }
.color-panel {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.85rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
  z-index: 9999;
}
.color-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}
.color-swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 12px rgba(var(--primary-rgb), 0.6);
}
.menu-toggle { display: none; }

/* =========================================================
   Hero - Epic
   ========================================================= */
.hero {
  margin-top: var(--header-height);
  position: relative;
  min-height: 78vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 40%, rgba(var(--primary-rgb), 0.22) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 15%, rgba(var(--secondary-rgb), 0.18) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 90%, rgba(var(--accent-rgb), 0.1) 0%, transparent 40%);
  transition: background 0.6s ease;
}
.hero-mesh {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(var(--primary-rgb), 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--primary-rgb), 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
  padding: 5rem 1.25rem;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  padding: 0.45rem 1.15rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.75rem;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  box-shadow: 0 0 30px rgba(var(--primary-rgb), 0.15);
  animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.15); }
  50% { box-shadow: 0 0 40px rgba(var(--primary-rgb), 0.3); }
}
.hero h1 {
  font-size: clamp(2.4rem, 5.5vw, 3.8rem);
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.2;
  margin-bottom: 1.4rem;
  letter-spacing: -0.03em;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 5s ease infinite;
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto 2.25rem;
  line-height: 1.8;
}
.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.9rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 8px 30px -5px rgba(var(--primary-rgb), 0.5);
}
.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 40px -5px rgba(var(--primary-rgb), 0.6);
  color: #fff;
}
.btn-outline {
  background: transparent;
  color: var(--text-heading);
  border: 1.5px solid var(--border-strong);
}
.btn-outline:hover {
  background: rgba(var(--primary-rgb), 0.1);
  border-color: var(--primary);
  color: var(--text-heading);
  transform: translateY(-2px);
}

/* Particles */
.particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.35;
  animation: float-particle 18s infinite ease-in-out;
}
@keyframes float-particle {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.25; }
  33% { transform: translate(30px, -60px) scale(1.2); opacity: 0.5; }
  66% { transform: translate(-20px, -30px) scale(0.8); opacity: 0.35; }
}

/* =========================================================
   Category Sections + Cards
   ========================================================= */
.category-section { padding: 3.5rem 0; }
.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.85rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.category-header h2 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.category-header h2 .icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35);
}
.view-all {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: gap 0.25s;
}
.view-all:hover { gap: 0.6rem; }

/* Posts Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.6rem;
}

/* Card - Premium */
.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}
.post-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s, background 0.4s;
  pointer-events: none;
  z-index: 2;
}
.post-card:hover {
  box-shadow: var(--shadow), var(--glow);
  border-color: transparent;
  background: var(--bg-card-hover);
}
.post-card:hover::before {
  opacity: 1;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
}
.post-card .thumb {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--bg-hover);
}
.post-card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.post-card:hover .thumb img { transform: scale(1.1); }
.post-card .thumb .placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--bg-hover), var(--bg-card));
  color: var(--text-muted);
  font-size: 2.8rem;
  transition: transform 0.5s;
}
.post-card:hover .thumb .placeholder { transform: scale(1.15); }
.post-card .content {
  padding: 1.35rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.post-card .meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}
.post-card .category-tag {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(var(--primary-rgb), 0.25);
}
.post-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.45;
  margin-bottom: 0.55rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card h3 a { color: inherit; }
.post-card h3 a:hover { color: var(--primary); }
.post-card .excerpt {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
  flex: 1;
  line-height: 1.65;
}
.post-card .read-more {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: auto;
  transition: gap 0.25s;
}
.post-card .read-more:hover { gap: 0.55rem; }

/* =========================================================
   Advanced Scroll Animations
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

.reveal-left {
  opacity: 0;
  transform: translateX(-60px) rotate(-2deg);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-left.visible { opacity: 1; transform: translateX(0) rotate(0); }

.reveal-right {
  opacity: 0;
  transform: translateX(60px) rotate(2deg);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-right.visible { opacity: 1; transform: translateX(0) rotate(0); }

.reveal-scale {
  opacity: 0;
  transform: scale(0.85) translateY(30px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-scale.visible { opacity: 1; transform: scale(1) translateY(0); }

.reveal-flip {
  opacity: 0;
  transform: perspective(800px) rotateX(15deg) translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-flip.visible { opacity: 1; transform: perspective(800px) rotateX(0) translateY(0); }

.stagger-1 { transition-delay: 0.08s; }
.stagger-2 { transition-delay: 0.16s; }
.stagger-3 { transition-delay: 0.24s; }
.stagger-4 { transition-delay: 0.32s; }
.stagger-5 { transition-delay: 0.4s; }

/* =========================================================
   Single / Archive / etc (shared)
   ========================================================= */
.single-post { margin-top: calc(var(--header-height) + 2.5rem); padding-bottom: 4rem; }
.single-header { text-align: center; max-width: 800px; margin: 0 auto 2.5rem; }
.single-header .category-tag {
  display: inline-block; margin-bottom: 1rem;
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  padding: 0.3rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
}
.single-header h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.3;
  margin-bottom: 1.1rem;
}
.single-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.single-content {
  max-width: 780px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2.75rem;
  border: 1px solid var(--border);
  line-height: 1.95;
  box-shadow: var(--shadow-sm);
}
.single-content h2, .single-content h3, .single-content h4 {
  color: var(--text-heading);
  margin: 2.2rem 0 1rem;
}
.single-content p { margin-bottom: 1.3rem; }
.single-content img { border-radius: var(--radius-sm); margin: 1.5rem 0; }
.single-content a { text-decoration: underline; text-underline-offset: 3px; }
.single-content pre, .single-content code {
  background: var(--bg-hover);
  border-radius: 8px;
  font-family: 'Courier New', monospace;
}
.single-content pre { padding: 1.35rem; overflow-x: auto; margin: 1.5rem 0; }
.single-content code { padding: 0.15rem 0.45rem; font-size: 0.9em; }

/* Footer */
.site-footer {
  background: var(--bg-footer);
  border-top: 1px solid var(--border);
  padding: 3.5rem 0 1.5rem;
  margin-top: 4rem;
  position: relative;
  z-index: 1;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}
.footer-brand h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.footer-brand p { color: var(--text-muted); font-size: 0.92rem; max-width: 320px; }
.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1rem;
}
.footer-col ul li { margin-bottom: 0.5rem; }
.footer-col a { color: var(--text-muted); font-size: 0.9rem; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Search Overlay */
.search-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0; visibility: hidden;
  transition: all 0.3s ease;
}
.search-overlay.open { opacity: 1; visibility: visible; }
.search-form-wrap { width: 100%; max-width: 640px; padding: 0 1.25rem; }
.search-form-wrap form {
  display: flex;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), var(--glow);
}
.search-form-wrap input {
  flex: 1;
  padding: 1.15rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-heading);
  font-size: 1.1rem;
  outline: none;
}
.search-form-wrap button {
  padding: 0 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.search-close {
  position: absolute; top: 2rem; left: 2rem;
  background: none; border: none;
  color: #fff; cursor: pointer; font-size: 1.5rem;
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 2rem; left: 2rem;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow), var(--glow);
  opacity: 0; visibility: hidden;
  transform: translateY(20px) scale(0.8);
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 900;
}
.back-to-top.visible {
  opacity: 1; visibility: visible;
  transform: translateY(0) scale(1);
}
.back-to-top:hover { transform: translateY(-5px) scale(1.08); }

/* Progress */
.scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  z-index: 1100;
  width: 0%;
  box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}

/* Ads */
.ads-placeholder {
  background: var(--bg-card);
  border: 2px dashed rgba(var(--primary-rgb), 0.3);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  margin: 2rem 0;
  transition: border-color 0.3s;
}
.ads-placeholder:hover { border-color: var(--primary); }

/* Comments */
.comments-area {
  max-width: 780px;
  margin: 3rem auto 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  border: 1px solid var(--border);
}
.comment-list .comment {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.comment-author { font-weight: 700; color: var(--text-heading); }
.comment-meta { font-size: 0.8rem; color: var(--text-muted); margin: 0.25rem 0 0.75rem; }

/* 404 */
.error-404 {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: var(--header-height);
}
.error-404 h1 {
  font-size: 7rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  text-shadow: 0 0 60px rgba(var(--primary-rgb), 0.3);
}
.error-404 p { font-size: 1.2rem; color: var(--text-muted); margin: 1rem 0 2rem; }

/* Archive */
.archive-header {
  margin-top: calc(var(--header-height) + 2.5rem);
  text-align: center;
  margin-bottom: 2.5rem;
}
.archive-header h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-heading);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px; height: 44px;
  padding: 0 0.8rem;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  transition: all 0.25s;
}
.pagination a:hover, .pagination .current {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
}

/* =========================================================
   Mobile
   ========================================================= */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    position: fixed;
    top: var(--header-height);
    left: 0; right: 0;
    background: var(--bg-elevated);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    gap: 0;
    height: auto;
    z-index: 999;
  }
  .main-nav.open .nav-item { height: auto; flex-direction: column; align-items: stretch; }
  .main-nav.open a { width: 100%; padding: 0.85rem 1rem; }
  .main-nav.open .dropdown {
    position: static;
    opacity: 1; visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding-right: 1rem;
    display: none;
  }
  .main-nav.open .nav-item.open > .dropdown { display: block; }
  .menu-toggle { display: flex; }
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .single-content { padding: 1.5rem; }
  .color-panel { left: auto; right: 0; transform: scale(0.9); }
  .color-panel.open { transform: scale(1); }
}

/* Utilities */
.text-center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* WordPress Menu Compatibility */
.main-nav .menu-item { position: relative; height: 100%; display: flex; align-items: center; }
.main-nav .menu-item > a { color: var(--text-muted); padding: 0.45rem 0.85rem; border-radius: var(--radius-xs); font-weight: 500; font-size: 0.9rem; transition: all 0.25s ease; white-space: nowrap; display: flex; align-items: center; gap: 0.3rem; }
.main-nav .menu-item > a:hover, .main-nav .menu-item:hover > a { color: var(--text-heading); background: rgba(var(--primary-rgb), 0.12); }
.main-nav .sub-menu {
  position: absolute; top: 100%; right: 0; min-width: 220px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0.5rem;
  opacity: 0; visibility: hidden; transform: translateY(12px) scale(0.96);
  transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: var(--shadow); z-index: 100; list-style: none;
}
.main-nav .menu-item:hover > .sub-menu { opacity: 1; visibility: visible; transform: translateY(4px) scale(1); }
.main-nav .sub-menu a { display: block; padding: 0.65rem 1rem; border-radius: var(--radius-xs); color: var(--text-muted); font-size: 0.88rem; font-weight: 500; }
.main-nav .sub-menu a:hover { background: rgba(var(--primary-rgb), 0.15); color: var(--text-heading); }
.main-nav .sub-menu .sub-menu { right: 100%; top: -0.5rem; }
@media (max-width: 1024px) {
  .main-nav.open .menu-item { height: auto; flex-direction: column; align-items: stretch; }
  .main-nav.open .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: none; background: transparent; padding-right: 1rem; display: none; }
  .main-nav.open .menu-item.open > .sub-menu { display: block; }
}

/* =========================================================
   v3 - Top Bar, Cart, Scroll Cards, Footer Ads
   ========================================================= */
.top-bar {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  height: 36px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1001;
  transition: background 0.5s ease;
}
.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.top-bar-socials {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.social-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
}
.social-btn:hover {
  background: #fff;
  color: var(--primary);
  transform: scale(1.15);
}
.top-bar-text {
  color: rgba(255,255,255,0.9);
  font-size: 0.8rem;
  font-weight: 500;
}

/* Adjust header for top bar */
.site-header {
  top: 36px;
}
.hero {
  margin-top: calc(var(--header-height) + 36px);
}
.single-post, .archive-header, .error-404 {
  margin-top: calc(var(--header-height) + 36px + 2rem);
}

/* Cart badge */
.cart-btn { position: relative; }
.cart-count {
  position: absolute;
  top: 2px; left: 2px;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.5);
}

/* Scroll-synced cards - NO CSS transition (JS drives it) */
.scroll-card {
  /* JS controls opacity/transform/filter directly */
  will-change: transform, opacity;
}

/* Ads row */
.ads-row {
  padding: 2rem 0;
  background: rgba(153,153,153,0.15);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ads-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.ad-slot {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Footer enhanced */
.footer-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.footer-box {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.85;
  color: var(--text-muted);
  box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.05);
}
.footer-box strong { color: var(--text-heading); }
.footer-badge {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1.2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}
.footer-socials-mini {
  display: flex;
  gap: 0.75rem;
}
.footer-socials-mini a {
  color: var(--text-muted);
  transition: color 0.25s;
}
.footer-socials-mini a:hover { color: var(--primary); }

@media (max-width: 900px) {
  .ads-grid { grid-template-columns: 1fr 1fr; }
  .footer-main-grid { grid-template-columns: 1fr; }
  .top-bar-text { display: none; }
}
@media (max-width: 600px) {
  .ads-grid { grid-template-columns: 1fr; }
  .top-bar-socials { gap: 0.25rem; }
  .social-btn { width: 22px; height: 22px; }
}

/* =========================================================
   v4 - Strong FX, Unified Header, Clean Ads, Better Footer
   ========================================================= */

/* Strong entrance animations (triggered by .fx-in) */
.fx-card {
  opacity: 0;
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.9s ease;
}
.fx-card.fx-in {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}
/* Extra punch on boom-up */
.fx-card[data-fx="boom-up"].fx-in {
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); /* slight overshoot */
}
.fx-card[data-fx="drop-bounce"].fx-in {
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fx-card[data-fx="zoom-spin"].fx-in {
  transition-timing-function: cubic-bezier(0.22, 1.2, 0.36, 1);
}

/* ===== Unified Header (no separate top bar) ===== */
.top-bar { display: none !important; } /* hide old top bar */

.site-header {
  top: 0 !important;
  height: auto;
  min-height: var(--header-height);
  padding: 0.35rem 0;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}
.site-header.scrolled {
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  border-bottom-color: rgba(var(--primary-rgb), 0.25);
}
.header-inner {
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  min-height: var(--header-height);
  padding: 0.25rem 0;
}
.header-socials {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}
.header-socials .social-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
}
.header-socials .social-btn:hover {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  transform: scale(1.12);
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
}

/* Fix margins without top-bar */
.hero {
  margin-top: var(--header-height) !important;
}
.single-post, .archive-header, .error-404 {
  margin-top: calc(var(--header-height) + 2rem) !important;
}

/* ===== Ads in designated placeholder ===== */
.ads-placeholder {
  background: var(--bg-card);
  border: 2px dashed rgba(var(--primary-rgb), 0.35);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  margin: 2.5rem 0;
}
.ads-placeholder h3 {
  color: var(--text-heading);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}
.ads-placeholder .ads-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.ads-placeholder .ad-slot {
  min-height: 90px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
}

/* Hide footer ads row - moved to placeholder */
.ads-row { display: none !important; }

/* ===== Better Footer ===== */
.site-footer {
  background: var(--bg-footer);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.25rem;
  margin-top: 3rem;
}
.footer-main-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: start;
}
.footer-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--text-muted);
  height: 100%;
}
.footer-box strong { color: var(--text-heading); }
.footer-box a { color: var(--primary); }
.footer-badge {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.55rem 1.4rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff !important;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35);
  transition: transform 0.25s;
}
.footer-badge:hover { transform: translateY(-2px); color: #fff !important; }

.footer-form .wpforms-container {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
}
.footer-form input,
.footer-form textarea {
  background: var(--bg-body) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-heading) !important;
  border-radius: 8px !important;
}
.footer-form button,
.footer-form .wpforms-submit {
  background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
  border: none !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-weight: 600 !important;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-socials-mini {
  display: flex;
  gap: 0.85rem;
}
.footer-socials-mini a {
  color: var(--text-muted);
  transition: color 0.25s, transform 0.25s;
}
.footer-socials-mini a:hover {
  color: var(--primary);
  transform: scale(1.15);
}

/* Header logo polish */
.site-logo {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 6s ease infinite;
}

@media (max-width: 900px) {
  .footer-main-grid { grid-template-columns: 1fr; }
  .ads-placeholder .ads-grid { grid-template-columns: 1fr 1fr; }
  .header-socials { display: none; } /* hide socials on tablet to save space, show in footer */
}
@media (max-width: 600px) {
  .ads-placeholder .ads-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   v5 - Card entrance: left / right / bottom + rotate + scale
   Mobile-safe (no reduced-motion block unless user prefers)
   ========================================================= */

.anim-card {
  opacity: 0;
  will-change: transform, opacity;
  transition:
    opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Initial states (BEFORE entering) --- */

/* From left */
.anim-from-left {
  transform: translateX(-120px) rotate(-12deg) scale(0.75);
}
/* From right */
.anim-from-right {
  transform: translateX(120px) rotate(12deg) scale(0.75);
}
/* From bottom */
.anim-from-bottom {
  transform: translateY(110px) scale(0.7) rotate(3deg);
}
/* From left + stronger spin */
.anim-from-left-spin {
  transform: translateX(-150px) rotate(-22deg) scale(0.55);
}
/* From right + stronger spin */
.anim-from-right-spin {
  transform: translateX(150px) rotate(22deg) scale(0.55);
}
/* From bottom + zoom from tiny */
.anim-from-bottom-zoom {
  transform: translateY(130px) scale(0.4) rotate(-6deg);
}

/* --- Final state (visible) --- */
.anim-card.anim-in {
  opacity: 1;
  transform: translateX(0) translateY(0) rotate(0) scale(1);
}

/* Slight overshoot feel on some */
.anim-from-bottom.anim-in,
.anim-from-bottom-zoom.anim-in {
  transition-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1);
}
.anim-from-left-spin.anim-in,
.anim-from-right-spin.anim-in {
  transition-timing-function: cubic-bezier(0.22, 1.15, 0.36, 1);
}

/* Mobile: still animate, slightly less travel so it feels snappy */
@media (max-width: 768px) {
  .anim-from-left {
    transform: translateX(-70px) rotate(-8deg) scale(0.85);
  }
  .anim-from-right {
    transform: translateX(70px) rotate(8deg) scale(0.85);
  }
  .anim-from-bottom {
    transform: translateY(70px) scale(0.85) rotate(2deg);
  }
  .anim-from-left-spin {
    transform: translateX(-80px) rotate(-14deg) scale(0.7);
  }
  .anim-from-right-spin {
    transform: translateX(80px) rotate(14deg) scale(0.7);
  }
  .anim-from-bottom-zoom {
    transform: translateY(80px) scale(0.55) rotate(-4deg);
  }
  .anim-card {
    transition-duration: 0.7s;
  }
}

/* Only reduce if user explicitly prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  .anim-card {
    transition: opacity 0.3s ease;
    transform: none !important;
  }
  .anim-card.anim-in {
    opacity: 1;
  }
}

/* Safety: if JS fails, cards still become visible */
@keyframes anim-fallback-in {
  to {
    opacity: 1;
    transform: none;
  }
}
.anim-card:not(.anim-in) {
  animation: anim-fallback-in 0.8s ease 3s forwards;
}

/* =========================================================
   v6 - Scroll-synced cards (JS drives transform every frame)
   ========================================================= */
.scroll-sync-card {
  /* JS sets opacity + transform; no CSS transition */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

/* Disable old one-shot systems so they don't fight */
.anim-card,
.fx-card,
.reveal,
.reveal-left,
.reveal-right,
.reveal-scale,
.reveal-flip {
  /* If leftover classes exist, don't force opacity 0 */
  opacity: 1;
  transform: none;
  filter: none;
  animation: none !important;
  transition: none !important;
}

/* Performance: content-visibility for offscreen sections */
.category-section {
  content-visibility: auto;
  contain-intrinsic-size: 1px 600px;
}

/* Reduce paint on hover for mobile */
@media (max-width: 768px) {
  .post-card:hover {
    transform: none;
  }
  .post-card:hover::before {
    opacity: 0;
  }
  .particles { display: none; }
}


/* === v6.1 CRITICAL: scroll-sync must win === */
.post-card.scroll-sync-card,
.category-header.scroll-sync-card,
.ads-placeholder.scroll-sync-card,
.scroll-sync-card {
  transition: none !important;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-font-smoothing: subpixel-antialiased;
}
.post-card.scroll-sync-card:hover {
  transform: none; /* JS owns transform */
}

/* Ads 4 columns x 2 rows */
.ads-placeholder .ads-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  grid-template-rows: repeat(2, auto) !important;
  gap: 1rem !important;
}
.ads-placeholder .ad-slot {
  min-height: 100px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
}
@media (max-width: 900px) {
  .ads-placeholder .ads-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: repeat(4, auto) !important;
  }
}
@media (max-width: 500px) {
  .ads-placeholder .ads-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: none !important;
  }
}

/* =========================================================
   v6.2 - CSS Scroll-Driven Animations (native) + Ads 4-col
   ========================================================= */

/* Ads: force exactly 4 columns */
.ads-grid-4x2,
.ads-placeholder .ads-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 12px !important;
  width: 100% !important;
  max-width: 100% !important;
}
.ads-placeholder .ad-slot {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}
/* Scripts often inject images/tables - constrain them */
.ads-placeholder .ad-slot img,
.ads-placeholder .ad-slot iframe,
.ads-placeholder .ad-slot table,
.ads-placeholder .ad-slot > * {
  max-width: 100% !important;
  height: auto !important;
}
@media (max-width: 900px) {
  .ads-grid-4x2,
  .ads-placeholder .ads-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 500px) {
  .ads-grid-4x2,
  .ads-placeholder .ads-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ---- Native CSS scroll-driven card motion ---- */
@supports (animation-timeline: view()) {
  .post-card {
    animation-name: mostafa-card-in;
    animation-duration: 1s;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: view();
    animation-range: entry 0% cover 45%;
  }
  .post-card:nth-child(3n+1) {
    --from-x: -120px;
    --from-rot: -18deg;
  }
  .post-card:nth-child(3n+2) {
    --from-x: 120px;
    --from-rot: 18deg;
  }
  .post-card:nth-child(3n) {
    --from-x: 0px;
    --from-y: 100px;
    --from-rot: 5deg;
  }
  @keyframes mostafa-card-in {
    0% {
      opacity: 0;
      transform: translateX(var(--from-x, 0)) translateY(var(--from-y, 40px)) rotate(var(--from-rot, 0deg)) scale(0.55);
    }
    100% {
      opacity: 1;
      transform: translateX(0) translateY(0) rotate(0deg) scale(1);
    }
  }
  .category-header {
    animation-name: mostafa-head-in;
    animation-duration: 1s;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: view();
    animation-range: entry 0% cover 40%;
  }
  @keyframes mostafa-head-in {
    from {
      opacity: 0;
      transform: translateY(50px) scale(0.9);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* JS fallback class when CSS scroll timeline not available */
.no-scroll-timeline .post-card,
.no-scroll-timeline .category-header {
  /* JS will set inline styles */
}

/* =========================================================
   v7 - Glass 3-row header, stronger off-screen motion, ads cards
   ========================================================= */

/* --- Glass 3-row header --- */
.glass-header {
  position: fixed !important;
  top: 0 !important;
  left: 0; right: 0;
  z-index: 1000;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border-bottom: none !important;
  backdrop-filter: none !important;
  display: flex;
  flex-direction: column;
}
.header-row {
  width: 100%;
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
}
.header-row-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Row 1 socials */
.header-row-socials {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.85), rgba(var(--secondary-rgb), 0.75));
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.header-row-socials .header-row-inner {
  min-height: 34px;
}
.header-socials-bar {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.header-socials-bar .social-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
}
.header-socials-bar .social-btn:hover {
  background: #fff;
  color: var(--primary);
  transform: scale(1.12);
}
.header-tagline {
  color: rgba(255,255,255,0.9);
  font-size: 0.78rem;
  font-weight: 500;
}

/* Row 2 brand + tools */
.header-row-brand {
  background: rgba(10, 14, 26, 0.72);
  border-bottom: 1px solid var(--border);
}
[data-mode="light"] .header-row-brand {
  background: rgba(255,255,255,0.78);
}
.header-row-brand .header-row-inner {
  min-height: 52px;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  position: relative;
  z-index: 1200;
}

/* Row 3 nav */
.header-row-nav {
  background: rgba(10, 14, 26, 0.55);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
[data-mode="light"] .header-row-nav {
  background: rgba(255,255,255,0.65);
}
.header-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.35rem 1.5rem;
  min-height: 48px;
}
.header-row-nav .main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.15rem;
  padding: 0;
  height: auto !important;
  width: auto;
  flex: 1;
  margin-right: 0.25rem;
}
.header-row-nav .main-nav a,
.header-row-nav .nav-item > a {
  font-size: 0.88rem;
  padding: 0.4rem 0.75rem;
}
.header-tools-theme {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1300;
  margin-left: 0.25rem;
}

.site-header.scrolled .header-row-brand,
.site-header.scrolled .header-row-nav {
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

/* Body offset for 3-row header (~34+52+44) */
:root { --header-height: 130px; }
.hero { margin-top: var(--header-height) !important; }
.single-post, .archive-header, .error-404 {
  margin-top: calc(var(--header-height) + 1.5rem) !important;
}

@media (max-width: 1024px) {
  .header-tagline { display: none; }
  .header-row-nav .main-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--bg-elevated);
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    z-index: 50;
  }
  .header-row-nav .main-nav.open {
    display: flex;
  }
  .header-row-nav { position: relative; }
  :root { --header-height: 90px; }
}

/* --- Ads: 4 col x 2 row, centered, gap between rows, each in card --- */
.ads-placeholder {
  text-align: center;
}
.ads-placeholder h3 {
  margin-bottom: 1.25rem;
}
.ads-grid-4x2 {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-rows: auto auto !important;
  column-gap: 14px !important;
  row-gap: 28px !important; /* فاصله بین سطر اول و دوم */
  justify-items: center;
  align-items: stretch;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}
.ad-card {
  width: 100%;
  max-width: 260px;
  min-height: 110px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.ad-card:hover {
  border-color: rgba(var(--primary-rgb), 0.45);
  box-shadow: var(--glow);
}
.ad-card img,
.ad-card iframe,
.ad-card table,
.ad-card > * {
  max-width: 100% !important;
  height: auto !important;
}
@media (max-width: 900px) {
  .ads-grid-4x2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    row-gap: 20px !important;
  }
}
@media (max-width: 500px) {
  .ads-grid-4x2 {
    grid-template-columns: 1fr !important;
  }
}

/* --- Stronger off-screen card motion (CSS scroll timeline) --- */
@supports (animation-timeline: view()) {
  .post-card {
    --from-x: 0px;
    --from-y: 0px;
    --from-rot: 0deg;
    --from-scale: 0.45;
    animation-name: mostafa-card-fly;
    animation-duration: 1s;
    animation-timing-function: linear;
    animation-fill-mode: both;
    animation-timeline: view();
    /* Start further outside, finish when well in view */
    animation-range: entry -20% cover 50%;
  }
  .post-card:nth-child(3n+1) {
    --from-x: -180px;
    --from-y: 30px;
    --from-rot: -24deg;
    --from-scale: 0.4;
  }
  .post-card:nth-child(3n+2) {
    --from-x: 180px;
    --from-y: 30px;
    --from-rot: 24deg;
    --from-scale: 0.4;
  }
  .post-card:nth-child(3n) {
    --from-x: 0px;
    --from-y: 160px;
    --from-rot: 8deg;
    --from-scale: 0.35;
  }
  @keyframes mostafa-card-fly {
    0% {
      opacity: 0;
      transform: translateX(var(--from-x)) translateY(var(--from-y)) rotate(var(--from-rot)) scale(var(--from-scale));
    }
    100% {
      opacity: 1;
      transform: translateX(0) translateY(0) rotate(0deg) scale(1);
    }
  }
}

/* --- Footer v7 --- */
.site-footer {
  background: var(--bg-footer);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.25rem;
  margin-top: 3rem;
}
.footer-top {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1.2fr 0.9fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-logo {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.footer-brand-block p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.7;
}
.footer-top h4 {
  color: var(--text-heading);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}
.footer-links-block ul li {
  margin-bottom: 0.45rem;
}
.footer-links-block a {
  color: var(--text-muted);
  font-size: 0.88rem;
}
.footer-links-block a:hover { color: var(--primary); }
.footer-legal-note {
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.footer-muted { color: var(--text-muted); font-size: 0.88rem; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
@media (max-width: 900px) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 560px) {
  .footer-top {
    grid-template-columns: 1fr;
  }
}

/* Ads: stick content to top of card */
.ad-card {
  align-items: flex-start !important;
  justify-content: flex-start !important;
  padding-top: 10px !important;
}
.ad-card > * {
  margin-top: 0 !important;
  align-self: flex-start;
}

/* Ensure no CSS scroll animation fights JS */
.post-card,
.category-header {
  animation: none !important;
}

.footer-top {
  grid-template-columns: 0.9fr 1.3fr 1.1fr 1.2fr !important;
}
.footer-legal-block .footer-box {
  font-size: 0.88rem;
  line-height: 1.85;
}

/* Footer v7.3 — mobile fix + badges inline */
.footer-top {
  display: grid;
  grid-template-columns: 0.85fr 1.25fr 1.1fr 1.15fr;
  gap: 1.5rem;
  align-items: start;
}
.footer-col h4 {
  margin-bottom: 0.75rem;
}
.footer-socials-mini {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.footer-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.15rem;
  flex-wrap: wrap;
}
.footer-badges .enamad-link img {
  max-width: 100px;
  height: auto;
  display: block;
  cursor: pointer;
}
.footer-badges .footer-badge {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

@media (max-width: 1024px) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }
}

@media (max-width: 640px) {
  .site-footer {
    padding: 2rem 0 1rem;
  }
  .footer-top {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .footer-box {
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.8;
  }
  .footer-col h4 {
    font-size: 0.95rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.85rem;
  }
  .footer-links-block ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 1rem;
  }
  .footer-links-block ul li {
    margin-bottom: 0;
  }
  .footer-form-block .wpforms-container,
  .footer-form-block form {
    max-width: 100%;
  }
  .footer-form-block input,
  .footer-form-block textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  .footer-badges {
    justify-content: center;
    gap: 0.85rem;
    padding: 0.5rem 0;
  }
  .footer-bottom {
    text-align: center;
    font-size: 0.8rem;
    padding-top: 1rem;
  }
  .footer-socials-mini {
    justify-content: flex-start;
  }
}

/* =========================================================
   v7.4 - Mobile footer MUST be single column
   ========================================================= */
@media (max-width: 768px) {
  .site-footer .footer-top,
  .footer-top {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 1.5rem !important;
    width: 100% !important;
  }
  .site-footer .footer-col,
  .footer-col,
  .footer-links-block,
  .footer-legal-block,
  .footer-form-block,
  .footer-trust-block {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
  }
  .site-footer .footer-box,
  .footer-box {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 1.15rem !important;
    font-size: 0.9rem !important;
    line-height: 1.9 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  .site-footer .footer-links-block ul {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem 1.25rem !important;
  }
  .site-footer .footer-form-block,
  .site-footer .footer-form-block .wpforms-container,
  .site-footer .footer-form-block form {
    width: 100% !important;
    max-width: 100% !important;
  }
  .site-footer .footer-form-block input,
  .site-footer .footer-form-block textarea,
  .site-footer .footer-form-block .wpforms-field input,
  .site-footer .footer-form-block .wpforms-field textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .site-footer .footer-badges {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1rem !important;
    flex-wrap: wrap !important;
  }
  .site-footer .footer-col h4 {
    text-align: right;
    width: 100%;
  }
}

/* Global ads strip — second band above footer */
.site-ads-strip {
  padding: 2rem 0 1.5rem;
  background: var(--bg-body);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.site-ads-strip .ads-placeholder {
  margin: 0;
  border-style: dashed;
}
.site-footer {
  margin-top: 0;
}


/* Ads 4 cols + shop products */
.ads-grid-4x1 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: stretch;
}
.ad-card-shop { padding: 0.5rem !important; align-items: stretch !important; }
.shop-live {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
.shop-live-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; font-weight: 700; margin-bottom: 0.45rem;
  color: var(--text-heading);
}
.shop-live-head a { font-size: 0.72rem; color: var(--primary); }
.shop-live-list { list-style: none; margin: 0; padding: 0; overflow: auto; max-height: 280px; }
.shop-live-list li { border-bottom: 1px solid var(--border); padding: 0.35rem 0; }
.shop-live-list li:last-child { border-bottom: 0; }
.shop-live-list a {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 0.75rem; line-height: 1.4; color: var(--text-muted);
}
.shop-live-list a:hover { color: var(--primary); }
@media (max-width: 900px) {
  .ads-grid-4x1 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .ads-grid-4x1 { grid-template-columns: 1fr; }
}
