/* ============================================================
 * Timeline V3 - Split Horizontal Compact (WCAG 2 AA Compliant)
 *
 * Full-width compact timeline for the "Qui sommes-nous 3" page.
 * Split layout: left image panel (period photo) + right content panel.
 * Horizontal year axis with pill-chip buttons and arrow navigation.
 *
 * WCAG 2 AA compliance:
 * - All text meets 4.5:1 contrast ratio minimum
 * - Large text (>=18pt bold) meets 3:1 minimum
 * - Focus indicators on all interactive elements
 * - Touch targets >= 40px
 *
 * Brand colors only: #C20E1A (primary red), Poppins font, 1rem radius.
 * Height: ~540px desktop, stacks on mobile.
 * ============================================================ */

/* === Layout: fills parent container to align with surrounding content === */
.tl3 {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 540px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
    background: #fff;
}

/* === LEFT PANEL: Period Image === */
.tl3-image-panel {
    position: relative;
    width: 40%;
    min-width: 40%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0s;
}

/* Crossfade overlay — sits on top, fades in with new image */
.tl3-image-next {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
}

/* Dark gradient for text readability over image */
.tl3-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.05) 0%,
        rgba(0, 0, 0, 0.55) 100%
    );
    z-index: 2;
}

/* Period name label — bottom-left of image panel */
.tl3-period-label {
    position: absolute;
    bottom: 28px;
    left: 28px;
    z-index: 3;
}

/* Contrast: #fff on dark overlay (~0.55 opacity black) = well above 4.5:1 */
.tl3-period-label-text {
    font-family: var(--e-global-typography-primary-font-family, 'Poppins', sans-serif);
    font-size: 30px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
    line-height: 1.2;
}

/* Period subtitle — descriptive tagline per era
 * e.g. "Les Origines", "L'Ere Industrielle", "Durabilite & Amont Agricole"
 * Text-only differentiation, no color change — respects brand charter */
.tl3-period-subtitle {
    display: block;
    font-family: var(--e-global-typography-secondary-font-family, 'Poppins', sans-serif);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 6px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease;
    line-height: 1.3;
}

/* === RIGHT PANEL: Content === */
.tl3-content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 32px 36px 24px;
    overflow: hidden;
    position: relative;
}

/* Thin accent bar at top of content panel — brand red */
.tl3-content-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #C20E1A;
    z-index: 1;
}

/* ============================================================
 * Period Filter Tabs — Segmented Control Design
 *
 * WCAG 2 AA contrast:
 * - Inactive: #444 on #f5f5f5 = ~8.5:1 (passes AAA)
 * - Hover:    #C20E1A on #f5f5f5 = ~5:1 (passes AA)
 * - Active:   #fff on #C20E1A = ~4.8:1 (passes AA)
 * - Focus:    2px outline for keyboard navigation
 * ============================================================ */
.tl3-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
    flex-shrink: 0;
    background: #f5f5f5;
    border-radius: 99rem;
    padding: 5px;
    width: fit-content;
}

.tl3-filter-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 99rem;
    background: transparent;
    /* #444 on #f5f5f5 = 8.5:1 — passes WCAG AAA */
    color: #444;
    font-family: var(--e-global-typography-secondary-font-family, 'Poppins', sans-serif);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

/* Focus ring for keyboard users — WCAG 2.4.7 */
.tl3-filter-btn:focus-visible {
    outline: 2px solid #C20E1A;
    outline-offset: 2px;
}

.tl3-filter-btn:hover {
    color: #C20E1A;
    background: rgba(194, 14, 26, 0.06);
}

/* #fff on #C20E1A = 4.8:1 — passes WCAG AA for normal text */
.tl3-filter-btn.active {
    background: #C20E1A;
    color: #fff;
    box-shadow: 0 2px 12px rgba(194, 14, 26, 0.35);
    font-weight: 700;
}

/* === Event Content Area === */
.tl3-event {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
    padding-right: 8px;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Slide-out animation */
.tl3-event.tl3-event-exit {
    opacity: 0;
    transform: translateY(8px);
}

/* Slide-in animation */
.tl3-event.tl3-event-enter {
    animation: tl3-slide-in 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes tl3-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* #C20E1A on #fff = 5.9:1 — passes WCAG AA (large bold text, also passes AAA) */
.tl3-event-year {
    font-family: var(--e-global-typography-primary-font-family, 'Poppins', sans-serif);
    font-size: 48px;
    font-weight: 900;
    color: #C20E1A;
    line-height: 1;
    margin-bottom: 14px;
    letter-spacing: -1px;
}

/* #222 on #fff = 16.5:1 — passes WCAG AAA */
.tl3-event-title {
    font-family: var(--e-global-typography-primary-font-family, 'Poppins', sans-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--e-global-color-text, #222221);
    line-height: 1.4;
    margin-bottom: 12px;
}

/* #555 on #fff = 7.45:1 — passes WCAG AA and AAA */
.tl3-event-text {
    font-family: var(--e-global-typography-secondary-font-family, 'Poppins', sans-serif);
    font-size: 14px;
    font-weight: 500;
    color: #555;
    line-height: 1.65;
}

/* Custom scrollbar for long content */
.tl3-event::-webkit-scrollbar {
    width: 3px;
}
.tl3-event::-webkit-scrollbar-track {
    background: transparent;
}
.tl3-event::-webkit-scrollbar-thumb {
    background: rgba(194, 14, 26, 0.2);
    border-radius: 3px;
}

/* ============================================================
 * Horizontal Year Axis — Pill Chip Strip Design
 *
 * WCAG 2 AA contrast:
 * - Default: #333 on #f2f2f2 = ~10.3:1 (passes AAA)
 * - Hover:   #fff on #C20E1A = ~4.8:1 (passes AA)
 * - Active:  #fff on #C20E1A = ~4.8:1 (passes AA)
 * - Focus:   2px solid #C20E1A outline
 * ============================================================ */
.tl3-axis-wrapper {
    flex-shrink: 0;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.tl3-axis {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
}

/* === Scroll Arrow Buttons === */
.tl3-axis-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: #fff;
    /* #C20E1A on #fff = 5.9:1 — passes WCAG AA */
    color: #C20E1A;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    z-index: 3;
}

.tl3-axis-arrow:hover {
    background: #C20E1A;
    border-color: #C20E1A;
    color: #fff;
    box-shadow: 0 2px 8px rgba(194, 14, 26, 0.3);
}

.tl3-axis-arrow:focus-visible {
    outline: 2px solid #C20E1A;
    outline-offset: 2px;
}

.tl3-axis-arrow:active {
    transform: scale(0.92);
}

/* Hide arrows when not needed — controlled by JS */
.tl3-axis-arrow.tl3-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Arrow SVG icons */
.tl3-axis-arrow svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* === Scrollable Pill Strip Container === */
.tl3-axis-track {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Hide the old axis line and progress bar — replaced by pill strip */
.tl3-axis-line {
    display: none;
}
.tl3-axis-progress {
    display: none;
}

/* Scrollable year pills container —
 * right padding prevents last pill from being flush against arrow/edge */
.tl3-axis-years {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 24px 4px 4px;
    scroll-behavior: smooth;
}

.tl3-axis-years::-webkit-scrollbar {
    display: none;
}

/* === Year Pill Button ===
 * Each year is a pill chip with proper dimensions for touch/click.
 * The .tl3-dot span is visually hidden — the pill IS the marker. */
.tl3-year-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    z-index: 2;
    /* Pill shape */
    padding: 0;
    border-radius: 99rem;
    /* #333 on #f2f2f2 = 10.3:1 — passes WCAG AAA */
    background: #f2f2f2;
    min-height: 40px;
    min-width: 40px;
}

/* Hide the dot circle — not needed in pill design */
.tl3-dot {
    display: none;
}

/* Year label IS the pill content now */
.tl3-year-label {
    font-family: var(--e-global-typography-secondary-font-family, 'Poppins', sans-serif);
    font-size: 13px;
    font-weight: 600;
    /* #333 on #f2f2f2 = 10.3:1 — passes WCAG AAA */
    color: #333;
    white-space: nowrap;
    transition: all 0.25s ease;
    padding: 10px 18px;
    line-height: 1;
}

/* Hover: brand red background with white text.
 * Clear interaction affordance — meets WCAG AA.
 * #fff on #C20E1A = 4.8:1 (passes AA) */
.tl3-year-dot:hover {
    background: #C20E1A;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(194, 14, 26, 0.25);
}

.tl3-year-dot:hover .tl3-year-label {
    color: #fff;
}

/* Focus ring for keyboard navigation — WCAG 2.4.7 */
.tl3-year-dot:focus-visible {
    outline: 2px solid #C20E1A;
    outline-offset: 2px;
}

/* Active pill: brand red background with white text + deeper shadow.
 * Shadow depth differentiates active (selected) from hover (preview). */
.tl3-year-dot.active {
    background: #C20E1A;
    box-shadow: 0 3px 12px rgba(194, 14, 26, 0.35);
    transform: translateY(-1px);
}

.tl3-year-dot.active .tl3-year-label {
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}

/* Active hover: darker red for feedback
 * #fff on #a80c16 = 5.8:1 — passes WCAG AA */
.tl3-year-dot.active:hover {
    background: #a80c16;
}

/* ============================================================
 * Responsive — Tablet (768px - 1023px)
 * ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    .tl3 {
        width: 100%;
        height: 500px;
    }

    .tl3-image-panel {
        width: 36%;
        min-width: 36%;
    }

    .tl3-content-panel {
        padding: 24px 24px 18px;
    }

    .tl3-event-year {
        font-size: 38px;
    }

    .tl3-event-title {
        font-size: 16px;
    }

    .tl3-period-label-text {
        font-size: 22px;
    }

    .tl3-period-subtitle {
        font-size: 11px;
        letter-spacing: 1px;
    }

    .tl3-filter-btn {
        padding: 8px 18px;
        font-size: 12px;
    }

    .tl3-year-label {
        font-size: 12px;
        padding: 8px 14px;
    }
}

/* ============================================================
 * Responsive — Mobile (< 768px)
 * Stacked layout: image on top, content below
 * ============================================================ */
@media (max-width: 767px) {
    .tl3 {
        flex-direction: column;
        width: 100%;
        height: auto;
        border-radius: 0.75rem;
    }

    .tl3-image-panel {
        width: 100%;
        min-width: 100%;
        height: 200px;
    }

    .tl3-period-label {
        bottom: 16px;
        left: 16px;
    }

    .tl3-period-label-text {
        font-size: 20px;
    }

    .tl3-period-subtitle {
        font-size: 10px;
        letter-spacing: 0.8px;
        margin-top: 4px;
    }

    .tl3-content-panel {
        padding: 20px 16px 16px;
    }

    .tl3-filters {
        margin-bottom: 16px;
        padding: 3px;
        gap: 4px;
    }

    .tl3-filter-btn {
        padding: 7px 14px;
        font-size: 11px;
    }

    .tl3-event-year {
        font-size: 32px;
        margin-bottom: 8px;
    }

    .tl3-event-title {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .tl3-event-text {
        font-size: 13px;
    }

    .tl3-event {
        min-height: 140px;
    }

    .tl3-axis {
        gap: 6px;
    }

    .tl3-axis-years {
        gap: 6px;
        padding: 4px 16px 4px 4px;
    }

    .tl3-year-label {
        font-size: 11px;
        padding: 8px 12px;
    }

    .tl3-year-dot {
        min-height: 36px;
        min-width: 36px;
    }

    .tl3-axis-arrow {
        width: 30px;
        height: 30px;
    }
}

/* ============================================================
 * Print
 * ============================================================ */
@media print {
    .tl3 {
        flex-direction: column;
        width: 100%;
        height: auto;
        box-shadow: none;
    }

    .tl3-image-panel {
        display: none;
    }

    .tl3-content-panel::before {
        display: none;
    }

    .tl3-event {
        opacity: 1 !important;
        transform: none !important;
    }

    .tl3-axis-arrow {
        display: none;
    }

    .tl3-year-dot.active {
        background: #eee;
        color: #000;
        box-shadow: none;
    }
}
