/* =========================================================
   GALLERY
   Portfolio ArtStation. Les donnees viennent de
   data/artstation.json, genere une fois par jour par
   .github/workflows/site-data.yml via build-artstation.mjs.
   ========================================================= */

/* display: flex sur un element masque par l attribut hidden gagne contre la
   feuille du navigateur. On tranche une fois pour toute la vue. */
#art-view [hidden],
.art-viewer [hidden] {
    display: none !important;
}

#art-view .art-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 5rem;
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
}

/* --- EN TETE PROFIL --- */
#art-view .art-head {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 2rem);
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    margin-bottom: 2.2rem;
}

#art-view .art-avatar {
    width: clamp(76px, 12vw, 104px);
    height: clamp(76px, 12vw, 104px);
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(19, 175, 240, .45);
    box-shadow: 0 0 26px rgba(19, 175, 240, .22);
    background: #0d1216;
    flex: none;
}

#art-view .art-identity {
    text-align: left;
}

#art-view .art-identity h1 {
    font-family: var(--cyber-font);
    font-size: clamp(1.9rem, 5vw, 3rem);
    letter-spacing: 4px;
    margin: 0;
    color: #fff;
    text-shadow: 2px 2px 0 var(--neon-blue), -2px -2px 0 var(--neon-purple);
}

#art-view .art-headline {
    font-family: var(--code-font);
    font-size: .85rem;
    color: var(--neon-blue);
    margin-top: .4rem;
}

#art-view .art-location {
    font-family: var(--code-font);
    font-size: .72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: .5;
    margin-top: .2rem;
}

/* --- COMPTEURS --- */
#art-view .art-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 2.5rem;
}

#art-view .art-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    font-family: var(--code-font);
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .03);
    line-height: 1;
}

#art-view .art-stat b {
    font-size: clamp(.95rem, 2.4vw, 1.15rem);
    color: var(--neon-blue);
    font-weight: 700;
}

#art-view .art-stat span {
    font-size: .6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: .6;
}

#art-view .art-stat.is-link {
    text-decoration: none;
    color: inherit;
    border-color: rgba(19, 175, 240, .4);
    background: rgba(19, 175, 240, .07);
    transition: box-shadow .2s ease, border-color .2s ease;
}

#art-view .art-stat.is-link:hover {
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(19, 175, 240, .22);
}

/* --- GRILLE --- */
#art-view .art-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
}

#art-view .art-card {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    overflow: hidden;
    background: #0a0e12;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    animation: artIn .45s ease both;
    transition: transform .3s cubic-bezier(.22, .61, .36, 1), border-color .3s ease, box-shadow .3s ease;
}

@keyframes artIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

#art-view .art-card:hover,
#art-view .art-card:focus-visible {
    transform: translateY(-6px);
    border-color: rgba(19, 175, 240, .55);
    box-shadow: 0 18px 34px rgba(0, 0, 0, .6), 0 0 22px rgba(19, 175, 240, .18);
    outline: none;
}

#art-view .art-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s cubic-bezier(.22, .61, .36, 1), opacity .4s ease;
    opacity: 0;
}

#art-view .art-card img.ready {
    opacity: 1;
}

#art-view .art-card:hover img {
    transform: scale(1.05);
}

/* Le voile porte le titre. Visible en permanence sur la moitie basse pour
   que la grille reste lisible au doigt, ou le survol n existe pas. */
#art-view .art-veil {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    padding: 2.4rem .9rem .8rem;
    background: linear-gradient(180deg, transparent, rgba(3, 5, 7, .88) 55%);
    pointer-events: none;
}

#art-view .art-title {
    font-family: var(--code-font);
    font-size: .78rem;
    line-height: 1.35;
    color: #fff;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#art-view .art-metrics {
    display: flex;
    gap: 10px;
    flex: none;
    font-family: var(--code-font);
    font-size: .62rem;
    color: #9aa4ae;
    white-space: nowrap;
}

#art-view .art-metrics i {
    opacity: .7;
    margin-right: 3px;
}

#art-view .art-shots {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 999px;
    font-family: var(--code-font);
    font-size: .6rem;
    color: #e6e6e6;
    background: rgba(3, 5, 7, .7);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#art-view .art-status {
    text-align: center;
    font-family: var(--code-font);
    font-size: .78rem;
    letter-spacing: 1px;
    color: #6e7681;
    padding: 2.5rem 0 0;
}

#art-view .art-status .ok {
    color: var(--neon-green);
}

/* =========================================================
   VISIONNEUSE
   ========================================================= */

.art-viewer {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    flex-direction: column;
    background: rgba(3, 4, 6, .97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
}

.art-viewer.open {
    display: flex;
    animation: readerIn .22s ease both;
}

body.viewer-open {
    overflow: hidden;
}

.art-viewer .av-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem clamp(.7rem, 2vw, 1.2rem);
    padding-left: max(.7rem, env(safe-area-inset-left));
    padding-right: max(.7rem, env(safe-area-inset-right));
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(10, 12, 15, .9);
}

.art-viewer .av-close {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: #e6e6e6;
    font-size: 1rem;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.art-viewer .av-close:hover {
    background: rgba(255, 0, 60, .12);
    color: var(--neon-red);
}

.art-viewer .av-heading {
    flex: 1 1 auto;
    min-width: 0;
}

.art-viewer .av-heading h2 {
    font-family: var(--cyber-font);
    font-size: clamp(.85rem, 2.2vw, 1.1rem);
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.art-viewer .av-heading span {
    display: block;
    font-family: var(--code-font);
    font-size: .6rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--neon-blue);
    margin-top: 2px;
}

.art-viewer .av-link {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(19, 175, 240, .4);
    background: rgba(19, 175, 240, .08);
    color: #e6e6e6;
    font-family: var(--code-font);
    font-size: .65rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.art-viewer .av-link:hover {
    border-color: var(--neon-blue);
    box-shadow: 0 0 18px rgba(19, 175, 240, .25);
}

.art-viewer .av-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* --- SCENE --- */
.art-viewer .av-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.art-viewer .av-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .7);
}

.art-viewer .av-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(10, 12, 15, .75);
    color: #e6e6e6;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background .18s ease, border-color .18s ease;
}

.art-viewer .av-nav:hover {
    background: rgba(19, 175, 240, .18);
    border-color: var(--neon-blue);
}

.art-viewer .av-prev {
    left: max(10px, env(safe-area-inset-left));
}

.art-viewer .av-next {
    right: max(10px, env(safe-area-inset-right));
}

.art-viewer .av-counter {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--code-font);
    font-size: .62rem;
    letter-spacing: 2px;
    color: #8b949e;
    background: rgba(10, 12, 15, .7);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    padding: 4px 12px;
}

/* --- FICHE --- */
.art-viewer .av-info {
    flex: none;
    max-height: 34vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: rgba(8, 10, 13, .92);
    padding: 1.1rem clamp(1rem, 3vw, 2rem) 1.4rem;
    padding-left: max(clamp(1rem, 3vw, 2rem), env(safe-area-inset-left));
    padding-right: max(clamp(1rem, 3vw, 2rem), env(safe-area-inset-right));
}

.art-viewer .av-desc {
    font-family: var(--ui-font);
    font-size: .92rem;
    line-height: 1.75;
    color: #c9d1d9;
    max-width: 820px;
    margin: 0 auto .9rem;
}

.art-viewer .av-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    max-width: 820px;
    margin: 0 auto;
}

.art-viewer .av-chip {
    font-family: var(--code-font);
    font-size: .6rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 999px;
    color: #8b949e;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .03);
}

.art-viewer .av-chip.is-soft {
    color: var(--neon-blue);
    border-color: rgba(19, 175, 240, .35);
}

/* --- MOBILE --- */
@media (max-width: 768px) {
    #art-view .art-wrap {
        padding: 1.5rem 1rem 4rem;
    }

    #art-view .art-head {
        gap: 1rem;
    }

    #art-view .art-identity {
        text-align: center;
        flex: 1 1 100%;
    }

    #art-view .art-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: .7rem;
    }

    #art-view .art-card {
        border-radius: 11px;
    }

    #art-view .art-title {
        font-size: .68rem;
    }

    #art-view .art-metrics {
        display: none;
    }

    #art-view .art-stat {
        padding: 7px 12px;
    }

    .art-viewer .av-info {
        max-height: 40vh;
        padding-top: .9rem;
    }

    .art-viewer .av-desc {
        font-size: .85rem;
        line-height: 1.65;
    }

    .art-viewer .av-link span {
        display: none;
    }
}

@media (max-width: 420px) {
    .art-viewer .av-heading h2 {
        font-size: .8rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    #art-view .art-card,
    .art-viewer.open {
        animation: none;
    }

    #art-view .art-card,
    #art-view .art-card img {
        transition: none;
    }
}
