/* EasyPrint header/footer layer. Data stays in WordPress/WooCommerce. */
:root {
  --easyprint-accent: #06a9b7;
  --easyprint-announcement-text: #fff;
  --easyprint-search-width: 620px;
  --easyprint-mega-columns: 4;
  --easyprint-mega-background: #fff;
  --easyprint-border: #e4e9ed;
  --easyprint-ink: #17232d;
  --easyprint-muted: #5d6a73;
  --easyprint-navy: #12233f;
  --easyprint-soft: #f4f8f9;
}

/* Keep the header controlled by Kadence row settings. */
#masthead .site-header-row-container-inner { overflow: visible; }
#masthead .site-main-header-wrap { border-bottom: 1px solid var(--easyprint-border); }
#masthead .site-bottom-header-wrap { border-bottom: 1px solid var(--easyprint-border); }
#masthead .kadence-sticky-header.item-is-fixed:not(.item-at-start) {
  box-shadow: 0 8px 28px rgba(18, 35, 63, 0.09);
}

/*
 * True RTL/LTR header mirroring, desktop only. `body.rtl`/`body.ltr` are set
 * by the Multilingual Core's Router::filter_body_class() from the actual
 * current language, not from the raw site locale. Setting `direction` here
 * (rather than only aligning text) flips the desktop 3-part flex row -
 * logo/search/account area order and the navigation row - because CSS
 * `flex-direction: row` already follows the inherited `direction` property;
 * Kadence's own markup never sets `dir` on <html>, so without this the
 * header stayed visually LTR regardless of language.
 *
 * Scoped to the same >=1025px breakpoint as the desktop nav rules below:
 * Kadence's *mobile* header row is a different, 2-section
 * "site-header-row-has-sides site-header-row-no-center" layout that Kadence
 * already positions correctly for RTL on its own (confirmed live - the
 * mobile account/greeting/flags order was already correct before this
 * rule). Forcing `direction` on it too double-applies RTL to that row's own
 * inset-inline math and pushes the cart section off-canvas
 * (getBoundingClientRect().x went negative, clipped past the left edge).
 * Mobile is intentionally left to Kadence's existing behavior.
 */
@media screen and (min-width: 1025px) {
  body.rtl #masthead { direction: rtl; }
  body.ltr #masthead { direction: ltr; }

  /*
   * The Multilingual Core's language switcher always renders both an
   * in-header copy (via the easyprint-language-switcher header item,
   * desktop only - see site-chrome.php) and a fixed-position footer
   * fallback, in every response (see LanguageSwitcher::render_floating_fallback()
   * docblock for why this can't be decided server-side). Hide the floating
   * copy wherever the in-header one is visible, so desktop shows exactly
   * one switcher.
   */
  .ep-language-switcher--floating { display: none; }

  /*
   * Two pre-existing, unconditional rules in
   * wp-content/themes/kadence-easyprint-v4/assets/css/easyprint-products-accordion.css
   * (a vendor-theme file this repository does not own or track) hardcode
   * `direction: rtl` on the primary nav <ul> and on `.easyprint-mega-parent`,
   * regardless of page language - proven live via matched-CSSRule inspection,
   * not assumed. They happened to be harmless while the site was
   * effectively Arabic-only; once the header started truly mirroring per
   * language, they left the EN mega-menu's grid columns flowing right-to-
   * left (e.g. "Business Cards" landing in the rightmost column instead of
   * the leftmost).
   *
   * Both direct rules target the element itself (not an ancestor), so
   * inheriting `ltr` from `#masthead` above does not reach them - only a
   * rule of equal-or-higher specificity that also targets the element
   * directly can win. `body.rtl`/`body.ltr #masthead .easyprint-mega-parent`
   * has higher specificity (1 ID + 2 classes + 1 element) than the vendor
   * file's `.easyprint-products-menu.easyprint-products-menu--enhanced`
   * (2 classes only), and `body.rtl`/`body.ltr #masthead
   * .site-header-item-main-navigation .primary-menu-container > ul` is
   * likewise more specific than the vendor file's `#masthead
   * .site-header-item-main-navigation .primary-menu-container > ul` (which
   * has no `body.rtl`/`.ltr` prefix at all). No `!important` needed -
   * verified live before this file changed, via a temporary injected
   * <style> proving the override wins on both the AR and EN storefront
   * before implementing it here.
   */
  body.rtl #masthead .site-header-item-main-navigation .primary-menu-container > ul,
  body.rtl #masthead .easyprint-mega-parent { direction: rtl; }
  body.ltr #masthead .site-header-item-main-navigation .primary-menu-container > ul,
  body.ltr #masthead .easyprint-mega-parent { direction: ltr; }
}

.easyprint-announcement-item {
  width: 100%;
  justify-content: center;
  margin: 0;
  color: var(--easyprint-announcement-text);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}
.easyprint-announcement-inner { width: 100%; }
.easyprint-announcement-item a,
.easyprint-announcement-item span {
  color: inherit;
  text-decoration: none;
}
.easyprint-announcement-item a:hover,
.easyprint-announcement-item a:focus { color: inherit; text-decoration: underline; }

.easyprint-product-search-item {
  width: var(--easyprint-search-width);
  max-width: 100%;
  margin-inline: 18px;
}
.easyprint-product-search {
  width: 100%;
  display: flex;
  position: relative;
  align-items: center;
}
.easyprint-product-search input[type="search"] {
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 16px;
  padding-inline-end: 50px;
  border: 1px solid #d7dfe4;
  border-radius: 10px;
  background: #f7f9fa;
  color: var(--easyprint-ink);
  font: inherit;
  outline: 0;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.easyprint-product-search input[type="search"]:focus {
  background: #fff;
  border-color: var(--easyprint-accent);
  box-shadow: 0 0 0 3px rgba(6, 169, 183, .14);
}
.easyprint-product-search button {
  position: absolute;
  inset-inline-end: 4px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--easyprint-navy);
  cursor: pointer;
}
.easyprint-product-search button:hover,
.easyprint-product-search button:focus-visible {
  background: var(--easyprint-soft);
  color: var(--easyprint-accent);
}
.easyprint-product-search button svg { width: 20px; height: 20px; fill: currentColor; }

.easyprint-account-item { margin-inline: 2px; }
.easyprint-account-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 9px;
  border-radius: 9px;
  color: var(--easyprint-ink);
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  transition: color .16s ease, background .16s ease;
}
.easyprint-account-link:hover,
.easyprint-account-link:focus-visible {
  color: var(--easyprint-accent);
  background: var(--easyprint-soft);
}
.easyprint-account-link svg { width: 22px; height: 22px; fill: currentColor; }
.easyprint-account-copy {
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1.08;
}
.easyprint-account-greeting {
  font-size: 10px;
  font-weight: 600;
  color: var(--easyprint-muted);
}
.easyprint-account-name {
  display: block;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

/* Language switcher header item: compact circle flags beside account/cart. */
.easyprint-language-switcher-item { margin-inline: 2px; display: flex; align-items: center; }
.ep-language-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.ep-language-switcher__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  line-height: 0;
  opacity: 0.55;
  transition: opacity .16s ease, box-shadow .16s ease;
}
.ep-language-switcher__link:hover,
.ep-language-switcher__link:focus-visible {
  opacity: 0.85;
}
.ep-language-switcher__link:focus-visible {
  outline: 2px solid var(--easyprint-accent);
  outline-offset: 2px;
}
.ep-language-switcher__link.is-current {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--easyprint-soft), 0 0 0 3px var(--easyprint-accent);
}
.ep-language-switcher__flag {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: block;
}

/* Desktop primary navigation and Mega Menu. */
@media screen and (min-width: 1025px) {
	/* Preserve the approved 1.0.4 right-aligned RTL navigation spacing. */
	#masthead .main-navigation .primary-menu-container > ul.menu {
		flex-grow: 0;
		justify-content: flex-start;
		gap: 32px;
	}

	#masthead .main-navigation .primary-menu-container > ul.menu > li {
		flex: 0 0 auto;
	}

  #masthead .site-bottom-header-wrap > .site-header-row-container-inner > .site-container { position: relative; }
  #masthead .site-bottom-header-inner-wrap,
  #masthead .site-header-bottom-section-center,
  #masthead .site-header-item-main-navigation,
  #masthead .site-header-item-main-navigation .main-navigation,
  #masthead .site-header-item-main-navigation .primary-menu-container,
  #masthead .site-header-item-main-navigation .primary-menu-container > ul,
  #masthead .site-header-item-main-navigation .primary-menu-container > ul > li.easyprint-mega-parent {
    position: static;
  }
  #masthead .site-header-item-main-navigation { width: 100%; }
  #masthead .main-navigation,
  #masthead .main-navigation .primary-menu-container,
  #masthead .main-navigation .primary-menu-container > ul { width: 100%; }

  #masthead .main-navigation .primary-menu-container > ul > li.easyprint-mega-parent > .sub-menu {
    inset-inline: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    grid-template-columns: repeat(var(--easyprint-mega-columns), minmax(0, 1fr));
    gap: 24px 30px;
    padding: 24px 26px 28px;
    border: 1px solid var(--easyprint-border);
    border-top: 2px solid var(--easyprint-accent);
    border-radius: 0 0 14px 14px;
    background: var(--easyprint-mega-background);
    box-shadow: 0 18px 46px rgba(18, 35, 63, .14);
  }
  #masthead .main-navigation .primary-menu-container > ul > li.easyprint-mega-parent:hover > .sub-menu,
  #masthead .main-navigation .primary-menu-container > ul > li.easyprint-mega-parent.menu-item--toggled-on > .sub-menu,
  #masthead .main-navigation .primary-menu-container > ul > li.easyprint-mega-parent:focus-within > .sub-menu,
  #masthead .main-navigation .primary-menu-container > ul > li.easyprint-mega-parent > .sub-menu.opened {
    display: grid;
  }
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu > li {
    min-width: 0;
  }
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu > li > a {
    width: auto;
    padding: 4px 0 10px;
    color: var(--easyprint-navy);
    background: transparent;
    border-radius: 0;
    font-size: 14px;
    font-weight: 800;
  }
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu > li > a:hover,
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu > li > a:focus {
    color: var(--easyprint-accent);
    background: transparent;
  }
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu > li > .sub-menu {
    display: block;
    position: static;
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    clip: auto;
    height: auto;
    overflow: visible;
    box-shadow: none;
    border: 0;
    background: transparent;
  }
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu > li > .sub-menu li a {
    width: auto;
    padding: 7px 0;
    color: var(--easyprint-muted);
    background: transparent;
    border-radius: 0;
    font-size: 13px;
    font-weight: 500;
  }
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu > li > .sub-menu li a:hover,
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu > li > .sub-menu li a:focus {
    color: var(--easyprint-accent);
    background: transparent;
  }
  #masthead .main-navigation .easyprint-mega-parent > .sub-menu .dropdown-nav-toggle { display: none; }
}

/* Footer columns are generated from one normal hierarchical WordPress menu. */
.easyprint-footer-columns-item { width: 100%; margin: 0; }
.easyprint-footer-columns {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(210px, .9fr) minmax(0, 3.1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
  text-align: start;
}
.easyprint-footer-brand-name {
  color: var(--easyprint-navy);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.35;
}
.easyprint-footer-intro {
  max-width: 320px;
  margin: 12px 0 0;
  color: var(--easyprint-muted);
  font-size: 13.5px;
  line-height: 1.9;
}
.easyprint-footer-contact {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  color: var(--easyprint-muted);
  font-size: 13px;
}
.easyprint-footer-contact li + li { margin-top: 7px; }
.easyprint-footer-contact a { color: inherit; text-decoration: none; }
.easyprint-footer-contact a:hover { color: var(--easyprint-accent); }
.easyprint-footer-menu-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 30px 26px;
}
.easyprint-footer-menu-group { min-width: 0; }
.easyprint-footer-group-title {
  display: block;
  margin-bottom: 12px;
  color: var(--easyprint-navy);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}
a.easyprint-footer-group-title:hover { color: var(--easyprint-accent); }
.easyprint-footer-links,
.easyprint-footer-sublinks {
  list-style: none;
  margin: 0;
  padding: 0;
}
.easyprint-footer-link-item + .easyprint-footer-link-item { margin-top: 7px; }
.easyprint-footer-links a,
.easyprint-footer-sublinks a {
  color: var(--easyprint-muted);
  font-size: 13px;
  line-height: 1.55;
  text-decoration: none;
}
.easyprint-footer-links a:hover,
.easyprint-footer-sublinks a:hover { color: var(--easyprint-accent); }
.easyprint-footer-sublinks { margin-top: 6px; padding-inline-start: 10px; }
.easyprint-footer-menu-empty {
  padding: 16px;
  border: 1px dashed #b8c4cb;
  border-radius: 10px;
  color: var(--easyprint-muted);
  font-size: 13px;
}

.site-bottom-footer-wrap .site-footer-row { align-items: center; }
.site-bottom-footer-wrap .footer-html { font-size: 12.5px; }

@media screen and (max-width: 1180px) and (min-width: 1025px) {
  #masthead .main-navigation .primary-menu-container > ul > li.easyprint-mega-parent > .sub-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .easyprint-product-search-item { margin-inline: 10px; }
  .easyprint-account-name { max-width: 82px; }
}

@media screen and (max-width: 1024px) {
  .easyprint-announcement-item { font-size: 12px; }
  .easyprint-account-label { display: inline-flex; }
  .easyprint-account-link { min-width: 42px; gap: 4px; padding: 0 4px; }
  .easyprint-account-greeting { font-size: 9px; }
  .easyprint-account-name { max-width: 72px; font-size: 11px; }
  .easyprint-product-search-item {
    width: 100%;
    margin: 0;
  }
  .easyprint-product-search input[type="search"] { height: 42px; }
  .easyprint-footer-columns {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .easyprint-footer-menu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media screen and (max-width: 719px) {
  .easyprint-announcement-item {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .easyprint-product-search input[type="search"] {
    height: 40px;
    font-size: 13px;
    border-radius: 9px;
  }
  .easyprint-product-search button { width: 34px; height: 34px; }
  .easyprint-footer-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 18px; }
  .site-bottom-footer-wrap .site-footer-row { gap: 12px; }
}

@media screen and (max-width: 420px) {
  .easyprint-footer-menu-grid { grid-template-columns: 1fr 1fr; }
  .easyprint-footer-group-title { font-size: 13.5px; }
  .easyprint-footer-links a, .easyprint-footer-sublinks a { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .easyprint-product-search input[type="search"],
  .easyprint-account-link { transition: none; }
}
