/*
Theme Name: Mizpardaz Blog Theme
Author: Mizpardaz
Description: Custom theme for mizpardaz.ir/blog — matches the main Next.js landing page exactly.
Version: 1.3.0
Text Domain: mizpardaz-blog
*/

/* ===== CSS Variables (matching Tailwind & Next.js app) ===== */
:root {
  --background: #ffffff;
  --foreground: #020817;
  --primary: #f97316;
  --primary-hover: #ea580c;
  --primary-foreground: #ffffff;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --card: #ffffff;
  --radius: 0.75rem;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== Base ===== */
html { scroll-behavior: smooth; }
body {
  font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Tahoma, sans-serif;
  direction: rtl;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }

/* ===== Container (matching max-w-6xl = 1152px + px-4) ===== */
.container {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===== HEADER — exact match with Next.js page ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px; /* h-16 */
}

/* Logo */
.site-branding {
  display: flex;
  align-items: center;
}
.site-branding a {
  display: flex;
  align-items: center;
  gap: 0.625rem; /* gap-2.5 */
  text-decoration: none;
}
.site-branding a:hover .logo-icon {
  transform: scale(1.05);
}
.logo-icon {
  width: 40px; /* w-10 */
  height: 40px; /* h-10 */
  background: var(--primary);
  color: #fff;
  border-radius: 12px; /* rounded-xl */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.logo-icon svg { width: 20px; height: 20px; }
.site-branding .brand-text {
  display: flex;
  flex-direction: column;
}
.site-branding .brand-name {
  font-size: 1.25rem; /* text-xl */
  font-weight: 900;
  letter-spacing: -0.025em;
  color: var(--foreground);
  line-height: 1.2;
}
.site-branding .brand-subtitle {
  font-size: 10px;
  color: var(--muted-foreground);
  font-weight: 500;
  line-height: 1.2;
}

/* Desktop Nav */
.main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.main-nav a {
  font-size: 0.875rem; /* text-sm */
  font-weight: 600;
  color: var(--muted-foreground);
  transition: color 0.2s;
}
.main-nav a:hover { color: var(--foreground); }

/* Desktop Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  text-decoration: none;
}
.btn-ghost:hover { background-color: var(--muted); color: var(--foreground); }
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  transition: background-color 0.2s;
  text-decoration: none;
}
.btn-primary:hover { background-color: var(--primary-hover); color: #fff; }
.btn-sm {
  height: 36px;
  padding: 0 0.625rem;
  font-size: 0.75rem;
}

/* Mobile Header Controls */
.mobile-header-actions {
  display: none;
  align-items: center;
  gap: 0.5rem;
}
.mobile-menu-toggle {
  background: transparent;
  border: none;
  padding: 0.5rem;
  border-radius: 8px;
  color: var(--foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}
.mobile-menu-toggle:hover {
  background-color: var(--muted);
}

/* Mobile Drawer */
.mobile-nav-drawer {
  display: none;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 1.5rem 1rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}
.site-header.mobile-menu-open .mobile-nav-drawer {
  display: block;
  animation: slideDown 0.2s ease-out;
}
/* Icon close — hidden by default, shown when menu is open */
.icon-close {
  display: none;
}
.site-header.mobile-menu-open .icon-menu {
  display: none;
}
.site-header.mobile-menu-open .icon-close {
  display: block !important;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.mobile-nav-links a {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: background-color 0.2s;
  text-decoration: none;
}
.mobile-nav-links a:hover {
  background-color: var(--muted);
}

.mobile-nav-cta {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.btn-outline-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--foreground);
  text-decoration: none;
  transition: background-color 0.2s;
}
.btn-outline-full:hover {
  background-color: var(--muted);
}
.btn-primary-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  transition: background-color 0.2s;
}
.btn-primary-full:hover {
  background-color: var(--primary-hover);
}

/* ===== MAIN CONTENT ===== */
.site-main {
  padding: 3rem 0;
  min-height: 60vh;
}

/* ===== BLOG INDEX — Post Grid ===== */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
}
.page-title {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--foreground);
  line-height: 1.2;
}
.page-subtitle {
  color: var(--muted-foreground);
  margin-top: 0.5rem;
  font-size: 1rem;
}

.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.post-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.post-card:hover {
  box-shadow: 0 4px 12px -2px rgba(0,0,0,0.1);
  border-color: #fbbf24;
}
.post-thumbnail img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}
.post-content {
  padding: 1.5rem;
}
.post-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.post-title a { color: var(--foreground); }
.post-title a:hover { color: var(--primary); }
.post-excerpt {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.post-meta {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  display: flex;
  gap: 1rem;
}

/* ===== SINGLE POST ===== */
.single-post {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
}
.single-post-header {
  text-align: center;
  margin-bottom: 2rem;
}
.single-post-header .post-meta {
  justify-content: center;
  margin-bottom: 1rem;
}
.single-post-title {
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1.2;
  color: var(--foreground);
}
.single-post-thumbnail img {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 2rem;
}
.single-post-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--foreground);
}
.single-post-content h2,
.single-post-content h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 800;
}
.single-post-content p {
  margin-bottom: 1.25rem;
}
.single-post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}
.single-post-content blockquote {
  border-right: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--muted);
  border-radius: 0 8px 8px 0;
  color: var(--muted-foreground);
  font-style: italic;
}
.single-post-content ul,
.single-post-content ol {
  padding-right: 1.5rem;
  margin-bottom: 1.25rem;
}
.single-post-content li {
  margin-bottom: 0.5rem;
}

/* Back to blog link */
.back-to-blog {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: 2rem;
  text-decoration: none;
  transition: color 0.2s;
}
.back-to-blog:hover { color: var(--primary); }

/* ===== PAGINATION ===== */
.pagination {
  margin-top: 3rem;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  text-decoration: none;
  transition: all 0.2s;
}
.pagination a:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination .current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== FOOTER — exact match with Next.js page ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 4rem 0 0;
  background: var(--background);
}
.footer-grid {
  display: grid;
  grid-template-columns: 5fr 2fr 3fr 2fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

/* Footer Col 1: Branding */
.footer-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.footer-branding .logo-icon {
  width: 40px;
  height: 40px;
}
.footer-branding .brand-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--foreground);
}
.footer-desc {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.6;
  max-width: 320px;
}

/* Footer Col Links */
.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 1rem;
}
.footer-col ul {
  list-style: none;
}
.footer-col li {
  margin-bottom: 0.75rem;
}
.footer-col a {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--primary); }

/* Phone number */
.footer-phone {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--foreground);
  direction: ltr;
  text-align: left;
  background: var(--muted);
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* Enamad box */
.enamad-box {
  background: #fff;
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.enamad-box img { max-width: 100%; height: auto; }

/* =========================================================
   STRICT FLOATING ENAMAD PURGE (only footer .enamad-box stays)
   ========================================================= */
body > a[href*="enamad"]:not(.enamad-box a),
body > div[id*="enamad"]:not(.enamad-box),
body > div[class*="enamad"]:not(.enamad-box),
body > iframe[src*="enamad"],
body > img[src*="enamad"],
#enamad_floating_seal,
#enamad_seal,
#eNamadLogo,
.enamad-floating,
.enamad-fixed,
.enamad-seal-fixed,
.enamad-float,
.enamad_sticky,
.enamad-seal,
.trustseal-fixed,
[id*="enamad_float"],
[class*="enamad_float"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  max-width: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  top: -9999px !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  z-index: -9999 !important;
}

/* Ensure footer enamad box stays visible */
.enamad-box,
.enamad-box a,
.enamad-box img {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  z-index: 1 !important;
}

/* Footer Bottom Bar */
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-copyright {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  font-weight: 500;
}
.footer-legal {
  display: flex;
  gap: 1rem;
}
.footer-legal span {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color 0.2s;
}
.footer-legal span:hover { color: var(--primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .header-actions { display: none; }
  .mobile-header-actions { display: flex; }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
  .single-post-title { font-size: 1.75rem; }
  .post-list { grid-template-columns: 1fr; }
}
