/**
 * WarBrief global layout utilities + spacing + overflow fixes
 */

/* ── Utilities ── */
.wb-u-container,
.wb-wrap {
  width: 100%;
  max-width: var(--wb-max-width);
  margin-inline: auto;
  padding-inline: var(--wb-gutter);
  box-sizing: border-box;
}

.wb-u-scroll-x,
.wb-scroll-x {
  display: flex;
  gap: var(--wb-space-2);
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
}

.wb-u-scroll-x::-webkit-scrollbar,
.wb-scroll-x::-webkit-scrollbar { display: none; }

.wb-u-stack { display: flex; flex-direction: column; gap: var(--wb-gap-stack); }
.wb-u-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wb-space-3); }

.wb-pill {
  background: var(--wb-color-secondary);
  color: var(--wb-color-text-inverse);
  font: 700 11px/1 var(--wb-font-sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
}

/* ── Global overflow guard ── */
html { overflow-x: hidden; scroll-behavior: smooth; }
body.wb-modern-active {
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

body.wb-modern-active img,
body.wb-modern-active video,
body.wb-modern-active iframe,
body.wb-modern-active table {
  max-width: 100%;
}

body.wb-modern-active main,
body.wb-modern-active section,
body.wb-modern-active article,
body.wb-modern-active aside {
  max-width: 100%;
}

/* ── Site header fixes ── */
body.wb-modern-active > header,
body.wb-modern-active header[style*="sticky"] {
  max-width: 100vw;
  width: 100%;
  overflow: hidden;
  padding-inline: var(--wb-gutter) !important;
  box-sizing: border-box;
  z-index: var(--wb-z-header);
  gap: var(--wb-space-4) !important;
}

body.wb-modern-active header > div:first-child {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42%;
}

body.wb-modern-active header > div:last-child {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

body.wb-modern-active header .wb-site-logo {
  display: inline-block;
  font-family: var(--wb-font-sans), Inter, sans-serif !important;
  font-size: clamp(1.25rem, 2.8vw, 1.75rem) !important;
  line-height: 1.1 !important;
  letter-spacing: -0.02em !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  color: #fff !important;
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (min-width: 768px) {
  body.wb-modern-active header nav {
    display: flex !important;
    align-items: center;
    gap: clamp(12px, 2vw, 24px) !important;
    min-width: 0;
    flex-wrap: nowrap;
  }
}

@media (max-width: 767px) {
  body.wb-modern-active > header,
  body.wb-modern-active header[style*="sticky"] {
    overflow: visible !important;
  }

  body.wb-modern-active header nav,
  body.wb-modern-active header #menu-header {
    display: none !important;
  }

  body.wb-modern-active header > div:first-child {
    flex: 1 1 auto !important;
    min-width: min-content !important;
    max-width: none !important;
    flex-shrink: 0 !important;
  }

  body.wb-modern-active header > div:last-child {
    flex: 0 0 auto !important;
  }
}

body.wb-modern-active header nav a,
body.wb-modern-active header .wb-live-nav-link {
  font-family: var(--wb-font-sans), Inter, sans-serif !important;
  font-size: 13px !important;
  line-height: 1.2 !important;
  letter-spacing: 0.08em !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

body.wb-modern-active header .flex.items-center.gap-8 {
  min-width: 0;
  flex-shrink: 1;
}

body.wb-modern-active header .flex.items-center.gap-4 {
  flex-shrink: 0;
  min-width: 0;
}

@media (max-width: 1100px) {
  body.wb-modern-active header nav a,
  body.wb-modern-active header .wb-live-nav-link {
    font-size: 12px !important;
    letter-spacing: 0.06em !important;
  }

  body.wb-modern-active header nav {
    gap: 14px !important;
  }
}

/* ── Desktop spacing uplift ── */
.wb-hero,
.wb-blog-hero,
.wb-cpt-hero,
.wb-single-hero {
  padding-block: var(--wb-space-hero-y);
}

.wb-main,
.wb-blog-main-wrap,
.wb-cpt-main,
.wb-single-main {
  padding-block: var(--wb-space-section-y);
}

.wb-blog-layout,
.wb-cpt-layout,
.wb-single-layout {
  gap: var(--wb-gap-layout);
}

.wb-blog-grid,
.wb-cpt-grid,
.wb-card-grid,
.wb-blog-related-grid,
.wb-cpt-related-grid,
.wb-single-related-grid {
  gap: var(--wb-gap-grid);
}

.wb-blog-article,
.wb-cpt-article,
.wb-single-article {
  padding: var(--wb-space-8) var(--wb-space-9);
}

.wb-blog-section-head,
.wb-cpt-section-head,
.wb-section-head {
  margin-bottom: var(--wb-space-7);
  padding-bottom: var(--wb-space-4);
}

.wb-blog-slider-section {
  padding-block: var(--wb-space-9) var(--wb-space-4);
}

.wb-cpt-featured {
  margin-bottom: var(--wb-space-9);
}

.wb-blog-card-body,
.wb-cpt-card-body {
  padding: var(--wb-space-5) var(--wb-space-6) var(--wb-space-6);
}

/* ── Topic / theater chip bars ── */
.wb-blog-cat-nav,
.wb-theater-nav {
  position: sticky;
  top: var(--wb-header-height);
  z-index: var(--wb-z-sticky);
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  box-sizing: border-box;
}

.wb-blog-cat-inner,
.wb-theater-inner {
  display: flex;
  align-items: center;
  gap: var(--wb-space-4);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.wb-blog-cat-label,
.wb-theater-label {
  flex-shrink: 0;
}

.wb-blog-cat-chips,
.wb-theater-chips {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: var(--wb-space-2);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
  overscroll-behavior-x: contain;
}

.wb-blog-cat-chips::-webkit-scrollbar,
.wb-theater-chips::-webkit-scrollbar { display: none; }

.wb-blog-chip,
.wb-chip,
.wb-theater-chips .wb-chip {
  flex-shrink: 0;
}

/* ── Sidebar overflow on mobile ── */
.sidebar-primary,
.wb-blog-sidebar,
.wb-cpt-sidebar,
.wb-single-sidebar {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1023px) {
  .sidebar-primary {
    max-width: 100% !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .sidebar-with-content {
    flex-direction: column;
    gap: var(--wb-gap-layout);
  }

  .sidebar-with-content .content-area,
  .sidebar-with-content .sidebar-primary {
    width: 100%;
    max-width: 100%;
  }
}

/* ── Theme main containers ── */
body.wb-modern-active main.max-w-max-width-site {
  max-width: var(--wb-max-width);
  padding-inline: var(--wb-gutter);
  box-sizing: border-box;
}

/* ── Pagination / grids min-width ── */
.wb-blog-card,
.wb-cpt-card,
.wb-card,
.wb-blog-slide,
.wb-cpt-featured {
  min-width: 0;
}

@media (min-width: 1280px) {
  .wb-blog-layout,
  .wb-cpt-layout,
  .wb-single-layout {
    gap: calc(var(--wb-gap-layout) + 8px);
  }
}

@media (max-width: 767px) {
  :root {
    --wb-gutter: 16px;
    --wb-space-section-y: 40px;
    --wb-space-hero-y: 40px;
  }

  .wb-blog-article,
  .wb-cpt-article,
  .wb-single-article {
    padding: var(--wb-space-6) var(--wb-space-5);
  }

  .wb-blog-cat-inner,
  .wb-theater-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .wb-blog-cat-chips,
  .wb-theater-chips {
    width: 100%;
  }
}

body.admin-bar .wb-blog-cat-nav,
body.admin-bar .wb-theater-nav { top: calc(var(--wb-header-height) + 32px); }
@media (max-width: 782px) {
  body.admin-bar .wb-blog-cat-nav,
  body.admin-bar .wb-theater-nav { top: calc(var(--wb-header-height) + 46px); }
}
