/* Lean Blocksy integration for the homepage only. */

@media (max-width: 600px) {
  body.home #main > .ct-container {
    row-gap: var(--lwd-home-section-gap) !important;
  }
}

body #header {
  margin-bottom: 0 !important;
}

body #main > .ct-container {
  padding-top: var(--lwd-home-start-gap) !important;
}

body.home #main > .ct-container {
  row-gap: var(--lwd-home-section-gap) !important;
}

body #sidebar .ct-sidebar {
  margin-top: 0 !important;
}

body #sidebar .ct-sidebar > .ct-widget {
  margin: 0 0 var(--lwd-sidebar-gap) !important;
}

body #sidebar .ct-sidebar > .ct-widget:last-child {
  margin-bottom: 0 !important;
}

body #sidebar .ct-widget > :is(
  .lwd-sidebar-ad-wrap,
  .lwd-sidebar-promo,
  .lwd-home-ad,
  .lwd-banner-combination,
  .lwd-regiolinks-banner
) {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

body #sidebar .ct-widget > p:empty {
  display: none !important;
}

/* One authoritative sidebar rail for cards and banners. */
body #sidebar :is(
  .lwd-sidebar-ad-wrap,
  .lwd-regiolinks-banner,
  .lwd-sidebar-promo,
  .lwd-sidebar-newsletter,
  .lwd-sidebar-subscription:not(.lwd-sidebar-latest-posts),
  .lwd-sidebar-switch-ad,
  .lwd-banner-combination
) {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
}

body #sidebar .lwd-home-ad :is(a, img) {
  width: 100% !important;
  max-width: 100% !important;
}

body #sidebar .lwd-sidebar-ad-wrap > .lwd-sidebar-pel {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

@media (max-width: 689.98px) {
  body #sidebar .ct-sidebar {
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }

  body #sidebar :is(
    .lwd-sidebar-ad-wrap,
    .lwd-regiolinks-banner,
    .lwd-sidebar-promo,
    .lwd-sidebar-latest,
    .lwd-sidebar-newsletter,
    .lwd-sidebar-subscription,
    .lwd-sidebar-switch-ad,
    .lwd-banner-combination
  ) {
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  body #sidebar :is(
    .lwd-sidebar-latest,
    .lwd-sidebar-subscription,
    .lwd-sidebar-newsletter,
    .lwd-regiolinks-banner
  ) {
    --lwd-sidebar-card-padding: 14px;
  }

  body #main figure.lwd-home-ad,
  body #sidebar figure.lwd-home-ad {
    width: calc(100% - 28px) !important;
    max-width: calc(100% - 28px) !important;
    margin-right: auto !important;
    margin-left: auto !important;
  }

  body #sidebar .lwd-sidebar-ad-wrap > .lwd-sidebar-pel {
    width: 100% !important;
    max-width: none !important;
  }

  body #main > .ct-container:has(> #sidebar) {
    row-gap: 12px !important;
  }
}

@media (min-width: 1000px) {
  body #main figure.lwd-home-ad {
    width: 80% !important;
    max-width: 80% !important;
    margin-right: auto !important;
    margin-left: auto !important;
  }

  body #sidebar figure.lwd-home-ad {
    width: calc(100% - 44px) !important;
    max-width: calc(100% - 44px) !important;
    margin-right: auto !important;
    margin-left: auto !important;
  }
}

/* Emergency fallback blocks become visible when the plugin CSS is absent. */
#sidebar .liw-slot-sidebar-hide {
  display: none !important;
}

body #sidebar :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--lwd-heading-font, Arial, sans-serif) !important;
}

@media (min-width: 1000px) {
  #header .ct-container,
  #main > .ct-container,
  #footer .ct-container {
    width: min(calc(100% - 48px), var(--lwd-site-width)) !important;
    max-width: var(--lwd-site-width) !important;
    margin-inline: auto !important;
  }

  #main > .ct-container:has(> #sidebar) {
    grid-template-columns: minmax(0, 1fr) var(--lwd-sidebar-width) !important;
    column-gap: var(--lwd-column-gap) !important;
  }

  .ct-logo-container {
    box-sizing: border-box;
    padding: 6px;
  }

  .ct-header [data-device="desktop"] [data-row="bottom"] .ct-container {
    min-height: 0 !important;
  }

  .ct-header [data-device="desktop"] #menu-lwdmenu > li > a {
    height: auto !important;
    min-height: 0 !important;
    padding-block: 6px !important;
    line-height: 1.2 !important;
  }

  body.home #header {
    margin-bottom: 0;
  }

  body.home #main > .ct-container {
    padding-top: var(--lwd-home-start-gap);
  }

  body.home #sidebar .ct-sidebar {
    margin-top: 0;
  }

  body.home #sidebar .ct-sidebar > .ct-widget {
    margin: 0 0 var(--lwd-home-section-gap) !important;
  }

  body.home #sidebar .ct-sidebar > .ct-widget:last-child {
    margin-bottom: 0 !important;
  }
}

@media (max-width: 600px) {
  #header.ct-header {
    margin-bottom: 8px;
  }
}

#header nav {
  font-family: var(--lwd-menu-font);
  font-size: var(--lwd-menu-size);
  font-stretch: condensed;
  font-weight: var(--lwd-menu-weight);
  letter-spacing: var(--lwd-menu-tracking);
}

#header nav a {
  font: inherit !important;
  letter-spacing: inherit;
}

.ct-header [data-row="middle"],
.ct-header [data-row="top"],
.ct-header [data-row="bottom"] {
  overflow: visible !important;
}

.ct-header [data-row="middle"] {
  background: #fff !important;
}

.ct-logo-container {
  display: block !important;
  width: var(--lwd-logo-width) !important;
  text-align: center;
}

.ct-logo-container img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 auto !important;
}

.ct-header .ct-logo {
  width: 100% !important;
}

.ct-header .ct-container {
  max-width: 100% !important;
  padding-right: 0 !important;
  padding-left: 0 !important;
}

.ct-header {
  margin-bottom: 15px;
}

.ct-sidebar {
  padding: 5px;
  border-radius: 12px;
  background: var(--lwd-sidebar-bg);
  font-family: var(--lwd-body-font);
  font-size: var(--lwd-sidebar-size);
  line-height: 1.5;
}

.ct-sidebar :is(.widget-title, .widgettitle, .wp-block-heading) {
  font-family: var(--lwd-heading-font);
  font-size: var(--lwd-sidebar-title-size);
  line-height: 1.25;
}

#footer a,
#footer a:is(:link, :visited, :hover, :focus, :active) {
  color: #fff !important;
  text-decoration: none !important;
}

#footer a:focus-visible {
  outline-color: #fff;
}

.ct-sidebar figcaption,
.ct-sidebar .wp-caption-text,
.ct-sidebar .wp-element-caption,
.ct-sidebar .lwd-sidebar-ad-caption {
  margin-top: 6px;
  color: #5c5c5c !important;
  font-family: var(--lwd-body-font);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
}
