/* ==========================================================================
   WIDGETS WORDPRESS SUR-MESURE (CBTW) - CSS STANDARD
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Capsule Sonore
   -------------------------------------------------------------------------- */
.cbtw-widget-capsule-sonore {
    background-color: var(--color-sable, #f9f8f6);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.cbtw-capsule__header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cbtw-capsule__play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background-color: var(--color-ardoise, #2c3e50);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.cbtw-capsule__play-btn:hover {
    transform: scale(1.05);
}

.cbtw-capsule__subtitle-wrap {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    display: block;
}

.cbtw-capsule__title {
    margin: 0.2rem 0 0 0;
    font-size: 1.1rem;
    font-weight: 500;
}

.cbtw-capsule__progress-bar {
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
    cursor: pointer;
    border-radius: 2px;
    overflow: hidden;
}

.cbtw-capsule__progress {
    width: 0%;
    height: 100%;
    background-color: var(--color-ardoise, #2c3e50);
    transition: width 0.1s linear;
}

.cbtw-capsule__details {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.cbtw-capsule__summary {
    cursor: pointer;
    opacity: 0.8;
    font-weight: 500;
}

.cbtw-capsule__transcription {
    padding-top: 0.75rem;
    line-height: 1.6;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   2. Journal Note
   -------------------------------------------------------------------------- */
.cbtw-widget-journal-note {
    margin: 2rem 0;
}

.cbtw-journal__container {
    border-left: 2px solid var(--color-ardoise, #2c3e50);
    padding-left: 1.5rem;
}

.cbtw-journal__date {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.6;
    display: block;
    margin-bottom: 0.75rem;
}

.cbtw-journal__body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.cbtw-journal__main-text {
    font-size: 1.05rem;
    line-height: 1.7;
}

.cbtw-journal__margin-note {
    background-color: #f4f1ea;
    padding: 1rem;
    font-size: 0.85rem;
    border-radius: 4px;
    align-self: start;
    font-style: italic;
}

.cbtw-journal__margin-label {
    display: block;
    font-weight: 600;
    font-style: normal;
    text-transform: uppercase;
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

@media screen and (max-width: 767px) {
    .cbtw-journal__body {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* --------------------------------------------------------------------------
   3. Carte Postale
   -------------------------------------------------------------------------- */
.cbtw-widget-carte-postale {
    width: 100%;
    margin: 1.5rem 0;
}

.cbtw-carte-postale__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    background-color: var(--color-sable, #f9f8f6);
    padding: 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.cbtw-carte-postale__front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 2px;
}

.cbtw-carte-postale__back {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    border-left: 1px dashed rgba(0, 0, 0, 0.15);
}

.cbtw-carte-postale__date {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
    margin-bottom: 0.75rem;
}

.cbtw-carte-postale__text {
    font-size: 1rem;
    line-height: 1.6;
}

@media screen and (max-width: 767px) {
    .cbtw-carte-postale__inner {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .cbtw-carte-postale__back {
        border-left: none;
        border-top: 1px dashed rgba(0, 0, 0, 0.15);
        padding: 1rem 0 0 0;
    }
}

/* --------------------------------------------------------------------------
   4. Livre Animé
   -------------------------------------------------------------------------- */
.cbtw-widget-livre {
    max-width: 650px;
    margin: 3rem auto;
    perspective: 1200px;
}

.cbtw-book {
    position: relative;
    background: #fcfbf9;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border-radius: 4px;

    /* Uniformisation des dimensions du livre */
    aspect-ratio: 4 / 3; /* Format paysage fixe */
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cbtw-book__page {
    display: none;
    height: 100%; /* La page prend toute la hauteur du conteneur */
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.6s ease-in-out, transform 0.6s ease;
}

.cbtw-book__page.is-active {
    display: flex; /* Remplace le display block pour gérer la flexibilité */
    opacity: 1;
}

/* Zone de contenu avec scrollbar interne si le texte est long */
.cbtw-book__page-content {
    flex-grow: 1;
    overflow-y: auto; /* Scroll interne actif */
    padding-right: 15px; /* Espace pour ne pas coller à la scrollbar */
    padding-bottom: 20px;

    /* Stylisation de la scrollbar (esthétique fine) */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

/* Scrollbar personnalisée pour navigateurs webkit (Chrome/Safari) */
.cbtw-book__page-content::-webkit-scrollbar {
    width: 6px;
}
.cbtw-book__page-content::-webkit-scrollbar-track {
    background: transparent;
}
.cbtw-book__page-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

/* Effet magique d'apparition progressive du texte */
.cbtw-book__page.is-active .js-reveal-content {
    animation: magicReveal 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes magicReveal {
    0% { opacity: 0; transform: translateY(12px) scale(0.98); filter: blur(4px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.cbtw-book__page-number {
    position: absolute;
    bottom: 1.5rem;
    right: 2rem;
    font-size: 0.8rem;
    opacity: 0.5;
    background: #fcfbf9; /* Masque le texte qui passerait derrière au scroll */
    padding-left: 10px;
}

.cbtw-book__controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.cbtw-book__btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0.5rem;
}

.cbtw-book__btn:hover { opacity: 1; }

.cbtw-book__btn[disabled],
.cbtw-book__btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* --- Responsive Livre Animé --- */
@media screen and (max-width: 767px) {
    .cbtw-book {
        aspect-ratio: 3 / 4; /* Bascule en format portrait sur smartphone */
        padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    }

    .cbtw-book__page-number {
        bottom: 1rem;
        right: 1.5rem;
    }
}

/* --------------------------------------------------------------------------
   5. Galerie Immersive
   -------------------------------------------------------------------------- */
.cbtw-galerie__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.cbtw-galerie__item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.cbtw-galerie__item img:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
}

/* --------------------------------------------------------------------------
   6. Hotspots & Polarsteps
   -------------------------------------------------------------------------- */
.cbtw-hotspots__map-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.cbtw-hotspots__bg {
    width: 100%;
    height: auto;
    display: block;
}

.cbtw-hotspot__pin {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-ardoise, #2c3e50);
    color: #ffffff;
    border: 2px solid #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.cbtw-hotspot__pin:hover { transform: translate(-50%, -50%) scale(1.2); }

.cbtw-hotspot__pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    opacity: 0.6;
    animation: hotspotPulse 2s infinite;
}

@keyframes hotspotPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* Modal Popin */
.cbtw-hotspot-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cbtw-hotspot-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.cbtw-hotspot-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.cbtw-hotspot-modal__card {
    position: relative;
    background: #ffffff;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    border-radius: 8px;
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.cbtw-hotspot-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    background: none;
    font-size: 1.2rem;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   7. Timeline / Parcours
   -------------------------------------------------------------------------- */
   .cbtw-widget-timeline {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 15px;
    font-family: inherit;
}

.cbtw-timeline__main-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 40px;
    color: #1a1a1a;
    letter-spacing: 0.5px;
}

.cbtw-timeline__container {
    position: relative;
    padding: 20px 0;
}

/* Ligne centrale */
.cbtw-timeline__line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: #e2e8f0;
    transform: translateX(-50%);
}

/* Élément de timeline */
.cbtw-timeline__item {
    position: relative;
    width: 50%;
    padding: 10px 30px;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Animation douce d'apparition au scroll */
.cbtw-timeline__item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.cbtw-timeline__item--left {
    left: 0;
    text-align: right;
}

.cbtw-timeline__item--right {
    left: 50%;
    text-align: left;
}

/* Puce centrale */
.cbtw-timeline__dot {
    position: absolute;
    top: 24px;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border: 3px solid var(--color-bleu-encre, #3b82f6);
    border-radius: 50%;
    z-index: 2;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.cbtw-timeline__item--left .cbtw-timeline__dot {
    right: -10px;
}

.cbtw-timeline__item--right .cbtw-timeline__dot {
    left: -10px;
}

.cbtw-timeline__item:hover .cbtw-timeline__dot {
    transform: scale(1.3);
    background: var(--color-bleu-encre, #3b82f6);
}

/* Boîte de contenu */
.cbtw-timeline__content {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.cbtw-timeline__item:hover .cbtw-timeline__content {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.07);
    transform: translateY(-2px);
}

.cbtw-timeline__date {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-bleu-encre, #3b82f6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.cbtw-timeline__item-title {
    font-size: 1.2rem;
    margin: 0 0 10px 0;
    color: #1f2937;
    font-weight: 600;
}

.cbtw-timeline__thumb {
    margin: 12px 0;
    border-radius: 6px;
    overflow: hidden;
}

.cbtw-timeline__thumb img {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: cover;
    display: block;
}

.cbtw-timeline__desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4b5563;
}

.cbtw-timeline__desc p {
    margin: 0 0 8px 0;
}

.cbtw-timeline__desc p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   RESPONSIVE (Mobiles & Tablettes)
   ========================================================================== */

@media (max-width: 768px) {
    .cbtw-timeline__line {
        left: 20px;
    }

    .cbtw-timeline__item {
        width: 100%;
        left: 0 !important;
        padding-left: 50px;
        padding-right: 10px;
        text-align: left !important;
    }

    .cbtw-timeline__dot {
        left: 11px !important;
        right: auto !important;
    }
}