/**
 * Timeline Vertical – Styles
 * @author AK Digital
 *
 * Uses a flat CSS grid: each .tv-row is a 3-column row
 * (date | line | content) so dates are always aligned
 * with their corresponding content.
 */

/* ── Variables (overridable via Elementor controls) ── */
.tv {
    --tv-dot-size: 14px;
    --tv-line-w: 2px;
    --tv-date-width: 80px;
    --tv-row-gap: 48px;
    --tv-col-gap: 32px;

    position: relative;
    display: grid;
    row-gap: var(--tv-row-gap);
}

/* ── Row: 3-column grid ── */
/* Left layout (default): date | dot | content */
.tv[data-layout="left"] .tv-row,
.tv:not([data-layout]) .tv-row {
    display: grid;
    grid-template-columns: var(--tv-date-width) var(--tv-dot-size) 1fr;
    column-gap: var(--tv-col-gap);
    align-items: start;
    position: relative;
}

/* Right layout: content | dot | date */
.tv[data-layout="right"] .tv-row {
    display: grid;
    grid-template-columns: 1fr var(--tv-dot-size) var(--tv-date-width);
    column-gap: var(--tv-col-gap);
    align-items: start;
    position: relative;
}

/* ── Date column ── */
.tv-date-col {
    display: flex;
    align-items: center;
    min-height: var(--tv-dot-size);
}

/* Left layout: date aligned right */
.tv[data-layout="left"] .tv-date-col,
.tv:not([data-layout]) .tv-date-col {
    justify-content: flex-end;
    text-align: right;
}

/* Right layout: date aligned left */
.tv[data-layout="right"] .tv-date-col {
    justify-content: flex-start;
    text-align: left;
}

.tv-date {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

/* ── Line column ── */
.tv-line-col {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tv-dot-size);
}

/* Track: continuous vertical line behind all dots */
.tv-line-track {
    position: absolute;
    top: calc(var(--tv-dot-size) / 2);
    left: 50%;
    transform: translateX(-50%);
    width: var(--tv-line-w);
    /* height is set by JS to reach the last dot */
    height: var(--tv-line-height, 100%);
    pointer-events: none;
}

.tv-line {
    position: absolute;
    inset: 0;
    background-color: #D1D5DB;
    border-radius: 1px;
}

.tv-line-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    background-color: #0B3954;
    border-radius: 1px;
    transition: height .4s ease-out;
}

/* ── Dot ── */
.tv-dot {
    width: var(--tv-dot-size);
    height: var(--tv-dot-size);
    border-radius: 50%;
    border: var(--tv-line-w) solid #D1D5DB;
    background: #fff;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    transition: border-color .3s, background-color .3s, transform .3s;
}

.tv-dot.is-active {
    border-color: #0B3954;
    background-color: #0B3954;
    transform: scale(1.25);
}

/* ── Content column ── */
.tv-content {
    min-width: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .5s ease-out, transform .5s ease-out;
}

.tv-row.is-visible .tv-content {
    opacity: 1;
    transform: translateY(0);
}

.tv-image {
    margin-bottom: 12px;
}

.tv-image img {
    display: block;
    max-width: 180px;
    height: auto;
    border-radius: 4px;
}

.tv-title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 6px;
}

.tv-desc {
    font-size: .95rem;
    line-height: 1.55;
    margin: 0;
}

/* ── Responsive: tablet ── */
@media (max-width: 1024px) {
    .tv {
        --tv-col-gap: 24px;
        --tv-row-gap: 40px;
    }

    .tv-image img {
        max-width: 150px;
    }
}

/* ── Responsive: mobile ── */
@media (max-width: 767px) {
    .tv {
        --tv-col-gap: 14px;
        --tv-row-gap: 28px;
    }

    /* Both layouts collapse to: dot | content (date moves above content) */
    .tv[data-layout="left"] .tv-row,
    .tv[data-layout="right"] .tv-row,
    .tv:not([data-layout]) .tv-row {
        grid-template-columns: var(--tv-dot-size) 1fr;
        grid-template-rows: auto auto;
    }

    /* Date becomes inline above the content, spanning the content column */
    .tv-date-col {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-start !important;
        text-align: left !important;
        min-height: auto;
        margin-bottom: 4px;
    }

    /* Line column spans both rows vertically */
    .tv-line-col {
        grid-column: 1;
        grid-row: 1 / span 2;
        align-items: start;
        padding-top: 2px;
    }

    /* Content goes below the date */
    .tv-content {
        grid-column: 2;
        grid-row: 2;
    }

    .tv-date {
        font-size: 1.1rem;
        font-weight: 700;
    }

    .tv-title {
        font-size: 1rem;
    }

    .tv-desc {
        font-size: .85rem;
    }

    .tv-image img {
        max-width: 100%;
    }
}

/* ── Responsive: small mobile ── */
@media (max-width: 480px) {
    .tv {
        --tv-col-gap: 12px;
        --tv-row-gap: 24px;
    }

    .tv-date {
        font-size: 1rem;
    }

    .tv-title {
        font-size: .95rem;
    }

    .tv-desc {
        font-size: .8rem;
    }
}
