/* Blog JS Migration — blog.css */
/* Extends bine.css — all colors and spacing via CSS custom properties */

/* :root {} — blog-specific token overrides (if needed) */

/* Author display rules (display:grid/flex) override the UA [hidden] rule.
   Re-declare it with !important so the hidden attribute always wins. */
[hidden] { display: none !important; }

/* ══════════════════════════════════════════
   SHARED UTILITIES (T010)
══════════════════════════════════════════ */

.post-img-placeholder {
  background: linear-gradient(135deg, var(--grad-a, #9109df), var(--grad-b, #dc1fff));
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md, 8px);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.placeholder-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  unicode-bidi: plaintext;
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

.skeleton-block {
  background: linear-gradient(
    90deg,
    var(--border, #e2e8f0) 25%,
    var(--border-strong, #cbd5e1) 50%,
    var(--border, #e2e8f0) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm, 4px);
}

.bine-article-toc {
  display: none;
}

/* ══════════════════════════════════════════
   BLOG HERO (T013)
══════════════════════════════════════════ */

.blog-hero {
  padding-block: 120px 48px;
  text-align: center;
}

.blog-hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 12px;
  line-height: 1.2;
}

.blog-hero-sub {
  font-size: 1.1rem;
  color: var(--fg-3, var(--fg-muted, #64748b));
  max-width: 560px;
  margin-inline: auto;
  margin-bottom: 0;
}

.blog-search-wrap {
  max-width: 640px;
  margin: 28px auto 0;
}

.blog-search {
  width: 100%;
  padding: 14px 20px;
  border: 1px solid var(--border-strong, #cbd5e1);
  border-radius: 9999px;
  background: var(--field-bg, var(--surface, #fff));
  color: var(--fg);
  font-size: 1rem;
  outline-offset: 2px;
  transition: border-color 0.18s;
}

.blog-search:focus {
  border-color: var(--primary, #9109df);
}

/* ══════════════════════════════════════════
   CATEGORY PILLS (T014)
══════════════════════════════════════════ */

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

.pill {
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1px solid var(--border-strong, #cbd5e1);
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--fg-3, #64748b);
  background: var(--surface, #fff);
  transition: background 0.18s, color 0.18s;
  font-family: inherit;
}

.pill.active,
.pill:hover {
  background: var(--primary, #9109df);
  color: #fff;
  border-color: var(--primary, #9109df);
}

/* ══════════════════════════════════════════
   FEATURED BANNER CARD (T015)
══════════════════════════════════════════ */

.featured-post {
  position: relative;
  border-radius: var(--r-xl, 20px);
  overflow: hidden;
  margin-bottom: 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 340px;
  box-shadow: var(--card-shadow-lg, 0 8px 40px rgba(0,0,0,.12));
}

.featured-post-img-wrap {
  overflow: hidden;
  height: 100%;
}

.featured-post-img-wrap img,
.featured-post-img-wrap .post-img-placeholder {
  object-fit: cover;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.featured-post-body {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(135deg, var(--bg-soft, var(--bg, #f8fafc)), var(--surface-2, var(--surface, #fff)));
  gap: 10px;
}

.featured-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--eyebrow-bg, rgba(145,9,223,.1));
  color: var(--eyebrow-fg, var(--primary, #9109df));
  border-radius: var(--r-sm, 4px);
  font-size: 0.75rem;
  font-weight: 600;
  align-self: flex-start;
}

.featured-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary, #9109df);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.featured-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
  margin: 0;
}

.featured-excerpt {
  font-size: 0.95rem;
  color: var(--fg-3, #64748b);
  line-height: 1.6;
  margin: 0;
}

.featured-date {
  font-size: 0.8rem;
  color: var(--fg-4, #94a3b8);
}

.featured-cta {
  align-self: flex-start;
  margin-top: 4px;
}

/* ══════════════════════════════════════════
   POST CARD GRID (T016)
══════════════════════════════════════════ */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 64px;
}

.post-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-card {
  border-radius: var(--r-lg, 12px);
  overflow: hidden;
  background: var(--card-bg, var(--surface, #fff));
  border: 1px solid var(--card-border, var(--border, #e2e8f0));
  box-shadow: var(--card-shadow, 0 2px 8px rgba(0,0,0,.06));
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-lg, 0 8px 40px rgba(0,0,0,.12));
}

.post-card-img-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.post-card-img-wrap img,
.post-card-img-wrap .post-img-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  display: block;
}

.post-card-body {
  padding: 20px;
}

.post-card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--fg-4, #94a3b8);
}

.post-card-category {
  color: var(--primary, #9109df);
  font-weight: 600;
}

.post-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.4;
  margin: 0 0 8px;
}

.post-card-excerpt {
  font-size: 0.9rem;
  color: var(--fg-3, #64748b);
  line-height: 1.6;
  margin: 0;
}

/* Skeleton cards */
.skeleton-card .post-card-img-wrap {
  background: var(--border, #e2e8f0);
}

/* ══════════════════════════════════════════
   ERROR & EMPTY STATES (T024)
══════════════════════════════════════════ */

.blog-error,
.blog-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--fg-3, #64748b);
}

.blog-error h3,
.blog-empty h3 {
  color: var(--fg);
  margin-bottom: 16px;
}

.retry-btn {
  margin-top: 16px;
}

/* ══════════════════════════════════════════
   POST HEADER (T029)
══════════════════════════════════════════ */

.post-header {
  margin-bottom: 0;
  padding-top: 90px;
}

.post-hero-wrap {
  width: 100%;
  aspect-ratio: 16 / 7;
  overflow: hidden;
}

.post-hero-wrap img,
.post-hero-wrap .post-img-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  display: block;
}

.post-header-body {
  padding-block: 32px;
}

.post-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary, #9109df);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 8px;
}

.post-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--fg);
  margin: 12px 0 0;
}

.post-meta {
  display: flex;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--fg-4, #94a3b8);
  margin-top: 12px;
}

/* Post skeleton */
.post-skeleton {
  padding: 40px 0;
}

.post-skeleton .skeleton-block {
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════
   POST TWO-COLUMN LAYOUT & BODY (T030)
══════════════════════════════════════════ */

.post-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  align-items: start;
  margin-block: 40px;
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--fg-2, var(--fg));
  min-width: 0;
}

.post-body h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 2.5em;
  margin-bottom: 0.75em;
  color: var(--fg);
}

.post-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 0.5em;
  color: var(--fg);
}

.post-body p {
  margin-bottom: 1.25em;
}

.post-body blockquote {
  border-inline-start: 4px solid var(--primary, #9109df);
  margin-inline: 0;
  padding-inline-start: 20px;
  color: var(--fg-3, #64748b);
  font-style: italic;
}

.post-body pre {
  background: var(--surface-2, var(--surface, #f8fafc));
  border-radius: var(--r-md, 8px);
  padding: 16px;
  overflow-x: auto;
}

.post-body figure {
  margin: 2em 0;
}

.post-body figure img {
  width: 100%;
  border-radius: var(--r-lg, 12px);
}

.post-body figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--fg-4, #94a3b8);
  margin-top: 8px;
}

.post-body aside.bine-article-callout {
  background: var(--eyebrow-bg, rgba(145,9,223,.08));
  border-radius: var(--r-md, 8px);
  padding: 16px 20px;
  color: var(--eyebrow-fg, var(--primary, #9109df));
  margin: 1.5em 0;
}

/* ══════════════════════════════════════════
   TOC SIDEBAR (T031)
══════════════════════════════════════════ */

.post-sidebar {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.toc-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-4, #94a3b8);
  margin-bottom: 12px;
  margin-top: 0;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  margin-bottom: 6px;
}

.toc-item a {
  display: block;
  font-size: 0.9rem;
  color: var(--fg-3, #64748b);
  text-decoration: none;
  padding: 4px 0 4px 12px;
  border-inline-start: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.toc-item a:hover {
  color: var(--fg);
}

.toc-item.active a {
  color: var(--primary, #9109df);
  border-inline-start-color: var(--primary, #9109df);
  font-weight: 500;
}

.toc-item.level-3 a {
  padding-inline-start: 24px;
  font-size: 0.85rem;
}

/* ══════════════════════════════════════════
   SHARE BAR & TOAST (T032)
══════════════════════════════════════════ */

.share-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 32px;
  border-top: 1px solid var(--border, #e2e8f0);
  flex-wrap: wrap;
}

.share-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-3, #64748b);
  margin-inline-end: auto;
}

.share-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong, #cbd5e1);
  background: var(--surface, #fff);
  color: var(--fg-3, #64748b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
}

.share-btn:hover {
  background: var(--primary, #9109df);
  color: #fff;
  border-color: var(--primary, #9109df);
}

.share-toast {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  background: var(--fg, #0f172a);
  color: var(--bg, #f8fafc);
  padding: 10px 18px;
  border-radius: var(--r-md, 8px);
  font-size: 0.875rem;
  z-index: 9999;
  animation: fade-in-up 0.2s ease;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ══════════════════════════════════════════
   NOT FOUND STATE
══════════════════════════════════════════ */

.not-found {
  text-align: center;
  padding: 80px 20px;
  color: var(--fg-3, #64748b);
}

.not-found h2 {
  color: var(--fg);
  margin-bottom: 16px;
}

/* ══════════════════════════════════════════
   RESPONSIVE — TABLET (T045)
══════════════════════════════════════════ */

@media (max-width: 1079px) {
  .posts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .post-layout {
    grid-template-columns: 1fr;
  }

  #postToc {
    display: none;
  }

  .featured-post {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════
   RESPONSIVE — MOBILE (T046)
══════════════════════════════════════════ */

@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: 1fr;
  }

  .blog-hero {
    padding-block: 40px 32px;
  }

  .featured-post {
    min-height: auto;
  }

  .featured-post-body {
    padding: 24px;
  }
}

/* ══════════════════════════════════════════
   MOBILE TOC DRAWER (T047)
══════════════════════════════════════════ */

.toc-toggle {
  display: none;
  width: 100%;
  background: var(--surface-2, var(--surface, #f8fafc));
  border: none;
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding: 14px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  text-align: start;
  font-family: inherit;
}

@media (max-width: 1079px) {
  .toc-toggle {
    display: block;
  }
}

/* ══════════════════════════════════════════
   RTL OVERRIDES (T048)
══════════════════════════════════════════ */

[dir="rtl"] .toc-item a {
  padding-inline-start: 0;
  padding-inline-end: 12px;
  border-inline-start: none;
  border-inline-end: 2px solid transparent;
}

[dir="rtl"] .toc-item.active a {
  border-inline-end-color: var(--primary, #9109df);
}

[dir="rtl"] .toc-item.level-3 a {
  padding-inline-start: 0;
  padding-inline-end: 24px;
}

[dir="rtl"] .share-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] .featured-post-body {
  text-align: right;
}

[dir="rtl"] .post-body blockquote {
  border-inline-start: none;
  border-inline-end: 4px solid var(--primary, #9109df);
  padding-inline-start: 0;
  padding-inline-end: 20px;
}

/* Arabic post content — switch to Cairo font and ensure RTL text alignment */
#post-main[dir="rtl"] {
  font-family: 'Cairo', 'Poppins', 'Segoe UI', Tahoma, Arial, sans-serif;
}

#post-main[dir="rtl"] .post-title,
#post-main[dir="rtl"] .post-eyebrow,
#post-main[dir="rtl"] .post-meta {
  text-align: start;
}

