/* Documents PDF des campagnes : vignettes, gestion, et liseuse (reprise du palmarès, préfixe cdoc-). */

.cdoc-table-thumb { width: 2.6rem; height: 3.4rem; object-fit: cover; }
.cdoc-thumb { width: 2.6rem; height: 3.4rem; object-fit: cover; flex-shrink: 0; }
.cdoc-thumb--empty { display: inline-flex; align-items: center; justify-content: center; background: rgba(var(--primary-rgb, 90, 125, 90), .1); color: rgb(var(--primary-rgb, 90, 125, 90)); }

.cdoc-card { overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; }
.cdoc-card:hover { transform: translateY(-3px); box-shadow: 0 .8rem 1.6rem rgba(0, 0, 0, .12) !important; }
.cdoc-card__cover { position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; background: #2b2a28; cursor: pointer; }
.cdoc-card__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.cdoc-card__placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: rgba(255, 255, 255, .5); }
.cdoc-card__read { position: absolute; left: 50%; bottom: .75rem; transform: translate(-50%, 6px); padding: .3rem .8rem; border-radius: 2rem; background: rgba(0, 0, 0, .7); color: #fff; font-size: .8rem; white-space: nowrap; opacity: 0; transition: opacity .2s ease, transform .2s ease; }
.cdoc-card__cover:hover .cdoc-card__read, .cdoc-card__cover:focus-visible .cdoc-card__read { opacity: 1; transform: translate(-50%, 0); }

.cdoc-modal .modal-xl { max-width: min(1400px, 96vw); }
.cdoc-modal .cdoc-viewer-frame { height: min(80vh, 900px); }

.cdoc-mine-item + .cdoc-mine-item { border-top: 1px solid rgba(0, 0, 0, .08); }
.cdoc-quota { height: .5rem; }

/* ==========================================================================
   Liseuse
   ========================================================================== */
.cdoc-viewer-frame {
    position: relative;
    height: min(82vh, 860px);
    min-height: 420px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1rem 2.4rem rgba(0, 0, 0, .18);
}
.cdoc-viewer-frame--admin { height: 460px; min-height: 0; }

@media (max-width: 767.98px) {
    .cdoc-viewer-frame { height: 72vh; min-height: 380px; border-radius: .75rem; }
}

.cdoc-viewer {
    --cdoc-accent: #5a7d5a;
    display: flex;
    flex-direction: column;
    background: var(--cdoc-color, #2b2a28);
    color: #fff;
}
.cdoc-viewer[data-background="gradient"] { background: linear-gradient(135deg, var(--cdoc-color), var(--cdoc-color2)); }
.cdoc-viewer[data-background="image"] { background: var(--cdoc-color) var(--cdoc-image) center / cover no-repeat; }
.cdoc-viewer[data-toolbar="top"] { flex-direction: column-reverse; }
.cdoc-viewer:fullscreen { border-radius: 0; height: 100vh; }

.cdoc-viewer__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: hidden;
}

.cdoc-viewer__status {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    opacity: .9;
}
.cdoc-viewer__progress {
    display: block;
    width: 12rem;
    max-width: 70vw;
    height: .35rem;
    margin-top: 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, .2);
    overflow: hidden;
}
.cdoc-viewer__progress > span { display: block; width: 0; height: 100%; background: var(--cdoc-accent); transition: width .2s ease; }

.cdoc-viewer__book { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.cdoc-viewer__flip { width: 100%; }
.cdoc-viewer__page { background: #fff; overflow: hidden; }
.cdoc-viewer__page img { width: 100%; height: 100%; object-fit: cover; /* contain laissait un liseré blanc d'un pixel */ display: block; user-select: none; pointer-events: none; }

/* Zoom : le livre est reconstruit au double de la hauteur de scène, qui défile dans les deux sens. */
.cdoc-viewer.is-zoomed .cdoc-viewer__stage { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.cdoc-viewer.is-zoomed .cdoc-viewer__book { height: auto; flex: 0 0 auto; }
.cdoc-viewer.is-zoomed .cdoc-viewer__slide { overflow: auto; align-items: flex-start; }
.cdoc-viewer.is-zoomed .cdoc-viewer__slide img { max-width: none; max-height: none; height: 200%; }

/* Mode diaporama. */
.cdoc-viewer__slider { width: 100%; height: 100%; overflow: hidden; }
.cdoc-viewer__track { display: flex; height: 100%; transition-property: transform; transition-timing-function: cubic-bezier(.4, 0, .2, 1); touch-action: pan-y; }
.cdoc-viewer__slide { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.cdoc-viewer__slide img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 .6rem 1.6rem rgba(0, 0, 0, .35); user-select: none; }

/* Miniatures. */
.cdoc-viewer__thumbs {
    display: flex;
    gap: .5rem;
    padding: .6rem .75rem;
    overflow-x: auto;
    background: rgba(0, 0, 0, .35);
    scrollbar-width: thin;
}
.cdoc-viewer__thumb {
    position: relative;
    flex: 0 0 auto;
    width: 4.2rem;
    padding: 0;
    border: 2px solid transparent;
    border-radius: .35rem;
    background: none;
    overflow: hidden;
    cursor: pointer;
}
.cdoc-viewer__thumb img { display: block; width: 100%; background: #fff; }
.cdoc-viewer__thumb span { position: absolute; right: 2px; bottom: 2px; padding: 0 .3rem; border-radius: .25rem; background: rgba(0, 0, 0, .6); color: #fff; font-size: .65rem; }
.cdoc-viewer__thumb.is-active { border-color: var(--cdoc-accent); }

/* Barre d'outils. */
.cdoc-viewer__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .4rem .75rem;
    padding: .5rem .75rem;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(6px);
}
.cdoc-viewer__group { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.cdoc-viewer__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    text-decoration: none;
    transition: background-color .15s ease;
}
.cdoc-viewer__btn:hover, .cdoc-viewer__btn:focus-visible { background: var(--cdoc-accent); color: #fff; }
.cdoc-viewer__btn[disabled] { opacity: .35; pointer-events: none; }
.cdoc-viewer__pager { min-width: 4.5rem; text-align: center; font-variant-numeric: tabular-nums; font-size: .9rem; font-weight: 600; }

@media (max-width: 575.98px) {
    .cdoc-viewer__toolbar { justify-content: center; }
    .cdoc-viewer__btn { width: 2.1rem; height: 2.1rem; }
    .cdoc-viewer__btn[data-act="first"], .cdoc-viewer__btn[data-act="last"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .cdoc-viewer__track { transition: none; }
}
