/* Superion.gg – Animacje strony (moduł animacje). Działa tylko gdy <html> ma klasę sgg-anim (ustawia ją skrypt w <head>).
   Animujemy wyłącznie opacity + osobne właściwości translate/scale – istniejące hovery (transform: scale) zostają nietknięte,
   a układ strony się nie przesuwa. Przed wejściem element jest tylko przezroczysty (zajmuje swoje miejsce). */

:root {
    --sgg-a-ease: cubic-bezier(.2, .75, .2, 1);
    --sgg-a-dur: .75s;
    --sgg-a-dist: 28px;
}
@media (max-width: 767px) {
    :root { --sgg-a-dur: .55s; --sgg-a-dist: 16px; }
}

/* ── Stan przed wejściem ───────────────────────────────── */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-ticker,
    .sgg-art-card,
    .sgg-sbm__row,
    .sgg-najnowsze .sgg-ncard,
    .tdm_block_inline_text:has(+ .td_block_categories_tags),
    .td_block_categories_tags .td-ct-item,
    .sgg-fw__col
):not(.sgg-in) { opacity: 0; }

/* Współpraca – osobna lista (gdy przeglądarka nie zna :has, pada tylko ta reguła, nie ta wyżej) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-wspolpraca__hero-line, .sgg-wspolpraca__hero-label, .sgg-wspolpraca__hero-title, .sgg-wspolpraca__hero-sub,
    .sgg-wspolpraca__about-heading, .sgg-wspolpraca__tl-item, .sgg-wspolpraca__tl-line, .sgg-wspolpraca__quality-item,
    .sgg-wspolpraca__social-card, .sgg-wspolpraca__stat-card,
    .sgg-wp__section-heading, .sgg-wp__trust-card, .sgg-wp__type-tabs, .sgg-wp__card, .sgg-wp__choice,
    .sgg-wp__footnote, .sgg-wp__channel, .sgg-form__section, .sgg-form__submit
):not(.sgg-in) { opacity: 0; }
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-anim-wsp .tdc-content-wrap .td-spa-hero .tdm_block,
    .sgg-anim-wsp .tdc-content-wrap .td_block_title,
    .sgg-anim-wsp .tdc-content-wrap :is(.td_block_text_with_title, .tdm_block_socials, .tdm_block_button_simplified):not(:has(.sgg-wspolpraca, .sgg-form))
):not(.sgg-in) { opacity: 0; }

/* Regulamin + Logo */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-regulamin-header__line, .sgg-regulamin-header__label, .sgg-regulamin-header__title, .sgg-regulamin-header__meta,
    .sgg-regulamin-pdf, .sgg-regulamin-body > ol > li, .sgg-regulamin-body > ol > li > ol > li,
    .sgg-reg-hist__header, .sgg-reg-hist__item,
    .sgg-logo-dl-header__line, .sgg-logo-dl-header__title, .sgg-logo-dl-header__sub, .sgg-logo-dl-notice,
    .sgg-logo-dl-section__title, .sgg-logo-dl-card
):not(.sgg-in) { opacity: 0; }

/* Partnerzy */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-main-title, .sgg-header-description, .sgg-header-cta, .sgg-partnerzy-filters, .sgg-parent-title,
    .sgg-partnerzy-section .sgg-section-title, .sgg-partner-card
):not(.sgg-in) { opacity: 0; }

/* Ogłoszenia */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-ogl-hero__title, .sgg-ogl-hero__sub, .sgg-ogl-tabs, .sgg-ogl-toolbar, .sgg-ogl-game-bar, .sgg-ogl-src-bar,
    .sgg-ogl-req-bar, .sgg-ogl-card, .sgg-ogl-pager
):not(.sgg-in) { opacity: 0; }

/* Redakcja (/redakcja/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-red-eyebrow, .sgg-red-title, .sgg-red-tagline, .sgg-red-desc, .sgg-red-btn, .sgg-red-section-header, .sgg-red-card, .sgg-red-support-eyebrow, .sgg-red-support-title, .sgg-red-support-desc, .sgg-red-support-card, .sgg-red-zrzutka-heading, .sgg-red-zrzutka-note
):not(.sgg-in) { opacity: 0; }

/* Rekrutacja (/redaktor/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-rek-header__line, .sgg-rek-header__title, .sgg-rek-header__sub, .sgg-rek-about, .sgg-rek-details__row, .sgg-rek-panel, .sgg-rek-panel__list > li, .sgg-rek-join, .sgg-rek-join__link
):not(.sgg-in) { opacity: 0; }

/* Profile drużyn (/profile-druzyn/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-pdh-eyebrow, .sgg-pdh-title, .sgg-pdh-subtitle, .sgg-pd-sortbar, .sgg-pd-card
):not(.sgg-in) { opacity: 0; }

/* Profil drużyny (np. /yng-skillz/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-team-info-title, .sgg-team-card, .monthly-posts-container .articles-header, .monthly-posts-container .month-item, .sgg-zmiany-header, .sgg-zmiana-item
):not(.sgg-in) { opacity: 0; }

/* Organizatorzy (/organizatorzy/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-org-header__line, .sgg-org-header__title, .sgg-org-header__desc, .sgg-org-card
):not(.sgg-in) { opacity: 0; }

/* Profil organizatora (np. /vofoxen/, /lunacy-cup/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-op__eyebrow, .sgg-op__hero-name, .sgg-op__hero-actions, .sgg-op__hero-logo, .sgg-op__hero-socials, .sgg-op__nav-wrap, .sgg-op__card, .sgg-op__cell, .sgg-op__stat, .sgg-op__relacja, .sgg-op__art-featured, .sgg-op__art-row
):not(.sgg-in) { opacity: 0; }

/* Relacje: Immunity (sgg-ir) + terminarz */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-ir__eyebrow, .sgg-ir__hero-name, .sgg-ir__hero-actions, .sgg-ir__hero-logo, .sgg-ir__socials, .sgg-ir__nav-wrap, .sgg-ir__card, .sgg-ir__cell, .sgg-ir__place, .sgg-ir__award, .sgg-ir__po-match, .immunity-round-title, .immunity-match-card
):not(.sgg-in) { opacity: 0; }

/* Relacje: generator (np. /clanarea/cup/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-ca__eyebrow, .sgg-ca__title, .sgg-ca__hero-tags, .sgg-ca__hero-links, .sgg-ca__hero-logo, .sgg-ca__phase, .sgg-ca__round-title, .sgg-ca__match, .sgg-ca__teams-head, .sgg-ca__tcard, .sgg-ca__articles-title, .sgg-ca__art-filters, .sgg-ca__art
):not(.sgg-in) { opacity: 0; }

/* Awards – moduł ma własne wejście nagłówków / kategorii / kart; tu tylko reszta */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-aw-hero__intro, .sgg-aw-hero__links, .sgg-aw-noms-head__sub, .sgg-aw-cat__total
):not(.sgg-in) { opacity: 0; }

/* Discord (/discord/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-dc__eyebrow, .sgg-dc__title, .sgg-dc__desc, .sgg-dc__avatars, .sgg-dc__invite, .sgg-dc__tile, .sgg-dc__card, .sgg-dc__list > *, .sgg-dc__bar, .sgg-dc__h2, .sgg-dc__feature, .sgg-dc__steps
):not(.sgg-in) { opacity: 0; }

/* Mecze (/mecze/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-mpage__eyebrow, .sgg-mpage__title, .sgg-mpage__lead, .sgg-mpage__stat, .sgg-mpage__side, .sgg-mpage__tabs, .sgg-mpage__dayh, .sgg-mpage__row
):not(.sgg-in) { opacity: 0; }

/* Użytkownicy (/uzytkownicy/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .usd-head, .usd-bar, .usd-card, .usd-pager
):not(.sgg-in) { opacity: 0; }

/* Kontakt (/kontakt/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-kontakt__line, .sgg-kontakt__title, .sgg-kontakt__subtitle, .sgg-kontakt__email-card, .sgg-kontakt__social, .sgg-kf__head, .sgg-kf__field, .sgg-kf__check, .sgg-kf__foot
):not(.sgg-in) { opacity: 0; }

/* Aplikacja (/aplikacja/, /en/app/) */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-app__eyebrow, .sgg-app__h1, .sgg-app__lead, .sgg-app__cta-row, .sgg-app__meta, .sgg-app__phone, .sgg-app__h2, .sgg-app__sub, .sgg-app__feat, .sgg-app__steps > li, .sgg-app__faq > details, .sgg-app__final
):not(.sgg-in) { opacity: 0; }

/* user-system: logowanie / reset hasła */
.sgg-anim:not(.sgg-anim-off) :is(
    .us-login-header, .us-login-title, .us-discord-btn, .us-divider, .us-login-form .us-form-group, .us-form-options-row, .us-login-submit, .us-login-card .us-register-link
):not(.sgg-in) { opacity: 0; }

/* user-system: zapomniałem hasła */
.sgg-anim:not(.sgg-anim-off) :is(
    .us-fp-header, .us-forgot-password-description, .us-forgot-password-form .us-form-group, .us-forgot-password-submit, .us-forgot-password-links
):not(.sgg-in) { opacity: 0; }

/* user-system: rejestracja / edycja profilu */
.sgg-anim:not(.sgg-anim-off) :is(
    .us-reg-header, .us-profile-edit-header, .us-form-section, .us-form-actions, .us-form-footer
):not(.sgg-in) { opacity: 0; }

/* user-system: profil użytkownika (/user/…) */
.sgg-anim:not(.sgg-anim-off) :is(
    .usm-back, .usm-av, .usm-id, .usm-tags, .usm-socials, .usm-stats > div, .usm-card, .usm-badge, .usm-post
):not(.sgg-in) { opacity: 0; }

/* Teambook – tylko gość (logowanie) i konto bez drużyny (formularz zgłoszenia) */
.sgg-anim:not(.sgg-anim-off) :is(
    .tbl-eyebrow, .tbl-h1, .tbl-lead, .tbl-cta, .tbl-card, .tbl-perks > *, .tbl-showcase, .tbl-section-title, .tbl-feat, .tbl-steps > *, .tbl-foot, .tba-hero > *, .tba-card, .tb-app-section, .tba-side > *, .tba-teams-head, .tba-team, .tba-foot
):not(.sgg-in) { opacity: 0; }

/* Elementy „tylko poniżej ekranu” (np. treść artykułu) – klasę sgg-a-wait dodaje animacje.js wyłącznie temu, czego nie widać */
.sgg-anim:not(.sgg-anim-off) .sgg-a-wait:not(.sgg-in) { opacity: 0; }

/* Reklama */
.sgg-anim:not(.sgg-anim-off) :is(
    .sgg-reklama-header__line, .sgg-reklama-header__title, .sgg-reklama-header__sub, .sgg-reklama-intro,
    .sgg-reklama-section-title, .sgg-reklama-placements-note, .sgg-reklama-slot-note, .sgg-reklama-placement,
    .sgg-reklama-info__item, .sgg-reklama-pricing__item, .sgg-reklama-stats__item, .sgg-reklama-contact,
    :is(.sgg-reklama-purchase__list, .sgg-reklama-payment__list, .sgg-reklama-banned__list) > li
):not(.sgg-in) { opacity: 0; }

/* ── Wejście ──────────────────────────────────────────── */
.sgg-anim .sgg-in {
    animation: var(--sgg-a-name, sgg-a-up) var(--sgg-a-dur) var(--sgg-a-ease) backwards;
    animation-delay: var(--sgg-d, 0ms);
}
.sgg-anim .sgg-in.sgg-a--up    { --sgg-a-name: sgg-a-up; }
.sgg-anim .sgg-in.sgg-a--down  { --sgg-a-name: sgg-a-down; }
.sgg-anim .sgg-in.sgg-a--right { --sgg-a-name: sgg-a-right; }
.sgg-anim .sgg-in.sgg-a--zoom  { --sgg-a-name: sgg-a-zoom; --sgg-a-dur: .9s; }
.sgg-anim .sgg-in.sgg-a--fade  { --sgg-a-name: sgg-a-fade; }
.sgg-anim .sgg-in.sgg-a--left  { --sgg-a-name: sgg-a-left; }
.sgg-anim .sgg-in.sgg-a--pop   { --sgg-a-name: sgg-a-pop; --sgg-a-dur: .7s; --sgg-a-ease: cubic-bezier(.34, 1.56, .64, 1); }
.sgg-anim .sgg-in.sgg-a--line  { --sgg-a-name: sgg-a-line; --sgg-a-dur: 1s; }

@keyframes sgg-a-up    { from { opacity: 0; translate: 0 var(--sgg-a-dist); scale: .985; } }
@keyframes sgg-a-down  { from { opacity: 0; translate: 0 calc(var(--sgg-a-dist) * -.6); } }
@keyframes sgg-a-right { from { opacity: 0; translate: var(--sgg-a-dist) 0; } }
@keyframes sgg-a-zoom  { from { opacity: 0; scale: .96; translate: 0 calc(var(--sgg-a-dist) * .6); } }
@keyframes sgg-a-fade  { from { opacity: 0; } }
@keyframes sgg-a-left  { from { opacity: 0; translate: calc(var(--sgg-a-dist) * -1) 0; } }
@keyframes sgg-a-pop   { from { opacity: 0; scale: .8; translate: 0 10px; } }
@keyframes sgg-a-line  { from { opacity: 0; scale: 0 1; } }   /* linie „rysują się” od środka */

/* Miniatura w karcie: lekki „najazd” obrazka razem z wejściem karty (scale ≠ transform z hovera) */
.sgg-anim .sgg-in :is(.sgg-art-card__thumb-wrap, .sgg-ncard__thumb) img {
    animation: sgg-a-img 1.1s var(--sgg-a-ease) backwards;
    animation-delay: var(--sgg-d, 0ms);
}
@keyframes sgg-a-img { from { scale: 1.12; filter: saturate(.6) brightness(.85); } }

/* ── Slider: tekst slajdu przy KAŻDEJ zmianie (pierwszy slajd bez animacji – nie opóźniamy LCP) ── */
.sgg-anim .sgg-slider.sgg-a-live .sgg-slider__slide.is-active :is(.sgg-slider__meta, .sgg-slider__title, .sgg-slider__excerpt, .sgg-slider__btn) {
    animation: sgg-a-slide .8s var(--sgg-a-ease) backwards;
}
.sgg-anim .sgg-slider.sgg-a-live .sgg-slider__slide.is-active .sgg-slider__meta    { animation-delay: .12s; }
.sgg-anim .sgg-slider.sgg-a-live .sgg-slider__slide.is-active .sgg-slider__title   { animation-delay: .22s; }
.sgg-anim .sgg-slider.sgg-a-live .sgg-slider__slide.is-active .sgg-slider__excerpt { animation-delay: .34s; }
.sgg-anim .sgg-slider.sgg-a-live .sgg-slider__slide.is-active .sgg-slider__btn     { animation-delay: .46s; }
@keyframes sgg-a-slide { from { opacity: 0; translate: 0 22px; } }

/* Kropki slidera: aktywna „rośnie” */
.sgg-anim .sgg-slider__dot { transition: scale .3s var(--sgg-a-ease), opacity .3s; }
.sgg-anim .sgg-slider__dot.is-active { scale: 1.25; }

/* Paralaksa tła (JS ustawia --sgg-par tylko na desktopie) */
@media (min-width: 1019px) and (hover: hover) {
    .sgg-anim .sgg-slider.sgg-a-par .sgg-slider__bg { translate: 0 var(--sgg-par, 0px); will-change: translate; }
}

/* ── Hover: uniesienie kart (translate ≠ transform – nie gryzie się z istniejącym zoomem miniatury) ── */
@media (hover: hover) and (pointer: fine) {
    .sgg-anim .sgg-art-card.sgg-in,
    .sgg-anim .sgg-ncard.sgg-in {
        transition: border-color .15s, background .15s, translate .3s var(--sgg-a-ease), box-shadow .3s var(--sgg-a-ease);
    }
    .sgg-anim .sgg-art-card.sgg-in:hover,
    .sgg-anim .sgg-ncard.sgg-in:hover {
        translate: 0 -4px;
        box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .55), 0 0 0 1px rgba(106, 184, 255, .18);
    }
    .sgg-anim .sgg-sbm__row.sgg-in { transition: translate .25s var(--sgg-a-ease), background .2s; }
    .sgg-anim .sgg-sbm__row.sgg-in:hover { translate: 3px 0; }
    .sgg-anim .td_block_categories_tags .td-ct-item.sgg-in { transition: translate .25s var(--sgg-a-ease), color .2s; }
    .sgg-anim .td_block_categories_tags .td-ct-item.sgg-in:hover { translate: -4px 0; }

    /* Połysk na etykietach kategorii */
    .sgg-anim :is(.sgg-art-card__cat, .sgg-slider__cat, .sgg-ncard__cat) { position: relative; overflow: hidden; }
    .sgg-anim :is(.sgg-art-card__cat, .sgg-slider__cat, .sgg-ncard__cat)::after {
        content: ""; position: absolute; inset: 0; pointer-events: none;
        background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
        translate: -120% 0;
    }
    .sgg-anim :is(.sgg-art-card__cat, .sgg-slider__cat, .sgg-ncard__cat):hover::after,
    .sgg-anim :is(.sgg-art-card, .sgg-ncard):hover :is(.sgg-art-card__cat, .sgg-ncard__cat)::after {
        transition: translate .7s var(--sgg-a-ease);
        translate: 120% 0;
    }
}
html.sgg-anim[data-sgg-theme="light"] :is(.sgg-art-card, .sgg-ncard).sgg-in:hover {
    box-shadow: 0 14px 28px -14px rgba(15, 23, 42, .3), 0 0 0 1px rgba(59, 130, 246, .2);
}

/* Logo: podgląd lekko się unosi przy najechaniu */
@media (hover: hover) and (pointer: fine) {
    .sgg-anim .sgg-logo-dl-card.sgg-in { transition: translate .3s var(--sgg-a-ease), box-shadow .3s var(--sgg-a-ease); }
    .sgg-anim .sgg-logo-dl-card.sgg-in:hover { translate: 0 -5px; box-shadow: 0 16px 32px -14px rgba(0, 0, 0, .5); }
    .sgg-anim .sgg-logo-dl-card__preview img { transition: scale .4s var(--sgg-a-ease); }
    .sgg-anim .sgg-logo-dl-card.sgg-in:hover .sgg-logo-dl-card__preview img { scale: 1.06; }
}

/* Reklama: miejsca i cennik unoszą się przy najechaniu */
@media (hover: hover) and (pointer: fine) {
    .sgg-anim :is(.sgg-reklama-placement, .sgg-reklama-pricing__item).sgg-in { transition: translate .3s var(--sgg-a-ease), box-shadow .3s var(--sgg-a-ease), border-color .2s, background .2s; }
    .sgg-anim :is(.sgg-reklama-placement, .sgg-reklama-pricing__item).sgg-in:hover { translate: 0 -4px; box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .5); }
}

/* Ogłoszenia: karta unosi się przy najechaniu */
@media (hover: hover) and (pointer: fine) {
    .sgg-anim .sgg-ogl-card.sgg-in { transition: border-color .2s, background .2s, box-shadow .2s, translate .3s var(--sgg-a-ease); }
    .sgg-anim .sgg-ogl-card.sgg-in:hover { translate: 0 -3px; }
}

/* ── Bezpieczniki ─────────────────────────────────────── */
.sgg-anim-off .sgg-in,
.sgg-anim-off .sgg-in img { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
    .sgg-anim *, .sgg-anim *::after { animation: none !important; transition: none !important; }
    /* skrypt w <head> i tak nie włącza animacji przy „ogranicz ruch”; to na wypadek zmiany ustawienia w trakcie wizyty –
       tylko elementy oznaczone przez animacje.js (data-sgg-a), nic innego na stronie */
    .sgg-anim [data-sgg-a], .sgg-anim .sgg-ticker, .sgg-anim .sgg-art-card { opacity: 1 !important; }
    .sgg-anim .sgg-slider__bg { translate: none !important; }
}
