/* ===========================
   WATHAEQ WordPress Theme CSS
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ─── */
:root {
  --font-heading: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-arabic: 'IBM Plex Sans Arabic', sans-serif;

  --background: hsl(210, 20%, 98%);
  --foreground: hsl(220, 25%, 10%);
  --card: hsl(0, 0%, 100%);
  --card-foreground: hsl(220, 25%, 10%);
  --primary: hsl(200, 80%, 35%);
  --primary-foreground: hsl(0, 0%, 100%);
  --secondary: hsl(38, 90%, 55%);
  --secondary-foreground: hsl(0, 0%, 100%);
  --muted: hsl(210, 15%, 93%);
  --muted-foreground: hsl(220, 10%, 46%);
  --accent: hsl(200, 60%, 94%);
  --accent-foreground: hsl(200, 80%, 25%);
  --border: hsl(210, 15%, 88%);
  --radius: 0.625rem;
  --shadow-card: 0 1px 3px hsl(220 25% 10% / 0.06), 0 1px 2px hsl(220 25% 10% / 0.04);
  --shadow-card-hover: 0 10px 25px -5px hsl(200 80% 35% / 0.12), 0 4px 10px hsl(220 25% 10% / 0.06);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* font-family RTL moved to direction.css */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
}

/* heading font RTL moved to direction.css */

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ─── Layout ─── */
.container-page {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 640px) { .container-page { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .container-page { padding-inline: 2rem; } }

/* ─── Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background-color: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
}

.site-header .header-inner {
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.site-logo .logo-icon {
  width: 36px;
  height: 36px;
  background-color: var(--primary);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.site-logo .logo-icon svg { width: 20px; height: 20px; }

.site-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
  font-family: var(--font-arabic);
}

/* Primary Nav */
.primary-nav {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

@media (min-width: 768px) { .primary-nav { display: flex; } }

.primary-nav a {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: background-color 0.15s, color 0.15s;
}

.primary-nav a:hover,
.primary-nav a.current-menu-item {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

/* Lang Toggle & Mobile Menu Btn */
.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.lang-toggle:hover { background-color: var(--muted); }
.lang-toggle svg { width: 16px; height: 16px; }

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--foreground);
}

@media (min-width: 768px) { .mobile-menu-btn { display: none; } }

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  background-color: white;
}

.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  border-radius: 0.375rem;
  transition: background-color 0.15s;
}
.mobile-nav a:hover { background-color: var(--accent); color: var(--accent-foreground); }

/* ─── Hero Section ─── */
.gradient-hero {
  background: linear-gradient(135deg, hsl(200, 80%, 30%), hsl(220, 60%, 20%));
}

.hero-section {
  padding: 4rem 0;
}

@media (min-width: 640px) { .hero-section { padding: 6rem 0; } }

.hero-section .hero-inner { text-align: center; }

.hero-section h1 {
  max-width: 42rem;
  margin-inline: auto;
  margin-bottom: 1rem;
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.2;
  color: white;
}

@media (min-width: 640px) { .hero-section h1 { font-size: 2.25rem; } }
@media (min-width: 1024px) { .hero-section h1 { font-size: 3rem; } }

.hero-section p {
  max-width: 32rem;
  margin-inline: auto;
  margin-bottom: 2rem;
  font-size: 1rem;
  color: rgba(255,255,255,0.8);
}

/* ─── Search Bar ─── */
.search-bar-wrap {
  max-width: 36rem;
  margin-inline: auto;
}

.search-bar-wrap .search-form {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 0.75rem;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.search-bar-wrap .search-form input[type="search"],
.search-bar-wrap .search-form input[type="text"] {
  flex: 1;
  padding: 0.875rem 1rem;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-family: inherit;
  background: transparent;
  min-width: 0; /* يمنع overflow */
}

.search-bar-wrap .search-form button {
  padding: 0.875rem 1.25rem;
  background-color: var(--primary);
  border: none;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-bar-wrap .search-form button:hover { background-color: hsl(200, 80%, 28%); }

/* ─── Section Common ─── */
.section { padding: 3rem 0; }
.section-bg { background-color: hsl(210, 15%, 97%); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.section-header h2 { font-size: 1.25rem; font-weight: 700; }

.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary);
  transition: text-decoration 0.15s;
}

.view-all-link:hover { text-decoration: underline; }
.view-all-link svg { width: 16px; height: 16px; }

/* ─── Category Cards ─── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) { .categories-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .categories-grid { grid-template-columns: repeat(5, 1fr); } }

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.category-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: hsl(200, 80%, 60%);
}

.category-card .cat-icon { font-size: 1.875rem; }
.category-card .cat-name { font-size: 0.75rem; font-weight: 500; }
.category-card .cat-count { font-size: 0.625rem; color: var(--muted-foreground); }

/* ─── Template Cards Grid ─── */
.templates-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) { .templates-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .templates-grid { grid-template-columns: repeat(4, 1fr); } }

/* ─── Template Card ─── */
.template-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.3s, border-color 0.3s;
}

.template-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: hsl(200, 80%, 60%);
}

.template-card .card-thumbnail {
  position: relative;
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--muted);
  color: var(--muted-foreground);
  gap: 0.5rem;
}

.template-card .card-thumbnail svg { width: 48px; height: 48px; opacity: 0.4; }
.template-card .card-thumbnail span { font-size: 0.75rem; }

.template-card .card-thumbnail .thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.template-card .card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1rem;
}

.template-card .card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.template-card .badge-category {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background-color: var(--accent);
  color: var(--accent-foreground);
  font-size: 0.625rem;
  font-weight: 500;
}

.template-card .badge-lang {
  font-size: 0.625rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
}

.template-card .card-title {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card .card-desc {
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card .card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.template-card .card-footer .downloads {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.template-card .card-footer svg { width: 12px; height: 12px; }

/* ─── Blog Cards Grid ─── */
.blog-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .blog-grid { grid-template-columns: repeat(3, 1fr); } }

/* ─── Blog Card ─── */
.blog-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.3s, border-color 0.3s;
}

.blog-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: hsl(200, 80%, 60%);
}

.blog-card .blog-thumb {
  aspect-ratio: 16/9;
  background-color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  opacity: 0.3;
  overflow: hidden;
}

.blog-card .blog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}

.blog-card .blog-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1rem;
}

.blog-card .blog-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.blog-card .blog-date svg { width: 12px; height: 12px; }

.blog-card .blog-title {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card .blog-excerpt {
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card .read-more {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  transition: gap 0.2s;
}

.blog-card:hover .read-more { gap: 0.5rem; }
.blog-card .read-more svg { width: 12px; height: 12px; }

/* ─── Ad Placement ─── */
.ad-placement {
  width: 100%;
  min-height: 90px;
  border-radius: 0.75rem;
  border: 1px dashed var(--border);
  background-color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  margin-block: 1rem;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: inherit;
}

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

.btn-primary:hover { background-color: hsl(200, 80%, 28%); }

.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-outline:hover { background-color: var(--muted); }

.btn-lg { padding: 0.875rem 1.5rem; font-size: 1rem; width: 100%; }
.btn svg { width: 16px; height: 16px; }

/* ─── Template Detail Page ─── */
.template-detail-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .template-detail-grid {
    grid-template-columns: 2fr 1fr;
  }
}

.template-preview-box {
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--muted);
  overflow: hidden;
}

.template-preview-box .preview-inner {
  aspect-ratio: 3/4;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--muted-foreground);
}

.template-preview-box .preview-inner svg { width: 96px; height: 96px; opacity: 0.3; }
.template-preview-box .preview-inner p { font-size: 0.875rem; }

.template-info-card {
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  padding: 1.5rem;
}

.template-info-card h1 { font-size: 1.25rem; margin-bottom: 0.75rem; }
.template-info-card .desc { font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 1rem; line-height: 1.6; }

.btn-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }

.details-table { width: 100%; border-collapse: collapse; }
.details-table dt, .details-table dd { padding: 0.375rem 0; font-size: 0.875rem; }
.details-table .detail-row { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }
.details-table .detail-row:last-child { border-bottom: none; }
.details-table dt { color: var(--muted-foreground); }
.details-table dd { font-weight: 500; }

.how-to-use-card {
  margin-top: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  padding: 1.5rem;
}

.how-to-use-card h2 { font-size: 1.125rem; margin-bottom: 0.75rem; }
.how-to-use-card p { font-size: 0.875rem; color: var(--muted-foreground); line-height: 1.7; }

/* ─── Filter Buttons ─── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.filter-btn {
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  border: none;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  background-color: var(--muted);
  color: var(--muted-foreground);
  font-family: inherit;
}

.filter-btn:hover,
.filter-btn.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

/* ─── Footer ─── */
.site-footer {
  border-top: 1px solid var(--border);
  background-color: var(--card);
}

.footer-grid {
  display: grid;
  gap: 2rem;
  padding: 3rem 0;
}

@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }

.footer-brand .brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.footer-brand .brand-icon {
  width: 32px;
  height: 32px;
  background-color: var(--primary);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.footer-brand .brand-icon svg { width: 16px; height: 16px; }
.footer-brand .brand-name { font-size: 1.125rem; font-weight: 700; font-family: var(--font-arabic); }
.footer-brand p { font-size: 0.875rem; color: var(--muted-foreground); line-height: 1.6; }

.footer-col h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

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

.footer-col ul a {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: color 0.15s;
}

.footer-col ul a:hover { color: var(--foreground); }

.footer-bottom {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* ─── Page Hero (inner pages) ─── */
.page-hero {
  padding: 2.5rem 0;
  text-align: center;
}

.page-hero h1 { font-size: 1.5rem; font-weight: 700; color: white; margin-bottom: 0.5rem; }
.page-hero p { font-size: 0.875rem; color: rgba(255,255,255,0.8); }

/* ─── Breadcrumb ─── */
.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
  transition: color 0.15s;
}

.breadcrumb-back:hover { color: var(--foreground); }
.breadcrumb-back svg { width: 16px; height: 16px; }

/* ─── Contact Form ─── */
.contact-form { max-width: 640px; margin-inline: auto; }
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  background-color: var(--card);
  color: var(--foreground);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsl(200, 80%, 35%, 0.1);
}

.form-group textarea { min-height: 140px; resize: vertical; }

/* ─── No Results ─── */
.no-results {
  padding: 4rem 0;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* ─── Prose / Static Pages ─── */
.prose {
  max-width: 720px;
  margin-inline: auto;
  padding-block: 2.5rem;
}

.prose h2 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }
.prose p { font-size: 0.95rem; line-height: 1.8; color: var(--muted-foreground); margin-bottom: 1rem; }

/* ─── RTL Support ─── */
/* arrow flip moved to direction.css */

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in { animation: fadeIn 0.4s ease both; }

/* ─── Responsive Utilities ─── */
.hidden { display: none; }
@media (min-width: 768px) { .md\:hidden { display: none; } }

/* ═══════════════════════════════════════════════════
   SEO + ACCESSIBILITY + RESPONSIVE ENHANCEMENTS
   ═══════════════════════════════════════════════════ */

/* ─── Skip to Content (Accessibility) ─── */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  background: var(--primary);
  color: white;
  font-weight: 600;
  border-radius: 0 0 0.5rem 0.5rem;
  transition: top 0.2s;
  text-decoration: none;
}

.skip-to-content:focus {
  top: 0;
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

/* ─── Focus Styles (Accessibility) ─── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* ─── Pagination Styles ─── */
.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0.25rem 0.75rem;
  margin: 0 0.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.page-numbers:hover { background: var(--accent); border-color: var(--primary); }
.page-numbers.current { background: var(--primary); color: white; border-color: var(--primary); }
.page-numbers.dots { border: none; background: none; }

/* ─── Images: Responsive ─── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ─── Tables: Responsive ─── */
table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
  display: block;
}

@media (min-width: 640px) { table { display: table; } }

th, td {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  /* text-align handled by direction.css */
}

th { background: var(--muted); font-weight: 600; }

/* ─── Typography Scale: Responsive ─── */
h1 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.875rem); }
h3 { font-size: clamp(1rem, 2vw, 1.375rem); }

/* ─── Touch Targets: Minimum 44px ─── */
.btn,
.filter-btn,
.lang-toggle,
.mobile-menu-btn,
.primary-nav a,
.category-card {
  min-height: 44px;
}

.filter-btn { min-height: 36px; }

/* ─── Form Elements: Touch-friendly ─── */
input[type="text"],
input[type="email"],
input[type="search"],
textarea,
select {
  font-size: 16px; /* Prevents iOS zoom on focus */
  -webkit-appearance: none;
  appearance: none;
}

/* ─── Card Grid: Better Mobile ─── */
@media (max-width: 479px) {
  .templates-grid { grid-template-columns: 1fr; }
  .blog-grid      { grid-template-columns: 1fr; }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Hero: Mobile Padding ─── */
@media (max-width: 639px) {
  .hero-section { padding: 2.5rem 0; }
  .hero-section h1 { font-size: 1.625rem; }
  .hero-section p  { font-size: 0.9rem; }
}

/* ─── Search Bar: Mobile ─── */
@media (max-width: 479px) {
  .search-bar-wrap .search-form { flex-direction: column; border-radius: 0.75rem; gap: 0; }
  .search-bar-wrap .search-form input { border-radius: 0.75rem 0.75rem 0 0; }
  .search-bar-wrap .search-form button { border-radius: 0 0 0.75rem 0.75rem; width: 100%; }
}

/* ─── Header: Mobile Improvements ─── */
@media (max-width: 360px) {
  .site-logo .logo-text { font-size: 1rem; }
  .lang-toggle span { display: none; }
}

/* ─── Template Detail: Mobile Stack ─── */
@media (max-width: 1023px) {
  .template-detail-grid { grid-template-columns: 1fr; }
  .template-preview-box .preview-inner { aspect-ratio: auto; min-height: 250px; }
}

/* ─── Footer: Mobile ─── */
@media (max-width: 639px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-grid .footer-brand { text-align: center; }
  .footer-grid .footer-brand .brand-wrap { justify-content: center; }
}

/* ─── Print Styles ─── */
@media print {
  .site-header,
  .site-footer,
  .ad-placement,
  .filter-bar,
  .btn-group { display: none !important; }

  body { font-size: 12pt; color: #000; }
  a { color: #000; text-decoration: underline; }
  .template-detail-grid { grid-template-columns: 1fr; }
  .template-info-card { border: 1px solid #ccc; }
}

/* ─── Dark Mode (System Preference) ─── */
@media (prefers-color-scheme: dark) {
  :root {
    --background: hsl(220, 25%, 6%);
    --foreground: hsl(210, 20%, 95%);
    --card: hsl(220, 20%, 10%);
    --card-foreground: hsl(210, 20%, 95%);
    --primary: hsl(200, 80%, 50%);
    --muted: hsl(220, 15%, 16%);
    --muted-foreground: hsl(215, 15%, 60%);
    --accent: hsl(200, 40%, 16%);
    --accent-foreground: hsl(200, 80%, 70%);
    --border: hsl(220, 15%, 18%);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-card-hover: 0 10px 25px -5px rgba(0,0,0,0.4);
  }

  .site-header { background-color: rgba(10,15,25,0.95); }
  .mobile-nav  { background-color: hsl(220, 20%, 8%); }
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── High Contrast Mode ─── */
@media (forced-colors: active) {
  .btn-primary { forced-color-adjust: none; }
  .category-card { border: 2px solid ButtonText; }
}

/* RTL/LTR rules moved to direction.css */

/* ─── Wordpress Alignment Classes ─── */
.alignleft  { float: left; margin-right: 1.5rem; margin-bottom: 1rem; }
.alignright { float: right; margin-left: 1.5rem; margin-bottom: 1rem; }
.aligncenter { display: block; margin-inline: auto; margin-bottom: 1rem; }
.alignfull  { width: 100vw; margin-left: calc(50% - 50vw); }

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

/* ─── Loading States ─── */
.loading {
  opacity: 0.6;
  pointer-events: none;
  cursor: wait;
}

/* ─── Smooth Scroll ─── */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ═══════════════════════════════════════════
   CUSTOMIZER — LOGO & IDENTITY STYLES
   ═══════════════════════════════════════════ */

/* Custom Logo from WordPress Media */
.site-logo img,
.site-logo .custom-logo {
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* Footer logo override */
.footer-brand .site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  margin-bottom: 0.75rem;
}

.footer-brand .brand-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--foreground);
}

/* Social links */
.footer-social,
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--muted);
  color: var(--muted-foreground);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.social-link:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* Transparent header transition */
.site-header {
  transition: background-color 0.3s, border-color 0.3s;
}

/* Customizer highlight outline (WP built-in) */
.customize-partial-edit-shortcut button {
  background: var(--primary) !important;
}

/* ══════════════════════════════════════════════════
   ARABIC RTL — مدمج في main.css للتأكد من التطبيق
   ══════════════════════════════════════════════════ */

/* HTML دائماً RTL */
html { direction: rtl !important; }
body { text-align: right !important; font-family: var(--font-arabic) !important; }

/* ── الهيدر ── */
.header-inner  { flex-direction: row-reverse !important; }
.site-logo     { flex-direction: row-reverse !important; }
.header-actions{ flex-direction: row-reverse !important; }
.primary-nav   { flex-direction: row-reverse !important; }
.mobile-nav, .mobile-nav a { text-align: right !important; }

/* ── البحث ── */
.search-bar-wrap .search-form { flex-direction: row-reverse !important; }
.search-bar-wrap input {
  text-align: right !important;
  direction: rtl !important;
  border-radius: 0 0.75rem 0.75rem 0 !important;
}
.search-bar-wrap button { border-radius: 0.75rem 0 0 0.75rem !important; }

/* ── رؤوس الأقسام ── */
.section-header   { flex-direction: row-reverse !important; }
.section-header h2{ text-align: right !important; }
.view-all-link    { flex-direction: row-reverse !important; }
.view-all-arrow, .read-more-arrow { transform: scaleX(-1) !important; }

/* ── البطاقات ── */
.template-card .card-body { text-align: right !important; direction: rtl !important; }
.card-meta     { flex-direction: row-reverse !important; }
.card-footer   { flex-direction: row-reverse !important; }
.blog-card .blog-body,
.blog-card .blog-title,
.blog-card .blog-excerpt { text-align: right !important; direction: rtl !important; }
.blog-date     { flex-direction: row-reverse !important; }
.read-more     { flex-direction: row-reverse !important; }

/* ── الفوتر ── */
.site-footer { direction: rtl !important; }
.footer-grid {
  display: flex !important;
  flex-wrap: wrap;
  flex-direction: row !important; /* RTL يعكس تلقائياً مع direction:rtl */
  gap: 2rem;
  padding: 3rem 0;
}
.footer-grid > * { flex: 1 1 150px; }
.footer-brand p, .footer-col h3, .footer-col ul a { text-align: right !important; }
.footer-brand .site-logo { flex-direction: row-reverse !important; }

/* ── breadcrumbs ── */
.breadcrumb-back { flex-direction: row-reverse !important; }
.breadcrumb-back svg, .view-all-link svg:not(.view-all-arrow) { transform: scaleX(-1); }

/* ── موبايل ── */
@media (max-width: 479px) {
  .search-bar-wrap .search-form { flex-direction: column !important; }
  .search-bar-wrap input  { border-radius: 0.75rem 0.75rem 0 0 !important; text-align: center !important; }
  .search-bar-wrap button { border-radius: 0 0 0.75rem 0.75rem !important; width: 100%; }
}
