/* =====================================================================
   HISTOIRE — frise horizontale « Cinéma »
   Préfixe unique : hh-  (indépendant de hs- vertical, hl- et l3-)
   Règle chronologique à l'échelle + scène plein cadre + pellicule.
   Les zones hors scène utilisent les variables du thème (mode sombre
   .dark-mode-color suivi automatiquement) ; la scène est volontairement
   sombre (texte blanc sur image).

   Réglages rapides :
     --hh-accent   couleur d'accent
     --hh-stage-h  hauteur de la scène
     --hh-dur      durée d'un événement en lecture auto (fixée aussi côté JS si besoin)
===================================================================== */

.hh-root {
    --hh-accent: #c9803a;
    --hh-stage-h: clamp(440px, 58vh, 580px);
    --hh-dur: 7s;
    --hh-pad-x: clamp(64px, 8vw, 96px);
    --hh-panel-w: 520px;
    --hh-fig-h: calc(var(--hh-stage-h) - 48px); /* hauteur utile de l'image en mode « image entière » */
    --hh-line: var(--background-nav-stronger, rgba(128, 128, 128, 0.35));
    position: relative;
    margin: 8px 0 40px;
}

/* =========================
   1. EN-TÊTE
========================= */

.hh-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 8px;
}

.hh-play {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 50%;
}

.hh-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.hh-ring circle {
    fill: none;
    stroke-width: 2.5;
}

.hh-ring-bg { stroke: color-mix(in srgb, var(--text-color) 18%, transparent); }

.hh-ring-prog {
    stroke: var(--hh-accent);
    stroke-linecap: round;
    stroke-dasharray: 113.1;
    stroke-dashoffset: 113.1;
}

.hh-root.is-playing .hh-ring-prog.is-running {
    animation: hh-ring var(--hh-dur) linear forwards;
}

.hh-root.is-paused .hh-ring-prog { animation-play-state: paused; }

@keyframes hh-ring { to { stroke-dashoffset: 0; } }

.hh-ico {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    fill: currentColor;
}

.hh-ico-pause { display: none; }
.hh-root.is-playing .hh-ico-play { display: none; }
.hh-root.is-playing .hh-ico-pause { display: block; }

.hh-play:hover .hh-ring-bg { stroke: color-mix(in srgb, var(--text-color) 40%, transparent); }

.hh-head-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hh-counter {
    font-size: 13px;
    color: var(--text-color-attenuate);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.hh-counter b {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-color);
}

.hh-head-era {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hh-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hh-hint {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-color-attenuate);
}

/* =========================
   2. RÈGLE CHRONOLOGIQUE
========================= */

.hh-ruler {
    position: relative;
    z-index: 5;
    height: 78px;
    margin: 4px 0 20px;
    cursor: ew-resize;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

.hh-bands {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 30px;
}

.hh-band {
    position: absolute;
    top: 0;
    height: 30px;
    box-sizing: border-box;
    padding: 0 10px;
    border-left: 1px solid var(--hh-line);
    font-size: 10px;
    font-weight: 700;
    line-height: 30px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-color-attenuate);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hh-band:nth-child(odd) { background: color-mix(in srgb, var(--text-color) 4%, transparent); }

.hh-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 52px;
    height: 2px;
    border-radius: 1px;
    background: var(--hh-line);
}

.hh-track-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--hh-x, 0%);
    background: var(--hh-accent);
    border-radius: 1px;
    transition: width 0.5s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.hh-tick {
    position: absolute;
    top: 34px;
    width: 22px;
    height: 38px;
    margin-left: -11px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.hh-tick::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 12px;
    width: 2px;
    height: 12px;
    margin-left: -1px;
    border-radius: 1px;
    background: color-mix(in srgb, var(--text-color) 38%, transparent);
    transition: height 0.25s ease, top 0.25s ease, background 0.25s ease;
}

.hh-tick:hover::before {
    top: 9px;
    height: 18px;
    background: var(--text-color);
}

.hh-tick.is-past::before { background: color-mix(in srgb, var(--hh-accent) 65%, transparent); }

.hh-tick.is-active::before {
    top: 8px;
    height: 20px;
    background: var(--hh-accent);
}

.hh-tick:focus-visible { outline: 2px solid var(--hh-accent); outline-offset: -2px; border-radius: 4px; }

.hh-tip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 260px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--text-color);
    color: var(--background-color);
    font-size: 12px;
    line-height: 1.3;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 20;
}

.hh-tip b { font-weight: 800; margin-right: 4px; }

.hh-tick:first-of-type .hh-tip { left: 0; transform: none; }
.hh-tick:last-of-type .hh-tip  { left: auto; right: 0; transform: none; }

.hh-tick:hover .hh-tip,
.hh-tick:focus-visible .hh-tip,
.hh-ruler.is-scrubbing .hh-tick.is-active .hh-tip { opacity: 1; }

.hh-playhead {
    position: absolute;
    left: var(--hh-x, 0%);
    top: 46px;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
    background: var(--hh-accent);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--hh-accent) 25%, transparent);
    transition: left 0.5s cubic-bezier(0.3, 0.7, 0.2, 1);
    pointer-events: none;
    z-index: 3;
}

.hh-ruler.is-scrubbing .hh-playhead,
.hh-ruler.is-scrubbing .hh-track-fill { transition-duration: 0.18s; }

/* =========================
   3. SCÈNE
========================= */

.hh-stage {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: #111;
    color: #fff;
    touch-action: pan-y;
}

.hh-slide {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 340px;
    padding: 0 var(--hh-pad-x);
    overflow: hidden;
}

.hh-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.hh-fig {
    position: absolute;
    inset: 0;
}

.hh-main {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.45s ease;
}

/* Fond flou (copie de l'image) : n'apparaît qu'en mode « image entière » */
.hh-blur {
    display: none;
    position: absolute;
    left: -6%;
    top: -6%;
    width: 112%;
    height: 112%;
    object-fit: cover;
    filter: blur(26px) saturate(1.25) brightness(0.8);
}

.hh-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(6, 6, 8, 0.8) 0%, rgba(6, 6, 8, 0.46) 46%, rgba(6, 6, 8, 0.06) 100%);
}

.hh-bg--plain {
    background: linear-gradient(135deg, color-mix(in srgb, var(--hh-accent) 62%, #000), #15130f);
}

.hh-copyright {
    position: absolute;
    right: 14px;
    bottom: 10px;
    z-index: 2;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
}

/* Panneau texte (verre dépoli) */

.hh-panel {
    position: relative;
    z-index: 2;
    width: min(var(--hh-panel-w), 100%);
    max-height: calc(100% - 56px);
    overflow-y: auto;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: clamp(20px, 2.4vw, 30px);
    border-radius: 18px;
    background: rgba(12, 12, 14, 0.5);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    border: 0.5px solid rgba(255, 255, 255, 0.18);
}

.hh-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--hh-accent) 55%, #fff);
}

.hh-date {
    display: block;
    font-size: clamp(34px, 4.6vw, 64px);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.hh-date::before {
    content: "";
    display: block;
    width: 36px;
    height: 3px;
    margin-bottom: 12px;
    border-radius: 2px;
    background: var(--hh-accent);
}

.hh-title {
    margin: 0;
    font-size: clamp(18px, 1.9vw, 24px);
    font-weight: 600;
    line-height: 1.25;
    color: #fff;
}

.hh-text {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.84);
}

.hh-full[hidden] { display: none; }
.hh-full p { margin: 0 0 0.85em; }
.hh-full p:last-child { margin-bottom: 0; }
.hh-full a { color: #fff; text-decoration: underline; }

.hh-slide.is-open .hh-excerpt { display: none; }

.hh-more {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 0 2px;
    background: none;
    border: 0;
    border-bottom: 1px solid currentColor;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.hh-more svg { transition: transform 0.25s ease; }
.hh-slide.is-open .hh-more svg { transform: rotate(180deg); }

/* Flèches */

.hh-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 0.5px solid rgba(255, 255, 255, 0.35);
    background: rgba(12, 12, 14, 0.45);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, opacity 0.2s;
}

.hh-prev { left: 16px; }
.hh-next { right: 16px; }

.hh-arrow:hover { background: #fff; color: #111; }
.hh-arrow:disabled { opacity: 0.3; pointer-events: none; }

.hh-arrow:focus-visible,
.hh-play:focus-visible,
.hh-more:focus-visible,
.hh-thumb:focus-visible { outline: 2px solid var(--hh-accent); outline-offset: 2px; }

/* ---------- Mode JS : slides empilées + transitions ---------- */

.hh-js .hh-stage { height: var(--hh-stage-h); }

.hh-js .hh-slide {
    position: absolute;
    inset: 0;
    min-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease, visibility 0s linear 0.7s;
}

.hh-js .hh-slide.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.7s ease, visibility 0s;
}

.hh-js .hh-panel {
    opacity: 0;
    transform: translateX(30px);
    transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.5s ease;
}

.hh-js .hh-slide.is-before .hh-panel { transform: translateX(-30px); }

.hh-js .hh-slide.is-active .hh-panel {
    opacity: 1;
    transform: none;
    transition-delay: 0.12s;
}

/* Image pas encore mesurée → masquée (évite le saut plein cadre → image entière) */
.hh-js .hh-slide.is-pending .hh-main { opacity: 0; }

/* Mode « plein cadre » : Ken Burns, lent zoom-out pendant que l'événement est affiché */
.hh-js .hh-slide.is-fill .hh-main {
    transform: scale(1.14);
    transition: transform 1.2s ease-out, opacity 0.45s ease;
}

.hh-js .hh-slide.is-fill.is-active .hh-main {
    transform: scale(1);
    transition: transform 9s linear, opacity 0.45s ease;
}

/* Mode « image entière » : cadre arrondi posé sur un fond flouté de la même image */
.hh-slide.is-fit { --hh-panel-w: 440px; }

.hh-slide.is-fit .hh-blur { display: block; }

.hh-slide.is-fit .hh-bg::after {
    background: linear-gradient(90deg, rgba(6, 6, 8, 0.72) 0%, rgba(6, 6, 8, 0.34) 60%, rgba(6, 6, 8, 0.4) 100%);
}

.hh-slide.is-fit .hh-fig {
    inset: 20px 72px 28px calc(var(--hh-pad-x) + var(--hh-panel-w) + 28px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hh-slide.is-fit .hh-main {
    position: relative;
    inset: auto;
    width: min(100%, calc(var(--hh-fig-h) * var(--hh-ar, 1.5)));
    height: auto;
    aspect-ratio: var(--hh-ar, 1.5);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.hh-js .hh-slide.is-fit .hh-main {
    transform: translateY(12px) scale(0.97);
    transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s, opacity 0.45s ease;
}

.hh-js .hh-slide.is-fit.is-active .hh-main { transform: none; }

/* Bouton « Remplir le cadre / Image entière » */
.hh-fit {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 6;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    border: 0.5px solid rgba(255, 255, 255, 0.35);
    background: rgba(12, 12, 14, 0.45);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.hh-fit:hover { background: #fff; color: #111; }
.hh-fit:focus-visible { outline: 2px solid var(--hh-accent); outline-offset: 2px; }
.hh-fit[hidden] { display: none; }

.hh-fit svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hh-fit .hh-fit-shrink { display: block; }
.hh-fit .hh-fit-expand { display: none; }
.hh-fit.is-fit-on .hh-fit-shrink { display: none; }
.hh-fit.is-fit-on .hh-fit-expand { display: block; }

/* ---------- Sans JS : liste lisible, contrôles masqués ---------- */

.hh-root:not(.hh-js) .hh-stage {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: visible;
    background: none;
}

.hh-root:not(.hh-js) .hh-slide { border-radius: 20px; min-height: 360px; background: #111; }
.hh-root:not(.hh-js) .hh-arrow,
.hh-root:not(.hh-js) .hh-fit,
.hh-root:not(.hh-js) .hh-play,
.hh-root:not(.hh-js) .hh-hint,
.hh-root:not(.hh-js) .hh-ruler,
.hh-root:not(.hh-js) .hh-strip,
.hh-root:not(.hh-js) .hh-head { display: none; }

/* =========================
   4. PELLICULE
========================= */

.hh-strip {
    position: relative; /* offsetParent pour le centrage JS (scrollLeft) */
    display: flex;
    gap: 10px;
    padding: 14px 10px 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}

.hh-strip::-webkit-scrollbar { display: none; }

.hh-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 132px;
    height: 84px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: var(--background-nav-stronger);
    opacity: 0.6;
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.hh-thumb:hover { opacity: 0.92; }

.hh-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hh-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 38%, rgba(0, 0, 0, 0.72) 100%);
}

.hh-thumb-date {
    position: absolute;
    left: 9px;
    right: 9px;
    bottom: 7px;
    z-index: 2;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hh-thumb--plain {
    background: linear-gradient(135deg, color-mix(in srgb, var(--hh-accent) 55%, #000), #1b1812);
}

.hh-thumb.is-active {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 0 0 2px var(--background-color), 0 0 0 4px var(--hh-accent);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1000px) {
    .hh-root { --hh-fig-h: calc(var(--hh-stage-h) * 0.38); }

    /* Image entière : image en haut, panneau en bas (pas assez de place à côté) */
    .hh-slide.is-fit {
        align-items: flex-end;
        padding: 0 clamp(14px, 4vw, 40px) 14px;
    }

    .hh-slide.is-fit .hh-panel { width: 100%; max-height: 60%; }

    .hh-slide.is-fit .hh-fig {
        inset: 14px clamp(14px, 4vw, 40px) auto;
        height: var(--hh-fig-h);
    }

    .hh-slide.is-fit .hh-bg::after {
        background: linear-gradient(180deg, rgba(6, 6, 8, 0.2) 0%, rgba(6, 6, 8, 0.55) 55%, rgba(6, 6, 8, 0.86) 100%);
    }
}

@media (max-width: 760px) {
    .hh-root { --hh-stage-h: 560px; }

    .hh-hint { display: none; }

    .hh-slide { align-items: flex-end; padding: 0 12px 12px; }

    .hh-bg::after {
        background: linear-gradient(180deg, rgba(6, 6, 8, 0.05) 0%, rgba(6, 6, 8, 0.3) 38%, rgba(6, 6, 8, 0.86) 100%);
    }

    .hh-panel {
        width: 100%;
        max-height: 70%;
        padding: 16px;
        background: rgba(12, 12, 14, 0.55);
    }

    .hh-date { font-size: 38px; }
    .hh-date::before { margin-bottom: 8px; }

    .hh-arrow { top: 22%; width: 38px; height: 38px; margin-top: -19px; }
    .hh-prev { left: 10px; }
    .hh-next { right: 10px; }

    .hh-copyright { bottom: auto; top: 10px; }

    .hh-fit { top: 10px; left: 10px; right: auto; width: 34px; height: 34px; }

    .hh-thumb { width: 104px; height: 68px; }
    .hh-band { font-size: 9px; padding: 0 6px; letter-spacing: 0.08em; }
}

/* =========================
   ACCESSIBILITÉ : mouvement réduit
========================= */

@media (prefers-reduced-motion: reduce) {
    .hh-js .hh-slide,
    .hh-js .hh-slide.is-active,
    .hh-js .hh-panel,
    .hh-js .hh-slide.is-active .hh-panel { transition-duration: 0.01s; transition-delay: 0s; transform: none; }

    .hh-js .hh-slide.is-fill .hh-main,
    .hh-js .hh-slide.is-fill.is-active .hh-main,
    .hh-js .hh-slide.is-fit .hh-main { transform: none; transition: none; }

    .hh-play { display: none; }
    .hh-playhead,
    .hh-track-fill,
    .hh-thumb { transition: none; }
    .hh-strip { scroll-behavior: auto; }
}