/* ==========================================================================
   ROYCE CAPITALS — market page header
   File: css/market-header.css   (the six market pages only)

   Ported September 2026 from update/marketHeaders/component/css/
   royce-market-header.css. One compact navy band under the fixed bar: gold
   eyebrow + headline in one H1, a paragraph, Start Trading, a View instruments
   anchor, and a per-market inline SVG artwork on the inline-end side, closed by
   a 1px gold hairline. Everything is scoped under .rmh.

   What changed in the port, and why:
   - Fonts inherit Ping AR + LT. The package set Marcellus/Inter, which were
     never shipped here (NFR-10).
   - Tokens come from css/royce-header.css (--rz-*), which every page loads, so
     there are no fallbacks. --nav-h is the header's resting height and is
     reserved as top padding — never measured (docs/responsive-breakpoints.md).
   - The accent is a class per market (.rmh--forex …), not an inline style, so
     js/market-header.js swaps one class when js/market-specs.js switches
     market without a page load.
   - The CTA is the site's .rz-btn.rz-btn--gold; the package's .rmh__btn is gone.
   - Breakpoints are on the ladder: 1180 → 1199.98, 900 → 991.98, 420 → 575.98.
   - text-align is `start`, and the artwork bleed and masks have .rtl mirrors,
     because the Arabic copy lays this out right-to-left.
   - Navy in both themes, like the homepage .rz-hero. The artwork colours assume
     navy; there is no light colourway.
   ========================================================================== */

/*#region  **** Section  ****/
.rmh {
  --rmh-navy: var(--rz-navy);
  --rmh-deep: #08111f;
  --rmh-gold: var(--rz-gold);
  --rmh-gold-hi: var(--rz-gold-hover);
  --rmh-ivory: var(--rz-ivory);
  --rmh-body: #c5ccd6;
  --rmh-max: var(--rz-max-w);
  --rmh-gutter: var(--rz-gutter);
  --rmh-pad: clamp(2rem, 2.6vw, 2.5rem);
  --rmh-accent-rgb: 127, 166, 201;
  /* Written by the parallax handler in js/market-header.js; 0 at rest. */
  --rmh-px: 0;
  --rmh-py: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: block;
  margin: 0;
  /* The bar is fixed and already scrolled on every internal page; the band
     reserves its resting height and the navy runs up under it. */
  padding: var(--nav-h) 0 0;
  border: 0;
  min-height: 0;
  box-shadow: none;
  text-align: start;
  line-height: 1.5;
  background: var(--rmh-navy);
  color: var(--rmh-ivory);
  -webkit-font-smoothing: antialiased;
}

.rmh *,
.rmh *::before,
.rmh *::after {
  box-sizing: border-box;
}

/* Secondary accent per market. The class is the single switch. */
.rmh--forex {
  --rmh-accent-rgb: 127, 166, 201;
}
.rmh--indices {
  --rmh-accent-rgb: 95, 168, 160;
}
.rmh--energy {
  --rmh-accent-rgb: 200, 120, 74;
}
.rmh--metal {
  --rmh-accent-rgb: 186, 193, 203;
}
.rmh--stocks {
  --rmh-accent-rgb: 124, 149, 196;
}
.rmh--exchange-future {
  --rmh-accent-rgb: 140, 123, 192;
}

/* Background: quiet depth + accent light behind the artwork */
.rmh__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(ellipse 42% 95% at 82% 55%, rgba(var(--rmh-accent-rgb), 0.13), transparent 70%), radial-gradient(ellipse 30% 70% at 72% 40%, rgba(214, 166, 28, 0.07), transparent 70%), linear-gradient(180deg, var(--rmh-navy) 0%, var(--rmh-deep) 100%);
}

.rtl .rmh__bg {
  background: radial-gradient(ellipse 42% 95% at 18% 55%, rgba(var(--rmh-accent-rgb), 0.13), transparent 70%), radial-gradient(ellipse 30% 70% at 28% 40%, rgba(214, 166, 28, 0.07), transparent 70%), linear-gradient(180deg, var(--rmh-navy) 0%, var(--rmh-deep) 100%);
}

/* The hairline. Works above both the light and the dark page body. */
.rmh::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(214, 166, 28, 0.45) 22%, rgba(214, 166, 28, 0.45) 78%, transparent 100%);
}

.rmh__inner {
  position: relative;
  max-width: var(--rmh-max);
  margin: 0 auto;
  padding: var(--rmh-pad) var(--rmh-gutter);
  display: grid;
  grid-template-columns: minmax(0, 63fr) minmax(0, 37fr);
  column-gap: 2rem;
  align-items: center;
}

.rmh__copy {
  position: relative;
  z-index: 2;
  min-width: 0;
}
/*#endregion*/

/*#region  **** Copy  ****/
/* H1 = label + headline, one semantic unit (a visually-hidden ": " sits
   between them in the markup). */
.rmh__h1 {
  margin: 0;
  padding: 0;
  border: 0;
  font: inherit;
  font-weight: 400;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  text-align: start;
}

.rmh__label,
.rmh__mark,
.rmh__title,
.rmh__desc,
.rmh__actions {
  border: 0;
  text-transform: none;
  text-decoration: none;
  box-shadow: none;
  background-image: none;
}

.rmh__label {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0 0 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.06em;
  color: var(--rmh-gold);
}

.rtl .rmh__label {
  letter-spacing: 0;
}

.rmh__mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.rmh__mark::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--rmh-gold);
}

.rmh__mark::after {
  content: '';
  width: 5px;
  height: 5px;
  background: rgb(var(--rmh-accent-rgb));
  transform: rotate(45deg);
}

.rmh__title {
  display: block;
  font-weight: 400;
  font-size: clamp(1.75rem, 1rem + 1.8vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.005em;
  color: var(--rmh-ivory);
  text-wrap: balance;
  max-width: 22ch;
}

.rtl .rmh__title {
  letter-spacing: 0;
}

.rmh__desc {
  margin: 0.75rem 0 0;
  padding: 0;
  max-width: 36rem;
  font-size: clamp(1rem, 0.95rem + 0.15vw, 1.0625rem);
  line-height: 1.6;
  color: var(--rmh-body);
  letter-spacing: normal;
  text-wrap: pretty;
}
/*#endregion*/

/*#region  **** Actions  ****/
.rmh__actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
  /* The homepage hero CTA's geometry (css/royce-home-hero.css .rz-hero__cta) on
     the shared button system: tokens only, the box stays css/buttons.css's. */
  --btn-pad-x: 34px;
  --btn-font-size: 15px;
  --btn-tracking: 0.04em;
}

.rtl .rmh__actions {
  --btn-tracking: 0px;
}

/* Package labels are sentence case ("Start Trading"); buttons.css uppercases
   .rz-btn, so undo it here as .rz-hero__cta does on the homepage. */
.rmh__actions .rz-btn {
  text-transform: none;
}

/* Anchor to #market-specs-section. Ships `hidden` and is revealed by
   js/market-specs.js once the specifications data has loaded — a link that
   goes nowhere never shows (BRD §8.2). */
.rmh__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  color: var(--rmh-ivory);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  border: 0;
  background: linear-gradient(var(--rmh-gold), var(--rmh-gold)) 0 calc(50% + 0.8em) / 0 1px no-repeat;
  transition:
    background-size 0.3s ease,
    color 0.25s ease;
}

.rtl .rmh__link {
  background-position: 100% calc(50% + 0.8em);
}

.rmh__link[hidden] {
  display: none !important;
}

.rmh__link svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--rmh-gold);
  transition: transform 0.3s ease;
}

.rmh__link:hover {
  color: #fff;
  background-size: calc(100% - 22px) 1px;
}

.rmh__link:hover svg {
  transform: translateY(2px);
}

.rmh__link:focus-visible {
  outline: 2px solid var(--rmh-gold);
  outline-offset: 3px;
}
/*#endregion*/

/*#region  **** Artwork  ****/
/* Decorative, bleeds to the viewport edge on the inline-end side, never under
   the copy. The bleed and the fade mask are physical, hence the .rtl mirrors. */
.rmh__art {
  position: relative;
  z-index: 1;
  align-self: stretch;
  min-height: 13rem;
  margin: calc(var(--rmh-pad) * -1) calc(var(--rmh-gutter) * -1 - max(0px, (100vw - var(--rmh-max)) / 2)) calc(var(--rmh-pad) * -1) 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 24%);
  mask-image: linear-gradient(90deg, transparent 0, #000 24%);
}

.rtl .rmh__art {
  margin: calc(var(--rmh-pad) * -1) 0 calc(var(--rmh-pad) * -1) calc(var(--rmh-gutter) * -1 - max(0px, (100vw - var(--rmh-max)) / 2));
  -webkit-mask-image: linear-gradient(270deg, transparent 0, #000 24%);
  mask-image: linear-gradient(270deg, transparent 0, #000 24%);
}

.rmh__art svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  display: block;
  overflow: visible;
  /* vertical-align: top; */
}

/* The drawing is composed for a left-to-right read; mirror the whole plate
   rather than re-author six artworks. The currency glyphs are wrapped back the
   right way round by the rule below. */
.rtl .rmh__art svg {
  transform: scaleX(-1);
}

.rtl .rmh__art svg text {
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleX(-1);
}

/* Parallax depth: --d per layer, --rmh-px/--rmh-py from the pointer handler. */
.rmh-l {
  transform-box: view-box;
  transform: translate(calc(var(--rmh-px) * var(--d, 1) * 1px), calc(var(--rmh-py) * var(--d, 1) * 1px));
  transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
/*#endregion*/

/*#region  **** Motion  ****/
/* One short orchestrated reveal from first paint; nothing is held back for
   more than ~0.5s. Off entirely under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .rmh__label,
  .rmh__title,
  .rmh__desc,
  .rmh__actions {
    animation: rmh-rise 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  }

  .rmh__title {
    animation-delay: 0.05s;
  }

  .rmh__desc {
    animation-delay: 0.1s;
  }

  .rmh__actions {
    animation-delay: 0.15s;
  }

  .rmh-in {
    animation: rmh-fade 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 70ms);
  }
}

@keyframes rmh-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rmh-fade {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rmh *,
  .rmh *::before,
  .rmh *::after {
    transition: none !important;
    animation: none !important;
  }

  .rmh-l {
    transform: none !important;
  }
}
/*#endregion*/

/*#region  **** Responsive  ****/
/* Small laptops: give the artwork a little more of the row. */
@media (max-width: 1199.98px) {
  .rmh__inner {
    grid-template-columns: minmax(0, 60fr) minmax(0, 40fr);
  }
}

/* Tablets and below: height follows content, the artwork becomes a quiet
   corner treatment behind the copy. */
@media (max-width: 991.98px) {
  .rmh {
    --rmh-pad: 2.25rem;
  }

  .rmh__inner {
    display: block;
  }

  .rmh__art,
  .rtl .rmh__art {
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    opacity: 0.55;
    -webkit-mask-image: radial-gradient(ellipse 62% 150px at 100% 0, #000 35%, transparent 100%);
    mask-image: radial-gradient(ellipse 62% 150px at 100% 0, #000 35%, transparent 100%);
  }

  .rtl .rmh__art {
    -webkit-mask-image: radial-gradient(ellipse 62% 150px at 0 0, #000 35%, transparent 100%);
    mask-image: radial-gradient(ellipse 62% 150px at 0 0, #000 35%, transparent 100%);
  }

  .rmh__art svg {
    inset: auto;
    top: -34px;
    inset-inline-end: -96px;
    width: 360px;
    height: 218px;
  }

  .rmh__copy {
    max-width: 40rem;
  }

  .rmh__title {
    font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2rem);
    max-width: none;
  }

  .rmh__desc {
    margin-top: 0.75rem;
  }

  .rmh__actions {
    margin-top: 1.375rem;
    gap: 0.5rem 1.5rem;
  }
}

/* Phones: the CTA takes the row, the anchor drops beneath it. */
@media (max-width: 575.98px) {
  .rmh__actions .rz-btn {
    flex: 1 1 100%;
  }

  .rmh__link {
    flex: 0 0 auto;
  }
}

@media (forced-colors: active) {
  .rmh__art {
    display: none;
  }
}

@media print {
  .rmh__art,
  .rmh__bg {
    display: none;
  }

  .rmh {
    background: none;
    color: #000;
  }

  .rmh__title,
  .rmh__desc {
    color: #000;
  }
}
/*#endregion*/
