# Chevron Strip Slider: Nested V Layers, a Photo in Staggered Strips and a Sliding Word Track

## Goal
Build a full-viewport **black slider** with three **nested V shapes** stacked downward (dark grey, lighter grey, white accent) cut with `clip-path`, a **V-shaped photo** sitting inside the top one, **split into seven vertical strips** each nudged up or down by a fixed amount so the photo looks staggered. Across the middle runs a **track of giant words** ("Save", "Invest", "Lend", "Give") in `mix-blend-mode: difference`, one per slide, spaced far apart so only the current one is centred. On each change the strips **drop out downward one after another, the image swaps, and they drop back in from above**, the word track **slides one step**, and a short caption to the right **crossfades**. Previous/next buttons and a "1 / 4" counter at the bottom; **autoplay every 5 s that pauses while the pointer is over the slider or focus is inside**. On load the V layers open from a collapsed clip-path.

## Tech
Vanilla HTML/CSS/JS with ES module imports. `gsap` (npm), no plugins. Font: **Schibsted Grotesk** (500).

## Layout / HTML
```html
<div class="cs">
  <section class="cs-stage" data-cs aria-roledescription="carousel" aria-label="Chevron slider">
    <div class="cs-layers" aria-hidden="true"><i class="cs-chev cs-chev-3"></i><i class="cs-chev cs-chev-2"></i><i class="cs-chev cs-chev-1"></i></div>
    <div class="cs-photo" data-cs-photo role="img" aria-label="Save"><div class="cs-strips" data-cs-strips></div></div>
    <div class="cs-words" data-cs-words aria-hidden="true">
      <span style="--i:0">Save</span><span style="--i:1">Invest</span><span style="--i:2">Lend</span><span style="--i:3">Give</span>
    </div>
    <p class="cs-caption" data-cs-caption aria-live="polite">A steady return on what you keep.</p>
    <div class="cs-ctrl">
      <button type="button" aria-label="Previous slide" data-cs-prev>←</button>
      <span class="cs-count" data-cs-count>1 / 4</span>
      <button type="button" aria-label="Next slide" data-cs-next>→</button>
    </div>
  </section>
</div>
```

## Styling
`:root`: `--cs-bg:#0a0a0a`, `--cs-ink:#fff`, `--cs-layer-1:#1c1c1c`, `--cs-layer-2:#2a2a2a`, `--cs-accent:#fff` (bottom V).

Everything is laid out in pixels of a 1440 × 900 canvas through `--k: min(calc(100vw / 1440), calc(100svh / 900))` on `.cs-stage` (`height:100svh; min-height:480px; overflow:hidden`). Under 700px wide `--k` becomes `min(100vw/640, 100svh/900)` so the shapes stay large.

- `.cs-chev`: absolute, `left:50%`, `580k × 560k`, `margin-left:-290k`, `clip-path:polygon(0 0, 50% 46%, 100% 0, 100% 54%, 50% 100%, 0 54%)` (a thick V). Tops: `-1` at `130k` (`--cs-layer-1`), `-2` at `195k` (`--cs-layer-2`), `-3` at `260k` (`--cs-accent`). Markup order puts `-3` at the back.
- `.cs-photo`: absolute, `z-index:2`, centred, top `130k`, `380k × 430k`, `clip-path:polygon(0 0, 100% 0, 100% 56%, 50% 100%, 0 56%)`. `.cs-strips`: `inset:0; display:flex`; each `span` `flex:1; height:100%; background-repeat:no-repeat`.
- `.cs-words`: absolute, `z-index:3`, full width, top `320k`, `font-size:150k`, weight 500, `letter-spacing:-.05em`, `line-height:1`, white, `mix-blend-mode:difference`, `pointer-events:none`, `--step:1100k`. Each span `position:absolute; left:calc(50% + var(--i) * var(--step)); transform:translateX(-50%); white-space:nowrap`. (Mobile: `190k` type, `900k` step.)
- `.cs-caption`: `z-index:3`, `left:calc(50% + 320k)`, top `620k`, width `280k` (min `12rem`), `clamp(1rem, 22k, 1.4rem)`. Mobile: centred above the controls.
- `.cs-ctrl`: centred at `bottom:clamp(1.25rem,5vh,3rem)`, flex with `gap:1rem`; buttons `48px` circles, `1px solid rgba(255,255,255,.4)`, invert to white on hover/focus; counter tabular numerals at 70 % opacity.

## GSAP effect (be exact)
Build in `mount(config)` → `destroy()`.

```js
const DEFAULTS = { interval: 5, strips: 7, wordDuration: 0.9, stripStagger: 0.04 };
const OFFSETS = [0, 18, -12, 26, -20, 10, -6]; // px of the 1440 canvas
```
Slides: `{ img, word, caption }` × 4 (images below; captions "A steady return on what you keep.", "Projects with a name and an address.", "Loans to workshops close to home.", "A share of the yield, to a cause you pick.").

**Strips**: create `strips` empty spans once. `paintStrips(i)`: `W, H` = photo box, `tile = W / N`, `side = max(W, H)` (images are square, so this is "cover"). For strip `j`: `backgroundImage` = slide image, `backgroundSize = side px × side px`, `backgroundPosition = (-(j*tile) - (side-W)/2)px  (-(side-H)/2)px`, and `gsap.set(strip, { y: OFFSETS[j] * k })` where `k = photoWidth / 380`. Together the strips recompose the photo, each shifted vertically. Repaint on resize. Preload the four images at mount.

**go(n)** (wraps around):
- counter text `n+1 / 4`;
- `gsap.to(words, { x: -n * step, duration: wordDuration, ease: "power3.inOut", overwrite: true })`, `step = span[1].offsetLeft - span[0].offsetLeft`;
- kill the previous strip timeline, then timeline: strips `yPercent:105, duration:.35, stagger:stripStagger, ease:"power2.in"` → `paintStrips(n)` → `fromTo yPercent:-105 → 0, duration:.45, stagger, ease:"power3.out"`;
- caption: kill its tweens, `opacity 0` in .2 s, swap text, `opacity 1` in .3 s.

**Autoplay**: `setInterval(go(slide+1), interval*1000)` (skip when `document.hidden`); stopped on `pointerenter` and `focusin`, restarted on `pointerleave` (unless focus is inside) and `focusout` leaving the slider (unless hovered).

**Intro**: `.cs-chev` from `clipPath:"polygon(50% 46%, 50% 46%, 50% 46%, 50% 100%, 50% 100%, 50% 100%)"`, `.6 s`, stagger `.08`, `power3.out`; strips from `yPercent:-60, opacity:0` at `.15`; words from `opacity:0` at `.2`.

`prefers-reduced-motion: reduce`: no intro, no autoplay; buttons swap image, words and caption instantly.

**destroy()**: clear the interval and listeners, kill timelines, `clearProps` on words, caption and layers, empty the strips, reset caption and counter.

## Assets / images
Four square photos (600 × 600 JPEG), root-absolute:
- `/c/chevron-strip-slider/slide-ahorrar.jpg`
- `/c/chevron-strip-slider/slide-invertir.jpg`
- `/c/chevron-strip-slider/slide-prestar.jpg`
- `/c/chevron-strip-slider/slide-donar.jpg`

## Behavior notes
- The strips are background slices of one image, not seven images, so the photo always lines up when they settle.
- Because the strips keep their fixed `y` offsets and the swap animates `yPercent`, both transforms combine cleanly.
- The word track moves in steps of the measured distance between two words, so changing the type size only needs `--step`.
- Only the prefixed variables are global.

## Using this outside its demo page

This component is written as a complete page: that is how the demo is meant to look. If you are dropping it into an existing project, or combining it with other components, these are the things it declares at document level and that you need to move or reconcile first.

- **Palette on `:root`**: `--cs-bg`, `--cs-ink`, `--cs-layer-1`, `--cs-layer-2`, `--cs-accent`. Generic names like `--ink`, `--paper` or `--muted` are defined by many components in this catalogue with different values, and they will also collide with whatever your own project defines. Move them onto the component's wrapper (`.my-section { --ink: … }`) or keep the prefix.
- **Rules on `*, *::before, *::after`, `html, body`**: the demo owns the whole document, so these set the box model and resets. Dropped into an existing project they restyle the entire page, not just this section. Re-target them at the component's wrapper before using it.
