/* ==========================================================================
   Module HallOfFame — palmarès des concours
   Couleurs : jetons du site (--primary-rgb / --secondary-rgb). La liseuse prend les siennes du
   back-office (variables --hof-*, posées par halloffame-flipbook.js).
   ========================================================================== */

/* ---- Liste (BO) ---------------------------------------------------------- */
.hof-table-thumb { width: 3.2rem; height: 3.2rem; object-fit: cover; }

/* ---- Cartes de concours (front) ----------------------------------------- */
.hof-card { transition: transform .2s ease, box-shadow .2s ease; overflow: hidden; }
.hof-card:hover { transform: translateY(-3px); box-shadow: 0 .8rem 1.6rem rgba(0, 0, 0, .1) !important; }

.hof-card__cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), .18), rgba(var(--secondary-rgb), .22));
    color: rgba(var(--primary-rgb), .55);
    font-size: 2.6rem;
}
.hof-card__cover { overflow: hidden; }
/* Image en absolu : avec `aspect-ratio`, une image en flux agrandissait le cadre au lieu d'être recadrée. */
.hof-card__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.hof-card__category {
    position: absolute;
    left: .75rem;
    top: .75rem;
    background: rgba(255, 255, 255, .92);
    color: rgb(var(--primary-rgb));
    font-weight: 600;
    font-size: .72rem;
    line-height: 1.2;
    padding: .35em .8em;
    z-index: 1;
}

/* ---- Rangs et podium ------------------------------------------------------ */
.hof-rank { --medal: 150, 150, 150; }
.hof-rank--1 { --medal: 212, 168, 54; }
.hof-rank--2 { --medal: 160, 166, 176; }
.hof-rank--3 { --medal: 184, 115, 51; }

.hof-rank__medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: rgba(var(--medal), .18);
    color: rgb(var(--medal));
    font-weight: 700;
    font-size: .85rem;
}

.hof-podium-mini li { display: flex; align-items: center; gap: .6rem; padding: .2rem 0; }

.hof-podium {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
}
.hof-podium__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    flex: 0 1 14rem;
    padding: 1.1rem 1rem 1rem;
    border-radius: 1rem;
    background: rgba(var(--medal), .08);
    border: 1px solid rgba(var(--medal), .35);
    text-align: center;
}
.hof-podium__step .hof-rank__medal { width: 2.6rem; height: 2.6rem; font-size: 1.15rem; }
/* Le premier au centre et plus haut, comme sur un podium. */
.hof-podium__step.hof-rank--1 { order: 2; padding-top: 1.8rem; }
.hof-podium__step.hof-rank--2 { order: 1; }
.hof-podium__step.hof-rank--3 { order: 3; }
.hof-podium__step:nth-child(n+4) { order: 4; }
.hof-podium__place { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: rgb(var(--medal)); font-weight: 700; }
.hof-podium__name { font-weight: 700; font-size: 1.05rem; }
.hof-podium__work { font-style: italic; font-size: .9rem; opacity: .8; }

@media (max-width: 575.98px) {
    .hof-podium { flex-direction: column; align-items: stretch; }
    .hof-podium__step { flex-basis: auto; }
    .hof-podium__step.hof-rank--1 { order: 0; padding-top: 1.1rem; }
    .hof-podium__step.hof-rank--2 { order: 1; }
}

.hof-summary p:last-child { margin-bottom: 0; }

/* Compteur de lectures (carte du palmarès, sous la liseuse). */
.hof-reads { color: rgba(0, 0, 0, .55); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ==========================================================================
   Liseuse
   ========================================================================== */
.hof-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);
}
.hof-viewer-frame--admin { height: 460px; min-height: 0; }

@media (max-width: 767.98px) {
    .hof-viewer-frame { height: 72vh; min-height: 380px; border-radius: .75rem; }
}

.hof-viewer {
    --hof-accent: #5a7d5a;
    display: flex;
    flex-direction: column;
    background: var(--hof-color, #2b2a28);
    color: #fff;
}
.hof-viewer[data-background="gradient"] { background: linear-gradient(135deg, var(--hof-color), var(--hof-color2)); }
.hof-viewer[data-background="image"] { background: var(--hof-color) var(--hof-image) center / cover no-repeat; }
.hof-viewer[data-toolbar="top"] { flex-direction: column-reverse; }
.hof-viewer:fullscreen { border-radius: 0; height: 100vh; }

.hof-viewer__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: hidden;
}

.hof-viewer__status {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    opacity: .9;
}
.hof-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;
}
.hof-viewer__progress > span { display: block; width: 0; height: 100%; background: var(--hof-accent); transition: width .2s ease; }

.hof-viewer__book { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.hof-viewer__flip { width: 100%; }
.hof-viewer__page { background: #fff; overflow: hidden; }
.hof-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. */
.hof-viewer.is-zoomed .hof-viewer__stage { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.hof-viewer.is-zoomed .hof-viewer__book { height: auto; flex: 0 0 auto; }
.hof-viewer.is-zoomed .hof-viewer__slide { overflow: auto; align-items: flex-start; }
.hof-viewer.is-zoomed .hof-viewer__slide img { max-width: none; max-height: none; height: 200%; }

/* Mode diaporama. */
.hof-viewer__slider { width: 100%; height: 100%; overflow: hidden; }
.hof-viewer__track { display: flex; height: 100%; transition-property: transform; transition-timing-function: cubic-bezier(.4, 0, .2, 1); touch-action: pan-y; }
.hof-viewer__slide { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.hof-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. */
.hof-viewer__thumbs {
    display: flex;
    gap: .5rem;
    padding: .6rem .75rem;
    overflow-x: auto;
    background: rgba(0, 0, 0, .35);
    scrollbar-width: thin;
}
.hof-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;
}
.hof-viewer__thumb img { display: block; width: 100%; background: #fff; }
.hof-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; }
.hof-viewer__thumb.is-active { border-color: var(--hof-accent); }

/* Barre d'outils. */
.hof-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);
}
.hof-viewer__group { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.hof-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;
}
.hof-viewer__btn:hover, .hof-viewer__btn:focus-visible { background: var(--hof-accent); color: #fff; }
.hof-viewer__btn[disabled] { opacity: .35; pointer-events: none; }
.hof-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) {
    .hof-viewer__toolbar { justify-content: center; }
    .hof-viewer__btn { width: 2.1rem; height: 2.1rem; }
    .hof-viewer__btn[data-act="first"], .hof-viewer__btn[data-act="last"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .hof-card, .hof-viewer__track { transition: none; }
}
