/* ============================================================
   VARIABLES
   ============================================================ */
:root {
    --color-bg:              #f9f8f6;   /* quasi-blanc — fond principal */
    --color-bg-header:       #3964e2;   /* bleu — header */
    --color-bg-header-2:     #9ab0f0;   /* bleu — header */
    --color-bg-secondary:    #ede5b0;   /* crème — fonds de texte flottants */
    --color-text-header:     #ffffff;   /* blanc pur — texte sur header bleu */
    --color-border:          #e2ddd4;   /* beige clair — bordures */
    --color-border-hover:    #c8bda0;   /* beige soutenu — bordures hover */
    --color-primary:         #5e4d2c;   /* brun — ui principal */
    --color-primary-light:   #a08060;   /* brun clair */
    --color-text-primary:    #1a1512;   /* brun très foncé — texte */
    --color-text-secondary:  #4a3e28;   /* brun moyen — texte secondaire */
    --color-text-muted:      #9b8a62;   /* brun clair — texte atténué */
    --color-accent:          #c8bca4;   /* beige chaud — accents */
    --color-bg-panel:        #fdf8e8;   /* crème — panneaux/cartes (conservé) */

    /* Couleurs des trois périodes de la frise */
    --color-period-1:        #ddd0b8;   /* Famille Berton-Crillon  1530–1803 — vanille claire */
    --color-period-2:        #ddd0b8;   /* Famille Thomas          1803–1885 — champagne */
    --color-period-3:        #ddd0b8;   /* Famille Grammont-Crillon 1885–2030 — jaune paille */

    /* Fonds des trois périodes */
    --color-bg-period-1:     #FEFCF0;   /* Berton-Crillon — blanc vanille */
    --color-bg-period-2:     #FDFAE6;   /* Thomas — crème champagne */
    --color-bg-period-3:     #FAF6D8;   /* Grammont — ivoire jaune */

    --font-display: 'Labrada', Georgia, serif;
    --font-ui:      'Helvetica Neue', Helvetica, Arial, sans-serif;

    --transition:  0.3s ease;
    --shadow-sm:   0 1px 4px rgba(0,0,0,0.06);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
    --radius-md:   8px;
    --radius-sm:   4px;
    --radius-lg:   16px;

    /* Hauteur du header */
    --header-h: 60px;

    /* Position verticale de la frise (depuis le bas du scroll-wrapper) */
    --tl-bottom: 90px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;   /* tout le scroll est géré par .scroll-wrapper */
    font-family: var(--font-ui);
    background: var(--color-bg);
    color: var(--color-text-primary);
    font-size: 15px;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   HEADER
   ============================================================ */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    background: var(--color-bg-header);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    color: var(--color-text-header);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: color var(--transition);
}
.logo:hover { color: rgba(255,255,255,0.75); }

.logo-sub {
    font-size: 1.2rem;
    font-weight: 300;
    font-style: italic;
    color: var(--color-text-header);
    letter-spacing: 0.12em;
    border-left: 1px solid rgba(255,255,255,0.28);
    padding-left: 1rem;
}

.header-buttons { display: flex; gap: 1.4rem; align-items: center; }

.header-btn-img {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    opacity: 0.82;
    transition: opacity 0.2s;
}
.header-btn-img:hover { opacity: 1; }
.header-btn-img img {
    height: 26px;
    width: auto;
    display: block;
}
.header-btn-img span {
    font-family: var(--font-ui);
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.9);
}

/* ============================================================
   ZONE DE DÉFILEMENT (fixe, occupe tout sous le header)
   ============================================================ */
.scroll-wrapper {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0; bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    cursor: grab;
    /* masquer la scrollbar native */
    scrollbar-width: none;
}
.scroll-wrapper:active { cursor: grabbing; }
.scroll-wrapper::-webkit-scrollbar { display: none; }

/* Piste très large — largeur calculée en JS */
.scroll-track {
    position: relative;
    height: 100%;
    /* width défini par JS */
}

/* ============================================================
   FRISE CHRONOLOGIQUE
   ============================================================ */

/* Bandes de fond par période */
.tl-bg-band {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 0;
    
}

/* Segments de la frise — descend jusqu'en bas de la page */
.tl-line {
    position: absolute;
    bottom: 0;
    height: calc(var(--tl-bottom) + 12px);
    box-shadow: var(--shadow-md);
    
}

/* Barre de durée — événements (yearEnd) */
.tl-span-bar {
    position: absolute;
    bottom: var(--tl-bottom);   
    height: 11px;
    border-radius: 4px;
    background: var(--color-primary);
    opacity: 0.28;
    z-index: 3;
    cursor: pointer;
    overflow: visible;   
    transition: opacity var(--transition), background var(--transition);
}
.tl-span-bar:hover     { opacity: 0.55; }
.tl-span-bar.is-active { opacity: 0.75; }

/* Étiquette de l'année de fin — masquée */
.tl-span-year-end { display: none; }

/* Ticks de décennie — même couleur que le fond page, fond dans la bande */
.tl-tick {
    position: absolute;
    bottom: calc(var(--tl-bottom) - 2px);
    width: 10px;
    height: 20px;
    background: var(--color-bg);
    border-radius: 3px;
    transform: translateX(-50%);
}
.tl-tick.is-major {
    width: 10px;
    height: 22px;
    bottom: calc(var(--tl-bottom) - 4px);
    border-radius: 3px;
}

/* Labels de décennie */
.tl-decade-lbl {
    position: absolute;
    bottom: calc(var(--tl-bottom) - 36px);
    font-size: 0.8rem;
    font-family: var(--font-ui);
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    transform: translateX(-50%);
    white-space: nowrap;
    pointer-events: none;
}

/* Dot d'événement — rectangle comme les ticks, centré sur tl-bottom+5px */
.tl-dot {
    position: absolute;
    bottom: calc(var(--tl-bottom) - 7px);  /* centre: -7 + 12 = +5 ✓ */
    width: 12px;
    height: 24px;
    border-radius: 3px;
    background: var(--color-primary);
    transform: translateX(-50%);
    cursor: pointer;
    transition: all var(--transition);
    z-index: 5;
}
.tl-dot:hover {
    background: var(--color-primary);
    transform: translateX(-50%) scaleY(1.1);
}
.tl-dot.is-active {
    width: 14px;
    height: 28px;
    bottom: calc(var(--tl-bottom) - 9px);  /* centre: -9 + 14 = +5 ✓ */
    background: var(--color-primary);
}


/* ============================================================
   BULLES D'ÉVÉNEMENTS
   ============================================================ */
.event-bubble {
    position: absolute;
    width: 240px;
    padding-left: 14px;   /* décale le texte à droite du connecteur */
    /* bottom + left définis en JS */
    transition: opacity 0.45s ease;
    opacity: 0.12;
}
.event-bubble.is-near   { opacity: 0.42; }
.event-bubble.is-active { opacity: 1; }

/* Bulle en miroir : à gauche du dot, texte justifié à droite */
.event-bubble.is-left {
    padding-left: 0;
    padding-right: 14px;
    text-align: right;
}
.event-bubble.is-left .bubble-connector {
    left: auto;
    right: 0;
}

/* Date stylisée */
.bubble-date {
    display: block;
    font-size: 0.65rem;
    font-family: var(--font-ui);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 0.55rem;
}

/* Titre */
.bubble-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--color-text-primary);
    line-height: 1.3;
    margin-bottom: 0.55rem;
}

/* Corps de texte */
.bubble-text {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* Lien type "+ 1 archive" */
.bubble-tag {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    font-family: var(--font-ui);
    color: var(--color-primary);
    letter-spacing: 0.06em;
    border-bottom: none;
    cursor: pointer;
    transition: opacity var(--transition);
    text-decoration: underline ; 
    text-decoration-color : var(--color-primary);
}
.bubble-tag:hover { opacity: 0.65; }
.bubble-tag[data-tag-grp]:hover {
    opacity: 1;
    color: var(--color-accent);
}

/* ── Bulle avec image latérale (sideImage) ──────────────── */
.event-bubble.has-side-img {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding-left: 0;
    gap: 10px;
}
.bubble-side-img-col {
    flex-shrink: 0;
}
.bubble-side-img-col img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 3px;
    border: 1.5px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    cursor: zoom-in;
    transition: transform 0.2s ease, border-color 0.2s;
}
.bubble-side-img-col img:hover {
    transform: scale(1.03);
    border-color: var(--color-accent);
}
.bubble-main-col {
    flex: 1;
    min-width: 0;
    position: relative;
    padding-left: 14px;
}

/* ── Bulle avec image en tête (topImage) ────────────────── */
.bubble-top-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--color-border);
    margin-bottom: 0.6rem;
    cursor: zoom-in;
    transition: opacity 0.2s, border-color 0.2s;
}
.bubble-top-img:hover {
    opacity: 0.88;
    border-color: var(--color-accent);
}

/* Entrée individuelle dans une bulle groupée (plusieurs événements par année) */
.bubble-entry + .bubble-entry {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--color-border);
}

/* Connecteur vertical (du sommet de la bulle jusqu'au dot sur la frise) */
.bubble-connector {
    position: absolute;
    top: 0;        /* part du sommet de la bulle */
    left: 0;
    transform: none;
    width: 1px;
    background: linear-gradient(to bottom, transparent 0%, var(--color-border) 18%, var(--color-border) 85%, transparent 100%);
    pointer-events: none;
    /* height = hauteur bulle + distance bulle→dot, défini en JS via calc() */
}

/* ============================================================
   FLÈCHES DE NAVIGATION (fixes dans le viewport)
   ============================================================ */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: rgba(250, 248, 244, 0.92);
    backdrop-filter: blur(8px);
    font-size: 1.6rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 6px;
    z-index: 80;
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
    opacity: 0.7;
}
.nav-arrow:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    opacity: 1;
    box-shadow: 0 6px 24px rgba(139,111,71,0.28);
}
.nav-arrow.hidden {
    opacity: 0;
    pointer-events: none;
}
.nav-arrow-left  { left: 1.25rem; }
.nav-arrow-right { right: 1.25rem; }

/* ============================================================
   IMAGES DANS LES BULLES
   ============================================================ */
.bubble-imgs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-top: 0.7rem;
    margin-bottom: 0.5rem;
}
.bubble-img {
    width: auto;
    height: 120px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--color-border);
    cursor: zoom-in;
    flex-shrink: 0;
    transition: border-color var(--transition), transform var(--transition);
}
.bubble-img:hover {
    border-color: var(--color-accent);
    transform: scale(1.04);
}
.event-bubble.is-left .bubble-imgs {
    justify-content: flex-end;
}

/* ============================================================
   IMAGES FLOTTANTES SUR LA FRISE
   ============================================================ */
.tl-frise-img-wrap {
    position: absolute;
    transform: translateX(-50%);
    z-index: 4;
    cursor: zoom-in;
}
.tl-frise-img-wrap.is-below {
    bottom: calc(var(--tl-bottom) - 96px);
}
.tl-frise-img-wrap.is-above {
    bottom: calc(var(--tl-bottom) + 300px);
}
.tl-frise-img {
    display: block;
    width: 150px;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s;
}
.tl-frise-img-wrap:hover .tl-frise-img {
    transform: scale(1.07);

}
.tl-frise-caption {
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(44,36,22,0.88);
    color: #f0ece4;
    font-size: 0.6rem;
    font-family: var(--font-ui);
    letter-spacing: 0.07em;
    padding: 3px 7px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s;
}
.tl-frise-img-wrap.is-below .tl-frise-caption {
    bottom: auto;
    top: calc(100% + 5px);
}
.tl-frise-img-wrap:hover .tl-frise-caption { opacity: 1; }

/* ============================================================
   ENCARTS DE TEXTE FLOTTANTS SUR LA FRISE
   ============================================================ */
.tl-frise-text-wrap {
    position: absolute;
    transform: translateX(-50%);
    width: 350px;
    z-index: 4;
    top: 70px;
}
.tl-frise-text-wrap.is-below {
    top: auto;
    bottom: calc(var(--tl-bottom) - 110px);
}
.tl-frise-text {
    background: var(--color-bg-header-2);
    
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}
.tl-frise-text-wrap:hover .tl-frise-text {
    background: var(--color-bg-header);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
    
}
.tl-frise-text-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--color-bg);
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
    line-height: 1.3;
}
.tl-frise-text-body {
    font-size: 0.9rem;
    font-family: var(--font-ui);
    color: var(--color-bg);
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* tl-lightbox — styles déplacés dans ASSETS/css/gallery.css */

/* ── Séparateurs de période ───────────────────────────────────── */
.tl-period-sep {
    position: absolute;
    bottom: 0;
    height: calc(var(--tl-bottom) + 12px);
    width: 2px;
    background: rgba(80, 60, 40, 0.3);
    transform: translateX(-50%);
    z-index: 4;
    pointer-events: none;
}

/* ============================================================
   AIDE CONTEXTUELLE
   ============================================================ */
.tl-help-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.tl-help-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.tl-help-tip {
    position: absolute;
    z-index: 6;
    transform: translateX(-50%);
}
.tl-help-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: 0.09em;
    line-height: 150%;
    color: var(--color-text-header);
    background: var(--color-bg-header);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.tl-help-toggle:hover {
    color: var(--color-text-header);
    border-color: rgba(255,255,255,0.5);
    background: var(--color-bg-header-2);
}
.tl-help-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 210;
    width: min(440px, calc(100vw - 24px));
    background: #f0e8d8;
    border: 1px solid rgba(120, 100, 80, 0.22);
    border-top: 3px solid rgba(120, 100, 80, 0.22);
    border-radius: var(--radius-sm);
    padding: 0;
    box-shadow: 0 4px 16px rgba(80, 60, 40, 0.18);
    font-size: 0.9rem;
    line-height: 1.75;
    color: rgba(80, 60, 40, 0.85);
    display: none;
    pointer-events: none;
    overflow: hidden;
}
.tl-help-panel.is-open {
    display: block;
    pointer-events: auto;
}
.tl-help-panel-title {
    display: block;
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.2rem;
    color: rgba(80, 60, 40, 1);
    letter-spacing: 0.06em;
    padding: 0.5rem 1.1rem;
    background: #e8dbc8;
    border-bottom: 1px solid rgba(120, 100, 80, 0.18);
    margin-bottom: 0;
}
.tl-help-panel p { margin-bottom: 0.55rem; padding: 0 1.1rem; }
.tl-help-panel p:first-of-type { padding-top: 0.6rem; }
.tl-help-panel p:last-child { margin-bottom: 0; padding-bottom: 0.85rem; }

/* ============================================================
   RESPONSIVE (tablette)
   ============================================================ */
@media (max-width: 680px) {
    :root { --header-h: 54px; --tl-bottom: 70px; }
    .header { padding: 0 1rem; }
    .logo {
        font-size: 0.95rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.1rem;
    }
    .logo-sub {
        font-size: 0.6rem;
        border-left: none;
        padding-left: 0;
        letter-spacing: 0.1em;
    }
    .event-bubble { width: 180px; }
    .bubble-title { font-size: 0.95rem; }
    .nav-arrow { width: 38px; height: 38px; font-size: 1.5rem; }
    .nav-arrow-left  { left: 0.4rem; }
    .nav-arrow-right { right: 0.4rem; }
}
