/* =========================================================
   CORE — wspólne style dla wszystkich stron
   (kursor, przejścia stron, animacje tekstu, UI dem)
   ========================================================= */

:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
  --core-ink: #1A1633;
  --core-paper: #ECEAF6;
  --core-signal: #4B3BFF;
  --core-spark: #FF6B4A;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.smooth { scroll-behavior: auto; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
img, video, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
::selection { background: var(--core-signal); color: #fff; }

:focus-visible { outline: 2px solid var(--core-signal); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Kursor (tylko myszka) ---------- */
.has-cursor, .has-cursor * { cursor: none !important; }
.has-cursor input, .has-cursor textarea { cursor: text !important; }

.cursor, .cursor-label {
  position: fixed; top: 0; left: 0; z-index: 10000; pointer-events: none;
  will-change: transform;
}
.cursor { mix-blend-mode: difference; }
.cursor__dot {
  display: block; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: #fff;
  transform: scale(0); transition: transform .45s var(--ease-out);
}
.cursor.is-on .cursor__dot { transform: scale(1); }
.cursor.is-link .cursor__dot { transform: scale(3.2); }
.cursor.is-press .cursor__dot { transform: scale(.6); }
.cursor.is-hidden .cursor__dot { transform: scale(0); }

.cursor-label span {
  display: block; translate: -50% -50%;
  padding: .85em 1.2em; border-radius: 99px;
  background: var(--cursor-bg, var(--core-signal)); color: var(--cursor-fg, #fff);
  font: 600 13px/1 "Bricolage Grotesque", system-ui, sans-serif; letter-spacing: .01em; white-space: nowrap;
  transform: scale(0); transition: transform .5s var(--ease-out);
}
.cursor-label.is-on span { transform: scale(1); }

/* ---------- Przejście między stronami (kurtyna) ---------- */
.pt {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  display: grid; place-items: center;
  background: var(--core-ink);
  background-image: radial-gradient(rgba(236,234,246,.16) 1.2px, transparent 1.3px);
  background-size: 14px 14px;
  transform: translateY(101%);
}
.pt__label {
  color: var(--core-paper);
  font: 700 clamp(28px, 5vw, 64px)/1 "Bricolage Grotesque", system-ui, sans-serif;
  letter-spacing: -.03em;
  opacity: 0; transform: translateY(30px);
  transition: opacity .4s ease, transform .6s var(--ease-out);
}
.pt.is-cover { transform: translateY(0); transition: transform .75s var(--ease-io); pointer-events: all; }
.pt.is-cover .pt__label { opacity: 1; transform: none; transition-delay: .3s; }
.pt-in .pt { transform: translateY(0); transition: none; }
.pt.is-leave { transform: translateY(-101%); transition: transform .9s var(--ease-io); }

/* ---------- Animacje tekstu (dzielenie na słowa / litery) ---------- */
.js [data-split] .w {
  display: inline-block; overflow: hidden; vertical-align: top;
  padding: .06em 0 .12em; margin: -.06em 0 -.12em;
}
.js [data-split] .w__i, .js [data-split] .c {
  display: inline-block;
  transform: translate3d(0, 115%, 0) rotate(4deg);
  transform-origin: 0 100%;
  transition: transform 1.1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger, 45ms) + var(--d, 0ms));
}
.js [data-split="chars"] .w__i { transform: none; transition: none; }
.js [data-split].is-in .w__i, .js [data-split].is-in .c { transform: none; }

/* Pojawianie elementów */
.js [data-reveal] {
  opacity: 0; transform: translateY(32px);
  transition: opacity 1s ease, transform 1.2s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.js [data-reveal="clip"] {
  opacity: 1; transform: none;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.4s var(--ease-io);
  transition-delay: var(--d, 0ms);
}
.js [data-reveal="clip"] img { transform: scale(1.25); transition: transform 1.8s var(--ease-out); transition-delay: var(--d, 0ms); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal="clip"].is-in { clip-path: inset(0 0 0 0); }
.js [data-reveal="clip"].is-in img { transform: scale(1); }

/* Przyciski magnetyczne */
[data-magnetic] { transition: transform .6s var(--ease-out); will-change: transform; }

/* Tekst przewijany w górę na hover (jak w savvia) */
.roll { display: inline-flex; overflow: hidden; vertical-align: top; height: 1.2em; line-height: 1.2; }
.roll > span { display: block; transition: transform .6s var(--ease-out); }
.roll > span::after { content: attr(data-text); display: block; }
a:hover .roll > span, button:hover .roll > span, .roll:hover > span { transform: translateY(-50%); }

/* Pasek z przewijanym tekstem */
.marquee, [data-marquee] { overflow: hidden; white-space: nowrap; }
.marquee__track > * { flex: none; }
.marquee__track { display: inline-flex; will-change: transform; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 9500;
  translate: -50% 0; transform: translateY(140%);
  padding: 14px 22px; border-radius: 99px;
  background: var(--core-ink); color: var(--core-paper);
  font: 500 14px/1.3 "Bricolage Grotesque", system-ui, sans-serif;
  box-shadow: 0 20px 50px -20px rgba(26,22,51,.6);
  transition: transform .6s var(--ease-out);
  pointer-events: none;
}
.toast.is-on { transform: none; }

/* ---------- Elementy wspólne dla stron demo ---------- */
.demo-bar {
  position: fixed; z-index: 8000; left: 50%; bottom: 20px; translate: -50% 0;
  display: flex; align-items: center; gap: 4px;
  padding: 5px; border-radius: 99px;
  background: rgba(26,22,51,.86); color: var(--core-paper);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font: 500 13px/1 "Bricolage Grotesque", system-ui, sans-serif;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,.5);
  transform: translateY(160%); transition: transform .8s var(--ease-out) .6s;
}
.is-ready .demo-bar { transform: none; }
.demo-bar a {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  padding: 10px 16px; border-radius: 99px; background: var(--core-paper); color: var(--core-ink); font-weight: 600;
  transition: background .3s;
}
.demo-bar a:hover { background: #fff; }
.demo-bar a svg { width: 14px; height: 14px; }
.demo-bar span { padding: 0 14px 0 10px; opacity: .75; white-space: nowrap; }
@media (max-width: 520px) { .demo-bar span { display: none; } }

/* Scroll lock dla modali */
.is-locked { overflow: hidden; }

/* ---------- Ograniczony ruch ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
  .js [data-split] .w__i, .js [data-split] .c, .js [data-reveal] { transform: none !important; opacity: 1 !important; clip-path: none !important; }
  .js [data-reveal="clip"] img { transform: none !important; }
}
[hidden] { display: none !important; }

/* Strona osadzona jako podgląd (iframe) — bez kursora i paska demo */
.in-frame .demo-bar, .in-frame .cursor, .in-frame .cursor-label { display: none !important; }
