/* =====================================================
   Timeline Elementor Widget — timeline.css
   Desktop: left scroll + right sticky card design
   Mobile (≤768px): full-width accordion layout
   ===================================================== */

/* --- Wrapper --- */
.tew-wrapper {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    font-family: inherit;
    position: relative;
}

/* =====================
   LEFT PANEL
   ===================== */
.tew-left {
    width: 55%;
    max-height: 700px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding-right: 8px;
}

/* Custom scrollbar */
.tew-left::-webkit-scrollbar { width: 4px; }
.tew-left::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 4px; }
.tew-left::-webkit-scrollbar-thumb { background: #1e90ff; border-radius: 4px; }

.tew-timeline-track {
    position: relative;
    padding-left: 32px;
}

/* Vertical timeline line */
.tew-timeline-line {
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #d0e8ff;
    z-index: 0;
}

/* ─ Decade group ─ */
.tew-decade-group {
    margin-bottom: 28px;
}

.tew-decade-row {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
    position: relative;
}

.tew-decade-dot {
    width: 16px;
    height: 16px;
    background: #1e90ff;
    border-radius: 50%;
    position: absolute;
    left: -28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    border: 3px solid #fff;
    box-shadow: 0 0 0 2px #1e90ff;
}

.tew-decade-label {
    display: inline-block;
    background: #1e90ff;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 4px 14px;
    border-radius: 20px;
    text-transform: uppercase;
}

/* ─ Tab rows ─ */
.tew-decade-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tew-tab-row {
    display: flex;
    align-items: center;
    position: relative;
}

.tew-dot {
    width: 10px;
    height: 10px;
    background: #d0e8ff;
    border-radius: 50%;
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    transition: background 0.2s;
    flex-shrink: 0;
}

.tew-tab-row:hover .tew-dot,
.tew-tab-item.active ~ .tew-dot,
.tew-tab-row:has(.tew-tab-item.active) .tew-dot {
    background: #1e90ff;
}

/* ─ Tab item button ─ */
.tew-tab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1e90ff;
    color: #fff;
    padding: 10px 16px;
    border-radius: 30px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s, transform 0.15s;
    user-select: none;
    border: none;
    outline: none;
}

.tew-tab-item:hover {
    background: #1878d8;
    transform: translateX(3px);
}

.tew-tab-item.active {
    background: #0a5fb5;
    box-shadow: 0 4px 12px rgba(30,144,255,0.4);
}

.tew-tab-item:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.tew-tab-year {
    font-size: 11px;
    font-weight: 700;
    background: rgba(0,0,0,0.2);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tew-tab-icon {
    font-size: 13px;
    flex-shrink: 0;
}

.tew-tab-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tew-tab-arrow {
    font-size: 18px;
    font-weight: 300;
    flex-shrink: 0;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

/* =====================
   RIGHT PANEL
   ===================== */
.tew-right {
    width: 45%;
    position: sticky;
    top: 100px;
}

.tew-right-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.08);
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 600px;
    scroll-behavior: smooth;
}

/* Custom scrollbar for right card */
.tew-right-card::-webkit-scrollbar { width: 4px; }
.tew-right-card::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 4px; }
.tew-right-card::-webkit-scrollbar-thumb { background: #1e90ff; border-radius: 4px; }

/* ─ Content panels (fade) ─ */
.tew-content-panel {
    animation: tewFadeIn 0.4s ease forwards;
}

.tew-content-panel.tew-hidden {
    display: none;
}

@keyframes tewFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─ Header row ─ */
.tew-right-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.tew-right-year {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1;
    margin-bottom: 4px;
}

.tew-right-subtitle {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.tew-right-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─ Image ─ */
.tew-right-image-wrap {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    background: #f5f5f5;
}

.tew-right-image-wrap img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.tew-right-image-wrap:hover img {
    transform: scale(1.02);
}

/* ─ Video ─ */
.tew-right-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 16px;
}

.tew-right-video iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ─ Description text ─ */
.tew-right-text {
    font-size: 14px;
    color: #444;
    line-height: 1.7;
    margin-bottom: 16px;
}

.tew-right-text p { margin: 0 0 8px; }

/* ─ Footer: nav + counter ─ */
.tew-right-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
    position: sticky;
    bottom: 0;
    background: #ffffff;
    z-index: 1;
    margin-top: 8px;
}

.tew-nav-buttons {
    display: flex;
    gap: 8px;
}

.tew-btn-prev,
.tew-btn-next {
    background: none;
    border: 1px solid #e0e0e0;
    color: #555;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.tew-btn-prev:hover,
.tew-btn-next:hover {
    background: #1e90ff;
    color: #fff;
    border-color: #1e90ff;
}

.tew-btn-prev:disabled,
.tew-btn-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tew-counter {
    font-size: 13px;
    color: #999;
}

.tew-current {
    font-weight: 700;
    color: #1a1a2e;
}

/* =====================
   TABLET (≤1024px)
   ===================== */
@media (max-width: 1024px) {
    .tew-wrapper { gap: 24px; }
    .tew-left  { width: 50%; }
    .tew-right { width: 50%; }
}

/* =====================
   MOBILE ACCORDION (≤768px)
   Desktop layout ZERO changes — everything here is mobile-only
   ===================== */
@media (max-width: 768px) {

    /* Wrapper: single column */
    .tew-wrapper {
        flex-direction: column;
        gap: 0;
    }

    /* Hide sticky right panel — content shown inline as accordion */
    .tew-right {
        display: none !important;
    }

    /* Left panel: full width, no height cap, no clip */
    .tew-left {
        width: 100%;
        max-height: none;
        overflow: visible;
        padding-right: 0;
        margin-bottom: 0;
    }

    /* Remove timeline line & dots — looks odd in stacked layout */
    .tew-timeline-track {
        padding-left: 0;
    }
    .tew-timeline-line,
    .tew-dot,
    .tew-decade-dot {
        display: none;
    }

    /* Decade groups: no bottom gap */
    .tew-decade-group {
        margin-bottom: 0;
    }

    /* Decade label: full width pill */
    .tew-decade-row {
        margin-bottom: 6px;
        margin-top: 14px;
    }
    .tew-decade-label {
        font-size: 10px;
        letter-spacing: 1.5px;
        padding: 3px 12px;
    }

    /* Tab items gap */
    .tew-decade-items {
        gap: 10px;
        margin-bottom: 10px;
    }

    /* Tab row: stacks heading + accordion body vertically */
    .tew-tab-row {
        flex-direction: column;
        align-items: stretch;
    }

    /* ── Heading button: full-width blue pill ── */
    .tew-tab-item {
        border-radius: 12px;
        padding: 15px 20px;
        font-size: 15px;
        font-weight: 700;
        justify-content: space-between;
        transform: none !important;
        box-shadow: none !important;
    }

    .tew-tab-item:hover,
    .tew-tab-item.active {
        background: #1e90ff;
        transform: none !important;
        box-shadow: none !important;
    }

    /* Hide year badge & icon — cleaner mobile heading */
    .tew-tab-year,
    .tew-tab-icon {
        display: none;
    }

    /* Title: allow wrap on mobile */
    .tew-tab-title {
        font-size: 15px;
        font-weight: 700;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    /* Arrow: rotate when open */
    .tew-tab-arrow {
        font-size: 22px;
        opacity: 1;
        margin-left: 10px;
    }

    .tew-tab-item.tew-acc-open .tew-tab-arrow {
        transform: rotate(90deg);
    }

    /* ── Accordion body (OUTER — handles open/close slide only) ──
       The slide animation and the internal scrolling are now handled
       by two separate elements. Putting both on the same element
       (old version) made mobile browsers (iOS Safari / Chrome) fail
       to register the inner area as scrollable right after the
       open/close class toggled, which is why content looked "stuck"
       and wouldn't scroll. Now this outer element ONLY animates
       height/opacity — it never needs to scroll itself. */
    .tew-acc-body {
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        padding: 0 16px;
        background: #ffffff;
        border: 1.5px solid #d0e8ff;
        border-top: none;
        border-radius: 0 0 12px 12px;
        box-sizing: border-box;
        transition:
            max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
            opacity    0.28s ease,
            padding    0.28s ease;
    }

    .tew-acc-body.tew-acc-open {
        /* Generous cap, comfortably larger than the inner scroll box
           below (65vh + paddings) so the outer box never clips the
           inner content — it just auto-fits to whatever height the
           inner box actually needs. */
        max-height: 80vh;
        opacity: 1;
        padding: 20px 16px 22px;
    }

    /* ── Accordion inner (INNER — the ONLY element that scrolls) ──
       overflow-y:auto + touch-scroll props are set permanently here
       (not toggled by a class), so the browser always recognizes
       this box as a scrollable region from the moment it's in the
       DOM — this is what actually fixes the "can't scroll" issue. */
    .tew-acc-inner {
        display: block;
        max-height: 65vh;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overscroll-behavior: contain;
        padding-right: 6px;
    }

    /* Custom scrollbar for accordion inner content */
    .tew-acc-inner::-webkit-scrollbar { width: 4px; }
    .tew-acc-inner::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 4px; }
    .tew-acc-inner::-webkit-scrollbar-thumb { background: #1e90ff; border-radius: 4px; }

    /* Custom video inside accordion (mobile) */
    .tew-acc-video {
        position: relative;
        margin-bottom: 14px;
    }
    .tew-acc-video video {
        width: 100%;
        border-radius: 10px;
        display: block;
    }

    /* ── Card content inside accordion ── */

    /* Big year in blue */
    .tew-acc-year {
        font-size: 38px;
        font-weight: 800;
        color: #1e90ff;
        line-height: 1;
        margin: 0 0 4px;
    }

    /* Bold subtitle/title */
    .tew-acc-title {
        font-size: 15px;
        font-weight: 700;
        color: #1a1a2e;
        margin: 0 0 12px;
        line-height: 1.4;
    }

    /* Badge (category pill) */
    .tew-acc-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 1px;
        padding: 4px 10px;
        border-radius: 20px;
        margin-bottom: 12px;
    }

    /* Product image */
    .tew-acc-image {
        width: 100%;
        border-radius: 10px;
        overflow: hidden;
        margin-bottom: 14px;
        background: #f5f5f5;
    }

    .tew-acc-image img {
        width: 100%;
        height: 200px;
        object-fit: cover;
        display: block;
    }

    /* Description */
    .tew-acc-desc {
        font-size: 14px;
        color: #444;
        line-height: 1.75;
        margin: 0;
    }

    .tew-acc-desc p {
        margin: 0 0 6px;
    }
}

/* Elementor editor preview */
.elementor-editor-active .tew-right {
    position: relative;
    top: auto;
}
