/* OneShot – warstwa strukturalna (płótno, sceny, warstwa zapasowa, storyboard, rekwizyty).
   Bez kolorów marki, krojów i przycisków – to dostarcza strona. Zmienne do nadpisania w CSS strony:
   --os-head-h      wysokość nagłówka (ustawia boot.js)
   --os-bg          tło pod płótnem i warstwą zapasową (domyślnie czarne)
   --os-board-scrim przyciemnienie zdjęcia pod tekstem w storyboardzie
   --os-board-min   minimalna wysokość sekcji w storyboardzie
   --os-scene-min   minimalna wysokość sekcji w trybie kamery (długość ujęcia = droga przewijania)
   Tryby: domyślnie storyboard (bez JS, bez WebGL2, prefers-reduced-motion, ?os=board); html.os-motion – kamera. */

:root {
  --os-head-h: 64px;
  --os-bg: #000;
  --os-board-scrim: linear-gradient(0deg, rgb(0 0 0 / .72), rgb(0 0 0 / .38) 55%, rgb(0 0 0 / .2));
  --os-board-min: 78vh;
  --os-scene-min: 200vh;
  --os-mono-filter: grayscale(1) contrast(1.18) brightness(.97);
}

/* ---------- storyboard (podstawa): zdjęcie jako tło sekcji, tekst nad nim ---------- */
.os-stage, .os-fb { display: none; }
[data-shot] { position: relative; isolation: isolate; min-height: var(--os-board-min); }
[data-shot] > .os-plate {
  position: absolute; inset: 0; z-index: -2; display: block;
  width: 100%; height: 100%; max-width: none; object-fit: cover;
  object-position: var(--os-fx, 50%) var(--os-fy, 50%);
}
[data-shot]::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--os-board-scrim); }
html[data-os-grade="mono"] .os-plate, html[data-os-grade="mono"] .os-fb img { filter: var(--os-mono-filter); }

/* rekwizyty w storyboardzie: zwykły przepływ */
.os-stick { display: grid; place-items: center; width: 100%; }
[data-prop] { transform-style: preserve-3d; }

/* ---------- tryb kamery ---------- */
html.os-motion .os-stage {
  display: block; position: fixed; left: 0; top: 0; z-index: 0;
  width: 100%; height: 100vh; height: 100lvh; pointer-events: none;
  opacity: 0; transition: opacity 1.2s cubic-bezier(.16, 1, .3, 1);
}
html.os-motion.os-ready .os-stage { opacity: 1; }
html.os-motion body { background-color: var(--os-bg); }
html.os-motion [data-shot] { min-height: var(--os-scene-min); }
html.os-motion [data-shot]::before { display: none; }
html.os-motion [data-shot] > .os-plate { display: none; }

/* Kadr LCP (pierwsza sekcja): widoczny od pierwszego malowania, przyklejony do ekranu, gaśnie, gdy płótno ma obraz.
   Ujemny margines: nie przesuwa treści sekcji. */
html.os-motion [data-shot] > .os-plate--lcp {
  display: block; position: sticky; top: 0; inset: auto;
  height: 100vh; height: 100lvh; margin-bottom: -100vh; margin-bottom: -100lvh;
  transition: opacity 1.2s cubic-bezier(.16, 1, .3, 1);
}
html.os-motion.os-ready [data-shot] > .os-plate--lcp { opacity: 0; }

/* warstwa zapasowa (watchdog w motion.js) */
html.os-motion.os-fb-on .os-fb { display: block; position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--os-bg); pointer-events: none; }
.os-fb img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; opacity: 0; transition: opacity .6s cubic-bezier(.16, 1, .3, 1); transform-origin: 55% 50%; }
.os-fb img.is-on { opacity: 1; }

/* przyklejony kontener rekwizytów: ruch daje kamera, nie przewijanie */
@media (min-width: 900px) {
  html.os-motion .os-stick { position: sticky; top: 0; height: 100vh; padding-top: var(--os-head-h); perspective: 1400px; }
  html.os-motion [data-prop] { will-change: transform; }
}

/* nagłówki dzielone na słowa: maska z zapasem na polskie znaki (Ż, ą, ę) */
.os-wd { display: inline-block; clip-path: inset(-.25em -.08em -.22em -.08em); }
.os-wd > span { display: inline-block; will-change: transform; }

/* stopka zasłania płótno (stage przestaje rysować, gdy jej góra dojdzie do góry ekranu) */
html.os-motion .os-end { position: relative; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .os-stage, .os-fb { display: none !important; }
  .os-wd > span, [data-prop] { transform: none !important; }
}
@media print {
  .os-stage, .os-fb { display: none !important; }
}
