/* Livre PDF (flipbook) */

.soFlip {
    display: flex;
    justify-content: center;
    width: 100%;
}
.soFlip--inline {
    display: block;
}

/* ---------- Declencheur (mode pop-up) ---------- */
.soFlip__trigger {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.soFlip__trigger:hover,
.soFlip__trigger:focus {
    background: none;
    color: inherit;
}
.soFlip__cover {
    position: relative;
    display: block;
    width: 260px;
    max-width: 100%;
    aspect-ratio: 210 / 297;
    background: #eceae5;
    border-radius: 2px 6px 6px 2px;
    box-shadow: 0 18px 40px -14px rgba(28, 25, 23, .45), 0 3px 8px rgba(28, 25, 23, .12);
    transform-origin: left center;
    transition: transform .35s ease, box-shadow .35s ease;
    overflow: hidden;
}
.soFlip__cover.is-ready {
    aspect-ratio: auto;
}
/* reliure */
.soFlip__cover::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 14px;
    background: linear-gradient(90deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, 0) 60%, rgba(255, 255, 255, .18));
    pointer-events: none;
}
.soFlip__coverImg {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity .3s ease;
}
.soFlip__cover.is-ready .soFlip__coverImg {
    opacity: 1;
}
.soFlip__trigger:hover .soFlip__cover,
.soFlip__trigger:focus-visible .soFlip__cover {
    transform: perspective(1200px) rotateY(-14deg) translateY(-4px);
    box-shadow: 0 26px 50px -16px rgba(28, 25, 23, .55), 0 3px 8px rgba(28, 25, 23, .12);
}
.soFlip__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    background: var(--sf-accent, #B08D6A);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 12px;
    transition: filter .18s ease, transform .18s ease;
}
.soFlip__btn svg {
    flex: none;
    width: 20px;
    height: 20px;
}
.soFlip__trigger:hover .soFlip__btn,
.soFlip__trigger:focus-visible .soFlip__btn {
    filter: brightness(.92);
    transform: translateY(-1px);
}

/* ---------- Lecteur ---------- */
.soFlip__viewer {
    --sf-bg: transparent;
    --sf-fg: #1c1917;
    --sf-muted: #6b615b;
    --sf-ctl: rgba(192, 190, 181, .22);
    --sf-ctl-hover: rgba(192, 190, 181, .42);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    color: var(--sf-fg);
    background: var(--sf-bg);
    outline: none;
    box-sizing: border-box;
}
.soFlip__viewer[hidden] {
    display: none;
}
.soFlip__viewer *,
.soFlip__viewer *::before,
.soFlip__viewer *::after {
    box-sizing: border-box;
}

.soFlip__viewer.is-full {
    --sf-bg: #191614;
    --sf-fg: #f5f2ee;
    --sf-muted: #b5aca4;
    --sf-ctl: rgba(255, 255, 255, .09);
    --sf-ctl-hover: rgba(255, 255, 255, .2);
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    animation: soFlipIn .25s ease;
}
@keyframes soFlipIn {
    from { opacity: 0; transform: scale(.985); }
    to   { opacity: 1; transform: none; }
}
html.soFlip-lock,
html.soFlip-lock body {
    overflow: hidden !important;
}

/* Barres */
.soFlip__bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}
.soFlip__viewer.is-full .soFlip__bar {
    padding: 10px 14px;
}
.soFlip__bar--top {
    justify-content: space-between;
}
.soFlip__title {
    min-width: 0;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.soFlip__actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.soFlip__viewer .soFlip__ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sf-ctl);
    color: var(--sf-fg);
    cursor: pointer;
    text-decoration: none;
    transition: background .18s ease, color .18s ease, opacity .18s ease;
    -webkit-tap-highlight-color: transparent;
}
.soFlip__viewer .soFlip__ico:hover,
.soFlip__viewer .soFlip__ico:focus-visible {
    background: var(--sf-ctl-hover);
    color: var(--sf-fg);
}
.soFlip__viewer .soFlip__ico:disabled {
    opacity: .35;
    cursor: default;
}
.soFlip__ico svg {
    width: 20px;
    height: 20px;
}
.soFlip__icoOut,
.soFlip__viewer.is-zoomed .soFlip__icoIn {
    display: none;
}
.soFlip__viewer.is-zoomed .soFlip__icoOut {
    display: block;
}
.soFlip__viewer.is-zoomed [data-act="zoom"] {
    background: var(--sf-accent, #B08D6A);
    color: #fff;
}
.soFlip__ico--close,
.soFlip__viewer.is-full .soFlip__ico--full {
    display: none !important;
}
.soFlip__viewer.is-full .soFlip__ico--close {
    display: inline-flex !important;
}

.soFlip__count {
    flex: none;
    min-width: 74px;
    text-align: center;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--sf-muted);
    white-space: nowrap;
}
.soFlip__range {
    flex: 1;
    min-width: 0;
    height: 28px;
    margin: 0;
    padding: 0;
    background: transparent;
    accent-color: var(--sf-accent, #B08D6A);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.soFlip__range::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: var(--sf-ctl-hover);
}
.soFlip__range::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: var(--sf-ctl-hover);
}
.soFlip__range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    margin-top: -7px;
    border: 0;
    border-radius: 50%;
    background: var(--sf-accent, #B08D6A);
}
.soFlip__range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: var(--sf-accent, #B08D6A);
}

/* Scene */
.soFlip__stage {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    width: 100%;
    min-height: 200px;
    overflow: hidden;
}
.soFlip__viewer.is-full .soFlip__stage {
    min-height: 0;
    padding: 0 8px;
}
.soFlip__viewer.is-zoomed .soFlip__stage {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    cursor: grab;
}
.soFlip__viewer.is-zoomed .soFlip__stage.is-panning {
    cursor: grabbing;
}
.soFlip__zoomer {
    flex: none;
    position: relative;
    margin: auto;
}
.soFlip__book {
    min-width: 0 !important;
    min-height: 0 !important;
    transform-origin: 0 0;
    transition: transform .45s ease;
    opacity: 0;
}
.soFlip__viewer.is-ready .soFlip__book {
    opacity: 1;
    transition: transform .45s ease, opacity .3s ease;
}
.soFlip__viewer.is-zoomed .soFlip__book {
    pointer-events: none;
    transition: none;
}
.soFlip__viewer.is-zoomed .soFlip__links a {
    pointer-events: auto;
}

/* Pages */
.soFlip__page {
    background: #fff;
    overflow: hidden;
}
.soFlip__pageInner {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
}
.soFlip__pageInner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s ease;
}
.soFlip__page.is-ready img {
    opacity: 1;
}
/* ombre de pliure au centre du livre */
.soFlip__page.--left .soFlip__pageInner::after,
.soFlip__page.--right .soFlip__pageInner::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 7%;
    pointer-events: none;
}
.soFlip__page.--left .soFlip__pageInner::after {
    right: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .13));
}
.soFlip__page.--right .soFlip__pageInner::after {
    left: 0;
    background: linear-gradient(270deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .13));
}
.soFlip__viewer.is-single .soFlip__pageInner::after {
    display: none;
}
.soFlip__spin {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(0, 0, 0, .1);
    border-top-color: var(--sf-accent, #B08D6A);
    border-radius: 50%;
    animation: soFlipSpin .8s linear infinite;
}
.soFlip__page.is-ready .soFlip__spin {
    display: none;
}
@keyframes soFlipSpin {
    to { transform: rotate(360deg); }
}
.soFlip__links a {
    position: absolute;
    display: block;
    border-radius: 3px;
    transition: background .15s ease;
}
.soFlip__links a:hover,
.soFlip__links a:focus-visible {
    background: rgba(176, 141, 106, .22);
}

/* Chargement / erreur */
.soFlip__loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px;
    text-align: center;
    font-size: 15px;
    color: var(--sf-muted);
    pointer-events: none;
}
.soFlip__viewer.is-ready .soFlip__loader {
    display: none;
}
.soFlip__progress {
    display: block;
    width: 180px;
    max-width: 60%;
    height: 4px;
    border-radius: 2px;
    background: var(--sf-ctl-hover);
    overflow: hidden;
}
.soFlip__progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--sf-accent, #B08D6A);
    transition: width .2s ease;
}
.soFlip__viewer.is-error .soFlip__progress {
    display: none;
}
.soFlip__viewer.is-error .soFlip__loader {
    pointer-events: auto;
}
.soFlip__loader a {
    color: var(--sf-accent, #B08D6A);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .soFlip__viewer.is-full .soFlip__bar {
        padding: 8px 10px;
    }
    .soFlip__viewer.is-full .soFlip__stage {
        padding: 0 4px;
    }
    .soFlip__count {
        min-width: 58px;
        font-size: 13px;
    }
    .soFlip__title {
        font-size: 15px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .soFlip__viewer.is-full {
        animation: none;
    }
    .soFlip__cover,
    .soFlip__book {
        transition: none !important;
    }
}
