/* Przelacznik strony pokazowej (application/core/templates/mateusz/layouts/demo-switcher.phtml, takze na stronach
   pokazowych starych szablonow przez core/layout.phtml): karta w prawym dolnym rogu z wersja strony i paletami
   szablonu, na telefonie zwinieta do przycisku nad paskiem demo. Wlasny krój i kolory (nie z palety), zeby nie zmienial
   sie razem z paleta, ktora przestawia. */
.demo-switcher {
    --ds-ink: #1d1d1b;
    --ds-muted: #63615c;
    --ds-line: #e4e2dd;
    --ds-soft: #f2f1ee;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9990;
    font: 500 14px/1.35 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--ds-ink);
}
.demo-switcher [hidden] { display: none !important; }
.demo-switcher button { font: inherit; color: inherit; cursor: pointer; }
.demo-switcher :focus-visible { outline: 2px solid #0c6cb5; outline-offset: 2px; }

.demo-switcher__fab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px 12px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--ds-ink);
    color: #fff !important;
    font-weight: 650;
    box-shadow: 0 10px 28px -8px rgba(0, 0, 0, .45);
    transition: transform .25s cubic-bezier(.16, 1, .3, 1), box-shadow .25s ease-out;
}
.demo-switcher__fab:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -8px rgba(0, 0, 0, .5); }
.demo-switcher__fab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.demo-switcher__fab svg circle { fill: currentColor; stroke: none; }

.demo-switcher__panel {
    width: 344px;
    padding: 16px 18px 18px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .06);
    transform-origin: 100% 100%;
    animation: demo-switcher-in .32s cubic-bezier(.16, 1, .3, 1);
}
@keyframes demo-switcher-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }

.demo-switcher__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.demo-switcher__title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.demo-switcher__close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-right: -6px;
    border: 0;
    border-radius: 50%;
    background: transparent;
}
.demo-switcher__close:hover { background: var(--ds-soft); }
.demo-switcher__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.demo-switcher__label { margin: 0 0 8px; color: var(--ds-muted); font-size: 13px; font-weight: 600; }
.demo-switcher__segment + .demo-switcher__label,
.demo-switcher__templates + .demo-switcher__label { margin-top: 16px; }

.demo-switcher__templates { display: flex; flex-wrap: wrap; gap: 5px; }
.demo-switcher__chip {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--ds-line);
    border-radius: 999px;
    color: var(--ds-ink) !important;
    font-weight: 650;
    text-decoration: none !important;
    transition: background-color .2s ease-out, border-color .2s ease-out;
}
a.demo-switcher__chip:hover { border-color: var(--ds-ink); }
.demo-switcher__chip[aria-current] { border-color: var(--ds-ink); background: var(--ds-ink); color: #fff !important; }

.demo-switcher__segment { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; padding: 4px; border-radius: 999px; background: var(--ds-soft); }
.demo-switcher__option {
    padding: 9px 12px;
    border-radius: 999px;
    color: var(--ds-ink) !important;
    font-weight: 650;
    text-align: center;
    text-decoration: none !important;
    transition: background-color .2s ease-out;
}
a.demo-switcher__option:hover { background: rgba(0, 0, 0, .06); }
.demo-switcher__option[aria-current] { background: var(--ds-ink); color: #fff !important; }
.demo-switcher__option.is-soon { color: #a9a6a0 !important; cursor: default; }

.demo-switcher__swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.demo-switcher__swatch {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--swatch-a) 0 50%, var(--swatch-b) 50% 100%);
    box-shadow: 0 0 0 1px var(--ds-line), 0 2px 6px rgba(0, 0, 0, .12);
    transition: transform .2s cubic-bezier(.16, 1, .3, 1), box-shadow .2s ease-out;
}
.demo-switcher__swatch:hover { transform: scale(1.08); }
.demo-switcher__swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ds-ink), 0 2px 6px rgba(0, 0, 0, .12); }
.demo-switcher__name { min-height: 1.35em; margin: 10px 0 0; color: var(--ds-muted); font-size: 13px; }

/* Przejscie kolorow przy zmianie palety (tylko na chwile po kliknieciu) */
html.demo-palette-swap *, html.demo-palette-swap *::before, html.demo-palette-swap *::after {
    transition: background-color .45s ease-out, color .45s ease-out, border-color .45s ease-out, fill .45s ease-out, box-shadow .45s ease-out !important;
}

/* Telefon i tablet: pasek demo jest na dole, przycisk i karta nad nim */
@media (max-width: 992px) {
    .demo-switcher { right: 12px; bottom: 92px; }
    .demo-switcher__panel { width: min(344px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
    .demo-switcher__panel { animation: none; }
    .demo-switcher__fab, .demo-switcher__swatch { transition: none; }
    html.demo-palette-swap * { transition: none !important; }
}
