/* Define CSS Variables for easy customization */
:root {
    --line-color-base: #E0E0E0; /* Light gray base line */
    --line-color-fill: #607d8b; /* Blue-gray fill color (matches first point) */
    --point-size: 20px;
    --content-offset-left-desktop: 50px; /* From timeline-wrapper padding-left */
    --content-offset-left-mobile: 20px; /* From timeline-wrapper padding-left_mobile */
    --text-color-dark: #333333; /* Default values, overridden by Elementor controls */
    --text-color-medium: #555555; /* Default values, overridden by Elementor controls */
}

/* --- Widget Wrapper & Elementor Overrides --- */
/* Target the widget's main wrapper added by Elementor */
.elementor-widget-my-custom-timeline-widget .elementor-widget-container {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    width: 100% !important;
    height: auto !important;
    box-sizing: border-box !important;
}
/* Ensure inner containers/elements correctly apply flex and box-sizing */
.elementor-widget-my-custom-timeline-widget .elementor-element.elementor-container {
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    align-items: stretch !important;
}

/* --- Main Timeline Container --- */
.timeline-container {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important; /* This width is for the inner content, set by Elementor controls */
    max-width: 800px; /* Example max width, adjust as needed */
    margin: 0 auto !important; /* Center the timeline container */
    padding-left: var(--content-offset-left-desktop) !important;
    overflow: hidden !important; /* Crucial for line animation */
    /* Height is determined by content */
}
@media (max-width: 767px) {
    .timeline-container {
        padding-left: var(--content-offset-left-mobile) !important;
    }
}

/* --- Timeline Line (Base & Fill) --- */
.timeline-line {
    background-color: var(--line-color-base) !important;
    position: absolute !important;
    left: 25px !important; /* Calculated based on --content-offset-left-desktop and line width */
    top: 0 !important;
    height: 100% !important;
    width: 4px !important;
    overflow: hidden !important;
    z-index: 0;
}
@media (max-width: 767px) {
    .timeline-line {
        left: 10px !important; /* Calculated based on --content-offset-left-mobile and line width */
    }
}

.timeline-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%; /* Starts invisible */
    background-color: var(--line-color-fill);
    transform-origin: top;
    transition: height 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.timeline-line.animated::before {
    height: 100%; /* Fills up */
}

/* --- Timeline Item (Row) Styling --- */
.timeline-item {
    position: relative !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-height: 150px; /* Min height for each item, adjust as needed */
    margin-bottom: 40px !important;
    box-sizing: border-box !important;

    opacity: 0; /* Initially hidden for animation */
    transform: translateY(20px); /* Starts slightly below */
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.timeline-item:last-child {
    margin-bottom: 0 !important;
}
.timeline-item.animated {
    opacity: 1;
    transform: translateY(0);
}
@media (max-width: 767px) {
    .timeline-item {
        min-height: 120px;
        margin-bottom: 25px !important;
    }
}

/* --- Timeline Point (Circle) Styling --- */
.timeline-point {
    position: absolute !important;
    left: 16px !important; /* Adjusted for visual centering over the line */
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: var(--point-size) !important;
    height: var(--point-size) !important;
    border-radius: 50% !important;
    /* Background color controlled via inline style from PHP repeater */
    z-index: 1;
    box-shadow: 0 0 0 4px white, 0 0 0 5px var(--line-color-fill); /* White border and accent halo */
    transition: box-shadow 0.5s ease-out; /* Animates if line fill color changes */
}
@media (max-width: 767px) {
    .timeline-point {
        left: 5px !important; /* Adjusted for mobile line position */
    }
}

/* --- Timeline Content (Text) Styling --- */
.timeline-content {
    display: flex !important;
    flex-direction: column !important;
    width: 90% !important; /* Most of the width for text */
    padding-left: 30px !important; /* Space from point/line */
    box-sizing: border-box !important;
    justify-content: center !important; /* Vertically center content if min-height is larger */
}
@media (max-width: 767px) {
    .timeline-content {
        padding-left: 15px !important;
    }
}

/* Specific text styling for Elementor's nested heading/text-editor output */
.timeline-content .elementor-heading-title {
    font-family: 'Inter', sans-serif !important;
    font-weight: bold !important;
    font-size: 22px !important;
    color: var(--text-color-dark) !important;
    margin: 0 0 5px 0 !important; /* Bottom margin for heading */
}
@media (max-width: 767px) {
    .timeline-content .elementor-heading-title {
        font-size: 18px !important;
    }
}

.timeline-content .elementor-text-editor p {
    font-family: 'Inter', sans-serif !important;
    font-size: 16px !important;
    color: var(--text-color-medium) !important;
    margin: 0 !important; /* Remove default paragraph margins */
}
@media (max-width: 767px) {
    .timeline-content .elementor-text-editor p {
        font-size: 14px !important;
    }
}