/* ------------------------------------------------------------------
   MAC Hermann — front-end fixes and branded preloader
   Updated 2026-09-10
   ------------------------------------------------------------------ */

/* ==================================================================
   1. SAFETY NET — old Preloader Awesome plugin
   The plugin has been removed. These rules stay so that if it is ever
   reactivated it can no longer leave the site at opacity:0 (the blank
   white page) or drop a dead overlay over the content.
   ================================================================== */
.container-pageload {
    opacity: 1 !important;
}

#loader,
.pageload-overlay {
    display: none !important;
}

/* ==================================================================
   2. HORIZONTAL SCROLL — mobile and tablet
   .premium-blog-wrap carries margin-left/right:-12.5px for its gutters
   but the parent does not compensate, so the widget renders 13px wider
   than the viewport on every page that uses it. Clip the overhang —
   the cards carry 12.5px of inner padding, so no content is lost.
   ================================================================== */
.elementor-widget-premium-addon-blog > .elementor-widget-container {
    overflow-x: hidden;
}

/* ==================================================================
   3. BRANDED PRELOADER — CSS only
   Replaces the Preloader Awesome plugin. No HTML, no JavaScript, no
   plugin: body::before is the cream screen carrying the logo and
   body::after is the red progress bar. Both were confirmed unused
   across every stylesheet the site loads.

   Because it is driven by a fixed CSS animation rather than a script
   waiting on images, it always clears at 1.1s and can never hang the
   way the old one did.
   ================================================================== */

@keyframes mh-preloader-out {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes mh-preloader-bar {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* The cream screen with the trophy logo. */
body:not(.elementor-editor-active)::before {
    content: "";
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2147483000;
    background-color: #FEF4D5;
    background-image: url("https://machermanntrophy.com/wp-content/uploads/2024/10/MACHermannTrophy_FullMark_FullColor_OnLight-233x300.png");
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 116px auto;
    pointer-events: none;
    animation: mh-preloader-out 0.5s ease 1.1s forwards;
}

/* The red progress bar, sitting just below the logo. */
body:not(.elementor-editor-active)::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 2147483001;
    width: 140px;
    height: 3px;
    margin-top: 96px;
    margin-left: -70px;
    border-radius: 3px;
    background-color: #B12028;
    transform-origin: left center;
    pointer-events: none;
    animation:
        mh-preloader-bar 1.1s cubic-bezier(0.4, 0, 0.2, 1) forwards,
        mh-preloader-out 0.5s ease 1.1s forwards;
}

/* Never cover the page for someone who has asked for reduced motion. */
@media (prefers-reduced-motion: reduce) {
    body::before,
    body::after {
        display: none !important;
    }
}

/* Never print the preloader. */
@media print {
    body::before,
    body::after {
        display: none !important;
    }
}
