/* ==========================================================================
   Magengrim — hero
   Heading and lede over a four-tile mosaic: a tall feature image on the left,
   two smaller images top-right, and a dark call-to-action card beneath them.
   ========================================================================== */

.mg-hero {
  --mg-hero-ink: var(--mg-ink);
  --mg-hero-dim: var(--mg-dim);
  --mg-hero-accent: var(--mg-accent);
  --mg-hero-purple: var(--mg-purple);
  --mg-hero-indigo: var(--mg-indigo);

  /* The site header is in normal flow, so the hero must open its own space:
     without this the h1 cap-height starts on the header's exact bottom edge. */
  /* With the mosaic gone the headline carries the screen on its own, so the
     hero holds a full band and centres its block in it. */
  display: flex;
  align-items: center;
  min-height: min(78vh, 780px);
  padding: clamp(40px, 6vw, 96px) 0 clamp(48px, 7vw, 104px);
}

/* --- Media variant ------------------------------------------------------ */

/* The hero over the coin render. Everything the light hero states in ink has
   to invert here — a #8c8c9a recessive tone that reads correctly on white is
   invisible on near-black — so the variant restates the two-tone system
   rather than just dropping an image behind it. */
.mg-hero.mg-hero--media {
  position: relative;
  isolation: isolate;
  background-color: #09080f;
  background-image: url("../images/bg.webp");
  background-repeat: no-repeat;
  background-position: left 42%;
  background-size: 118% auto;

  /* The render runs behind the header as well as the hero. The header stays in
     normal flow — it still scrolls away with the page — so the hero pulls up
     underneath it and pads the space back, rather than the header floating.
     --site-header-h is measured by fixed-header.js; the literal covers the
     moment before that runs. */
  margin-top: calc(-1 * var(--site-header-h, 98px));
  padding-top: calc(var(--site-header-h, 98px) + clamp(40px, 6vw, 96px));
}

/* Weighted to the left, where the headline sits: the copy gets near-solid
   ground while the coins stay legible in the right half. */
.mg-hero.mg-hero--media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    98deg,
    rgba(9, 8, 15, 0.95) 0%,
    rgba(9, 8, 15, 0.9) 26%,
    rgba(9, 8, 15, 0.6) 50%,
    rgba(9, 8, 15, 0.3) 72%,
    rgba(9, 8, 15, 0.22) 100%
  );
  pointer-events: none;
}

/* Vertical pass: darkens the band the header sits in so the nav reads over
   the render, clears through the middle, then softens the seam into the next
   section. */
.mg-hero.mg-hero--media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Two layers: a tiling grain over the vertical scrim. The grain's strength
     lives in the PNG's alpha rather than in a CSS opacity, so it can sit in a
     multi-layer background without dimming the gradient beneath it. */
  background-image:
    url("../images/hero-noise.png?v=2"),
    linear-gradient(
      to bottom,
      rgba(9, 8, 15, 0.72) 0,
      rgba(9, 8, 15, 0.3) calc(var(--site-header-h, 98px) + 30px),
      rgba(9, 8, 15, 0) 46%,
      rgba(9, 8, 15, 0.55) 100%
    );
  background-repeat: repeat, no-repeat;
  background-position: center top, center top;
  background-size: 154px auto, auto;
  pointer-events: none;
}

/* --- Header over the render --------------------------------------------- */

/* The header has no ground of its own on a page whose hero runs the render, so
   it goes transparent and its contents invert. `.mg-onmedia` is set on the
   body of exactly those pages — it was scoped to `.home` while the home page
   was the only one. */
.mg-onmedia .ekit-template-content-header {
  background-color: transparent !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

.mg-onmedia .ekit-template-content-header .mg-header-logo {
  filter: brightness(0) invert(1);
}

.mg-onmedia .ekit-template-content-header .jkit-nav-menu .jkit-menu > li > a {
  color: rgba(255, 255, 255, 0.82) !important;
}

.mg-onmedia .ekit-template-content-header .jkit-nav-menu .jkit-menu > li > a svg {
  fill: rgba(255, 255, 255, 0.82) !important;
}

.mg-onmedia .ekit-template-content-header .jkit-nav-menu .jkit-menu > li > a:hover,
.mg-onmedia .ekit-template-content-header .jkit-nav-menu .jkit-menu > li.current-menu-item > a {
  color: #ffffff !important;
}

.mg-onmedia .ekit-template-content-header .mg-calllink .mg-calllink__key,
.mg-onmedia .ekit-template-content-header .mg-calllink .mg-calllink__arrow {
  color: #ffffff !important;
}

.mg-onmedia .ekit-template-content-header .mg-calllink .mg-calllink__lead {
  color: rgba(255, 255, 255, 0.55) !important;
}

.mg-onmedia .ekit-template-content-header .mg-navbtn,
.mg-onmedia .ekit-template-content-header .jkit-hamburger-menu {
  color: #ffffff !important;
}

.mg-onmedia .ekit-template-content-header .jkit-hamburger-menu svg {
  fill: #ffffff !important;
  stroke: #ffffff !important;
}

.mg-hero.mg-hero--media .mg-dim {
  color: rgba(255, 255, 255, 0.46);
}

.mg-hero.mg-hero--media .mg-key,
.mg-hero.mg-hero--media .mg-hero__title {
  color: #ffffff;
}

.mg-hero.mg-hero--media .mg-hero__lede {
  color: rgba(255, 255, 255, 0.62);
}

/* The tiles were shadowed for a light page; on near-black those shadows do
   nothing, so a hairline ring separates them from the ground instead. The
   middle tile is dark and would otherwise dissolve entirely. */
.mg-hero.mg-hero--media .mg-chip {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0.06em 0.09em rgba(0, 0, 0, 0.5),
    0 0.14em 0.22em rgba(0, 0, 0, 0.45);
}

.mg-hero.mg-hero--media .mg-switch {
  box-shadow:
    inset 0 0.02em 0.05em rgba(255, 255, 255, 0.35),
    0 0.06em 0.18em rgba(0, 0, 0, 0.6);
}

@media (max-width: 767px) {
  /* Portrait crops the render hard; centring on the coins keeps them in
     frame rather than showing empty backdrop. */
  .mg-hero.mg-hero--media {
    background-size: cover;
    background-position: 64% 40%;
    /* Restated here because the shared mobile `.mg-hero` padding below resets
       the shorthand, and the headline must still clear the header. */
    margin-top: calc(-1 * var(--site-header-h, 86px));
    padding-top: calc(var(--site-header-h, 86px) + 30px);
  }

  .mg-hero.mg-hero--media::before {
    background: linear-gradient(
      178deg,
      rgba(9, 8, 15, 0.94) 0%,
      rgba(9, 8, 15, 0.86) 45%,
      rgba(9, 8, 15, 0.72) 100%
    );
  }
}

/* Interior pages run the same treatment at a shorter height: the headline is
   an introduction there, not the whole first screen. */
.mg-hero--page {
  min-height: min(56vh, 520px);
  padding: clamp(36px, 5vw, 76px) 0 clamp(40px, 5vw, 72px);
}

.mg-hero__inner {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Header call link --------------------------------------------------- */

/* The same two-tone emphasis as the headline, at link scale. Lives in the
   site header, so it is not scoped to the hero. */
.mg-calllink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "Sora", sans-serif;
  font-size: clamp(0.82rem, 1.05vw, 0.95rem);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.mg-calllink .mg-calllink__lead {
  color: rgba(13, 11, 26, 0.45);
  font-weight: 400;
}

.mg-calllink .mg-calllink__key {
  color: #0d0b1a;
  font-weight: 700;
}

.mg-calllink__arrow {
  flex: none;
  width: 34px;
  height: 8px;
  color: #0d0b1a;
  transition: transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mg-calllink:hover .mg-calllink__arrow,
.mg-calllink:focus-visible .mg-calllink__arrow {
  transform: translateX(5px);
}

.mg-calllink:focus-visible {
  outline: 2px solid #673de6;
  outline-offset: 4px;
  border-radius: 3px;
}

/* --- Headline ----------------------------------------------------------- */

.mg-hero__intro {
  margin-bottom: clamp(28px, 3.2vw, 44px);
}

.mg-hero .mg-hero__title {
  margin: 0 0 clamp(20px, 2.4vw, 30px);
  font-size: clamp(2.15rem, 6.6vw, 5rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: var(--mg-hero-ink);
}

/* Each line is its own block, so the four-line rhythm of the design holds
   at every width instead of reflowing into an arbitrary shape. */
.mg-line {
  display: block;
}

/* Connective words recede; the load-bearing ones stay solid. */
.mg-dim {
  color: var(--mg-hero-dim);
}

.mg-key {
  color: var(--mg-hero-ink);
}

/* --- Inline chips ------------------------------------------------------- */

/* Three tiles standing in for the three things we build. Sized in em so they
   track the headline through its whole clamp range. */
.mg-chips {
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  margin: 0 0.3em 0 0;
  transform: translateY(0.09em);
}

.mg-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.9em;
  height: 0.9em;
  border-radius: 0.25em;
  background: #ffffff;
  box-shadow:
    0 0.015em 0.02em rgba(13, 11, 26, 0.14),
    0 0.06em 0.09em rgba(13, 11, 26, 0.13),
    0 0.14em 0.22em rgba(13, 11, 26, 0.14);
}

.mg-chip + .mg-chip {
  margin-left: -0.12em;
}

.mg-chip img {
  display: block;
  width: auto;
  height: 0.58em;
  object-fit: contain;
}

/* The chip order and colour match the three solution cards further down. */
/* The mark keeps its own colour in each file; the middle tile inverts, so the
   row reads light - dark - light and the centre chip carries the contrast. */
.mg-chip--apps { --mg-chip-tilt: -8deg; z-index: 1; }

.mg-chip--infra {
  background: var(--mg-hero-ink);
  --mg-chip-tilt: 1deg;
  z-index: 2;
}

.mg-chip--pay { --mg-chip-tilt: 9deg; z-index: 3; }

.mg-chip { transform: rotate(var(--mg-chip-tilt, 0deg)); }

/* --- Inline switch ------------------------------------------------------ */

/* Reads as a live system: the platforms are on, and stay on. */
.mg-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 1.72em;
  height: 0.9em;
  margin: 0 0.28em 0 0;
  border-radius: 999px;
  vertical-align: baseline;
  transform: translateY(0.09em);
  background: linear-gradient(100deg, #3d1f8e 0%, #673de6 52%, #9a7cf5 100%);
  box-shadow:
    inset 0 0.02em 0.05em rgba(255, 255, 255, 0.35),
    0 0.06em 0.14em rgba(61, 31, 142, 0.4);
}

.mg-switch__knob {
  position: absolute;
  right: 0.07em;
  width: 0.76em;
  height: 0.76em;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.03em 0.08em rgba(13, 11, 26, 0.3);
}

/* --- Lede --------------------------------------------------------------- */

.mg-hero__lede {
  margin: 0;
  font-size: clamp(0.95rem, 1.25vw, 1.08rem);
  line-height: 1.65;
  color: rgba(13, 11, 26, 0.55);
  max-width: 52ch;
}

/* --- Entrance ----------------------------------------------------------- */

/* The chips and the switch drop in just behind the headline, so the first
   thing read is the sentence and the objects settle into it. */
.mg-hero[data-anim].is-visible .mg-chip {
  animation: mgChipIn 620ms cubic-bezier(0.34, 1.4, 0.5, 1) both;
}

.mg-hero[data-anim].is-visible .mg-chip--apps  { animation-delay: 260ms; }
.mg-hero[data-anim].is-visible .mg-chip--infra { animation-delay: 330ms; }
.mg-hero[data-anim].is-visible .mg-chip--pay   { animation-delay: 400ms; }

.mg-hero[data-anim].is-visible .mg-switch {
  animation: mgSwitchIn 620ms cubic-bezier(0.34, 1.4, 0.5, 1) both;
  animation-delay: 520ms;
}

.mg-hero[data-anim].is-visible .mg-switch__knob {
  animation: mgKnobIn 520ms cubic-bezier(0.34, 1.4, 0.5, 1) both;
  animation-delay: 700ms;
}

/* Each chip keeps its own resting rotation, so the keyframes carry it. */
@keyframes mgChipIn {
  from { opacity: 0; transform: translateY(0.3em) scale(0.6) rotate(0deg); }
  to   { opacity: 1; transform: translateY(0) scale(1) rotate(var(--mg-chip-tilt, 0deg)); }
}

@keyframes mgSwitchIn {
  from { opacity: 0; transform: translateY(0.3em) scale(0.6); }
  to   { opacity: 1; transform: translateY(0.09em) scale(1); }
}

@keyframes mgKnobIn {
  from { right: 0.87em; }
  to   { right: 0.07em; }
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 767px) {
  .mg-hero {
    min-height: 0;
    padding: 30px 0 52px;
  }

  .mg-hero__intro {
    margin-bottom: 26px;
  }

  .mg-calllink__arrow {
    width: 24px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .mg-hero[data-anim].is-visible .mg-chip,
  .mg-hero[data-anim].is-visible .mg-switch,
  .mg-hero[data-anim].is-visible .mg-switch__knob {
    animation: none;
  }

  .mg-calllink__arrow {
    transition: none;
  }

}

/* --- Media band --------------------------------------------------------- */

/* The same render, scrims and grain as the hero, applied to a full-width band
   elsewhere on the page. It differs from `.mg-hero--media` only in that it
   sits in normal flow with nothing overlapping it, so it needs no header
   offset. Kept beside the hero because the two share one recipe. */
.mg-band--media {
  position: relative;
  isolation: isolate;
  background-color: #09080f !important;
  background-image: url("../images/bg.webp") !important;
  background-repeat: no-repeat !important;
  background-position: left 46% !important;
  background-size: 118% auto !important;
}

.mg-band--media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    98deg,
    rgba(9, 8, 15, 0.95) 0%,
    rgba(9, 8, 15, 0.9) 26%,
    rgba(9, 8, 15, 0.62) 52%,
    rgba(9, 8, 15, 0.34) 74%,
    rgba(9, 8, 15, 0.26) 100%
  );
  pointer-events: none;
}

.mg-band--media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    url("../images/hero-noise.png?v=2"),
    linear-gradient(
      to bottom,
      rgba(9, 8, 15, 0.5) 0,
      rgba(9, 8, 15, 0) 34%,
      rgba(9, 8, 15, 0) 66%,
      rgba(9, 8, 15, 0.5) 100%
    );
  background-repeat: repeat, no-repeat;
  background-position: center top, center top;
  background-size: 154px auto, auto;
  pointer-events: none;
}

/* The band's own motion-effects layer carried a background image that no
   longer exists (kk-1.png, a 404 on every load); the section paints its own
   ground now, so the layer is retired rather than left requesting a missing
   file. */
.mg-band--media .elementor-motion-effects-container,
.mg-band--media .elementor-background-overlay {
  display: none !important;
}

.mg-band--media .elementor-heading-title,
.mg-band--media h1,
.mg-band--media h2,
.mg-band--media h3 {
  color: #ffffff !important;
}

.mg-band--media .elementor-widget-text-editor,
.mg-band--media .elementor-widget-text-editor p,
.mg-band--media p {
  color: rgba(255, 255, 255, 0.68) !important;
}

/* The band's call to action inverts to read on the render. */
.mg-band--media .elementor-button,
.mg-band--media .jkit-button-wrapper {
  background-color: #ffffff !important;
  color: var(--mg-ink) !important;
  border-color: #ffffff !important;
}

.mg-band--media .elementor-button:hover,
.mg-band--media .jkit-button-wrapper:hover {
  background-color: var(--mg-purple) !important;
  color: #ffffff !important;
  border-color: var(--mg-purple) !important;
}

@media (max-width: 767px) {
  .mg-band--media {
    background-size: cover !important;
    background-position: 64% 44% !important;
  }

  .mg-band--media::before {
    background: linear-gradient(
      178deg,
      rgba(9, 8, 15, 0.92) 0%,
      rgba(9, 8, 15, 0.86) 45%,
      rgba(9, 8, 15, 0.78) 100%
    );
  }
}
