/**
 * Guide article desktop sidebar (≥1100px).
 * Right rail: Related Tools (3) → Ad (300×250) → Related Guides (≤3).
 * Pack height must fit sticky viewport so all three stay co-visible when ad fills.
 */

.guide-desktop-split {
  display: block;
}

.guide-desktop-split__sidebar {
  display: none;
}

.guide-sidebar-card {
  margin: 0 0 0.65rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.guide-desktop-split__sidebar .guide-sidebar-card {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.guide-sidebar-card__title {
  margin: 0 0 0.4rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.guide-sidebar-card__list {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 1.5rem;
}

.guide-sidebar-card__list li {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #f1f5f9;
}

.guide-sidebar-card__list li:last-child {
  border-bottom: none;
}

.guide-sidebar-card__list a {
  display: block;
  padding: 0.4rem 0;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  color: #1d4ed8;
  text-decoration: none;
}

.guide-sidebar-card__list a:hover {
  color: #1e40af;
  text-decoration: underline;
}

.guide-sidebar-ad {
  margin: 0 0 0.65rem;
  padding: 0.5rem 0.65rem 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

/* Collapsed by default — no reserved gap until pending/filled */
.guide-sidebar-ad:not([data-ad-filled="1"]):not([data-ad-pending="1"]) {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.guide-sidebar-ad[data-ad-pending="1"],
.guide-sidebar-ad[data-ad-filled="1"] {
  display: block !important;
  visibility: visible;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
  margin-bottom: 0.65rem !important;
  padding: 0.5rem 0.65rem 0.65rem !important;
  border: 1px solid #e2e8f0 !important;
}

.guide-sidebar-ad[hidden],
.guide-sidebar-ad[data-ad-empty="1"] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.guide-sidebar-ad__label {
  margin: 0 0 0.35rem;
  font-size: 0.625rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  font-weight: 600;
}

.guide-sidebar-ad__mount {
  box-sizing: border-box;
  width: 300px;
  max-width: 100%;
  min-height: 250px;
  height: 250px;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}

.guide-sidebar-ad__mount .adsbygoogle {
  display: inline-block !important;
  width: 300px !important;
  height: 250px !important;
  max-width: 100%;
  overflow: hidden;
}

.guide-sidebar-ad__mount iframe {
  width: 300px !important;
  height: 250px !important;
  max-width: 100%;
  border: 0;
}

@media (min-width: 1100px) {
  .guide-desktop-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.25rem;
    align-items: stretch;
    margin-top: 0.5rem;
  }

  .guide-desktop-split__main {
    min-width: 0;
  }

  .guide-desktop-split__sidebar {
    display: block;
    align-self: stretch;
    min-height: 100%;
  }

  .guide-desktop-split__sidebar-sticky {
    position: sticky;
    top: 72px;
    z-index: 1;
    /*
     * Do NOT clip with max-height + overflow: Guides would hide when Ad fills.
     * Tools(3) + MREC + Guides(≤3) are sized to fit typical desktop viewports.
     */
    overflow: visible;
  }

  /* No extra top offset — margin pushed the ad below the sticky viewport */
  .guide-sidebar-ad[data-ad-pending="1"],
  .guide-sidebar-ad[data-ad-filled="1"] {
    margin-top: 0 !important;
  }

  .guide-sidebar-ad[hidden],
  .guide-sidebar-ad[data-ad-empty="1"] {
    margin-top: 0 !important;
  }
}

/* Short desktop windows: keep all three blocks co-visible */
@media (min-width: 1100px) and (max-height: 820px) {
  .guide-desktop-split__sidebar-sticky {
    top: 56px;
  }

  .guide-sidebar-card {
    margin-bottom: 0.45rem;
    padding: 0.5rem 0.6rem;
  }

  .guide-sidebar-card__title {
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
  }

  .guide-sidebar-card__list a {
    padding: 0.3rem 0;
    font-size: 0.75rem;
  }

  .guide-sidebar-ad[data-ad-pending="1"],
  .guide-sidebar-ad[data-ad-filled="1"] {
    margin-bottom: 0.45rem !important;
    padding: 0.35rem 0.5rem 0.5rem !important;
  }

  .guide-sidebar-ad__label {
    margin-bottom: 0.25rem;
  }
}

@media (max-width: 1099.98px) {
  .guide-desktop-split__sidebar {
    display: none !important;
  }
}
