/* ============================================================
   BarqNews Pro — 15 — Layout System
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img, svg, video { display: block; max-width: 100%; }

/* ---------- Containers ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--glob-gap);
}

.design-boxed .container {
  background: var(--card-bg);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

/* ---------- Page wrapper ---------- */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site-main {
  flex: 1;
  padding: var(--space-xl) 0;
}

/* ---------- Sidebar layout ---------- */
.with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--glob-gap);
  align-items: flex-start;
}

.primary-content {
  min-width: 0; /* مهم لإصلاح overflow في الـ grid */
}

.sidebar-side {
  position: sticky;
  top: calc(var(--header-height) + 20px);
  max-height: calc(100vh - var(--header-height) - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.sidebar-side::-webkit-scrollbar { width: 6px; }
.sidebar-side::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* بدون سايدبار */
.no-sidebar .primary-content {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* ---------- Header layout cell ---------- */
.content-layout-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.content-layout-cell {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ---------- Home grid sections ---------- */
.homepage-section {
  margin-bottom: var(--space-2xl);
}

.section-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--post-gap);
}

.section-three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--post-gap);
}

.section-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--post-gap);
}

.section-with-side {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--glob-gap);
  align-items: flex-start;
}

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  :root { --glob-gap: 36px; }
}

@media (max-width: 991px) {
  :root { --glob-gap: 28px; }
  .with-sidebar,
  .section-with-side {
    grid-template-columns: 1fr;
  }
  .sidebar-side {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .section-three-col { grid-template-columns: 1fr 1fr; }
  .section-hero { grid-template-columns: 1fr; }
}

@media (max-width: 575px) {
  :root {
    --glob-gap: 16px;
    --post-gap: 14px;
    --header-height: var(--header-height-mobile);
  }
  .section-three-col,
  .section-two-col { grid-template-columns: 1fr; }
  .site-main { padding: var(--space-lg) 0; }
}

/* ---------- Print ---------- */
@media print {
  #site-header,
  #site-footer,
  #news-ticker,
  .sidebar-side,
  .entry-share,
  .ad,
  #scroll-top,
  #reading-progress-bar,
  .breadcrumbs { display: none !important; }
  .entry-content { max-width: 100%; font-size: 12pt; color: black; }
  body { background: white; }
}
