/* Licensed to account 52c7da1aea3f, 2026-10-19. Moving parts. */
/* Sticky showcase, the mechanics: the pinned media, the fins that turn, the texts that come to the line.
   Moving parts. The script writes the state, the step on the line and how far each fin has turned; the look of the preview follows.
   Readable source: components/sticky-showcase/sticky-showcase.css */

/* File layout: required mechanics, then the optional look.
   The rules before the line "look, left out of the Webflow Embed" are what
   the script needs: the steps laid on a grid of two columns, every media
   pinned in the same place, the fins over them, the texts that fade off the
   reading line, and the single column of a narrow screen. They set no font
   and no colour of text.

   The pin is CSS, sticky positioning, with no spacer and no scroll trigger.
   Without the script none of it applies: each step is its media, then its
   words, one under the other. */

/* ---------- colours and sizes ---------- */

/* Two colours and the sizes of the layout, zero specificity.
   Set any of them in a rule of your own on the block marked data-sticky-showcase:
   --sticky-showcase-accent, --sticky-showcase-ground, --sticky-showcase-top,
   --sticky-showcase-share, --sticky-showcase-inset-x, --sticky-showcase-inset-y,
   --sticky-showcase-step, --sticky-showcase-stack and --sticky-showcase-shade. */
:where([data-sticky-showcase]) {
  --sticky-showcase-css: 1;
  --sticky-showcase-accent: #ff4a00;
  --sticky-showcase-ground: #15100c;
  --sticky-showcase-top: 0px;
  --sticky-showcase-share: 56%;
  --sticky-showcase-inset-x: clamp(20px, 4.6vw, 84px);
  --sticky-showcase-inset-y: clamp(24px, 7vh, 72px);
  --sticky-showcase-step: 90vh;
  --sticky-showcase-stack: 52vh;
  --sticky-showcase-shade: 0.55;
  --sticky-showcase-dim: 0.55;
  --sticky-showcase-edge: clamp(2px, 0.2vw, 3px);
  --sticky-showcase-depth: clamp(900px, 120vw, 2200px);
  --sticky-showcase-words-column: 1;
  --sticky-showcase-media-column: 2;
}

@supports (height: 1svh) {
  :where([data-sticky-showcase]) {
    --sticky-showcase-step: 90svh;
    --sticky-showcase-stack: 52svh;
  }
}

/* ---------- two columns, the media pinned ---------- */

/* The steps give their two blocks to one grid: the words down one column,
   every media in the same cell of the other, as tall as the whole block. */
[data-sticky-showcase][data-sticky-showcase-state] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--sticky-showcase-share));
}

[data-sticky-showcase-state][data-sticky-showcase-side="left"] {
  --sticky-showcase-words-column: 2;
  --sticky-showcase-media-column: 1;
  grid-template-columns: minmax(0, var(--sticky-showcase-share)) minmax(0, 1fr);
}

[data-sticky-showcase-state] > [data-sticky-showcase-step] {
  display: contents;
}

/* The words of a step: one row each, the scroll a step takes as their height. */
[data-sticky-showcase-state] > [data-sticky-showcase-step] > * {
  grid-column: var(--sticky-showcase-words-column);
  grid-row: var(--sticky-showcase-row);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: var(--sticky-showcase-step);
  opacity: calc(var(--sticky-showcase-dim) + (1 - var(--sticky-showcase-dim)) * var(--sticky-showcase-near, 0));
}

/* A step that holds the focus is read at full strength. */
[data-sticky-showcase-state] > [data-sticky-showcase-step]:focus-within > * {
  opacity: 1;
}

/* The media of every step, the fins and the rail: one screen, held at the top. */
[data-sticky-showcase-state] > [data-sticky-showcase-step] > [data-sticky-showcase-media],
[data-sticky-showcase-state] > [data-sticky-showcase-stage],
[data-sticky-showcase-state] > [data-sticky-showcase-rail] {
  grid-column: var(--sticky-showcase-media-column);
  grid-row: 1 / span var(--sticky-showcase-count, 1);
  position: sticky;
  top: var(--sticky-showcase-top);
  align-self: start;
  box-sizing: border-box;
  display: block;
  width: auto;
  max-width: none;
  min-height: 0;
  height: calc(100vh - var(--sticky-showcase-top));
  margin: 0;
  padding: var(--sticky-showcase-inset-y) var(--sticky-showcase-inset-x);
}

@supports (height: 1svh) {
  [data-sticky-showcase-state] > [data-sticky-showcase-step] > [data-sticky-showcase-media],
  [data-sticky-showcase-state] > [data-sticky-showcase-stage],
  [data-sticky-showcase-state] > [data-sticky-showcase-rail] {
    height: calc(100svh - var(--sticky-showcase-top));
  }
}

/* Only the media of the step on the line is seen; the others stay in the
   page for whoever reads it without seeing it. */
[data-sticky-showcase-state] > [data-sticky-showcase-step] > [data-sticky-showcase-media] {
  z-index: 2;
  opacity: 0;
  pointer-events: none;
}

[data-sticky-showcase-state] > [data-sticky-showcase-step][data-sticky-showcase-active] > [data-sticky-showcase-media] {
  opacity: 1;
  pointer-events: auto;
}

/* While the fins turn they carry the two pictures themselves. */
[data-sticky-showcase-state][data-sticky-showcase-turning] > [data-sticky-showcase-step] > [data-sticky-showcase-media] {
  opacity: 0;
}

/* The picture or the video, whole, in the middle of its box. */
[data-sticky-showcase-state] [data-sticky-showcase-media] > picture {
  display: block;
  width: 100%;
  height: 100%;
}

[data-sticky-showcase-state] [data-sticky-showcase-media] > img,
[data-sticky-showcase-state] [data-sticky-showcase-media] > video,
[data-sticky-showcase-state] [data-sticky-showcase-media] > picture > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}

/* The rail: a block pinned over the media, for a counter. */
[data-sticky-showcase-state] > [data-sticky-showcase-rail] {
  z-index: 4;
  padding: 0;
  pointer-events: none;
}

[data-sticky-showcase]:not([data-sticky-showcase-state]) > [data-sticky-showcase-rail] {
  display: none;
}

/* ---------- the fins ---------- */

/* The stage: the same box as a media, under them, never in the way. */
[data-sticky-showcase-stage] {
  z-index: 1;
  container-type: size;
  overflow: hidden;
  overflow: clip;
  pointer-events: none;
}

/* The frame: as large as the stage allows at the ratio the script gives,
   which goes from one picture's to the next while the fins turn. */
[data-sticky-showcase-frame] {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(100cqw, 100cqh * var(--sticky-showcase-ratio, 1));
  aspect-ratio: var(--sticky-showcase-ratio, 1);
  transform: translate(-50%, -50%);
  container-type: size;
  perspective: var(--sticky-showcase-depth);
  visibility: hidden;
}

[data-sticky-showcase-turning] [data-sticky-showcase-frame] {
  visibility: visible;
}

/* A fin: one upright slice, turning about its own middle. */
[data-sticky-showcase-slat] {
  position: absolute;
  top: 0;
  left: calc(100cqw * var(--sticky-showcase-fin) / var(--sticky-showcase-fins));
  width: calc(100cqw / var(--sticky-showcase-fins) + 0.6px);
  height: 100%;
  transform: rotateY(calc(var(--sticky-showcase-turn, 0) * 180deg));
  transform-style: preserve-3d;
  will-change: transform;
}

/* A side of a fin: its slice of one picture. Two are shown, back to back. */
[data-sticky-showcase-cell] {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

[data-sticky-showcase-cell][data-sticky-showcase-face] {
  display: block;
}

[data-sticky-showcase-cell][data-sticky-showcase-face="back"] {
  transform: rotateY(180deg);
}

[data-sticky-showcase-cell] > img {
  position: absolute;
  top: 0;
  left: calc(-100cqw * var(--sticky-showcase-fin) / var(--sticky-showcase-fins));
  display: block;
  width: 100cqw;
  max-width: none;
  height: 100cqh;
  object-fit: cover;
}

[data-sticky-showcase-cell] > canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* A fin loses its light as it turns away. */
[data-sticky-showcase-cell]::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: #000;
  opacity: calc(var(--sticky-showcase-lit, 0) * var(--sticky-showcase-shade));
}

/* The edge of a fin, in the accent: seen only while the fin is edge on. */
[data-sticky-showcase-edge] {
  position: absolute;
  top: 0;
  left: calc(50% - var(--sticky-showcase-edge) / 2);
  width: var(--sticky-showcase-edge);
  height: 100%;
  background-color: var(--sticky-showcase-accent);
  opacity: clamp(0, (var(--sticky-showcase-lit, 0) - 0.97) * 34, 1);
  transform: rotateY(90deg);
}

/* ---------- the frame that fills its box ---------- */

[data-sticky-showcase-fit="cover"] [data-sticky-showcase-media] > img,
[data-sticky-showcase-fit="cover"] [data-sticky-showcase-media] > video,
[data-sticky-showcase-fit="cover"] [data-sticky-showcase-media] > picture > img {
  object-fit: cover;
}

[data-sticky-showcase-fit="cover"] [data-sticky-showcase-frame] {
  width: 100cqw;
  height: 100cqh;
  aspect-ratio: auto;
}

/* ---------- one column, on a narrow screen ---------- */

/* The media is pinned across the top of the window, edge to edge, and the
   texts pass under it: they are read in what is left of the screen. */
@media (max-width: 767px) {
  [data-sticky-showcase][data-sticky-showcase-state],
  [data-sticky-showcase][data-sticky-showcase-state][data-sticky-showcase-side="left"] {
    --sticky-showcase-words-column: 1;
    --sticky-showcase-media-column: 1;
    --sticky-showcase-step: calc(100vh - var(--sticky-showcase-top) - var(--sticky-showcase-stack));
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--sticky-showcase-stack);
  }

  @supports (height: 1svh) {
    [data-sticky-showcase][data-sticky-showcase-state],
    [data-sticky-showcase][data-sticky-showcase-state][data-sticky-showcase-side="left"] {
      --sticky-showcase-step: calc(100svh - var(--sticky-showcase-top) - var(--sticky-showcase-stack));
    }
  }

  [data-sticky-showcase-state] > [data-sticky-showcase-step] > * {
    grid-row: calc(var(--sticky-showcase-row) + 1);
  }

  [data-sticky-showcase-state] > [data-sticky-showcase-step] > [data-sticky-showcase-media],
  [data-sticky-showcase-state] > [data-sticky-showcase-stage],
  [data-sticky-showcase-state] > [data-sticky-showcase-rail] {
    grid-row: 1 / span calc(var(--sticky-showcase-count, 1) + 1);
    height: var(--sticky-showcase-stack);
    padding: 0;
  }

  [data-sticky-showcase-state] > [data-sticky-showcase-stage] {
    background-color: var(--sticky-showcase-ground);
  }

  [data-sticky-showcase-state] [data-sticky-showcase-media] > img,
  [data-sticky-showcase-state] [data-sticky-showcase-media] > video,
  [data-sticky-showcase-state] [data-sticky-showcase-media] > picture > img {
    object-fit: cover;
  }

  [data-sticky-showcase-state] [data-sticky-showcase-frame] {
    width: 100cqw;
    height: 100cqh;
    aspect-ratio: auto;
  }
}

/* ---------- reduced motion ---------- */

/* No fin: the media of the step on the line fades in over the last one,
   the stage staying behind them as their ground on a narrow screen. */
[data-sticky-showcase-state="still"] > [data-sticky-showcase-step] > * {
  transition: opacity 0.4s ease;
}

/* The Webflow Embed inside the block: no room. Its scripts run all the same. */
[data-sticky-showcase] > .w-embed {
  display: none;
}

/* ---------- look, left out of the Webflow Embed ---------- */

/* Clinix Studio: the look of the preview (the sticky-showcase-* classes of
   the dark page with five moments of light on a wall, set in Instrument
   Sans and Geist Mono) is left out of this copy on purpose. The service
   detail page keeps its own type, colours and spacing in
   src/pages/diensten/[slug].astro, and sets the accent, the ground and the
   sizes through the custom properties above, on the block. The mechanics
   above are the file as shipped. */
