/* ==========================================================================
   Pas a Remigi (2026-10-31, canviapp.js)
   Al mòbil, a la portada, lliscant el dit cap a un costat pel mig de la pantalla entra el panell .app-switch des del
   costat contrari, seguint el dit, amb «Remigi» en el verd de la seva taula; en deixar-lo anar passat el llindar
   s'obre eltauler.cat/remigi/. Les tres primeres vegades, l'avís .app-switch-hint ho explica (uns 3 s).
   És la mateixa animació que el pas de Segueix! a Segueix! Música (css/app-switch.css de segueix/segueix).
   ========================================================================== */
:root {
    --app-switch-remigi: #2dd4bf; /* el verd aigua de Remigi damunt del feltre */
}

/* ---------- Panell que entra en lliscar el dit ---------- */
.app-switch {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    place-items: center;
    padding: 24px;
    /* El fons triat d'El Tauler (fonscolors.js), una mica més fosc */
    background: color-mix(in srgb, var(--bg-dark, #1a1410) 80%, #000);
    color: #f4f0e8;
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.6);
    font-family: var(--font-ui, system-ui, sans-serif);
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.app-switch.is-active {
    display: grid;
}

.app-switch__card {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
}

.app-switch__card svg {
    width: 76px;
    height: 76px;
    margin-bottom: 6px;
}

.app-switch__card svg rect {
    fill: #fffbeb;
    stroke: rgba(0, 0, 0, 0.25);
    stroke-width: 1;
}

.app-switch__card svg text {
    font-family: var(--font-ui, system-ui, sans-serif);
    font-size: 20px;
    font-weight: 800;
    text-anchor: middle;
}

.app-switch__n1 {
    fill: #cc0000;
}

.app-switch__n2 {
    fill: #1d4ed8;
}

.app-switch__card strong {
    color: var(--app-switch-remigi);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

/* «Deixa anar per anar-hi» quan ja s'ha passat el llindar */
.app-switch__go {
    margin-top: 10px;
    padding: 6px 14px;
    border: 1px solid rgba(244, 240, 232, 0.28);
    border-radius: 999px;
    color: rgba(244, 240, 232, 0.7);
    font-size: 0.8125rem;
    font-style: normal;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.app-switch.is-ready .app-switch__go {
    border-color: var(--app-switch-remigi);
    color: var(--app-switch-remigi);
    opacity: 1;
}

/* Mode dia i paper electrònic: panell clar, amb el verd fosc de Remigi per contrastar */
body.day-mode .app-switch,
body.epaper-mode .app-switch {
    --app-switch-remigi: #0f766e;
    background: color-mix(in srgb, var(--bg-dark, #f3ead6) 94%, #000);
    color: var(--text-primary, #2e2618);
}

body.day-mode .app-switch__go,
body.epaper-mode .app-switch__go {
    border-color: rgba(0, 0, 0, 0.25);
    color: rgba(0, 0, 0, 0.6);
}

/* ---------- Avís de les primeres vegades (mòbil) ---------- */
.app-switch-hint {
    position: fixed;
    top: 46%;
    left: 50%;
    z-index: 2147482000;
    display: grid;
    justify-items: center;
    gap: 6px;
    width: 220px;
    padding: 18px 16px 16px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 16px;
    background: rgba(20, 22, 21, 0.78);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    color: #fff;
    font-family: var(--font-ui, system-ui, sans-serif);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

.app-switch-hint.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.app-switch-hint__stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 72px;
}

.app-switch-hint__hand {
    width: 56px;
    height: 56px;
    fill: none;
    stroke: #fff;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
    animation: app-switch-hint-swipe 1.4s ease-in-out infinite;
}

.app-switch-hint__arrow {
    position: absolute;
    top: 50%;
    color: rgba(255, 255, 255, 0.75);
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    transform: translateY(-50%);
    animation: app-switch-hint-arrow 1.4s ease-in-out infinite;
}

.app-switch-hint__arrow--left {
    left: 8px;
}

.app-switch-hint__arrow--right {
    right: 8px;
    animation-delay: 0.7s;
}

.app-switch-hint strong {
    color: var(--app-switch-remigi);
    font-size: 1.0625rem;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.app-switch-hint__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@keyframes app-switch-hint-swipe {
    0%,
    100% {
        transform: translateX(-46px) rotate(-8deg);
    }

    50% {
        transform: translateX(46px) rotate(8deg);
    }
}

@keyframes app-switch-hint-arrow {
    0%,
    100% {
        opacity: 0.25;
    }

    50% {
        opacity: 1;
    }
}

@media (min-width: 769px) {
    .app-switch-hint {
        display: none;
    }
}

/* Moviment reduït i paper electrònic: sense animacions (la tinta no les pot seguir) */
@media (prefers-reduced-motion: reduce) {
    .app-switch,
    .app-switch-hint,
    .app-switch-hint__hand,
    .app-switch-hint__arrow {
        animation: none;
        transition: none;
    }
}

body.epaper-mode .app-switch,
body.epaper-mode .app-switch-hint,
body.epaper-mode .app-switch-hint__hand,
body.epaper-mode .app-switch-hint__arrow {
    animation: none;
    transition: none;
}
