/**
 * Marthoma Church Theme - History Formation Timeline Widget Styles
 *
 * @package MarthomaChurch
 */

/* Main Container */
.marthoma-history-formation-widget {
    width: 100%;
}

/* Main Title */
.hf-main-title {
    font-family: var(--marthoma-font-heading, 'Montserrat', sans-serif);
    font-size: 35px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 40px 0;
    text-align: center;
}

/* Timeline Wrapper - Two Column Flexbox Layout */
.hf-timeline-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 60px;
}

/* Years Column - Contains line and years side by side */
.hf-years-column {
    display: flex;
    flex-shrink: 0;
    flex-grow: 0;
    align-items: stretch;
    width: auto;
    min-width: fit-content;
    max-width: 200px;
    position: relative;
    overflow: visible;
}

/* Timeline Line Container - Vertical line */
.hf-timeline-line-container {
    position: relative;
    width: 3px;
    flex-shrink: 0;
    margin-right: 15px;
}

/* Timeline Vertical Line - inactive state (gray) */
.hf-timeline-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    background-color: #707070;
}

/* Timeline Active Line - overlays the inactive line */
.hf-timeline-line-active {
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 0;
    background-color: #ffffff;
    transition: height 0.3s ease;
}

/* Years List */
.hf-years-list {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Individual Year */
.hf-year {
    position: relative;
    font-family: var(--marthoma-font-heading, 'Montserrat', sans-serif);
    font-size: 35px;
    font-weight: 600;
    line-height: 1.2;
    color: #707070;
    white-space: nowrap;
    transition: color 0.3s ease;
    display: block;
    padding-left: 20px;
}

/* Active year styling */
.hf-year.is-active {
    color: #ffffff;
}

/* Content Column */
.hf-content-column {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 360px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Entry Row */
.hf-entry-row {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* Active Entry Row */
.hf-entry-row.is-active {
    opacity: 1;
}

/* Entry Card */
.hf-entry-card {
    display: flex;
    flex-direction: column;
}

/* Entry Title */
.hf-entry-title {
    font-family: var(--marthoma-font-heading, 'Montserrat', sans-serif);
    font-size: 18px;
    font-weight: 700;
    color: #707070;
    margin: 0 0 12px 0;
    transition: color 0.3s ease;
}

/* Active Entry Title */
.hf-entry-row.is-active .hf-entry-title {
    color: #ffffff;
}

/* Entry Description */
.hf-entry-description {
    font-family: var(--marthoma-font-body, 'Inter', sans-serif);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.7;
    color: #707070;
    margin: 0;
    text-align: justify;
    transition: color 0.3s ease;
}

/* Active Entry Description */
.hf-entry-row.is-active .hf-entry-description {
    color: rgba(255, 255, 255, 0.85);
}

/* ==========================================
   SYNCHRONIZED SPACING - Years match Content
   The key is to use matching min-heights
   ========================================== */

/* First entry - short (title + 2-3 lines) */
.hf-year:nth-child(1),
.hf-entry-row:nth-child(1) {
    min-height: 120px;
}

/* Second entry - medium */
.hf-year:nth-child(2),
.hf-entry-row:nth-child(2) {
    min-height: 100px;
}

/* Third entry - can grow naturally */
.hf-year:nth-child(3),
.hf-entry-row:nth-child(3) {
    min-height: auto;
}

/* Better approach: Use JS to sync heights or use consistent spacing */
.hf-year {
    margin-bottom: 60px;
}

.hf-year:last-child {
    margin-bottom: 0;
}

.hf-entry-row {
    margin-bottom: 60px;
}

.hf-entry-row:last-child {
    margin-bottom: 0;
}

/* Reset min-heights - rely on consistent margin spacing */
.hf-year:nth-child(1),
.hf-entry-row:nth-child(1),
.hf-year:nth-child(2),
.hf-entry-row:nth-child(2),
.hf-year:nth-child(3),
.hf-entry-row:nth-child(3) {
    min-height: auto;
}

/* ==========================================
   RESPONSIVE STYLES
   ========================================== */

/* Large Tablet (1024px and below) */
@media (max-width: 1024px) {
    .hf-timeline-wrapper {
        gap: 30px;
        justify-content: space-between;
    }

    .hf-years-column {
        flex-shrink: 0;
        flex-grow: 0;
        max-width: 130px;
    }

    .hf-timeline-line-container {
        margin-right: 12px;
    }

    .hf-year {
        font-size: 22px;
        margin-bottom: 45px;
        padding-left: 12px;
    }

    .hf-entry-row {
        margin-bottom: 45px;
    }

    .hf-entry-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .hf-entry-description {
        font-size: 14px;
        line-height: 1.6;
    }

    .hf-main-title {
        font-size: 28px;
        margin-bottom: 30px;
    }

    .hf-content-column {
        max-width: calc(100% - 180px);
    }
}

/* Tablet (768px and below) - Stacked Layout */
@media (max-width: 768px) {
    .marthoma-history-formation-widget {
        display: block;
        width: 100%;
    }

    .hf-timeline-wrapper {
        display: block !important;
        flex-direction: unset;
        gap: 0;
    }

    .hf-years-column {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }

    .hf-timeline-line-container,
    .hf-years-list,
    .hf-year {
        display: none !important;
    }

    .hf-content-column {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        flex: none !important;
        overflow: visible !important;
    }

    .hf-entry-row {
        display: block !important;
        position: relative;
        padding-left: 25px;
        margin-bottom: 25px;
        opacity: 1 !important;
    }

    /* Timeline line on mobile */
    .hf-entry-row::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: -25px;
        width: 3px;
        background-color: #707070;
    }

    .hf-entry-row:last-child {
        margin-bottom: 0;
    }

    .hf-entry-row:last-child::before {
        bottom: auto;
        height: 100%;
    }

    .hf-entry-card {
        display: block !important;
    }

    /* Show year above the card on mobile */
    .hf-entry-card::before {
        content: attr(data-year);
        font-family: var(--marthoma-font-heading, 'Montserrat', sans-serif);
        font-size: 16px;
        font-weight: 700;
        color: #ffffff;
        margin-bottom: 10px;
        display: block !important;
    }

    .hf-entry-row .hf-entry-title {
        display: block !important;
        color: #ffffff !important;
        font-size: 15px;
        margin-bottom: 8px;
    }

    .hf-entry-row .hf-entry-description {
        display: block !important;
        color: rgba(255, 255, 255, 0.85) !important;
        font-size: 14px;
        line-height: 1.6;
        text-align: left;
    }

    .hf-main-title {
        font-size: 22px;
        margin-bottom: 25px;
        text-align: left;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .hf-entry-row {
        padding-left: 18px;
        margin-bottom: 20px;
    }

    .hf-entry-row::before {
        width: 2px;
        bottom: -20px;
    }

    .hf-entry-card::before {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .hf-entry-title {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .hf-entry-description {
        font-size: 13px;
        line-height: 1.5;
    }

    .hf-main-title {
        font-size: 18px;
        margin-bottom: 20px;
    }
}

/* ==========================================
   REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .hf-year,
    .hf-entry-row,
    .hf-entry-title,
    .hf-entry-description {
        transition: none;
    }
}

/* ==========================================
   ELEMENTOR EDITOR
   ========================================== */

.elementor-editor-active .marthoma-history-formation-widget {
    min-height: 200px;
}
