/**
 * Archivio Storico Polo Industriale Siracusa
 * Timeline component
 *
 * Elementor integration:
 * - Primary color: --e-global-color-primary
 * - Text color: --e-global-color-text
 * - Primary typography: --e-global-typography-primary-*
 * - Text typography: --e-global-typography-text-*
 *
 * Every Elementor variable has a safe fallback, so the component also works
 * outside Elementor pages.
 */

.aspis-timeline {
    --aspis-timeline-color: var(--e-global-color-primary, #243875);
    --aspis-timeline-text-color: var(--e-global-color-text, #333333);
    --aspis-timeline-item-width: 280px;
    --aspis-timeline-dot-size: 15px;
    --aspis-timeline-line-size: 4px;
    --aspis-timeline-image-width: 190px;
    --aspis-timeline-image-height: 100px;
    --aspis-timeline-single-offset: 12px;
    --aspis-timeline-double-height: 420px;
    --aspis-timeline-double-gap: 35px;
    --aspis-timeline-scrollbar-color: #CCC;

    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    color: var(--aspis-timeline-text-color);
    font-family: var(--e-global-typography-text-font-family, inherit);
}

.aspis-timeline,
.aspis-timeline *,
.aspis-timeline *::before,
.aspis-timeline *::after {
    box-sizing: border-box;
}

.aspis-timeline-title {
	font-family: var(--e-global-typography-primary-font-family), Sans-serif;
    font-weight: var(--e-global-typography-primary-font-weight);
    color: #222848;
	font-size: 60px;
	text-align: center;
	margin-bottom: 30px;
}

/* Horizontal scrolling area. */
.aspis-timeline__scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--aspis-timeline-scrollbar-color) transparent;
}

.aspis-timeline__scroll::-webkit-scrollbar {
    height: 6px;
}

.aspis-timeline__scroll::-webkit-scrollbar-track {
    background: transparent;
}

.aspis-timeline__scroll::-webkit-scrollbar-thumb {
    background: var(--aspis-timeline-color);
    border-radius: 999px;
}

/* The track grows with the number of steps but fills the container when short. */
.aspis-timeline__track {
    position: relative;
    display: flex;
    justify-content: space-between;
    width: max-content;
    min-width: 100%;
}

/* Desktop horizontal line: from the first dot to the last dot. */
.aspis-timeline__track::before {
    content: "";
    position: absolute;
    z-index: 1;
    left: calc(var(--aspis-timeline-item-width) / 2);
    right: calc(var(--aspis-timeline-item-width) / 2);
    height: var(--aspis-timeline-line-size);
    background: var(--aspis-timeline-color);
}

.aspis-timeline__item {
    position: relative;
    flex: 0 0 var(--aspis-timeline-item-width);
    width: var(--aspis-timeline-item-width);
}

.aspis-timeline__dot {
    position: absolute;
    z-index: 3;
    left: 50%;
    width: var(--aspis-timeline-dot-size);
    height: var(--aspis-timeline-dot-size);
    border-radius: 50%;
    background: var(--aspis-timeline-color);
    transform: translate(-50%, -50%);
}

.aspis-timeline__content {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    text-align: center;
}

.aspis-timeline__image-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--aspis-timeline-image-height);
    margin-bottom: 15px;
}

.aspis-timeline__image,
.aspis-timeline__image-wrapper img {
    display: block;
    width: auto;
    height: auto;
    max-width: var(--aspis-timeline-image-width);
    max-height: var(--aspis-timeline-image-height);
    margin: 0;
    object-fit: contain;
}

/*
 * The element also receives Elementor's elementor-heading-title class in the
 * markup. These declarations provide reliable fallbacks while still using the
 * active Elementor Kit global typography and primary color when available.
 */
.aspis-timeline .aspis-timeline__text {
    margin: 0;
    color: var(--aspis-timeline-color);
    font-family: var(--e-global-typography-primary-font-family, inherit);
    font-size: 22px;
    font-style: var(--e-global-typography-primary-font-style, normal);
    font-weight: var(--e-global-typography-primary-font-weight, 700);
    line-height: 1.2;
    letter-spacing: var(--e-global-typography-primary-letter-spacing, normal);
    text-transform: var(--e-global-typography-primary-text-transform, none);
}

.aspis-timeline__description {
    margin-top: 10px;
    color: var(--aspis-timeline-text-color);
    font-family: var(--e-global-typography-text-font-family, inherit);
    font-size: 15px;
    font-style: var(--e-global-typography-text-font-style, normal);
    font-weight: var(--e-global-typography-text-font-weight, 400);
    line-height: var(--e-global-typography-text-line-height, 1.5);
    letter-spacing: var(--e-global-typography-text-letter-spacing, normal);
    text-transform: var(--e-global-typography-text-text-transform, none);
}

.aspis-timeline__description > :first-child {
    margin-top: 0;
}

.aspis-timeline__description > :last-child {
    margin-bottom: 0;
}

/* =========================================================
   Desktop layout: line-single
   ========================================================= */

.aspis-timeline--line-single .aspis-timeline__track::before {
    top: var(--aspis-timeline-single-offset);
    transform: translateY(-50%);
}

.aspis-timeline--line-single .aspis-timeline__item {
    min-height: 215px;
    padding-top: 55px;
}

.aspis-timeline--line-single .aspis-timeline__dot {
    top: var(--aspis-timeline-single-offset);
}

/* =========================================================
   Desktop layout: line-double
   ========================================================= */

.aspis-timeline--line-double .aspis-timeline__track {
    height: var(--aspis-timeline-double-height);
    align-items: stretch;
}

.aspis-timeline--line-double .aspis-timeline__track::before {
    top: 50%;
    transform: translateY(-50%);
}

.aspis-timeline--line-double .aspis-timeline__item {
    height: var(--aspis-timeline-double-height);
}

.aspis-timeline--line-double .aspis-timeline__dot {
    top: 50%;
}

.aspis-timeline--line-double .aspis-timeline__item:nth-child(odd) .aspis-timeline__content {
    position: absolute;
    bottom: calc(50% + var(--aspis-timeline-double-gap));
    left: 0;
}

.aspis-timeline--line-double .aspis-timeline__item:nth-child(even) .aspis-timeline__content {
    position: absolute;
    top: calc(50% + var(--aspis-timeline-double-gap));
    left: 0;
}

/* =========================================================
   COMPACT DOUBLE LINE LAYOUT - Desktop only
   ========================================================= */

@media (min-width: 768px) {

    .aspis-timeline--line-double {
        /*
         * In line-double adjacent items are displayed on opposite
         * sides of the timeline, so they can be much closer.
         */
        --aspis-timeline-item-width: 150px;
        --aspis-timeline-image-width: 140px;
    }

    .aspis-timeline--line-double .aspis-timeline__track {
        height: 360px;
    }

    .aspis-timeline--line-double .aspis-timeline__item {
        height: 360px;
    }

    .aspis-timeline--line-double .aspis-timeline__content {
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Items above the line */
    .aspis-timeline--line-double
    .aspis-timeline__item:nth-child(odd)
    .aspis-timeline__content {
        bottom: calc(50% + 25px);
    }

    /* Items below the line */
    .aspis-timeline--line-double
    .aspis-timeline__item:nth-child(even)
    .aspis-timeline__content {
        top: calc(50% + 25px);
    }
}

/* =========================================================
   Mobile layout: always vertical
   ========================================================= */

@media (max-width: 767px) {
    .aspis-timeline {
        --aspis-timeline-dot-size: 14px;
        --aspis-timeline-line-size: 3px;
        --aspis-timeline-image-width: 160px;
        --aspis-timeline-image-height: 90px;
        --aspis-timeline-mobile-line-x: 14px;
        --aspis-timeline-mobile-content-offset: 50px;
    }

    .aspis-timeline__scroll {
        overflow: visible;
        padding-bottom: 0;
    }

    .aspis-timeline__track,
    .aspis-timeline--line-double .aspis-timeline__track {
        min-width: 0;
        max-width: 100%;
		display: grid;
        width: max-content;
        height: auto;
        margin-left: auto;
        margin-right: auto;
        padding: 0;
        gap: 0;
    }

    /* The desktop line is replaced by per-step vertical connectors. */
    .aspis-timeline__track::before,
    .aspis-timeline--line-single .aspis-timeline__track::before,
    .aspis-timeline--line-double .aspis-timeline__track::before {
        display: none;
    }

    .aspis-timeline__item,
    .aspis-timeline--line-single .aspis-timeline__item,
    .aspis-timeline--line-double .aspis-timeline__item {
        position: relative;
        display: block;
        flex: none;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 0 0 45px var(--aspis-timeline-mobile-content-offset);
    }

    .aspis-timeline__item::before {
        content: "";
        position: absolute;
        z-index: 1;
        top: 0;
        bottom: 0;
        left: var(--aspis-timeline-mobile-line-x);
        width: var(--aspis-timeline-line-size);
        background: var(--aspis-timeline-color);
        transform: translateX(-50%);
    }

    .aspis-timeline__item:last-child {
        padding-bottom: 0;
    }

    .aspis-timeline__dot,
    .aspis-timeline--line-single .aspis-timeline__dot,
    .aspis-timeline--line-double .aspis-timeline__dot {
        top: 50%;
        left: var(--aspis-timeline-mobile-line-x);
        transform: translate(-50%, -50%);
    }

    .aspis-timeline--line-double .aspis-timeline__item:nth-child(odd) .aspis-timeline__content,
    .aspis-timeline--line-double .aspis-timeline__item:nth-child(even) .aspis-timeline__content,
    .aspis-timeline__content {
        position: relative;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        width: 100%;
        padding: 0;
        text-align: left;
    }

    .aspis-timeline__image-wrapper {
        min-height: 0;
		display: flex;
        width: 100%;
        justify-content: center;
        align-items: center;
        margin-bottom: 10px;
    }

    .aspis-timeline .aspis-timeline__text {
        font-size: 20px;
		width: 100%;
        text-align: center;
    }
}
