/*------------------------------*\

    #FLUXI-CARTE (prototype)

\*------------------------------*/

.fc-carte {
    --fc-carte-accent: #d6451b;
    --fc-carte-accent-contrast: #fff;
    --fc-carte-ink: #1d2433;
    --fc-carte-muted: #5b6474;
    --fc-carte-bg: #fff;
    --fc-carte-surface: #fff;
    --fc-carte-radius: 10px;
    --fc-carte-shadow: 0 6px 24px rgba(20, 28, 45, .18);
    --fc-carte-point-size: 34px;
    --fc-carte-panel-width: 400px;

    position: relative;
    margin: 2rem 0;
    color: var(--fc-carte-ink);
    container-type: inline-size;
}

/* Carte en premier bloc : on retire le fond blanc / l'ombre de la colonne du thème
   et son padding haut pour coller la carte sous l'en-tête */
.c-fadingBg:has(> .fc > .fc-item:first-child > .fc-carte) {
    padding-top: 0;
}

.c-fadingBg:has(> .fc > .fc-item:first-child > .fc-carte)::before,
.c-fadingBg:has(> .fc > .fc-item:first-child > .fc-carte)::after {
    display: none;
}

.fc-item:first-child > .fc-carte {
    margin-top: 0;
}

/* Pleine largeur : sort de la colonne de contenu (centrée)
   100vw inclut la barre de défilement : sa largeur est retirée (--fc-carte-scrollbar, posé par le JS) */

.single-post .fc .fc-carte {   
    width: 100%;    
}

.page .fc .fc-carte {
    --fc-carte-full: calc(100vw - var(--fc-carte-scrollbar, 0px));
    width: var(--fc-carte-full);
    max-width: none;
    margin-inline: calc((100% - var(--fc-carte-full)) / 2);
}


/* VIEWPORT & SCÈNE */

.fc-carte__viewport {
    position: relative;
    overflow: hidden;
    border-radius: var(--fc-carte-radius);
    background: var(--fc-carte-bg);
}

.fc-carte__img {
    display: block;
    width: 100%;
    height: auto;
}

.fc .fc-carte__viewport {
    border-radius: 0;
}

/* Hauteur : image à pleine largeur, plafonnée à une hauteur confortable
   (--fc-carte-ratio = hauteur / largeur de l'image, posé par le JS) */
.fc-carte.is-ready .fc-carte__viewport {
    height: min(calc(100cqw * var(--fc-carte-ratio, .6)), 85vh, 900px);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.fc-carte__viewport:focus-visible {
    outline: 3px solid var(--fc-carte-accent);
    outline-offset: 2px;
}

.fc-carte.is-ready .fc-carte__stage {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

/* will-change uniquement pendant un mouvement : sinon Chrome fige le rendu
   à l'échelle initiale et l'image reste floue une fois zoomée */
.fc-carte.is-moving .fc-carte__stage {
    will-change: transform;
}

.fc-carte.is-ready .fc-carte__img {
    height: 100%;
    pointer-events: none;
    -webkit-user-drag: none;
}

.fc-carte.is-zoomed .fc-carte__viewport {
    cursor: grab;
}

.fc-carte.is-dragging .fc-carte__viewport {
    cursor: grabbing;
}


/* POINTS */

.fc-carte__point {
    display: none;
}

.fc-carte.is-ready .fc-carte__point {
    position: absolute;
    z-index: 1;
    display: block;
    width: var(--fc-carte-point-size);
    height: var(--fc-carte-point-size);
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    /* Taille constante à l'écran quel que soit le zoom */
    transform: translate(-50%, -50%) scale(calc(1 / var(--fc-scale, 1)));
}

.fc-carte__point:focus-visible {
    outline: none;
}

.fc-carte__point.is-active {
    z-index: 2;
}

.fc-carte__pointDot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--fc-carte-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    color: var(--fc-carte-accent-contrast);
    font: 700 14px/1 system-ui, sans-serif;
    transition: transform .2s ease, background-color .2s ease;
}

.fc-carte__pointDot::after {
    content: "";
    position: absolute;
    inset: -3px;
    border: 2px solid var(--fc-carte-accent);
    border-radius: 50%;
    animation: fc-carte-pulse 2.4s ease-out infinite;
    pointer-events: none;
}

.fc-carte__point:hover .fc-carte__pointDot,
.fc-carte__point:focus-visible .fc-carte__pointDot {
    transform: scale(1.15);
}

.fc-carte__point:focus-visible .fc-carte__pointDot {
    box-shadow: 0 0 0 3px var(--fc-carte-ink), 0 2px 8px rgba(0, 0, 0, .35);
}

.fc-carte__point.is-active .fc-carte__pointDot {
    background: var(--fc-carte-ink);
    transform: scale(1.2);
}

.fc-carte__point.is-active .fc-carte__pointDot::after {
    animation: none;
    opacity: 0;
}

/* Infobulle au survol (le libellé reste lu par les lecteurs d'écran) */
.fc-carte__pointLabel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    padding: 5px 9px;
    border-radius: 6px;
    background: var(--fc-carte-ink);
    color: #fff;
    font: 600 13px/1.2 system-ui, sans-serif;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity .15s ease, transform .15s ease;
    pointer-events: none;
}

.fc-carte__point:hover .fc-carte__pointLabel,
.fc-carte__point:focus-visible .fc-carte__pointLabel {
    opacity: 1;
    transform: translate(-50%, 0);
}

.fc-carte__point.is-active .fc-carte__pointLabel {
    opacity: 0;
}

@keyframes fc-carte-pulse {
    0% { transform: scale(1); opacity: .9; }
    70%, 100% { transform: scale(1.8); opacity: 0; }
}


/* CONTRÔLES */

.fc-carte__controls {
    position: absolute;
    bottom: 12px;
    left: 50%;
    z-index: 3;
    display: flex;
    gap: 6px;
    transform: translateX(-50%);
    cursor: auto;
}

.fc-carte__btn,
.fc-carte__navBtn {
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    color: var(--fc-carte-ink);
    cursor: pointer;
}

.fc-carte__btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--fc-carte-surface);
    box-shadow: var(--fc-carte-shadow);
}

.fc-carte__navBtn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
}

.fc-carte__btn:hover,
.fc-carte__navBtn:hover {
    background: #eef0f3;
}

.fc-carte__btn:disabled {
    opacity: .45;
    cursor: default;
    background: var(--fc-carte-surface);
}

.fc-carte__btn:focus-visible,
.fc-carte__navBtn:focus-visible {
    outline: 2px solid var(--fc-carte-accent);
    outline-offset: 2px;
}

.fc-carte__btn svg,
.fc-carte__navBtn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ENCARTS */

/* Sans JS : liste des encarts sous l'image */
.fc-carte__encarts {
    margin-top: 1rem;
}

.fc-carte__encart + .fc-carte__encart {
    margin-top: 1.5rem;
}

.fc-carte__encartTitle {
    display: none;
    margin: 0 0 .75rem;
    font-size: 1.25rem;
    line-height: 1.25;
}

.fc-carte__encartTitle:focus {
    outline: none;
}

.fc-carte__encartText {
    color: var(--fc-carte-ink);
    line-height: 1.5;
}

.fc-carte__encartText > :first-child {
    margin-top: 0;
}

.fc-carte__encartText > :last-child {
    margin-bottom: 0;
}

.fc-carte__encartText img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Avec JS : un seul encart visible dans un panneau */
.fc-carte.is-ready .fc-carte__encarts {
    display: none;
    margin: 12px 16px 0;
    border-radius: var(--fc-carte-radius);
    background: var(--fc-carte-surface);
    box-shadow: var(--fc-carte-shadow);
}

.fc-carte.has-encart .fc-carte__encarts {
    display: block;
}

.fc-carte.is-ready .fc-carte__encart {
    display: none;
    margin: 0;
    padding: 4px 20px 20px;
}

.fc-carte.is-ready .fc-carte__encart.is-active {
    display: block;
}

.fc-carte__nav {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 8px 0;
    background: var(--fc-carte-surface);
}

.fc-carte__navCount {
    padding: 0 4px;
    color: var(--fc-carte-muted);
    font: 13px/1 system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}

.fc-carte__close {
    margin-left: auto;
}

/* Desktop & plein écran : panneau superposé à droite de la carte */
@media screen and (min-width: 768px) {
    .fc-carte.is-ready .fc-carte__encarts {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 3;
        width: min(var(--fc-carte-panel-width), 45%);
        max-height: calc(100% - 24px);
        margin: 0;
        overflow: auto;
    }  
    .fc-carte.is-ready .fc-carte__encart {
        padding: 12px 30px 30px;
    }  
}

.fc-carte:fullscreen {
    width: 100%;
    margin: 0;
    background: var(--fc-carte-bg);
}

.fc-carte:fullscreen .fc-carte__viewport {
    height: 100vh;
    border-radius: 0;
}

.fc-carte:fullscreen .fc-carte__encarts {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    width: min(var(--fc-carte-panel-width), calc(100% - 24px));
    max-height: calc(100% - 24px);
    margin: 0;
    overflow: auto;
}


/* AIDE MOLETTE */

.fc-carte__hint {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(20, 28, 45, .55);
    color: #fff;
    font: 600 1rem/1.3 system-ui, sans-serif;
    text-align: center;
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}

.fc-carte__hint.is-visible {
    opacity: 1;
}


/* DEBUG */

.fc-carte.is-debug .fc-carte__viewport {
    cursor: crosshair;
}

.fc-carte__debug {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 3;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .75);
    color: #fff;
    font: 12px/1.4 ui-monospace, Menlo, monospace;
    pointer-events: none;
}

.fc-carte__debugMarker {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid #ff0;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #000;
    transform: translate(-50%, -50%) scale(calc(1 / var(--fc-scale, 1)));
    pointer-events: none;
}


@media (prefers-reduced-motion: reduce) {
    .fc-carte__pointDot::after {
        animation: none;
    }
}
