/* ─── Maha Tool - Blog (public) ────────────────────────────────────────────
   Loaded only on /blog/ pages, on top of style.css. Uses the same --ag-accent
   / --ag-font variables the rest of the site already sets.
   ─────────────────────────────────────────────────────────────────────────── */

.ag-blog-hero {
  padding: 34px 0 26px;
  border-bottom: 1px solid #e8ecf0;
  margin-bottom: 30px;
}
.ag-blog-hero h1 {
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.2;
  margin: 0 0 10px;
  color: #1e2d3d;
}
.ag-blog-hero p {
  margin: 0;
  color: #6b7280;
  font-size: 15px;
  max-width: 72ch;
  line-height: 1.65;
}

/* ─── Category chips ──────────────────────────────────────────────────────── */
.ag-blog-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 28px;
}
.ag-blog-cats a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #e8ecf0;
  background: #fff;
  color: #46536b;
  font-size: 13px;
  font-weight: 500;
  transition: .18s ease;
}
.ag-blog-cats a:hover { border-color: var(--ag-accent); color: var(--ag-accent); }
.ag-blog-cats a.is-active { background: var(--ag-accent); border-color: var(--ag-accent); color: #fff; }
.ag-blog-cats a span { opacity: .7; font-size: 12px; }

/* ─── Post grid ───────────────────────────────────────────────────────────── */
.ag-blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}
.ag-blog-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: 14px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  height: 100%;
}
.ag-blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(67, 97, 238, .12);
  border-color: rgba(67, 97, 238, .3);
}
.ag-blog-card-media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #eef1fd, #f8f9ff);
  overflow: hidden;
  position: relative;
}
.ag-blog-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ag-blog-card-media .ag-blog-card-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ag-accent);
  opacity: .38;
}
.ag-blog-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.ag-blog-card-cat {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ag-accent);
  margin-bottom: 8px;
}
.ag-blog-card-title {
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #1e2d3d;
  margin: 0 0 8px;
}
.ag-blog-card:hover .ag-blog-card-title { color: var(--ag-accent); }
.ag-blog-card-desc {
  font-size: 13.5px;
  line-height: 1.65;
  color: #6b7280;
  margin: 0 0 14px;
  flex: 1;
}
.ag-blog-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #9aa5b4;
  border-top: 1px solid #f1f3f7;
  padding-top: 12px;
}
.ag-blog-card-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ag-blog-badge-featured {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.ag-blog-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 10px 0 50px;
}
.ag-blog-pagination a,
.ag-blog-pagination span {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid #e8ecf0;
  background: #fff;
  color: #46536b;
  font-size: 14px;
}
.ag-blog-pagination a:hover { border-color: var(--ag-accent); color: var(--ag-accent); }
.ag-blog-pagination .is-active { background: var(--ag-accent); border-color: var(--ag-accent); color: #fff; font-weight: 600; }
.ag-blog-pagination .is-disabled { opacity: .4; }

/* ─── Single post ─────────────────────────────────────────────────────────── */
.ag-post-wrap { max-width: 780px; margin: 0 auto; }
.ag-post-head { padding: 26px 0 18px; }
.ag-post-title {
  font-size: clamp(27px, 4.6vw, 40px);
  line-height: 1.2;
  margin: 10px 0 16px;
  color: #1e2d3d;
  letter-spacing: -.01em;
}
.ag-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: #6b7280;
  padding-bottom: 20px;
  border-bottom: 1px solid #e8ecf0;
}
.ag-post-meta span { display: inline-flex; align-items: center; gap: 5px; }
.ag-post-meta a { color: var(--ag-accent); font-weight: 500; }
.ag-post-hero {
  margin: 26px 0;
  border-radius: 14px;
  overflow: hidden;
  background: #f4f6fb;
}
.ag-post-hero img { width: 100%; height: auto; display: block; }

/* Article body: the only place raw editor HTML is rendered, so every common
   tag needs a style here. */
.ag-post-body {
  font-size: 16.5px;
  line-height: 1.8;
  color: #33415c;
}
.ag-post-body > *:first-child { margin-top: 0; }
.ag-post-body p { margin: 0 0 20px; }
.ag-post-body h2 {
  font-size: 24px;
  line-height: 1.3;
  color: #1e2d3d;
  margin: 38px 0 14px;
  font-weight: 600;
}
.ag-post-body h3 {
  font-size: 20px;
  line-height: 1.35;
  color: #1e2d3d;
  margin: 30px 0 12px;
  font-weight: 600;
}
.ag-post-body h4 { font-size: 17px; color: #1e2d3d; margin: 24px 0 10px; font-weight: 600; }
.ag-post-body ul,
.ag-post-body ol { margin: 0 0 20px; padding-left: 24px; }
.ag-post-body ul { list-style: disc; }
.ag-post-body ol { list-style: decimal; }
.ag-post-body li { margin-bottom: 8px; }
.ag-post-body a { color: var(--ag-accent); text-decoration: underline; text-underline-offset: 2px; }
.ag-post-body a:hover { text-decoration-thickness: 2px; }
.ag-post-body img { max-width: 100%; height: auto; border-radius: 10px; margin: 8px 0 20px; }
.ag-post-body strong { color: #1e2d3d; font-weight: 600; }
.ag-post-body hr { border: none; border-top: 1px solid #e8ecf0; margin: 32px 0; }
.ag-post-body blockquote:not(.instagram-media):not(.twitter-tweet) {
  border-left: 3px solid var(--ag-accent);
  background: #f8f9ff;
  border-radius: 0 8px 8px 0;
  margin: 24px 0;
  padding: 14px 20px;
  color: #46536b;
  font-style: italic;
}
.ag-post-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px 18px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 20px;
}
.ag-post-body code {
  background: #eef1fd;
  color: #3730a3;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: .9em;
}
.ag-post-body pre code { background: none; color: inherit; padding: 0; }
.ag-post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 14.5px;
}
.ag-post-body th,
.ag-post-body td { border: 1px solid #e8ecf0; padding: 10px 12px; text-align: left; }
.ag-post-body th { background: #f8f9ff; font-weight: 600; color: #1e2d3d; }
.ag-post-body figure { margin: 0 0 20px; }

/* Table + pre need their own scroller so the page body never scrolls sideways */
.ag-post-body table { display: block; overflow-x: auto; }

/* ─── Embeds ──────────────────────────────────────────────────────────────── */
.ag-post-body .ag-yt-embed,
.ag-post-body .tti-yt-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #0f172a;
  margin: 26px 0;
}
.ag-post-body .ag-yt-embed iframe,
.ag-post-body .tti-yt-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.ag-post-body blockquote.instagram-media,
.ag-post-body blockquote.twitter-tweet { margin: 26px auto !important; }

/* ─── Share row ───────────────────────────────────────────────────────────── */
.ag-post-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 34px 0;
  padding: 18px 0;
  border-top: 1px solid #e8ecf0;
  border-bottom: 1px solid #e8ecf0;
}
.ag-post-share-label { font-size: 13px; font-weight: 600; color: #46536b; margin-right: 4px; }
.ag-post-share a,
.ag-post-share button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #e8ecf0;
  background: #fff;
  color: #46536b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: .18s ease;
}
.ag-post-share a:hover,
.ag-post-share button:hover { border-color: var(--ag-accent); color: var(--ag-accent); }

/* ─── CTA back to the tools ───────────────────────────────────────────────── */
.ag-post-cta {
  background: linear-gradient(135deg, var(--ag-accent), #3a0ca3);
  color: #fff;
  border-radius: 16px;
  padding: 30px 28px;
  margin: 34px 0;
  text-align: center;
}
.ag-post-cta h3 { font-size: 20px; margin: 0 0 8px; color: #fff; }
.ag-post-cta p { margin: 0 0 18px; opacity: .9; font-size: 14.5px; line-height: 1.6; }
.ag-post-cta .ag-btn {
  background: #fff;
  color: var(--ag-accent);
  font-weight: 600;
  border: none;
}
.ag-post-cta .ag-btn:hover { background: #eef1fd; }

/* ─── Related ─────────────────────────────────────────────────────────────── */
.ag-post-related { margin: 44px 0 56px; }
.ag-post-related h2 {
  font-size: 21px;
  color: #1e2d3d;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8ecf0;
}

/* ─── Empty state ─────────────────────────────────────────────────────────── */
.ag-blog-empty {
  text-align: center;
  padding: 70px 20px;
  color: #9aa5b4;
}
.ag-blog-empty svg { margin: 0 auto 14px; opacity: .5; }
.ag-blog-empty h2 { font-size: 19px; color: #46536b; margin: 0 0 8px; }

@media (max-width: 640px) {
  .ag-blog-grid { grid-template-columns: 1fr; gap: 18px; }
  .ag-post-body { font-size: 16px; }
  .ag-post-cta { padding: 24px 18px; }
}
