
/* 
 Theme Name:     ACT Studios
 Author:         ACT Studios
 Author URI:     http://www.act-studios.com
 Template:       Divi
 Version:        1.0 
*/ 


/* ----------- PUT YOUR CUSTOM CSS BELOW THIS LINE -- DO NOT EDIT ABOVE THIS LINE --------------------------- */


/* Divi Overlays #327 ("Christmas and New Year" popup) - mobile/tablet fix.

   Two things break the popup below the desktop breakpoint:

   1. The close button is placed with hand-tuned pixel offsets applied as
      `left: <n>px`. The desktop value (-477px) lives in a media query the
      plugin writes as "(min-width: 981px), (max-width: 980px)", which in
      practice matches every width, so it is only escaped where a narrower
      override exists. Divi Overlays also treats "phone" as max-width 400px,
      so handsets wider than that (412-440px, plus anything in landscape)
      fall into its "tablet" bucket.

   2. The popup box is positioned by the plugin's JS, which measures the
      wrapper and writes an absolute `left` into a <style> tag. When that
      measurement is off, or runs before layout, the box sits off-centre.

   Rather than chase the offsets, anchor the close button to the popup's
   top-right corner and inset it with margins, and pin the box flush and
   full-width so Divi's own `margin: auto` on the section does the centring. */

@media (max-width: 980px) {

	/* Popup box: flush, full width, centred by the section's own auto margins.
	   Beats the plugin's JS-written `left` (lower specificity). `top` is left
	   alone so the plugin keeps handling vertical centring. */
	body #divi-overlay-container-327 .entry-content > div {
		left: 0 !important;
		right: 0 !important;
		min-width: 100% !important;
		width: 100% !important;
		max-width: 100% !important;
	}

	/* Anchor the close button's container to the popup's top-right corner */
	body .divioverlay .overlay-close-container[data-pointoforigin_tablet],
	body .divioverlay .overlay-close-container[data-pointoforigin_phone] {
		top: 0 !important;
		right: 0 !important;
		left: auto !important;
		bottom: auto !important;
		padding: 0 !important;
		transform: none !important;
	}

	/* Inset the X from that corner with margins rather than negative offsets,
	   so it lands in the same place regardless of screen width. The right
	   margin clears the 20px gutter the plugin puts on #et-boc, so the button
	   sits inside the white card rather than straddling its edge. */
	body .divioverlay a.overlay-close.overlay-customclose-btn-327 {
		left: auto !important;
		top: auto !important;
		margin: 12px 32px 0 0 !important;
	}

	/* 25px is below a comfortable touch target - grow the hit area without
	   changing how big the circle looks. */
	body .divioverlay a.overlay-close.overlay-customclose-btn-327:after {
		height: 34px !important;
		width: 34px !important;
	}

	body .divioverlay a.overlay-close.overlay-customclose-btn-327 span.custom_btn {
		top: 50% !important;
	}
}

/* Between 768px and 980px (iPad portrait, handsets in landscape) Divi still
   sizes the popup's section to 50%, while the close button above is anchored
   to the full-width wrapper - which would leave the X stranded on the dark
   backdrop, well clear of the white card. Shrink the wrapper to the card's
   width instead of widening the card, so the design is unchanged and the X
   lands on the card's own corner. */

@media (min-width: 768px) and (max-width: 980px) {

	body #divi-overlay-container-327 .entry-content > div {
		left: 25% !important;
		right: auto !important;
		min-width: 50% !important;
		width: 50% !important;
		max-width: 50% !important;
	}

	body.et-db #et-boc .et-l .et_pb_section_dov_327_0 {
		width: 100% !important;
	}
}

/* Vertical centring on mobile/tablet.

   Divi Overlays centres the box vertically in JS (setPointOfOrigin): it measures
   the content once and writes an absolute `top` into a <style> tag. That
   measurement is taken at a single moment and is easily wrong on a handset -
   the text wraps to more lines than it did when measured - so the box ends up
   sitting low rather than centred. Do it in CSS instead: no measurement, and it
   survives rotation and font loading.

   `max-height` plus internal scroll reproduces the clamp the JS does
   (`if (top < 0) top = 0`), so a popup taller than the screen stays reachable
   instead of having its top - and its close button - pushed off the top edge.

   The #sidebar-overlay variant is there to outrank the plugin's own
   `max-height: none !important`, which carries two IDs below 400px and would
   otherwise win on specificity. */

@media (max-width: 980px) {

	body #divi-overlay-container-327 .entry-content > div,
	body #sidebar-overlay #divi-overlay-container-327 .entry-content > div {
		top: 50% !important;
		bottom: auto !important;
		transform: translateY(-50%) !important;
		max-height: 100% !important;
		overflow-y: auto !important;
		-webkit-overflow-scrolling: touch;
	}
}

/* The popup only appearing once you start scrolling.

   This overlay has "prevent page scroll" switched on. On open, Divi Overlays
   adds .pcs_enabled to it and relocates it into a temporary container appended
   to the end of <body> - and its own stylesheet then drops the overlay out of
   `position: fixed`:

     .divioverlay.pcs_enabled                       { position: relative }
     .osx.et_mobile_device .divioverlay.pcs_enabled { position: absolute }

   Back in normal flow at the end of the document, the popup renders below the
   footer, off screen. It is supposed to be rescued by .prevent_mainpage_scroll_mobile
   taking the main page out of flow, but that rule is wrapped in
   `(min-device-width: 375px) and (max-device-width: 1024px)`, so handsets
   reporting a narrower device width never get it.

   What then makes the popup "arrive" is the first scroll: the browser collapses
   its address bar, which fires `resize`, and the plugin re-runs
   applyToDiviOverlayViewportHeight() and setPointOfOrigin() on that event.

   Holding the overlay in the viewport removes the whole dependency - once it is
   fixed, where the plugin parks it in the DOM no longer affects where it draws.
   The ID outranks the .osx.et_mobile_device rule, and !important beats the
   inline height that applyToDiviOverlayViewportHeight() writes, so the box stays
   predictable whether or not that function has run. */

@media (max-width: 980px) {

	body .divioverlay#overlay-327,
	body .divioverlay#overlay-327.pcs_enabled {
		position: fixed !important;
		top: 0 !important;
		left: 0 !important;
		width: 100% !important;
		height: 100% !important;
		max-height: 100% !important;
		overflow-x: hidden !important;
		overflow-y: auto !important;
	}
}
