/**
 * Jedi-Robe service highlights and locale strip.
 *
 * Migration-safe extraction from the canonical Jedi-Robe dark-commerce
 * stylesheet. Rule order and declarations are preserved for staging review.
 *
 * @package Jedi_Theme
 * @since   2026-08-25
 */

/**
 * Dark galactic service-highlight strip.
 *
 * Displays four equally distributed service messages followed by a dedicated
 * country-selector region on desktop. The original desktop strip is hidden
 * at the Shoptimizer mobile breakpoint because JavaScript clones the first
 * four highlights into the mobile navigation.
 *
 * @package Jedi_Theme
 */

/* ==========================================================================
   Desktop highlight strip
   ========================================================================== */

body.jr-dark-commerce .topbar-wrapper {
  max-width: 100rem;
}

body.jr-dark-commerce .jedi-highlights-strip {
  position: relative;
  z-index: 80;
  isolation: isolate;

  display: grid;
  grid-template-columns:
    minmax(11.25rem, auto)
    minmax(11.25rem, auto)
    minmax(11.25rem, auto)
    minmax(15rem, auto)
    minmax(11.25rem, auto);
  gap: 0;
  align-items: center;

  width: 100%;
  min-height: 3.625rem;
  margin: 0;
  padding: 0 1.875rem;

  color: var(--jr-text);
}

/**
 * Extend the dark background across the complete viewport.
 *
 * The widget itself can remain inside Shoptimizer's constrained .col-full
 * container while this decorative layer covers the full browser width.
 *
 * @package Jedi_Theme
 */
body.jr-dark-commerce .jedi-highlights-strip::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: -1;

  width: 100vw;

  background:
    radial-gradient(
      circle at 8% 0,
      rgba(45, 166, 83, 0.085),
      transparent 24rem
    ),
    radial-gradient(
      circle at 88% 100%,
      rgba(111, 203, 255, 0.07),
      transparent 26rem
    ),
    linear-gradient(
      180deg,
      #0d141e 0%,
      #080d15 100%
    );

  box-shadow:
    0 0.8rem 2rem rgba(0, 0, 0, 0.18);
  content: "";
  transform: translateX(-50%);
  pointer-events: none;
}

/**
 * Separate the service strip from the main site header.
 *
 * Uses a restrained blue-grey gradient instead of the green commerce accent.
 * The separator spans the viewport while fading at both outer edges.
 *
 * @package Jedi_Theme
 */
body.jr-dark-commerce .jedi-highlights-strip::after {
  position: absolute;
  bottom: 0;
  left: 50%;
  z-index: 2;

  width: 100vw;
  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(152, 169, 192, 0.08) 8%,
      rgba(152, 169, 192, 0.24) 24%,
      rgba(111, 203, 255, 0.26) 50%,
      rgba(152, 169, 192, 0.24) 76%,
      rgba(152, 169, 192, 0.08) 92%,
      transparent 100%
    );

  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.34),
    0 0 0.7rem rgba(111, 203, 255, 0.035);

  content: "";
  transform: translateX(-50%);
  pointer-events: none;
}


/* ==========================================================================
   Individual highlight
   ========================================================================== */

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item {
  position: relative;

  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;

  min-width: 0;
  min-height: 2.625rem;
  padding-inline: clamp(0.85rem, 1.2vw, 1.3rem);

  white-space: normal;
}

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item:first-child {
  padding-inline-start: 0;
}

/**
 * Disable the previous decorative separator implementation.
 *
 * @package Jedi_Theme
 */
body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item:not(:last-child)::after {
  display: none;
  content: none;
}

/* ==========================================================================
   Highlight icon
   ========================================================================== */

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item
  .icon {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  flex: none;

  color: var(--jr-green-light);
}

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item
  .icon
  img {
  display: block;
  width: auto;
  max-width: 1.5rem;
  height: auto;
  max-height: 1.5rem;

  object-fit: contain;

  filter:
    brightness(0)
    invert(1)
    opacity(0.88)
    drop-shadow(0 0 0.45rem rgba(69, 217, 107, 0.1));
}

/* ==========================================================================
   Highlight text
   ========================================================================== */

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item
  .text {
  min-width: 0;

  color: var(--jr-text-soft);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  line-height: 1.28;
  text-transform: uppercase;
  text-wrap: pretty;
}

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item
  .text
  a {
  color: inherit;
  text-decoration: none;
  transition:
    color 180ms ease,
    text-shadow 180ms ease;
}

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item
  .text
  a:hover {
  color: var(--jr-text);
  text-shadow: 0 0 0.8rem rgba(45, 166, 83, 0.14);
}

/* ==========================================================================
   Country-selector region
   ========================================================================== */

/**
 * Treat the fifth item as a separate utility region.
 *
 * It remains part of the same widget markup but is aligned independently from
 * the four service messages. Country flags retain their original colours.
 *
 * @package Jedi_Theme
 */
body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item:last-child {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  min-width: 10.5rem;
  padding-inline-start: clamp(1.25rem, 2vw, 2rem);
  padding-inline-end: 0;
}

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item:last-child
  .icon {
  width: auto;
  max-width: 11.75rem;
  height: auto;
}

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item:last-child
  .icon
  img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 1.625rem;

  filter: none;
}

body.jr-dark-commerce
  .jedi-highlights-strip
  .highlight-item:last-child
  .text {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  width: 100%;
}

body.jr-dark-commerce
  .jedi-highlights-strip
  .locale-switcher-container {
  display: none;
  flex-wrap: nowrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: flex-end;
}

/**
 * Remove Shoptimizer's original top-bar background and bottom border.
 *
 * @package Jedi_Theme
 */
body.jr-dark-commerce .col-full.topbar-wrapper {
  border-bottom: 0 !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

/**
 * JR Highlights Strip - responsive desktop layout.
 *
 * Keeps all four ecommerce service messages and the locale selector visible
 * throughout the desktop header range. Equal service columns create a
 * consistent visual rhythm while typography and icon sizes reduce
 * progressively before Shoptimizer switches to its mobile header at 992px.
 *
 * The mobile highlight carousel remains responsible for <= 992px.
 *
 * @package    Jedi_Theme
 * @subpackage Header_Highlights
 * @since      1.3.0
 */


/* ==========================================================================
   Compact desktop - 1260px to 1439px
   ========================================================================== */

@media (min-width: 1260px) and (max-width: 1439px) {

	body.jr-dark-commerce
		.jedi-highlights-strip {
		grid-template-columns:
			repeat(
				4,
				minmax(0, 1fr)
			)
			auto;

		column-gap:
			clamp(
				0.5rem,
				0.8vw,
				0.75rem
			);

		padding-inline:
			1rem;
	}


	/* --------------------------------------------------------------
	   Service items
	   -------------------------------------------------------------- */

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child) {
		grid-template-columns:
			1.4rem
			minmax(0, max-content);

		justify-content:
			center;

		align-items:
			center;

		gap:
			0.5rem;

		min-width:
			0;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child)
		.icon {
		width:
			1.4rem;

		height:
			1.4rem;

		flex:
			0 0 1.4rem;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child)
		.text {
		min-width:
			0;

		max-width:
			14rem;

		font-size:
			0.748rem;

		line-height:
			1.22;

		white-space:
			normal;

		text-wrap:
			balance;
	}


	/* --------------------------------------------------------------
	   Locale flags
	   -------------------------------------------------------------- */

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child {
		justify-self:
			end;

		min-width:
			0;

		padding-inline:
			0.65rem
			0;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child
		.icon {
		width:
			auto;

		max-width:
			10rem;

		height:
			auto;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child
		.icon
		img {
		max-height:
			2rem;
	}
}


/* ==========================================================================
   Narrow desktop - 993px to 1259px
   ========================================================================== */

/**
 * This is still a desktop header.
 *
 * Rather than removing trust messages, the component reduces typography,
 * icons and internal gaps while retaining four equal service columns.
 */
@media (min-width: 993px) and (max-width: 1259px) {

	body.jr-dark-commerce
		.jedi-highlights-strip {
		grid-template-columns:
			repeat(
				4,
				minmax(0, 1fr)
			)
			auto;

		column-gap:
			0.35rem;

		min-height:
			3.5rem;

		padding-inline:
			0.65rem;
	}


	/* --------------------------------------------------------------
	   Keep every service message
	   -------------------------------------------------------------- */

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:nth-child(4) {
		display:
			grid;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child) {
		grid-template-columns:
			1.2rem
			minmax(0, max-content);

		justify-content:
			center;

		align-items:
			center;

		gap:
			0.4rem;

		min-width:
			0;

		min-height:
			2.5rem;

		padding-inline:
			0.15rem;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child)
		.icon {
		width:
			1.2rem;

		height:
			1.2rem;

		flex:
			0 0 1.2rem;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child)
		.icon
		img {
		max-width:
			1.275rem;

		max-height:
			1.275rem;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child)
		.text {
		min-width:
			0;

		max-width:
			12.5rem;

		font-size:
			0.73rem;

		line-height:
			1.18;

		white-space:
			normal;

		text-wrap:
			balance;

    letter-spacing: 0.0em;
	}


	/* --------------------------------------------------------------
	   Locale flags
	   -------------------------------------------------------------- */

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child {
		justify-self:
			end;

		min-width:
			0;

		padding-inline:
			0.45rem
			0;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child
		.icon {
		width:
			auto;

		max-width:
			10rem;

		height:
			auto;

		flex:
			0 0 auto;
	}


	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child
		.icon
		img {
		max-height:
			2rem;
	}
}

/**
 * JR Highlights Strip - ultra-compact desktop.
 *
 * Preserves the complete static desktop trust strip between 993px and 1057px.
 * Service icons are removed only in this narrow range to recover horizontal
 * space while retaining all four trust messages and the locale selector.
 *
 * The mobile slider remains exclusive to the mobile header at <= 992px.
 *
 * @package    Jedi_Theme
 * @subpackage Header_Highlights
 * @since      1.5.0
 */

@media (min-width: 993px) and (max-width: 1057px) {

	/* --------------------------------------------------------------
	   Recover horizontal space from decorative service icons
	   -------------------------------------------------------------- */

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child)
		.icon {
		display: none;
	}


	/* --------------------------------------------------------------
	   Service items become text-only
	   -------------------------------------------------------------- */

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:not(:last-child) {
		grid-template-columns:
			minmax(0, 1fr);

		justify-content:
			center;

		gap:
			0;

		padding-inline:
			0.25rem;
	}


	/* Short transactional messages should remain single-line. */

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:nth-child(2)
		.text,
	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:nth-child(3)
		.text {
		white-space:
			nowrap;

		text-wrap:
			nowrap;
	}


	/* --------------------------------------------------------------
	   Locale control remains unchanged
	   -------------------------------------------------------------- */

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child
		.icon {
		display: block;
	}
}
/* ==========================================================================
   Wide desktop locale currency label - 1440px+
   ========================================================================== */

/**
 * Surface the currently active WooCommerce currency beside the region flags.
 *
 * The WP Jedi Toolkit locale switcher already renders the active currency
 * inside the hidden desktop popover. The wide desktop header can therefore
 * expose that state without introducing duplicate currency-switching logic.
 * The complete fifth highlight remains the hover/focus target for the existing
 * locale popover.
 *
 * @package    Jedi_Theme
 * @subpackage Header_Highlights
 * @since      1.6.0
 */
@media (min-width: 1440px) {

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child {
		gap: 0.6rem;
		min-width: 13rem;
		padding-inline-start: clamp(1rem, 1.4vw, 1.5rem);
		cursor: pointer;
	}

	/*
	 * The hidden .text element owns the locale popover. Collapse its normal
	 * flex width so the visible currency label can sit directly beside the
	 * flag artwork without affecting the popover's absolute positioning.
	 */
	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child
		.text {
		flex: 0 0 0;
		width: 0;
		min-width: 0;
		overflow: visible;
	}

	/**
	 * Currency label with a purpose-drawn SVG chevron.
	 *
	 * The chevron is decorative and remains part of the existing locale trigger;
	 * the locale switcher's existing interaction and popover markup are unchanged.
	 */
	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child::after {
		display: inline-flex;
		align-items: center;
		flex: 0 0 auto;

		padding-right: 0.9rem;

		background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23cfd4da' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
		background-repeat: no-repeat;
		background-position: right 50%;
		background-size: 0.55rem auto;

		color: var(--jr-text-soft);
		font-size: 0.75rem;
		font-weight: 700;
		letter-spacing: 0.035em;
		line-height: 1;
		text-transform: uppercase;
		white-space: nowrap;

		content: "Currency";

		transition:
			color 180ms ease,
			text-shadow 180ms ease;
	}

	/* Primary currencies. */
	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .currency-switcher a.active[href*="currency=GBP"]
		)::after {
		content: "GBP";
	}

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .currency-switcher a.active[href*="currency=USD"]
		)::after {
		content: "USD";
	}

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .currency-switcher a.active[href*="currency=EUR"]
		)::after {
		content: "EUR";
	}

	/* Secondary currencies. */
	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .secondary-currency-menu a.active[href*="currency=AUD"]
		)::after {
		content: "AUD";
	}

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .secondary-currency-menu a.active[href*="currency=CAD"]
		)::after {
		content: "CAD";
	}

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .secondary-currency-menu a.active[href*="currency=JPY"]
		)::after {
		content: "JPY";
	}

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .secondary-currency-menu a.active[href*="currency=NOK"]
		)::after {
		content: "NOK";
	}

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .secondary-currency-menu a.active[href*="currency=SEK"]
		)::after {
		content: "SEK";
	}

	body.jr-dark-commerce
		.jedi-highlights-strip
		.highlight-item:last-child:has(
			.locale-switcher .secondary-currency-menu a.active[href*="currency=CHF"]
		)::after {
		content: "CHF";
	}

	@media (hover: hover) and (pointer: fine) {
		body.jr-dark-commerce
			.jedi-highlights-strip
			.highlight-item:last-child:hover::after {
			color: var(--jr-text);
			text-shadow: 0 0 0.8rem rgba(45, 166, 83, 0.12);
		}
	}
}
