/*
 * Marquee block — continuous horizontal card strips.
 *
 * The drift is a CSS keyframe animation (translateX to -50% on a track that
 * holds TWO identical card sets), so the loop runs on the compositor and its
 * wrap is seamless with no main-thread jump. (The shared JS carousel engine
 * drove it before, but its per-loop transform jump flashed the whole row.)
 * Per-instance values (card width, gap, padding, fade width, row gap, type
 * sizes; plus the animation duration/direction inline) arrive from
 * includes/element-renderers/marquee.php.
 */

.impulse-marquee { position: relative; width: 100%; }

.impulse-marquee-row {
    position: relative;
    overflow: hidden;
}
.impulse-marquee-row + .impulse-marquee-row { margin-top: var(--mq-row-gap, 14px); }

.impulse-marquee-track {
    display: flex;
    width: max-content;
    will-change: transform;
}
@keyframes impulse-mq-left  { from { transform: translateX(0); }    to { transform: translateX(-50%); } }
@keyframes impulse-mq-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }

/* Pause on hover / keyboard focus so a card can be read and clicked. */
.impulse-marquee[data-pause="1"] .impulse-marquee-row:hover .impulse-marquee-track,
.impulse-marquee[data-pause="1"] .impulse-marquee-row:focus-within .impulse-marquee-track {
    animation-play-state: paused !important;
}

/* Faded edges — the streaming-service signature. Masking makes the strip
   ends transparent regardless of the page background behind it. */
.impulse-marquee-row.mq-fade {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--mq-fade, 12%), #000 calc(100% - var(--mq-fade, 12%)), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 var(--mq-fade, 12%), #000 calc(100% - var(--mq-fade, 12%)), transparent 100%);
}

/* MOBILE IS ALWAYS FULL WIDTH. A narrowed band is a desktop composition - it
   gives the strip visible ends and lets the page breathe around it. On a phone
   there is nothing to give away: 68vw of a 390px screen is 265px, which holds
   barely two cards and turns a moving band into a keyhole.

   !important because the width is an INLINE style. The renderer writes width
   and margin-left straight onto the wrapper, since this is a viewport band that
   deliberately escapes its section container, and a stylesheet cannot outrank
   that otherwise. */
@media (max-width: 767px) {
    .impulse-marquee {
        width: 100vw !important;
        margin-left: calc(50% - 50vw) !important;
        margin-right: 0 !important;
        max-width: none !important;
    }
    /* And the fade goes with it, for the reason the renderer already gives:
       full bleed has no visible ends to soften, and on a narrow screen the mask
       eats the first and last card instead. */
    .impulse-marquee-row.mq-fade { -webkit-mask-image: none; mask-image: none; }
}

/* Reduced motion — stop the drift; hand the row to native scroll. */
@media (prefers-reduced-motion: reduce) {
    .impulse-marquee-track { animation: none !important; }
    .impulse-marquee-row { overflow-x: auto; }
    .impulse-marquee-row.mq-fade { -webkit-mask-image: none; mask-image: none; }
}

/* Card — fills its slide; neutral + semi-transparent so it reads on light
   AND dark pages; text / icon inherit the surrounding section colour. */
.impulse-marquee-card {
    position: relative;
    flex: 0 0 var(--mq-card-w, 196px);
    margin-inline-end: var(--mq-gap, 14px);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: var(--mq-pad-v, 14px) var(--mq-pad-h, 16px);
    min-height: var(--mq-card-h, 0);
    border: 1px solid var(--mq-border, rgba(127, 127, 127, 0.22));
    border-radius: var(--mq-radius, 12px);
    background: var(--mq-card-bg, rgba(127, 127, 127, 0.08));
    color: var(--mq-text, inherit);
    text-decoration: none;
    overflow: hidden;
    transition: border-color 0.25s ease-in-out, transform 0.25s ease-in-out;
}
a.impulse-marquee-card:hover {
    border-color: var(--mq-border, rgba(127, 127, 127, 0.5));
    transform: translateY(-2px);
}

/* Optional hover-reveal: on hover (the row is already paused) the front
   cross-fades out and the back detail fades in, same box, no resize and no
   3D flip. Gated by data-reveal on the wrapper. */
.impulse-marquee-front {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    transition: opacity 0.25s ease-in-out;
}
.impulse-marquee-back {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    padding: var(--mq-pad-v, 14px) var(--mq-pad-h, 16px);
    font-size: var(--mq-sub-size, 12px);
    line-height: 1.35;
    color: inherit;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
}
.impulse-marquee[data-reveal="1"] .impulse-marquee-card:hover .impulse-marquee-front { opacity: 0; }
.impulse-marquee[data-reveal="1"] .impulse-marquee-card:hover .impulse-marquee-back { opacity: 1; }
.impulse-marquee-ico {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--mq-icon-color, var(--mq-text, inherit));
}
.impulse-marquee-ico svg { display: block; }
.impulse-marquee-tt { display: flex; flex-direction: column; min-width: 0; }
.impulse-marquee-title {
    font-weight: 500;
    font-size: var(--mq-title-size, 15px);
    line-height: 1.2;
    color: inherit;
}
.impulse-marquee-sub {
    font-size: var(--mq-sub-size, 12px);
    line-height: 1.3;
    margin-top: 2px;
    opacity: 0.7;
    color: inherit;
}

/* ── Image mode: logo wall or photo strip ─────────────────────────────────
   The card becomes a column (media + optional caption). image_style is a
   block-level class: mq-img-photo (framed, image fills) or mq-img-logo
   (transparent, contained, greyscale that lifts to colour on hover). */
.impulse-marquee--image .impulse-marquee-card {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
}
.impulse-marquee-img {
    display: block;
    width: 100%;
    height: var(--mq-card-h, 120px);
    object-fit: cover;
}
.impulse-marquee-img-ph {
    background: repeating-linear-gradient(45deg, rgba(127,127,127,0.08), rgba(127,127,127,0.08) 10px, rgba(127,127,127,0.14) 10px, rgba(127,127,127,0.14) 20px);
}
.impulse-marquee-cap {
    padding: 8px var(--mq-pad-h, 14px);
    font-size: var(--mq-sub-size, 12px);
    line-height: 1.3;
    color: inherit;
    text-align: center;
}
.impulse-marquee--image.mq-img-logo .impulse-marquee-card {
    background: transparent;
    border: none;
}
.impulse-marquee--image.mq-img-logo .impulse-marquee-img {
    height: var(--mq-card-h, 64px);
    object-fit: contain;
    padding: var(--mq-pad-v, 10px) var(--mq-pad-h, 14px);
    filter: grayscale(1);
    opacity: 0.7;
    transition: filter 0.25s ease-in-out, opacity 0.25s ease-in-out;
}
.impulse-marquee--image.mq-img-logo .impulse-marquee-card:hover .impulse-marquee-img {
    filter: grayscale(0);
    opacity: 1;
}

/* ── Testimonial mode: star rating + quote + avatar/name/role ─────────────── */
.impulse-marquee--testimonial .impulse-marquee-card {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    text-align: left;
}
.impulse-marquee-stars { display: inline-flex; gap: 2px; line-height: 1; }
.impulse-marquee-star { color: rgba(127, 127, 127, 0.3); display: inline-flex; }
.impulse-marquee-star svg { display: block; fill: currentColor; }
.impulse-marquee-star.on { color: var(--mq-icon-color, #fbbc04); }
.impulse-marquee-quote {
    font-size: var(--mq-title-size, 15px);
    line-height: 1.45;
    color: inherit;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.impulse-marquee-person {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}
.impulse-marquee-avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.impulse-marquee-person-tt { display: flex; flex-direction: column; min-width: 0; }
.impulse-marquee-name { font-weight: 600; font-size: var(--mq-sub-size, 13px); line-height: 1.2; color: inherit; }
.impulse-marquee-role { font-size: calc(var(--mq-sub-size, 12px) - 1px); opacity: 0.65; line-height: 1.2; margin-top: 1px; color: inherit; }

/* Caption placement (image mode): below (default) | overlay | hover | none. */
.impulse-marquee--image.mq-cap-none .impulse-marquee-cap { display: none; }
.impulse-marquee--image.mq-cap-overlay .impulse-marquee-cap,
.impulse-marquee--image.mq-cap-hover .impulse-marquee-cap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 22px 12px 9px;
    color: #fff;
    text-align: left;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
}
.impulse-marquee--image.mq-cap-hover .impulse-marquee-cap {
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
}
.impulse-marquee--image.mq-cap-hover .impulse-marquee-card:hover .impulse-marquee-cap { opacity: 1; }

/* ── Hover zoom (image mode, opt-in via hover_zoom) ───────────────────────
   A photo strip that only PAUSES on hover reads as a stall: the pointer is
   over a picture, something stopped, and nothing happened. Lifting the card
   under the pointer says the pause was deliberate and lets a trade's work be
   seen properly without opening a lightbox (Sergei 2026-07-28).

   The card scales rather than the <img> so the caption travels with it, and
   z-index lifts it clear of its neighbours: a scaled card with no stacking
   context slides UNDER the next one, which is the exact bug the swap grid
   had. overflow stays visible on the row for the same reason. */
.impulse-marquee[data-zoom="1"] .impulse-marquee-card {
    transition: transform 220ms ease-in-out, box-shadow 220ms ease-in-out;
    will-change: transform;
}
.impulse-marquee[data-zoom="1"] .impulse-marquee-card:hover,
.impulse-marquee[data-zoom="1"] .impulse-marquee-card:focus-within {
    transform: scale(var(--mq-zoom, 1.55));
    z-index: 5;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
    position: relative;
}
/* The row clips its overflow for the fade mask, which would crop a lifted
   card. Zoom mode trades the MASK for the zoom - but it must not trade away the
   horizontal clip with it. The row's overflow is what holds the strip to its
   box: the track is far wider than the viewport and the row is what cuts it
   off. Setting `overflow: visible` here let the track run past a 75vw box out
   to the section edges, so a narrowed marquee still read as full width and the
   Width slider looked broken (Sergei 2026-08-24, sunandsoap page 1 - where the
   saved data and the rendered box were correct the whole time).

   Per-axis: clip the track at the edge, let a hovered card lift out. `clip`
   rather than `hidden` because hidden would make this a scroll container, which
   is the very thing that forces the two to be traded against each other. */
.impulse-marquee[data-zoom="1"] .impulse-marquee-row {
    overflow-x: clip;
    overflow-y: visible;
}
/* THE FADE SURVIVES ZOOM. A mask clips to the element box in both axes, so a
   card lifting on hover used to be sliced off at the top and bottom - which is
   why the mask was simply turned off here. It does not have to be a choice:
   give the row enough vertical room that the lifted card is still INSIDE the
   masked box, then take that room back out of the layout with a negative
   margin so nothing on the page moves.

   The room needed is exactly how far the card grows - (zoom - 1) / 2 of the
   card height, each side - and both are variables the renderer already sets, so
   this tracks the designer's actual settings instead of a guess. The fallback
   height is deliberately generous: over-padding is free because the gradient
   runs HORIZONTALLY, so extra vertical room inside the mask is fully opaque and
   invisible, while under-padding is what crops a card. */
.impulse-marquee[data-zoom="1"] .impulse-marquee-row.mq-fade {
    --mq-lift: calc((var(--mq-zoom, 1.35) - 1) * 0.5 * var(--mq-card-h, 340px));
    padding-block: var(--mq-lift);
    margin-block: calc(var(--mq-lift) * -1);
}
/* The negative block margin would otherwise pull the next row up by the same
   amount this one pushed itself out, closing the gap between rows. */
.impulse-marquee[data-zoom="1"] .impulse-marquee-row.mq-fade + .impulse-marquee-row {
    margin-top: calc(var(--mq-row-gap, 14px) + var(--mq-lift, 0px));
}
@media (prefers-reduced-motion: reduce) {
    .impulse-marquee[data-zoom="1"] .impulse-marquee-card { transition: none; }
    .impulse-marquee[data-zoom="1"] .impulse-marquee-card:hover { transform: none; }
}

/* ── Per-service work strips ──────────────────────────────────────────────
   One titled strip per service that has photos. The title is small and quiet:
   it labels the row, it is not a section heading, and the section above it
   already said RECENT WORK. */
.impulse-mq-service + .impulse-mq-service { margin-top: 26px; }
.impulse-mq-service-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.01em;
    color: inherit;
    opacity: 0.82;
}
