/*
 * Homepage header skin: floating pill bar.
 * Opt-in only — activated by html[data-header-skin="floating"].
 * Nothing here applies to the live homepage unless the attribute is set.
 */

html[data-header-skin="floating"] {
  --header-float-gap: clamp(10px, 1.5vw, 20px);
  --header-float-inset: clamp(12px, 3.2vw, 44px);
  --header-float-height: 72px;
  --header-float-height-compact: 60px;
  --header-float-radius: 999px;
  --header-top-height: 0px;
  --header-main-height: var(--header-float-height);
  --header-total-height: calc(var(--header-float-height) + (var(--header-float-gap) * 2));
}

/* The purple utility strip is gone; its links are relocated by the mount script. */
html[data-header-skin="floating"] .header-top-bar {
  display: none;
}

html[data-header-skin="floating"] .site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  padding: var(--header-float-gap) var(--header-float-inset);
  background: transparent;
  transition:
    transform 420ms cubic-bezier(0.4, 0, 0.2, 1),
    padding 260ms ease;
  will-change: transform;
}

html[data-header-skin="floating"] .site-header.is-hidden {
  transform: translateY(calc(-100% - 12px));
}

html[data-header-skin="floating"] .site-header.is-compact {
  --header-float-gap: clamp(6px, 0.9vw, 12px);
  --header-float-height: var(--header-float-height-compact);
}

/* The white bar itself becomes the floating card. */
html[data-header-skin="floating"] .header-main-bar {
  padding: 0 clamp(14px, 2.2vw, 26px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--header-float-radius);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 22px 48px -20px rgba(32, 18, 48, 0.38),
    0 4px 14px -6px rgba(32, 18, 48, 0.18);
  transition:
    background-color 260ms ease,
    box-shadow 260ms ease,
    border-color 260ms ease;
}

html[data-header-skin="floating"] .site-header.is-compact .header-main-bar {
  border-color: rgba(231, 223, 239, 0.9);
  background: #ffffff;
  box-shadow:
    0 14px 30px -18px rgba(32, 18, 48, 0.32),
    0 2px 8px -4px rgba(32, 18, 48, 0.14);
}

html[data-header-skin="floating"] .header-main-shell {
  gap: clamp(10px, 1.6vw, 22px);
  min-height: var(--header-float-height);
  transition: min-height 260ms ease;
}

/* Relocated utility links now sit on white instead of purple. */
html[data-header-skin="floating"] .header-float-actions {
  display: inline-flex;
  align-items: center;
  gap: clamp(10px, 1.4vw, 20px);
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
}

/* .header-main-shell forces LTR for the brand placement; the relocated links
   keep the document direction so their original order survives the move. */
html[data-header-skin="floating"][dir="rtl"] .header-float-actions {
  direction: rtl;
}

html[data-header-skin="floating"][dir="ltr"] .header-float-actions {
  direction: ltr;
}

html[data-header-skin="floating"] .header-float-actions .topbar-link {
  color: var(--ink);
  white-space: nowrap;
  transition: color 180ms ease;
}

html[data-header-skin="floating"] .header-float-actions .topbar-link:hover {
  color: var(--purple);
}

html[data-header-skin="floating"] .header-float-actions .topbar-icon-button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  color: var(--purple);
}

html[data-header-skin="floating"] .header-float-actions .language-menu {
  color: var(--ink);
}

/* -- catalogue menus (أعمالي / المنتجات) --------------------------------- */

html[data-header-skin="floating"] .header-catalog {
  position: relative;
  display: inline-flex;
  align-items: center;
}

html[data-header-skin="floating"] .catalog-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  white-space: nowrap;
  transition: color 180ms ease;
}

html[data-header-skin="floating"] .header-catalog:hover .catalog-trigger,
html[data-header-skin="floating"] .header-catalog.is-open .catalog-trigger {
  color: var(--purple);
}

html[data-header-skin="floating"] .catalog-trigger-static {
  cursor: default;
}

html[data-header-skin="floating"] .catalog-caret {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-header-skin="floating"] .header-catalog:hover .catalog-caret,
html[data-header-skin="floating"] .header-catalog.is-open .catalog-caret {
  transform: rotate(180deg);
}

/* A hover bridge across the gap, so the pointer can travel to the panel. */
html[data-header-skin="floating"] .header-catalog::after {
  content: "";
  position: absolute;
  inset-block-start: 100%;
  inset-inline: -12px;
  height: 18px;
}

html[data-header-skin="floating"] .header-catalog-panel {
  position: absolute;
  inset-block-start: calc(100% + 16px);
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: 172px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: #ffffff;
  box-shadow: 0 22px 44px -18px rgba(32, 18, 48, 0.34);
  opacity: 0;
  transform: translateY(-10px) scale(0.97);
  transform-origin: top center;
  visibility: hidden;
  transition:
    opacity 180ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0ms linear 260ms;
}

html[data-header-skin="floating"][dir="rtl"] .header-catalog-panel {
  right: 0;
  left: auto;
  direction: rtl;
}

html[data-header-skin="floating"][dir="ltr"] .header-catalog-panel {
  right: auto;
  left: 0;
  direction: ltr;
}

html[data-header-skin="floating"] .header-catalog:hover .header-catalog-panel,
html[data-header-skin="floating"] .header-catalog.is-open .header-catalog-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  transition:
    opacity 180ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-header-skin="floating"] .catalog-item {
  display: block;
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 200ms ease,
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    color 160ms ease,
    background-color 160ms ease;
}

/* Staggered entrance — the items arrive one after another. */
html[data-header-skin="floating"] .header-catalog:hover .catalog-item,
html[data-header-skin="floating"] .header-catalog.is-open .catalog-item {
  opacity: 1;
  transform: translateY(0);
}

html[data-header-skin="floating"] .header-catalog:hover .catalog-item:nth-child(2),
html[data-header-skin="floating"] .header-catalog.is-open .catalog-item:nth-child(2) {
  transition-delay: 55ms;
}

html[data-header-skin="floating"] .header-catalog:hover .catalog-item:nth-child(3),
html[data-header-skin="floating"] .header-catalog.is-open .catalog-item:nth-child(3) {
  transition-delay: 110ms;
}

html[data-header-skin="floating"] .catalog-item:hover {
  color: var(--purple);
  background: var(--purple-soft);
}

/* Hairline divider on whichever side the menu button ends up on. The shell is
   LTR-flowing in RTL pages and row-reverse in LTR pages, so the side flips. */
html[data-header-skin="floating"][dir="rtl"] .header-float-actions {
  margin-left: auto;
  border-right: 1px solid var(--line);
  padding-right: clamp(10px, 1.4vw, 20px);
}

html[data-header-skin="floating"][dir="ltr"] .header-float-actions {
  margin-right: auto;
  border-left: 1px solid var(--line);
  padding-left: clamp(10px, 1.4vw, 20px);
}

/*
 * The brand asset is a square stacked lockup with ~22% transparent padding on
 * every side, so sizing it by width alone forces a ~124px tall bar. Cropping
 * the padding away with object-fit keeps the mark the same optical size inside
 * a bar half the height.
 */
html[data-header-skin="floating"] .brand-link img {
  width: 104px;
  height: 64px;
  object-fit: cover;
  object-position: center 49%;
  transition:
    width 260ms ease,
    height 260ms ease;
}

html[data-header-skin="floating"] .site-header.is-compact .brand-link img {
  width: 88px;
  height: 52px;
}

html[data-header-skin="floating"] .icon-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
}

/* The hamburger is gone; the account circle takes its place and keeps the same
   menu it already opened, now on hover as well as on click. */
html[data-header-skin="floating"] .account-orb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: #fff;
  background: var(--purple);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(32, 18, 48, 0.22);
  transition:
    background-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

html[data-header-skin="floating"] .account-orb:hover,
html[data-header-skin="floating"] .account-orb[aria-expanded="true"] {
  border-color: transparent;
  color: #fff;
  background: var(--purple-dark);
  box-shadow: 0 10px 22px rgba(32, 18, 48, 0.28);
  transform: translateY(-1px);
}

html[data-header-skin="floating"] .account-orb svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-header-skin="floating"] .account-orb-slot {
  position: relative;
  flex: 0 0 auto;
}

/* The shell is forced to LTR for the brand placement, so the dropdown edge has
   to be pinned physically rather than with inset-inline. */
html[data-header-skin="floating"] .account-orb-slot .public-user-dropdown {
  inset-block-start: calc(100% + 12px);
  min-width: 268px;
  border-radius: 14px;
  box-shadow: 0 22px 44px -18px rgba(32, 18, 48, 0.34);
}

/* Welcome line and accreditation abbreviations, lifted out of the bar. */
html[data-header-skin="floating"] .account-orb-slot .advisor-identity-slot {
  display: block;
  flex: none;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  padding: 4px 10px 10px;
}

html[data-header-skin="floating"] .account-orb-slot .advisor-identity-slot[hidden] {
  display: none;
}

html[data-header-skin="floating"] .account-orb-slot .advisor-identity-welcome {
  font-size: 15px;
}

html[data-header-skin="floating"] .account-orb-slot .advisor-identity-accreditation {
  margin-top: 3px;
  font-size: 12px;
}

html[data-header-skin="floating"][dir="rtl"] .account-orb-slot .public-user-dropdown {
  right: 0;
  left: auto;
  direction: rtl;
}

html[data-header-skin="floating"][dir="ltr"] .account-orb-slot .public-user-dropdown {
  right: auto;
  left: 0;
  direction: ltr;
}

/*
 * Two marks instead of one register button: sign in and register. Each is a
 * circle that widens on hover to reveal its word. The cart joins them, but only
 * once there is a session — it stays [hidden] for guests.
 */
html[data-header-skin="floating"] .header-entry-chips {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

html[data-header-skin="floating"] .entry-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding-inline: 8px;
  color: var(--purple);
  background: #ffffff;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition:
    gap 200ms ease,
    padding 200ms ease,
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

html[data-header-skin="floating"] .entry-chip[hidden] {
  display: none;
}

html[data-header-skin="floating"] .entry-chip:disabled {
  cursor: default;
}

html[data-header-skin="floating"] .entry-chip svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-header-skin="floating"] .entry-chip-label {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 13px;
  white-space: nowrap;
  transition:
    max-width 240ms ease,
    opacity 160ms ease;
}

html[data-header-skin="floating"] .entry-chip:hover,
html[data-header-skin="floating"] .entry-chip:focus-visible {
  gap: 7px;
  padding-inline: 14px 12px;
  border-color: var(--purple);
  background: var(--purple-soft);
}

html[data-header-skin="floating"] .entry-chip:hover .entry-chip-label,
html[data-header-skin="floating"] .entry-chip:focus-visible .entry-chip-label {
  max-width: 120px;
  opacity: 1;
}

html[data-header-skin="floating"] .entry-chip.is-primary {
  border-color: var(--purple);
  color: #ffffff;
  background: var(--purple);
  box-shadow: 0 8px 18px rgba(32, 18, 48, 0.18);
}

html[data-header-skin="floating"] .entry-chip.is-primary:hover,
html[data-header-skin="floating"] .entry-chip.is-primary:focus-visible {
  border-color: var(--purple-dark);
  color: #ffffff;
  background: var(--purple-dark);
}

@media (prefers-reduced-motion: reduce) {
  html[data-header-skin="floating"] .entry-chip,
  html[data-header-skin="floating"] .entry-chip-label {
    transition: none;
  }
}

/* The hero already renders behind the header, but the fixed header no longer
   reserves layout space, so the negative pull-up has to go. */
html[data-header-skin="floating"] .media-hero {
  margin-top: 0;
}

@media (max-width: 900px) {
  html[data-header-skin="floating"] {
    --header-float-height: 62px;
    --header-float-height-compact: 56px;
  }

  html[data-header-skin="floating"] .header-main-bar {
    padding: 0 12px;
  }

  html[data-header-skin="floating"] .header-main-shell {
    gap: 8px;
    flex-wrap: nowrap;
    padding-block: 0;
  }

  html[data-header-skin="floating"] .brand-link img,
  html[data-header-skin="floating"] .site-header.is-compact .brand-link img {
    width: 92px;
    height: 54px;
  }

  html[data-header-skin="floating"] .header-float-actions {
    gap: 10px;
  }

  html[data-header-skin="floating"] .header-float-actions .topbar-link:not(.topbar-button) {
    display: none;
  }

  html[data-header-skin="floating"][dir="rtl"] .header-float-actions,
  html[data-header-skin="floating"][dir="ltr"] .header-float-actions {
    border: 0;
    padding: 0;
  }
}

@media (max-width: 480px) {
  html[data-header-skin="floating"][dir="ltr"] .header-main-shell {
    flex-wrap: wrap;
    padding-block: 6px;
  }

  html[data-header-skin="floating"] .search-button {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-header-skin="floating"] .header-catalog-panel,
  html[data-header-skin="floating"] .catalog-item,
  html[data-header-skin="floating"] .catalog-caret {
    transition-duration: 1ms;
    transition-delay: 0ms;
  }

  html[data-header-skin="floating"] .site-header,
  html[data-header-skin="floating"] .header-main-bar,
  html[data-header-skin="floating"] .header-main-shell,
  html[data-header-skin="floating"] .brand-link img {
    transition: none;
  }

  html[data-header-skin="floating"] .site-header.is-hidden {
    transform: none;
  }
}
