/* History Interactive Timeline
   Design system: #002D48, #D7F1F0, Mardoto fonts, border-radius 32px */

.history-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px 0 0;
}
.history-page-header h2 {
    font-family: 'Mardoto-Bold', sans-serif;
    font-size: 40px;
    line-height: 1.2;
    margin: 0;
    color: #002D48;
}

/* ── TIMELINE NAV (horizontal scrollable) ── */
.tl-nav {
    position: sticky;
    top: 120px;
    z-index: 1;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(0,45,72,0.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    padding: 12px 8px;
    margin: 24px 0 40px;
    display: flex;
    align-items: center;
    gap: 0;
}

.tl-nav-arrow {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f4f5;
    color: #002D48;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
}
.tl-nav-arrow:hover {
    background: #002D48;
    color: #fff;
}
.tl-nav-arrow:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.tl-nav-scroll {
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
}
.tl-nav-scroll::-webkit-scrollbar { display: none; }

.tl-nav-track {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: max-content;
    padding: 0 8px;
}

.tl-nav-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 40px;
    font-family: 'Mardoto-Bold', sans-serif;
    font-size: 13px;
    color: #002D48;
    background: #f0f4f5;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
}
.tl-nav-dot:hover {
    background: #D7F1F0;
    color: #002D48;
}
.tl-nav-dot.active {
    background: #002D48;
    color: #fff;
    border-color: #002D48;
    box-shadow: 0 2px 12px rgba(0,45,72,0.3);
}

.tl-nav-line {
    width: 12px;
    height: 2px;
    background: rgba(0,45,72,0.15);
    flex-shrink: 0;
}

/* ── VERTICAL TIMELINE ── */
.tl-timeline {
    position: relative;
    padding: 20px 0 60px;
}

/* Central vertical line */
.tl-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #D7F1F0 0%, #002D48 20%, #002D48 80%, #D7F1F0 100%);
    transform: translateX(-50%);
    border-radius: 2px;
}

/* ── TIMELINE ITEM ── */
.tl-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 60px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.tl-item.tl-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Alternating layout */
.tl-item:nth-child(odd) {
    flex-direction: row;
    padding-right: calc(50% + 40px);
}
.tl-item:nth-child(even) {
    flex-direction: row-reverse;
    padding-left: calc(50% + 40px);
}

/* Year badge on the timeline line */
.tl-year-badge {
    position: absolute;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    background: #002D48;
    color: #fff;
    font-family: 'Mardoto-Black', sans-serif;
    font-size: 16px;
    padding: 8px 20px;
    border-radius: 30px;
    white-space: nowrap;
    z-index: 2;
    box-shadow: 0 3px 12px rgba(0,45,72,0.3);
}

/* Card */
.tl-card {
    flex: 1;
    background: #fff;
    border: 1px solid rgba(0,45,72,0.08);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 4px 4px 16px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tl-card:hover {
    box-shadow: 6px 6px 24px rgba(0,45,72,0.12);
    transform: translateY(-4px);
}

.tl-item:nth-child(odd) .tl-card { margin-right: 0; }
.tl-item:nth-child(even) .tl-card { margin-left: 0; }

/* Teal accent for even cards */
.tl-item:nth-child(even) .tl-card {
    background: #D7F1F0;
    border-color: transparent;
}

.tl-card-title {
    font-family: 'Mardoto-Bold', sans-serif;
    font-size: 22px;
    line-height: 1.3;
    color: #002D48;
    margin: 0 0 12px;
}

.tl-card-text {
    font-family: 'Mardoto-Regular', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(0,0,0,0.7);
    margin: 0 0 16px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card gallery — row of up to 3 photos, fixed height */
.tl-card-gallery {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-radius: 16px;
    overflow: hidden;
    height: 140px;
}

.tl-card-img {
    overflow: hidden;
    position: relative;
    flex: 1;
    min-width: 0;
}
.tl-card-gallery[data-count="1"] .tl-card-img {
    flex: 1;
}
.tl-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.tl-card:hover .tl-card-img img {
    transform: scale(1.05);
}

/* "+N more" badge on last photo */
.tl-card-img-more {
    position: absolute;
    inset: 0;
    background: rgba(0,45,72,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Mardoto-Bold', sans-serif;
    font-size: 18px;
    color: #fff;
}

.tl-card-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Mardoto-Medium', sans-serif;
    font-size: 14px;
    color: #007470;
    cursor: pointer;
}
.tl-card-more svg {
    transition: transform 0.3s ease;
}
.tl-card-more:hover svg {
    transform: translateX(3px);
}


/* ── MODAL / EXPANDED VIEW ── */
.tl-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,20,40,0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.tl-modal-overlay.tl-modal-open {
    display: flex;
    opacity: 1;
}

.tl-modal {
    background: #fff;
    border-radius: 32px;
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 48px 40px 40px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: tl-modal-in 0.35s ease;

    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #002D48 transparent;
}
.tl-modal::-webkit-scrollbar {
    width: 6px;
}
.tl-modal::-webkit-scrollbar-track {
    background: transparent;
    margin: 32px 0;
}
.tl-modal::-webkit-scrollbar-thumb {
    background: #002D48;
    border-radius: 10px;
}
.tl-modal::-webkit-scrollbar-thumb:hover {
    background: #004a6e;
}

@keyframes tl-modal-in {
    from { transform: scale(0.92) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.tl-modal-close {
    position: sticky;
    top: 0;
    float: right;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f0f4f5;
    color: #002D48;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
    margin-top: -8px;
}
.tl-modal-close:hover {
    background: #002D48;
    color: #fff;
}

.tl-modal-year {
    font-family: 'Mardoto-Black', sans-serif;
    font-size: 48px;
    color: #002D48;
    margin: 0 0 8px;
}

.tl-modal-title {
    font-family: 'Mardoto-Bold', sans-serif;
    font-size: 28px;
    color: #002D48;
    margin: 0 0 20px;
    padding-right: 50px;
}

.tl-modal-text {
    font-family: 'Mardoto-Regular', sans-serif;
    font-size: 17px;
    line-height: 1.8;
    color: rgba(0,0,0,0.75);
    margin: 0 0 28px;
}

/* Modal gallery */
.tl-modal-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.tl-modal-gallery-item {
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: pointer;
    position: relative;
}

.tl-modal-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.tl-modal-gallery-item:hover img {
    transform: scale(1.08);
}

/* ── RESPONSIVE ── */
@media (max-width: 1023px) {
    .tl-timeline::before {
        left: 24px;
    }
    .tl-item,
    .tl-item:nth-child(odd),
    .tl-item:nth-child(even) {
        flex-direction: row;
        padding-left: 64px;
        padding-right: 0;
    }
    .tl-year-badge {
        left: 24px;
        transform: translateX(-50%);
        font-size: 13px;
        padding: 6px 14px;
    }
    .tl-item:nth-child(even) .tl-card {
        margin-left: 0;
    }
    .tl-card-title {
        font-size: 20px;
    }
}

@media (max-width: 767px) {
    .history-page-header h2 {
        font-size: 28px;
    }
    .tl-timeline::before {
        left: 16px;
    }
    .tl-item,
    .tl-item:nth-child(odd),
    .tl-item:nth-child(even) {
        padding-left: 48px;
        margin-bottom: 40px;
    }
    .tl-year-badge {
        left: 16px;
        font-size: 12px;
        padding: 5px 12px;
        top: 12px;
    }
    .tl-card {
        padding: 20px;
        border-radius: 20px;
    }
    .tl-card-title {
        font-size: 18px;
    }
    .tl-card-text {
        font-size: 14px;
    }
    .tl-nav {
        padding: 8px 4px;
        margin: 16px 0 24px;
        border-radius: 16px;
    }
    .tl-nav-arrow {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    .tl-nav-dot {
        font-size: 12px;
        padding: 5px 10px;
    }
    .tl-nav-line {
        width: 6px;
    }
    .tl-modal-overlay {
        padding: 16px;
    }
    .tl-modal {
        padding: 28px 20px 20px;
        border-radius: 24px;
        max-height: 90vh;
    }
    .tl-modal-year {
        font-size: 36px;
    }
    .tl-modal-title {
        font-size: 22px;
        padding-right: 40px;
    }
    .tl-modal-text {
        font-size: 15px;
    }
    .tl-modal-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .tl-nav-dot {
        font-size: 11px;
        padding: 4px 8px;
    }
    .tl-nav-line {
        width: 4px;
    }
    .tl-card {
        padding: 16px;
    }
    .tl-card-title {
        font-size: 16px;
    }
    .tl-card-text {
        font-size: 13px;
        -webkit-line-clamp: 3;
    }
    .tl-modal {
        padding: 24px 16px 16px;
        border-radius: 20px;
    }
    .tl-modal-year {
        font-size: 28px;
    }
    .tl-modal-title {
        font-size: 18px;
    }
    .tl-modal-text {
        font-size: 14px;
        line-height: 1.6;
    }
    .tl-modal-gallery {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}
