/* ==========================================================================
   MOSAED TECH (مُساعد) - Blog & Knowledge Hub
   Builds on the tokens and primitives in styles.css.
   Version: 6.0
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Hero, search & category chips
   -------------------------------------------------------------------------- */
.blog-hero-panel {
  padding-bottom: 72px;
}

.blog-title {
  font-size: clamp(32px, 4.2vw, 52px);
}

.blog-controls {
  width: 100%;
  margin-top: 36px;
}

.blog-search-box {
  position: relative;
  max-width: 640px;
  margin-inline: auto;
}

.blog-search-icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 18px;
  width: 20px;
  height: 20px;
  color: var(--text-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.blog-search-input {
  width: 100%;
  height: 58px;
  padding-inline: 50px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  font-size: 15.5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.blog-search-input:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), var(--shadow-float);
}

.blog-category-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.category-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding-inline: 14px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-tab);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.category-chip-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.category-chip-btn.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-ink);
}

.chip-count-badge {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

.category-chip-btn.is-active .chip-count-badge {
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
}

[data-theme="dark"] .category-chip-btn.is-active .chip-count-badge {
  background: rgba(10, 25, 49, 0.1);
}

/* --------------------------------------------------------------------------
   2. Shared meta bits (category dot, read time, location)
   -------------------------------------------------------------------------- */
.article-cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
}

.article-cat-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--cat-color, var(--brand));
}

.cat-erp { --cat-color: #2563EB; }
.cat-accounting { --cat-color: #059669; }
.cat-portals { --cat-color: #7C3AED; }
.cat-ecommerce { --cat-color: #EA580C; }
.cat-seo { --cat-color: #0891B2; }
.cat-gulf { --cat-color: #0F766E; }

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.5;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  flex: none;
}

/* --------------------------------------------------------------------------
   3. Featured article
   -------------------------------------------------------------------------- */
.featured-section {
  padding-top: 56px;
}

.featured-article-card {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease;
}

.featured-article-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-float);
}

.featured-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  min-height: 300px;
  border-radius: 20px;
  background: var(--stage-bg);
}

.featured-visual .stage-core {
  width: 30%;
}

.featured-content {
  display: flex;
  flex-direction: column;
  padding: 28px 28px 22px;
}

.featured-top-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.featured-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12.5px;
  font-weight: 700;
}

.featured-title {
  margin-top: 16px;
  font-size: clamp(21px, 2.2vw, 28px);
  font-weight: 700;
  line-height: 1.5;
  text-wrap: pretty;
}

.featured-desc {
  margin-top: 12px;
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.9;
}

.featured-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 24px;
}

.featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

/* --------------------------------------------------------------------------
   4. Articles grid
   -------------------------------------------------------------------------- */
.articles-section {
  padding-top: 72px;
}

.articles-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 32px;
}

.articles-title {
  font-size: clamp(24px, 2.6vw, 32px);
}

.articles-count {
  color: var(--text-3);
  font-size: 0.6em;
  font-weight: 600;
}

.articles-hint {
  color: var(--text-3);
  font-size: 14px;
}

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

.article-card {
  color: inherit;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease, border-color 0.3s ease;
}

.article-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-float);
  transform: translateY(-3px);
}

.article-card:hover .arrow-btn {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-ink);
}

.article-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.article-card-title {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 16px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.article-card-snippet {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 8px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.article-card-snippet {
  margin-bottom: 20px;
}

.article-card-date {
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
}

.blog-empty-state {
  padding: 56px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  color: var(--text-2);
  text-align: center;
}

.blog-empty-state .empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  color: var(--text-3);
}

.blog-empty-state .empty-title {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.blog-empty-state .empty-desc {
  margin-top: 6px;
  font-size: 14px;
}

.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
}

.pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.pagination-page-indicator {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   5. Article page (/blog/<slug>, generated by tools/build.mjs)
   -------------------------------------------------------------------------- */
.post-hero {
  padding-bottom: 64px;
}

.post-hero-inner {
  max-width: 860px;
  margin-inline: auto;
  text-align: start;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 22px;
  padding: 0;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 500;
  list-style: none;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-inline-end: 8px;
  color: var(--line-strong);
}

.breadcrumbs a {
  color: var(--text-2);
  transition: color 0.2s ease;
}

.breadcrumbs a:hover {
  color: var(--text);
}

.post-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 700;
  line-height: 1.5;
  text-wrap: balance;
}

.post-lead {
  margin-top: 18px;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1.95;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.post-meta .meta-item {
  font-size: 13.5px;
}

.post-meta strong {
  color: var(--text);
  font-weight: 600;
}

.post-layout {
  max-width: 860px;
  padding-block: 48px 8px;
}

.article-content-body > :first-child {
  margin-top: 0;
}

.article-content-body h2,
.article-content-body h3 {
  margin-top: 36px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.6;
}

.article-content-body p {
  margin-top: 14px;
  color: var(--text-2);
  font-size: 17px;
  line-height: 2;
}

.article-content-body strong {
  color: var(--text);
}

.article-content-body a {
  color: var(--brand-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.article-table {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.article-table table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.8;
}

.article-table th,
.article-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  text-align: start;
  vertical-align: top;
}

.article-table th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
}

.article-table tr:last-child td {
  border-bottom: 0;
}

.post-faq {
  margin-top: 44px;
}

.post-faq-title {
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.5;
}

.article-content-body ul {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.article-content-body li {
  position: relative;
  padding-inline-start: 22px;
  color: var(--text-2);
  font-size: 16.5px;
  line-height: 1.9;
}

.article-content-body li::before {
  content: "";
  position: absolute;
  top: 0.8em;
  inset-inline-start: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.article-takeaways-box {
  margin-top: 44px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-2);
}

.takeaways-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 17px;
  font-weight: 700;
}

.takeaways-title svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

.takeaways-list li {
  color: var(--text);
  font-size: 15.5px;
}

.post-case {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 22px;
  margin-top: 20px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.post-case-logo {
  display: grid;
  place-items: center;
  width: 120px;
  height: 64px;
  flex: none;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #FFFFFF;
}

.post-case-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.post-case-body {
  flex: 1;
  min-width: 220px;
}

.post-case-label {
  color: var(--brand-ink);
  font-size: 12.5px;
  font-weight: 700;
}

.post-case-title {
  margin-top: 2px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.6;
}

.post-case-text {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.75;
}

[dir="rtl"] .post-case-link .btn-icon {
  transform: scaleX(-1);
}

.post-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: 20px;
  padding: 24px 28px;
  border-radius: 22px;
  background: var(--stage-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.post-cta-text {
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.6;
}

.post-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.post-cta-actions .icon-whatsapp {
  width: 18px;
  height: 18px;
  flex: none;
  color: #25D366;
}

.related-section {
  padding-top: 72px;
}

.related-title {
  margin-bottom: 28px;
  font-size: clamp(24px, 2.6vw, 32px);
}

/* --------------------------------------------------------------------------
   6. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .featured-article-card {
    grid-template-columns: 1fr;
  }

  .featured-visual {
    min-height: 200px;
  }
}

@media (max-width: 640px) {
  .blog-hero-panel {
    padding-bottom: 48px;
  }

  .blog-search-input {
    height: 52px;
    font-size: 14.5px;
  }

  .featured-section {
    padding-top: 40px;
  }

  .featured-visual {
    display: none;
  }

  .featured-content {
    padding: 16px 14px 12px;
  }

  .featured-footer .btn {
    width: 100%;
  }

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

  .post-hero {
    padding-bottom: 44px;
  }

  .post-lead {
    font-size: 16.5px;
  }

  .post-layout {
    padding-top: 32px;
  }

  .article-content-body p {
    font-size: 16px;
  }

  .article-takeaways-box,
  .post-cta {
    padding: 22px 20px;
  }

  .post-cta .btn {
    width: 100%;
  }

  .related-section {
    padding-top: 56px;
  }
}
