/*
Theme Name: The League Child
Theme URI: https://wrestlepain.com/
Description: Child theme for The League. Holds Wrestle Pain customisations.
Author: Wrestle Pain
Template: the-league
Version: 1.1.0
Text Domain: the-league-child
*/

/* ==========================================================================
   Sticky right sidebar — single posts + post index/archive pages
   --------------------------------------------------------------------------
   - #mvp-side-wrap pins below the fixed header while the main column scrolls.
   - It releases when its bottom reaches the bottom of the main content column
     (its containing block: .mvp-post-content-out on singles,
     .mvp-main-body-out2 on archives).
   - If the panel is taller than the viewport it scrolls internally so every
     widget stays reachable.
   - Off at <=899px, where the theme already stacks the sidebar below content.

   Note on !important: the theme prints an inline <style> block late in <head>
   containing

       @media screen and (min-width: 1004px) {
         .single .mvp-post-content-in, .single #mvp-side-wrap,
         .archive #mvp-side-wrap, .search #mvp-side-wrap { position: relative; z-index: 1; }
       }

   That has the same specificity as our selector but wins on source order, so
   `position` and `top` are forced here. Everything else is left unforced.
   ========================================================================== */

:root {
	/* Fixed header height (132px) + breathing room */
	--wpp-sticky-top: 152px;
}

@media screen and (min-width: 900px) {

	/* The theme sets overflow:hidden on #mvp-site, which makes it the nearest
	   scroll container and kills position:sticky. `clip` keeps the same
	   overflow containment without creating a scroll container. */
	body.single #mvp-site,
	body.blog #mvp-site,
	body.home #mvp-site,
	body.archive #mvp-site,
	body.search #mvp-site {
		overflow: clip;
	}

	body.single #mvp-side-wrap,
	body.blog #mvp-side-wrap,
	body.home #mvp-side-wrap,
	body.archive #mvp-side-wrap,
	body.search #mvp-side-wrap {
		position: -webkit-sticky !important;
		position: sticky !important;
		top: var(--wpp-sticky-top) !important;
		z-index: 1;
		max-height: calc(100vh - var(--wpp-sticky-top) - 20px);
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
	}

	/* Logged-in users: the WP admin bar pushes the fixed header down 32px. */
	body.admin-bar.single #mvp-side-wrap,
	body.admin-bar.blog #mvp-side-wrap,
	body.admin-bar.home #mvp-side-wrap,
	body.admin-bar.archive #mvp-side-wrap,
	body.admin-bar.search #mvp-side-wrap {
		top: calc(var(--wpp-sticky-top) + 32px) !important;
		max-height: calc(100vh - var(--wpp-sticky-top) - 52px);
	}
}
