/* =========================================================
   Base générale
   ========================================================= */

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #181818;
    background: #f5f4f1;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}


/* =========================================================
   Écran de chargement JLH Solutions
   ========================================================= */

.jlh-loader {
    --jlh-black: #161616;
    --jlh-anthracite: #303030;
    --jlh-grey: #777777;
    /*
       Remplace cette couleur par l'orange exact du logo
       si tu connais son code hexadécimal.
    */
    --jlh-orange: #f28c00;
    --jlh-orange-light: #ffad35;
    --jlh-background: #f6f5f2;
    --jlh-background-light: #ffffff;
    --jlh-background-dark: #e8e6e1;
    --jlh-grid-major: rgba(22, 22, 22, 0.075);
    --jlh-grid-minor: rgba(22, 22, 22, 0.026);
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    color: var(--jlh-black);
    background: radial-gradient( circle at 50% 38%, var(--jlh-background-light) 0%, var(--jlh-background) 52%, var(--jlh-background-dark) 100% );
}


/* =========================================================
   Fond technique
   ========================================================= */

.jlh-loader__background {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient( var(--jlh-grid-major) 1px, transparent 1px ), linear-gradient( 90deg, var(--jlh-grid-major) 1px, transparent 1px ), linear-gradient( var(--jlh-grid-minor) 1px, transparent 1px ), linear-gradient( 90deg, var(--jlh-grid-minor) 1px, transparent 1px );
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
    animation: jlh-grid-appearance 1.2s ease-out both;
}

    .jlh-loader__background::before {
        position: absolute;
        top: -220px;
        right: -160px;
        width: 560px;
        height: 560px;
        content: "";
        border: 1px solid rgba(242, 140, 0, 0.13);
        border-radius: 50%;
    }

    .jlh-loader__background::after {
        position: absolute;
        bottom: -280px;
        left: -210px;
        width: 640px;
        height: 640px;
        content: "";
        border: 1px solid rgba(22, 22, 22, 0.08);
        border-radius: 50%;
    }


/* =========================================================
   Repères décoratifs
   ========================================================= */

.jlh-loader__corner {
    position: absolute;
    width: 42px;
    height: 42px;
    opacity: 0.42;
}

.jlh-loader__corner--top-left {
    top: 32px;
    left: 32px;
    border-top: 2px solid var(--jlh-orange);
    border-left: 2px solid var(--jlh-orange);
}

.jlh-loader__corner--top-right {
    top: 32px;
    right: 32px;
    border-top: 2px solid var(--jlh-orange);
    border-right: 2px solid var(--jlh-orange);
}

.jlh-loader__corner--bottom-left {
    bottom: 32px;
    left: 32px;
    border-bottom: 2px solid var(--jlh-orange);
    border-left: 2px solid var(--jlh-orange);
}

.jlh-loader__corner--bottom-right {
    right: 32px;
    bottom: 32px;
    border-right: 2px solid var(--jlh-orange);
    border-bottom: 2px solid var(--jlh-orange);
}


/* =========================================================
   Mesures décoratives
   ========================================================= */

.jlh-loader__measure {
    position: absolute;
    color: rgba(22, 22, 22, 0.3);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

    .jlh-loader__measure::before,
    .jlh-loader__measure::after {
        position: absolute;
        content: "";
        background: rgba(22, 22, 22, 0.17);
    }

.jlh-loader__measure--top {
    top: 44px;
    left: 50%;
    width: min(38vw, 420px);
    text-align: center;
    transform: translateX(-50%);
}

    .jlh-loader__measure--top::before {
        top: 50%;
        right: calc(50% + 43px);
        left: 0;
        height: 1px;
    }

    .jlh-loader__measure--top::after {
        top: 50%;
        right: 0;
        left: calc(50% + 43px);
        height: 1px;
    }

.jlh-loader__measure--left {
    top: 50%;
    left: 37px;
    transform: translateY(-50%) rotate(-90deg);
}


/* =========================================================
   Contenu principal
   ========================================================= */

.jlh-loader__content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(90%, 620px);
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    text-align: center;
    animation: jlh-content-appearance 700ms ease-out both;
}


/* =========================================================
   Logo
   ========================================================= */

.jlh-loader__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(68vw, 280px);
    min-height: 70px;
    margin-bottom: 12px;
}

    .jlh-loader__logo img {
        display: block;
        width: 100%;
        max-width: 280px;
        max-height: 100px;
        object-fit: contain;
    }


/* =========================================================
   Illustration
   ========================================================= */

.jlh-loader__illustration {
    width: min(100%, 420px);
    margin: 0 auto 2px;
}

    .jlh-loader__illustration svg {
        display: block;
        width: 100%;
        height: auto;
        overflow: visible;
    }

.jlh-loader__plan-lines {
    fill: none;
    stroke: rgba(22, 22, 22, 0.16);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 14 7;
    animation: jlh-plan-lines 1.7s ease-out both;
}

.jlh-loader__building {
    fill: none;
    stroke: var(--jlh-anthracite);
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    animation: jlh-building-drawing 3s ease-in-out infinite;
}

.jlh-loader__crane {
    fill: none;
    stroke: var(--jlh-orange);
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 850;
    stroke-dashoffset: 850;
    animation: jlh-crane-drawing 3s 180ms ease-in-out infinite;
}

.jlh-loader__marker {
    fill: var(--jlh-orange);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    animation: jlh-marker-pulse 1.8s ease-in-out infinite;
}

.jlh-loader__marker--second {
    animation-delay: 500ms;
}

.jlh-loader__marker--third {
    animation-delay: 1s;
}


/* =========================================================
   Textes
   ========================================================= */

.jlh-loader__text {
    max-width: 520px;
}

.jlh-loader__eyebrow {
    margin: 0 0 8px;
    color: var(--jlh-orange);
    font-size: clamp(0.67rem, 2vw, 0.78rem);
    font-weight: 800;
    letter-spacing: 0.2em;
    line-height: 1.4;
    text-transform: uppercase;
}

.jlh-loader__title {
    margin: 0;
    color: var(--jlh-black);
    font-size: clamp(1.3rem, 4vw, 1.85rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.jlh-loader__subtitle {
    max-width: 470px;
    margin: 10px auto 0;
    color: rgba(22, 22, 22, 0.58);
    font-size: clamp(0.78rem, 2.4vw, 0.93rem);
    font-weight: 400;
    line-height: 1.55;
}


/* =========================================================
   Chargement Blazor
   ========================================================= */

.jlh-loader__loading {
    width: min(100%, 390px);
    margin-top: 26px;
}

.jlh-loader__progress {
    position: relative;
    width: 100%;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(22, 22, 22, 0.1);
}

.jlh-loader__progress-value {
    position: relative;
    width: var(--blazor-load-percentage, 10%);
    min-width: 4%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
    background: linear-gradient( 90deg, var(--jlh-orange), var(--jlh-orange-light) );
    box-shadow: 0 0 14px rgba(242, 140, 0, 0.27);
    transition: width 250ms ease-out;
}

    .jlh-loader__progress-value::after {
        position: absolute;
        inset: 0;
        width: 90px;
        content: "";
        background: linear-gradient( 90deg, transparent, rgba(255, 255, 255, 0.85), transparent );
        animation: jlh-progress-light 1.5s ease-in-out infinite;
    }

.jlh-loader__progress-information {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 20px;
    margin-top: 10px;
    color: rgba(22, 22, 22, 0.48);
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.jlh-loader__progress-label {
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jlh-loader__progress-percentage {
    flex: 0 0 auto;
    color: var(--jlh-orange);
    font-weight: 800;
}

    .jlh-loader__progress-percentage::after {
        content: var(--blazor-load-percentage-text, "0%");
    }


/* =========================================================
   Pied de page
   ========================================================= */

.jlh-loader__footer {
    position: absolute;
    right: 24px;
    bottom: 24px;
    left: 24px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: rgba(22, 22, 22, 0.37);
    font-size: clamp(0.58rem, 1.8vw, 0.7rem);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
}

.jlh-loader__footer-line {
    width: min(8vw, 60px);
    height: 1px;
    background: rgba(22, 22, 22, 0.17);
}


/* =========================================================
   Animations
   ========================================================= */

@keyframes jlh-content-appearance {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes jlh-grid-appearance {
    from {
        opacity: 0;
        transform: scale(1.025);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes jlh-plan-lines {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes jlh-building-drawing {
    0% {
        opacity: 0.2;
        stroke-dashoffset: 1500;
    }

    42%, 74% {
        opacity: 1;
        stroke-dashoffset: 0;
    }

    100% {
        opacity: 0.22;
        stroke-dashoffset: -1500;
    }
}

@keyframes jlh-crane-drawing {
    0% {
        opacity: 0.2;
        stroke-dashoffset: 850;
    }

    45%, 75% {
        opacity: 1;
        stroke-dashoffset: 0;
    }

    100% {
        opacity: 0.22;
        stroke-dashoffset: -850;
    }
}

@keyframes jlh-marker-pulse {
    0%, 25% {
        opacity: 0;
        transform: scale(0.65);
    }

    50% {
        opacity: 1;
        transform: scale(1.35);
    }

    75%, 100% {
        opacity: 0;
        transform: scale(0.65);
    }
}

@keyframes jlh-progress-light {
    from {
        transform: translateX(-100px);
    }

    to {
        transform: translateX(400px);
    }
}


/* =========================================================
   Écran d'erreur Blazor
   ========================================================= */

#blazor-error-ui {
    position: fixed;
    right: 20px;
    bottom: 20px;
    left: 20px;
    z-index: 100000;
    display: none;
    max-width: 700px;
    margin: auto;
    padding: 16px 48px 16px 18px;
    color: #ffffff;
    background: #202020;
    border-left: 5px solid var(--jlh-orange, #f28c00);
    border-radius: 5px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.24);
    font-size: 0.9rem;
}

    #blazor-error-ui .reload {
        margin-left: 10px;
        color: #ffad35;
        font-weight: 700;
    }

    #blazor-error-ui .dismiss {
        position: absolute;
        top: 50%;
        right: 12px;
        width: 28px;
        height: 28px;
        padding: 0;
        color: #ffffff;
        background: transparent;
        border: 0;
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        transform: translateY(-50%);
    }


/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 700px) {
    .jlh-loader__content {
        width: min(88%, 500px);
        max-height: calc(100dvh - 80px);
    }

    .jlh-loader__logo {
        width: min(64vw, 230px);
        min-height: 54px;
        margin-bottom: 6px;
    }

        .jlh-loader__logo img {
            max-height: 78px;
        }

    .jlh-loader__illustration {
        width: min(100%, 350px);
    }

    .jlh-loader__loading {
        margin-top: 20px;
    }

    .jlh-loader__corner {
        width: 27px;
        height: 27px;
    }

    .jlh-loader__corner--top-left {
        top: 18px;
        left: 18px;
    }

    .jlh-loader__corner--top-right {
        top: 18px;
        right: 18px;
    }

    .jlh-loader__corner--bottom-left {
        bottom: 18px;
        left: 18px;
    }

    .jlh-loader__corner--bottom-right {
        right: 18px;
        bottom: 18px;
    }

    .jlh-loader__measure {
        display: none;
    }

    .jlh-loader__footer {
        right: 14px;
        bottom: 14px;
        left: 14px;
        gap: 9px;
    }

    .jlh-loader__footer-line {
        width: 22px;
    }
}

@media (max-width: 420px) {
    .jlh-loader__content {
        width: 90%;
    }

    .jlh-loader__illustration {
        width: min(100%, 310px);
    }

    .jlh-loader__subtitle {
        max-width: 330px;
    }

    .jlh-loader__progress-information {
        font-size: 0.6rem;
    }

    .jlh-loader__footer {
        letter-spacing: 0.06em;
    }
}


/* Écrans mobiles peu hauts */

@media (max-height: 700px) {
    .jlh-loader__logo {
        width: min(55vw, 220px);
        min-height: 45px;
        margin-bottom: 0;
    }

        .jlh-loader__logo img {
            max-height: 65px;
        }

    .jlh-loader__illustration {
        width: min(82%, 330px);
    }

    .jlh-loader__eyebrow {
        margin-bottom: 5px;
    }

    .jlh-loader__subtitle {
        margin-top: 6px;
    }

    .jlh-loader__loading {
        margin-top: 15px;
    }

    .jlh-loader__footer {
        bottom: 10px;
    }
}


/* =========================================================
   Accessibilité : animations réduites
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .jlh-loader *,
    .jlh-loader *::before,
    .jlh-loader *::after {
        scroll-behavior: auto !important;
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }

    .jlh-loader__building,
    .jlh-loader__crane {
        opacity: 1;
        stroke-dasharray: none;
        stroke-dashoffset: 0;
    }

    .jlh-loader__marker {
        opacity: 1;
        transform: scale(1);
    }
}
