/*
Theme Name: MG Shopfronts
Theme URI: https://itlsoftware.company
Author: In The Loop Software Company
Author URI: https://worzl.ai
Description: Enterprise WordPress 6.6+ Block Theme for MG Shopfronts with Core Framework mobile architecture.
Version: 1.0.0
Requires at least: 6.6
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mg-shopfronts
Tags: full-site-editing, block-patterns, block-styles, custom-colors, custom-typography, fluid-layout, wide-blocks, mobile-responsive
*/

/* ==========================================================================
   CORE FRAMEWORK & GUTENBERG MOBILE ENHANCEMENTS
   ========================================================================== */

html, body, body * {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

/* Sticky Header with Elevation */
#header,
header.wp-block-template-part {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

/* Mobile Navigation Breakpoint & Drawer Fix */
body .wp-block-navigation__responsive-container-open:not(.always-shown) {
  display: block !important;
}
body .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
  display: none !important;
}
@media (min-width: 768px) {
  body .wp-block-navigation__responsive-container-open:not(.always-shown) {
    display: none !important;
  }
  body .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
    display: block !important;
  }
}

/* Navigation alignment & logo link fix */
.wp-block-navigation__container {
  flex-wrap: nowrap;
}
.wp-block-navigation-item__label {
  text-align: center;
  line-height: 1.25;
}
.wp-block-site-logo a {
  width: 100%;
}
ul.wp-block-navigation-submenu {
  left: -1px !important;
  min-width: unset !important;
}

/* Fix Mobile Column Flex-Basis Stacking (Gutenberg Bugfix) */
@media (max-width: 781px) {
  .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
    flex-basis: 0 !important;
    min-width: 100% !important;
  }
}
:where(.wp-block-columns) {
  margin-bottom: 0 !important;
}

/* Cover Block Inner Container Flex Inheritance */
.wp-block-cover__inner-container {
  display: flex;
  justify-content: inherit;
  align-content: inherit;
  align-items: inherit;
  flex-direction: inherit;
}

/* Image & Featured Image Overflow & Border Radius Fix */
.wp-block-post-featured-image {
  overflow: hidden;
}
.wp-block-image figure {
  overflow: hidden !important;
}
.wp-block-image img, 
.wp-block-image picture, 
.wp-block-image picture img,
html :where(img[class*=wp-image-]) {
  width: 100%;
  border-radius: inherit !important;
}

/* Remove top margin on first heading/paragraph inside cards */
div > p:first-child:not(.heroHeader *),
div > a:first-child:not(.heroHeader *),
div > .wp-block-heading:first-child:not(.heroHeader *),
div > .wp-block-post-title:first-child:not(.heroHeader *),
div > .wp-block-post-date:first-child:not(.heroHeader *) {
  margin-top: 0;
}

/* Buttons Full-Touch Target & Smooth Transitions */
.wp-element-button, 
.wp-block-button__link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.wp-element-button:hover,
.wp-block-button__link:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

/* Logged-in vs Logged-out Dynamic Menu Helpers */
.logged-in-only { display: none !important; }
body.logged-in .logged-in-only { display: flex !important; }
body.logged-in .logged-out-only { display: none !important; }
