/* --- Remove the top global padding + margin presets (safe version) --- */

/* Remove global top padding applied by WordPress block wrapper */
main.wp-block-group.has-global-padding {
  padding-top: 0 !important;
}

/* Override WP preset margin variables (only affect the top gap) */
:root {
  --wp--preset--spacing--50: 0px !important;
  --wp--preset--spacing--30: 0px !important;
}

/* Hide header v1 */
header[id*="header-v1"] {
  display: none !important;
}

/* Show header v5 */
header[id*="header-v5"] {
  display: block !important;
}

/* Ensure body and html never overflow horizontally */
html, body {
    overflow-x: hidden;
}

/* Restrict the full-width groups on mobile */
@media (max-width: 768px) {
    .wp-block-group.alignfull,
    .wp-block-group.alignwide,
    .wp-block-columns.alignwide {
        max-width: 100vw;
        overflow-x: hidden;
        padding-left: 8px !important;  /* reduced padding */
        padding-right: 8px !important;
        box-sizing: border-box;
    }

    /* Make the scrollable list contained */
    .anysell-list {
        display: flex;
        flex-wrap: nowrap; /* prevent wrapping */
        overflow-x: auto;  /* horizontal scroll */
        -webkit-overflow-scrolling: touch; /* smooth scroll */
        width: 100%; /* stay within viewport */
        max-width: 100vw;
        padding-left: 0;
        padding-right: 0;
        margin-left: 0;
        margin-right: 0;
    }

    /* Prevent list items from forcing overflow */
    .anysell-list li {
        flex: 0 0 auto; /* natural width */
        min-width: 0;
    }

    /* Prevent images inside list items from causing overflow */
    .anysell-list img {
        max-width: 100%;
        height: auto;
        display: block;
    }
}

/* ---------------------------
   Mobile Horizontal List Fix
   --------------------------- */

/* Prevent horizontal overflow globally */
html, body {
    overflow-x: hidden;
}

/* Restrict full-width groups and columns on mobile */
@media (max-width: 768px) {
    .wp-block-group.alignfull,
    .wp-block-group.alignwide,
    .wp-block-columns.alignwide {
        max-width: 100vw;
        overflow-x: hidden;
        padding-left: 8px !important;
        padding-right: 8px !important;
        box-sizing: border-box;
    }

    /* Scrollable list container */
    .anysell-list {
        display: flex;
        flex-wrap: nowrap;           /* prevent wrapping */
        overflow-x: auto;            /* horizontal scroll */
        -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
        width: 100%;
        max-width: 100vw;
        padding-left: 0;
        padding-right: 0;
        margin-left: 0;
        margin-right: 0;

        /* Smooth scroll & snapping */
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
    }

    /* List items */
    .anysell-list li {
        flex: 0 0 auto;             /* natural width */
        min-width: 0;
        scroll-snap-align: start;   /* snap each item */
        padding-right: 8px;         /* spacing between items */
    }

    /* Images inside list items */
    .anysell-list img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Optional: hide scrollbar for cleaner look */
    .anysell-list::-webkit-scrollbar {
        display: none;
    }
    .anysell-list {
        -ms-overflow-style: none;  /* IE/Edge */
        scrollbar-width: none;     /* Firefox */
    }
}
/* Hide all H1 elements on pages except the Shop page */
body.page:not(.woocommerce-shop) h1 {
    display: none !important;
}