/* ==========================================================
   MON DJASSA — Application installable (mobile first)
   Écran de démarrage et fenêtre d'installation
   ========================================================== */

:root {
    --pwa-night: #0f0f11;
    --pwa-ink: #1a1205;
}

/* ---------- Écran de démarrage ---------- */

.pwa-splash {
    display: none;
}

html.pwa-splash-on,
html.pwa-splash-on body {
    overflow: hidden;
    background: var(--pwa-night);
}

html.pwa-splash-on .pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 44%, rgba(255, 127, 0, 0.2), rgba(255, 127, 0, 0) 58%),
        var(--pwa-night);
    opacity: 1;
    transition: opacity 0.45s ease, transform 0.45s ease;
    /* Dernier filet de sécurité, sans JavaScript : l'application ne reste jamais bloquée. */
    animation: pwa-splash-secours 0.3s linear 8s forwards;
}

.pwa-splash-stage {
    position: relative;
    z-index: 1;
    width: min(100vw, 86vh);
    aspect-ratio: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pwa-splash-stage svg {
    display: block;
}

/* Logo visible seulement si l'animation tarde à se charger. */
.pwa-splash-logo {
    position: absolute;
    width: clamp(112px, 30vmin, 220px);
    height: auto;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    animation: pwa-logo-arrive 0.5s ease 0.45s forwards;
}

.pwa-splash.is-playing .pwa-splash-stage {
    opacity: 1;
}

.pwa-splash.is-playing .pwa-splash-logo {
    display: none;
}

.pwa-splash.is-static .pwa-splash-logo {
    opacity: 1;
    animation: none;
}

.pwa-splash.is-closing {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

@keyframes pwa-splash-secours {
    to {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

@keyframes pwa-logo-arrive {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

/* ---------- Fenêtre d'installation ---------- */

body.pwa-locked {
    overflow: hidden;
}

.pwa-dialog {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--text);
    background: var(--white);
    font-size: 15px;
}

.pwa-dialog[open] {
    animation: pwa-monte 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pwa-dialog::backdrop {
    background: rgba(15, 15, 17, 0.72);
    animation: pwa-fondu 0.3s ease;
}

.pwa-dialog [hidden] {
    display: none !important;
}

.pwa-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.pwa-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--white);
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pwa-close:hover,
.pwa-close:focus-visible {
    background: rgba(255, 255, 255, 0.26);
}

.pwa-close:focus-visible,
.pwa-btn:focus-visible,
.pwa-btn-text:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

/* En-tête sombre, dans la continuité de l'écran de démarrage */
.pwa-hero {
    position: relative;
    flex: none;
    padding: 28px 16px 22px;
    overflow: hidden;
    color: var(--white);
    text-align: center;
    background: var(--pwa-night);
}

.pwa-hero::before {
    content: "";
    position: absolute;
    top: -30%;
    left: 50%;
    width: 340px;
    height: 340px;
    margin-left: -170px;
    background: radial-gradient(circle, rgba(255, 127, 0, 0.42), rgba(255, 127, 0, 0) 68%);
    animation: pwa-lueur 3.6s ease-in-out infinite;
}

.pwa-hero-icon {
    position: relative;
    display: inline-block;
    width: 84px;
    height: 84px;
    padding: 6px;
    background: var(--white);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(255, 127, 0, 0.35);
    animation: pwa-pop 0.6s cubic-bezier(0.2, 1.3, 0.4, 1) 0.1s backwards;
}

.pwa-hero-icon::after {
    content: "";
    position: absolute;
    inset: -2px;
    border: 2px solid var(--primary);
    border-radius: 26px;
    animation: pwa-onde 2.4s ease-out 0.7s infinite;
}

.pwa-hero-icon img {
    display: block;
    width: 100%;
    height: 100%;
}

.pwa-hero-name {
    position: relative;
    margin: 12px 0 2px;
    font-size: 1.45em;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--white);
}

.pwa-hero-tagline {
    position: relative;
    margin: 0;
    font-size: 0.95em;
    color: rgba(255, 255, 255, 0.82);
}

.pwa-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 20px 16px 24px;
}

.pwa-pane {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: pwa-monte 0.4s ease 0.12s backwards;
}

.pwa-pane h2 {
    margin: 0 0 2px;
    font-size: 1.3em;
    line-height: 1.25;
    color: var(--text);
    text-align: center;
}

.pwa-text {
    margin: 0 0 4px;
    line-height: 1.5;
    color: var(--text-soft);
    text-align: center;
}

.pwa-benefits {
    display: grid;
    gap: 10px;
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
}

.pwa-benefits li {
    position: relative;
    padding-left: 32px;
    line-height: 1.4;
    animation: pwa-glisse 0.4s ease backwards;
}

.pwa-benefits li:nth-child(1) { animation-delay: 0.2s; }
.pwa-benefits li:nth-child(2) { animation-delay: 0.3s; }
.pwa-benefits li:nth-child(3) { animation-delay: 0.4s; }

.pwa-benefits li::before {
    content: "✓";
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    font-size: 13px;
    font-weight: 800;
    line-height: 22px;
    color: var(--pwa-ink);
    text-align: center;
    background: var(--primary-light);
    border-radius: 50%;
}

.pwa-steps {
    display: grid;
    gap: 10px;
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
}

.pwa-steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    line-height: 1.4;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    animation: pwa-etape-active 7.5s ease-in-out infinite;
}

.pwa-steps li:nth-child(2) { animation-delay: 2.5s; }
.pwa-steps li:nth-child(3) { animation-delay: 5s; }

.pwa-step-glyph {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--primary-dark);
    background: #fff3e6;
    border-radius: 12px;
}

.pwa-step-glyph-text {
    font-size: 26px;
    font-weight: 800;
}

.pwa-btn {
    display: block;
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    font: inherit;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--pwa-ink);
    background: var(--primary);
    border: 0;
    border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(255, 127, 0, 0.34);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease;
}

.pwa-btn:hover {
    background: var(--primary-light);
}

.pwa-btn:active {
    transform: scale(0.98);
}

.pwa-btn:disabled {
    cursor: wait;
    opacity: 0.7;
}

.pwa-btn-text {
    display: block;
    width: 100%;
    min-height: 44px;
    font: inherit;
    font-weight: 600;
    color: var(--text-soft);
    background: none;
    border: 0;
    cursor: pointer;
}

.pwa-pane-done {
    align-items: center;
    padding: 12px 0;
}

.pwa-done-check {
    color: #1c7c37;
}

.pwa-done-tick {
    stroke-dasharray: 44;
    animation: pwa-trace 0.6s ease 0.2s backwards;
}

/* Mentions « Bientôt » : texte simple, sans logo officiel */
.pwa-soon {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: auto 0 0;
    padding: 18px 0 0;
    list-style: none;
}

.pwa-soon li {
    padding: 6px 12px;
    font-size: 0.93em;
    font-weight: 600;
    color: var(--text-soft);
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.pwa-note {
    margin: 10px 0 0;
    font-size: 0.93em;
    color: var(--text-soft);
    text-align: center;
}

/* Lien du pied de page */
.pwa-open-link {
    min-height: 44px;
    padding: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    text-decoration: underline;
    background: none;
    border: 0;
    cursor: pointer;
}

/* Écrans peu hauts (petits téléphones, mode paysage) : en-tête réduit */
@media (max-height: 680px) {
    .pwa-hero {
        padding: 10px 56px;
    }

    .pwa-hero-icon {
        width: 52px;
        height: 52px;
        padding: 3px;
        border-radius: 14px;
    }

    .pwa-hero-icon::after {
        border-radius: 16px;
    }

    .pwa-hero-tagline {
        display: none;
    }

    .pwa-hero-name {
        margin-top: 4px;
        font-size: 1.15em;
    }

    .pwa-content {
        padding-top: 14px;
    }

    .pwa-steps li {
        padding: 6px 10px;
    }
}

/* Tablette et plus : fenêtre centrée */
@media (min-width: 768px) {
    .pwa-dialog {
        width: 520px;
        height: fit-content;
        max-height: 92vh;
        margin: auto;
        border-radius: var(--radius-lg);
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
        font-size: 16px;
    }

    .pwa-hero {
        padding: 36px 24px 26px;
    }

    .pwa-content {
        padding: 24px 32px 28px;
    }
}

@media (min-width: 1920px) {
    .pwa-dialog {
        width: 600px;
        font-size: 18px;
    }
}

@media (min-width: 2560px) {
    .pwa-dialog {
        width: 720px;
        font-size: 21px;
    }
}

@media (min-width: 3840px) {
    .pwa-dialog {
        width: 1040px;
        font-size: 30px;
    }

    .pwa-hero-icon {
        width: 140px;
        height: 140px;
    }
}

@keyframes pwa-monte {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pwa-fondu {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pwa-glisse {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pwa-pop {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pwa-onde {
    0% { opacity: 0.8; transform: scale(1); }
    70%, 100% { opacity: 0; transform: scale(1.32); }
}

@keyframes pwa-lueur {
    0%, 100% { opacity: 0.75; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.12); }
}

@keyframes pwa-etape-active {
    0%, 28%, 100% { border-color: var(--border); box-shadow: none; }
    6%, 22% { border-color: var(--primary); box-shadow: 0 4px 16px rgba(255, 127, 0, 0.22); }
}

@keyframes pwa-trace {
    from { stroke-dashoffset: 44; }
    to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .pwa-dialog,
    .pwa-dialog *,
    .pwa-dialog::backdrop,
    .pwa-dialog *::before,
    .pwa-dialog *::after,
    .pwa-splash-logo {
        animation: none !important;
        transition: none !important;
    }

    .pwa-splash-logo {
        opacity: 1;
    }
}
