/* Kingdom Advisors Elementor Widgets — Image Marquee
   An endlessly scrolling row of logos. The motion is a GSAP tween on the track (see the JS); this
   file owns layout, sizing and the edge fade only.

   Controlled values arrive as `--kaw-mq-*` variables the stylesheet reads, never as properties a
   control writes onto an element this file also styles — see the "Elementor specificity trap" note
   in the rundown for why that distinction matters. */

.kaw-marquee {
  --kaw-mq-w: 100%;          /* width of the moving strip */
  --kaw-mq-h: 100px;         /* logo height — width follows the logo's own proportions */
  --kaw-mq-max-w: 320px;     /* safety cap so one wide banner cannot dominate */
  --kaw-mq-gap: 40px;
  --kaw-mq-fade: 0px;        /* 0 = hard edge */
  --kaw-mq-opacity: 1;
  --kaw-mq-gray: 0;
  /* Extra filter functions appended to the chain by the Logo Colour control. Declared empty here and
     ALWAYS read with an empty fallback — `var(--x)` on an undefined property is invalid at computed
     value time, which would throw away the whole `filter` declaration and take greyscale with it. */
  --kaw-mq-tint: ;

  box-sizing: border-box;
  width: var(--kaw-mq-w);
  margin-inline: auto;
  position: relative;
  overflow: hidden;
}

.kaw-marquee *,
.kaw-marquee *::before { box-sizing: border-box; }

/* The fade is a mask, not an overlay gradient: an overlay would have to know the page background to
   fade *to*, and it would sit on top of the logo links. A mask fades the strip itself to transparent,
   so whatever is behind shows through and nothing is covered. At 0 the stops collapse and it is a
   hard edge — `mask-image` with a 0-width fade is a no-op, not a blur. */
.kaw-marquee[data-fade] {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--kaw-mq-fade), #000 calc(100% - var(--kaw-mq-fade)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--kaw-mq-fade), #000 calc(100% - var(--kaw-mq-fade)), transparent 100%);
}

/* The track. JS appends clones of the list to it and tweens it. */
.kaw-marquee__track {
  display: flex;
  align-items: center;
  gap: var(--kaw-mq-gap);
  width: max-content;
  will-change: transform;
}

.kaw-marquee__list {
  display: flex;
  align-items: center;
  gap: var(--kaw-mq-gap);
  flex: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kaw-marquee__item {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kaw-marquee__link {
  display: block;
  line-height: 0;
  border-radius: 2px;
}
.kaw-marquee__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 6px;
}

.kaw-marquee__img {
  display: block;
  object-fit: contain;
  opacity: var(--kaw-mq-opacity);
  filter: grayscale(var(--kaw-mq-gray)) var(--kaw-mq-tint, );
  transition: opacity 0.3s ease, filter 0.3s ease;
  -webkit-user-select: none;
  user-select: none;
}

/* Uniform HEIGHT, natural width — `width: auto` keeps each logo's own proportions, so a wordmark and
   a square mark read at the same visual weight, and max-width only ever shrinks an outlier.

   SEPARATE, HARDENED RULE ON PURPOSE. A bare <img> is the single most contested element on a
   WordPress site: near enough every theme ships `img { height: auto }` and plenty use `!important`,
   which beats a one-class selector and leaves every logo at its natural size — the widget looks like
   the Logo Height control does nothing. The extra class plus `!important` guarantees this declaration
   resolves.

   `!important` is safe HERE only because the values are VARIABLES: the controls still own the numbers,
   they write `--kaw-mq-h` / `--kaw-mq-max-w` on the root and this rule merely reads them. Do not copy
   this onto a property a control writes directly — there it would lock the editor out. */
.kaw-marquee .kaw-marquee__img {
  height: var(--kaw-mq-h) !important;
  width: auto !important;
  max-width: var(--kaw-mq-max-w) !important;
}

/* Greyscale (when enabled) lifts on hover for the logo you are actually looking at.
   The TINT deliberately does not lift with it. Greyscale is a stylistic mute — restoring the brand
   colours underneath is a nice reveal. A tint is there because the logos are otherwise unreadable
   against the section background, so releasing it on hover would make the logo you are pointing at
   the one that disappears. */
.kaw-marquee__item:hover .kaw-marquee__img,
.kaw-marquee__link:focus-visible .kaw-marquee__img {
  opacity: 1;
  filter: grayscale(0) var(--kaw-mq-tint, );
}

/* ------------------------------------------------------------------ Reduced motion / no-JS
   NOT simply "stop the animation". A frozen single-line strip leaves most logos off the side of the
   screen with no way to reach them. Instead the row wraps and shows every logo — the content is the
   point, the movement was only ever decoration.
   `.is-ready` is added by the JS once it has built the loop, so this is also the no-JS state. */
.kaw-marquee:not(.is-ready),
.kaw-marquee.is-static {
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
}
.kaw-marquee:not(.is-ready) .kaw-marquee__list,
.kaw-marquee.is-static .kaw-marquee__list {
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.kaw-marquee.is-static .kaw-marquee__track { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .kaw-marquee__img { transition: none; }
}
