/**
 * assets/css/front.css
 *
 * Styles frontend de la galerie. Charge uniquement sur les pages
 * contenant le shortcode [drone_gallery] (voir drone-gallery-pro.php).
 * Toutes les couleurs de marque passent par la variable --dgp-primary,
 * definie inline sur #dgp-root a partir des Parametres admin.
 *
 * v2 : suppression des emojis (place a l'image de couverture + nom),
 * tuiles categories en ratio 21:9, accordeon description, animations
 * premium sobres, accessibilite (focus-visible, reduced-motion).
 */

#dgp-root {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

#dgp-root *,
#dgp-root *::before,
#dgp-root *::after {
    box-sizing: border-box;
}

/* ── Header (titre SEO) ─────────────────────────────── */

.dgp-header {
    margin-bottom: 28px;
    text-align: center;
    opacity: 0;
    animation: dgpFadeUp .5s cubic-bezier(.16,1,.3,1) forwards;
}

.dgp-h2 {
    color: #fff;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

.dgp-sub {
    color: rgba(255, 255, 255, .6);
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    margin: 0;
    max-width: 560px;
    margin-inline: auto;
}

/* ── Onglets categories — ratio 21:9 ────────────────── */

.dgp-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (min-width: 640px) {
    .dgp-tabs { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
    .dgp-tabs { grid-template-columns: repeat(6, 1fr); }
}

.dgp-tab {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    aspect-ratio: 21 / 9;
    padding: 12px 14px;
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    user-select: none;
    background: linear-gradient(135deg, color-mix(in srgb, var(--dgp-primary) 18%, #1a1a1a), #141414);
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, .1);
    overflow: hidden;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: transform .3s cubic-bezier(.16,1,.3,1),
                border-color .3s cubic-bezier(.16,1,.3,1),
                box-shadow .3s cubic-bezier(.16,1,.3,1);
    opacity: 0;
    animation: dgpFadeUp .5s cubic-bezier(.16,1,.3,1) forwards;
}

/* Stagger leger a l'apparition des tuiles */
.dgp-tab:nth-child(1) { animation-delay: .03s; }
.dgp-tab:nth-child(2) { animation-delay: .07s; }
.dgp-tab:nth-child(3) { animation-delay: .11s; }
.dgp-tab:nth-child(4) { animation-delay: .15s; }
.dgp-tab:nth-child(5) { animation-delay: .19s; }
.dgp-tab:nth-child(6) { animation-delay: .23s; }

/* Voile sombre pour garantir la lisibilite du texte sur toute image de couverture */
.dgp-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.15) 60%, rgba(0,0,0,0) 100%);
    transition: background .3s ease;
    z-index: 0;
}

.dgp-tab:hover {
    transform: translateY(-3px) scale(1.015);
    border-color: rgba(255, 255, 255, .3);
    box-shadow: 0 14px 34px -14px rgba(0,0,0,.55);
}

.dgp-tab.active {
    border-color: var(--dgp-primary);
    box-shadow: 0 14px 38px -12px color-mix(in srgb, var(--dgp-primary) 55%, transparent),
                0 0 0 2px var(--dgp-primary) inset;
    transform: translateY(-3px);
}

.dgp-tab.active::before {
    background: linear-gradient(0deg, rgba(0,0,0,.8) 0%, color-mix(in srgb, var(--dgp-primary) 25%, transparent) 100%);
}

.dgp-tab-name {
    position: relative;
    z-index: 1;
    font-size: clamp(0.78rem, 1.3vw, 0.92rem);
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .04em;
    line-height: 1.25;
}

.dgp-tab-count {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 20px;
}

/* Focus clavier distinct du hover souris */
.dgp-tab:focus-visible {
    outline: 2px solid var(--dgp-primary);
    outline-offset: 3px;
}

/* ── Lecteur (ratio 16:9 classique, inchange) ───────── */

.dgp-player {
    display: none;
    background: linear-gradient(180deg, rgba(20, 20, 22, .92), rgba(10, 10, 11, .96));
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
}

.dgp-player.open {
    display: block;
    animation: dgpIn .45s cubic-bezier(.16, 1, .3, 1) forwards;
}

@keyframes dgpIn {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes dgpFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dgp-player-inner {
    padding: clamp(16px, 3vw, 32px);
}

.dgp-player-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.dgp-title {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}

.dgp-desc {
    font-size: 0.92rem;
    color: rgba(255, 255, 255, .55);
    margin: 0;
    line-height: 1.55;
    max-width: 640px;
}

.dgp-sound-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .16);
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .25s ease, transform .25s cubic-bezier(.16,1,.3,1);
}

.dgp-sound-btn:hover {
    background: rgba(255, 255, 255, .16);
    transform: scale(1.06);
}

.dgp-sound-btn:focus-visible {
    outline: 2px solid var(--dgp-primary);
    outline-offset: 2px;
}

/* ── Onglets multi-videos ───────────────────────────── */

.dgp-vid-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.dgp-vid-tabs::-webkit-scrollbar { height: 4px; }
.dgp-vid-tabs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.dgp-vid-tab {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 6px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    transition: background .2s ease, border-color .2s ease, transform .2s cubic-bezier(.16,1,.3,1);
}

/* Sans vignette (video MP4), le padding gauche redevient symetrique :
   aucun espace ni cadre vide ne doit rester visible a la place de l'image. */
.dgp-vid-tab.no-thumb {
    padding: 6px 14px;
}

.dgp-vid-tab:hover {
    background: rgba(255, 255, 255, .14);
    transform: translateY(-1px);
}

.dgp-vid-tab.active {
    background: var(--dgp-primary);
    border-color: var(--dgp-primary);
}

.dgp-vid-tab:focus-visible {
    outline: 2px solid var(--dgp-primary);
    outline-offset: 2px;
}

.dgp-vid-thumb {
    width: 34px;
    height: 24px;
    border-radius: 5px !important;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    background-color: rgba(255, 255, 255, .15);
    overflow: hidden;
}

.dgp-vid-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

/* ── Zone video (ratio 16:9) ─────────────────────────── */

.dgp-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
}

.dgp-wrap video,
.dgp-wrap iframe,
.dgp-fill {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.dgp-empty,
.dgp-loading,
.dgp-invalid {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(255, 255, 255, .3);
    text-align: center;
}

.dgp-empty p,
.dgp-invalid p {
    margin: 0;
    font-size: .9rem;
}

.dgp-preview {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dgp-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    transition: background .25s ease;
}

.dgp-preview:hover::before,
.dgp-preview:focus-visible::before {
    background: rgba(0, 0, 0, .5);
}

.dgp-preview:focus-visible {
    outline: 2px solid var(--dgp-primary);
    outline-offset: -4px;
}

.dgp-preview-play {
    position: relative;
    z-index: 1;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--dgp-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    transition: transform .25s cubic-bezier(.16,1,.3,1);
}

.dgp-preview:hover .dgp-preview-play,
.dgp-preview:focus-visible .dgp-preview-play {
    transform: scale(1.1);
}

.dgp-loading {
    background: linear-gradient(110deg, rgba(255, 255, 255, .04) 8%, rgba(255, 255, 255, .09) 18%, rgba(255, 255, 255, .04) 33%);
    background-size: 200% 100%;
    animation: dgpShimmer 1.4s linear infinite;
}

@keyframes dgpShimmer {
    to { background-position-x: -200%; }
}

/* ── Accordeon description video ────────────────────── */

.dgp-vid-desc {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding-top: 14px;
}

.dgp-vid-desc:empty { display: none; }

.dgp-vid-desc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .75);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    text-align: left;
}

.dgp-vid-desc-toggle:hover {
    color: #fff;
}

.dgp-vid-desc-toggle:focus-visible {
    outline: 2px solid var(--dgp-primary);
    outline-offset: 4px;
}

.dgp-vid-desc-chevron {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .3s cubic-bezier(.16,1,.3,1);
}

.dgp-vid-desc.is-open .dgp-vid-desc-chevron {
    transform: rotate(180deg);
}

.dgp-vid-desc-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .35s cubic-bezier(.16,1,.3,1);
}

.dgp-vid-desc.is-open .dgp-vid-desc-body {
    grid-template-rows: 1fr;
}

.dgp-vid-desc-body-inner {
    overflow: hidden;
}

.dgp-vid-desc-text {
    margin: 10px 0 0;
    font-size: .88rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, .6);
    white-space: pre-line;
}

/* ── CTA ─────────────────────────────────────────────── */

.dgp-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 18px 22px;
    border-radius: 14px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--dgp-primary) 22%, transparent), color-mix(in srgb, var(--dgp-primary) 8%, transparent));
    border: 1px solid color-mix(in srgb, var(--dgp-primary) 45%, transparent);
}

.dgp-cta-text {
    color: #fff;
    font-weight: 700;
    font-size: .98rem;
}

.dgp-cta-btn {
    background: var(--dgp-primary);
    color: #fff;
    padding: 11px 26px;
    border-radius: 9px;
    text-decoration: none;
    font-weight: 700;
    font-size: .92rem;
    transition: filter .2s ease, transform .2s cubic-bezier(.16,1,.3,1);
    white-space: nowrap;
}

.dgp-cta-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    color: #fff;
}

.dgp-cta-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* ── Zone logos clients — bandeau anime en boucle ───── */

.dgp-clients {
    margin-top: 36px;
    text-align: center;
}

.dgp-clients-title {
    color: rgba(255, 255, 255, .5);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    margin-bottom: 20px;
}

.dgp-clients-track-wrap {
    position: relative;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.dgp-clients-track {
    display: flex;
    align-items: center;
    gap: clamp(28px, 4vw, 56px);
    width: max-content;
    animation: dgpMarquee 32s linear infinite;
}

.dgp-clients-track-wrap:hover .dgp-clients-track {
    animation-play-state: paused;
}

@keyframes dgpMarquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.dgp-client-logo {
    flex: 0 0 auto;
    width: calc((100% / var(--dgp-clients-visible, 6)) - 40px);
    min-width: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dgp-client-logo img {
    max-height: 40px;
    max-width: 100%;
    width: auto;
    opacity: .55;
    filter: grayscale(1);
    transition: opacity .3s ease, filter .3s ease, transform .3s cubic-bezier(.16,1,.3,1);
}

.dgp-client-logo:hover img {
    opacity: 1;
    filter: grayscale(0);
    transform: scale(1.06);
}

.dgp-client-logo a:focus-visible {
    outline: 2px solid var(--dgp-primary);
    outline-offset: 4px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .dgp-clients-track {
        animation: none;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 600px) {
    .dgp-cta {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .dgp-cta-btn {
        text-align: center;
    }

    .dgp-tab-name {
        font-size: .72rem;
    }
}

@media (max-width: 380px) {
    .dgp-tabs {
        grid-template-columns: 1fr;
    }
}

/* ── Accessibilite : reduction de mouvement ─────────── */

@media (prefers-reduced-motion: reduce) {
    #dgp-root *,
    #dgp-root *::before,
    #dgp-root *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }

    .dgp-tab,
    .dgp-header {
        opacity: 1;
        animation: none;
    }
}