/**
 * Timeline (Dioendang) widget — frontend styles.
 *
 * Self-contained (no UIkit): the axis line, icon dots, alternating layouts,
 * and the horizontal track are all scoped .di-timeline* rules. Colors and
 * sizes set from the Elementor Style panel override the defaults below (the
 * line uses the --di-timeline-line-* custom properties the widget's controls
 * write).
 *
 * The vertical-layout defaults reproduce the legacy timeline widget's
 * default skin exactly (its ep-timeline.css + the UIkit helpers it leaned
 * on + the control defaults it printed), because the TM templates were
 * authored against those and store only their overrides:
 *
 *   left layout  — content indented 100px (50px wrapper + 50px container),
 *                  axis line centred at 50px, icon 48px centred at (51px,
 *                  20px) with a 4px border in the line colour, 50px between
 *                  items (none after the last), no line on the last item;
 *   card         — no shadow / radius / clipping by default, body padding
 *                  30px (40px from 1200px: UIkit `.bdt-padding`), image
 *                  inset 20px top/left/right, `object-fit: cover`;
 *   text         — title/excerpt/meta carry no default size, weight, margin
 *                  or opacity of their own; every <p> in the excerpt has zero
 *                  margin; the date pill is #f3f3f3, 10px 15px, 2px radius.
 */

.di-timeline {
	--di-timeline-line-color: #e0e0e0;
	--di-timeline-line-width: 4px;
	--di-timeline-visible: 4;
	position: relative;
}

/* ---------- Card (shared by every layout) ---------- */

.di-timeline-card {
	background: #f3f3f3;
	position: relative;
}

.di-timeline-thumb {
	padding: 20px 20px 0;
	overflow: hidden;
}

.di-timeline-thumb img {
	display: block;
	width: 100%;
	max-width: 100%;
	object-fit: cover;
}

.di-timeline-body {
	padding: 30px;
}

@media (min-width: 1200px) {
	.di-timeline-body {
		padding: 40px;
	}
}

.di-timeline-title,
.di-timeline-excerpt,
.di-timeline-excerpt p {
	margin: 0;
	padding: 0;
}

.di-timeline-title a {
	color: inherit;
	text-decoration: none;
}

.di-timeline-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	list-style: none;
	margin: 0;
	padding: 0;
}

.di-timeline-readmore {
	margin: 0;
	display: inline-flex;
	align-items: center;
}

.di-timeline-readmore svg {
	width: 1em;
	height: 1em;
}

/* ---------- Axis icon dot ---------- */

.di-timeline-icon {
	line-height: 0;
}

.di-timeline-icon span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: #ffffff;
	border: 4px solid var(--di-timeline-line-color);
	position: relative;
	z-index: 1;
	box-sizing: border-box;
	text-align: center;
	line-height: 1;
}

.di-timeline-icon svg {
	width: 1em;
	height: 1em;
}

/* ---------- Vertical layouts ---------- */

.di-timeline--vertical .di-timeline-items {
	display: flex;
	flex-direction: column;
}

.di-timeline--vertical .di-timeline-row {
	display: flex;
	align-items: stretch;
	position: relative;
}

/* The axis column: the line runs the full row height (so it continues
   through the 50px gap into the next item) and the icon is a point 20px
   below the row top, centred on the line, whatever its size. */
.di-timeline--vertical .di-timeline-axis {
	flex: 0 0 auto;
	width: 100px;
	position: relative;
}

.di-timeline--vertical .di-timeline-axis::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: var(--di-timeline-line-width);
	background: var(--di-timeline-line-color);
}

.di-timeline--vertical .di-timeline-row:last-child .di-timeline-axis::before {
	display: none;
}

.di-timeline--vertical .di-timeline-axis .di-timeline-icon {
	position: absolute;
	top: 20px;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1;
}

.di-timeline--vertical .di-timeline-side {
	min-width: 0;
}

.di-timeline--vertical .di-timeline-side--card {
	flex: 1;
	padding: 0 0 50px 0;
}

.di-timeline--vertical .di-timeline-row:last-child .di-timeline-side--card {
	padding-bottom: 0;
}

/* Left layout: axis on the left, cards on the right (default flow). */

/* Right layout: mirrored — the line sits 20px in from the right edge, the
   card ends 50px before it. */
.di-timeline--right .di-timeline-row {
	flex-direction: row-reverse;
}

.di-timeline--right .di-timeline-axis {
	width: 20px;
}

.di-timeline--right .di-timeline-axis::before,
.di-timeline--right .di-timeline-axis .di-timeline-icon {
	left: 0;
}

.di-timeline--right .di-timeline-side--card {
	padding: 0 50px 50px 0;
}

/* Center layout (from 960px, the legacy `@m` breakpoint): a 50/50 split
   with the line on the seam, the card 50px off it, the date opposite. */
.di-timeline--center .di-timeline-side--date,
.di-timeline--center .di-timeline-side--card {
	flex: 1 1 50%;
}

.di-timeline--center .di-timeline-axis {
	width: 0;
}

.di-timeline--center .di-timeline-axis::before,
.di-timeline--center .di-timeline-axis .di-timeline-icon {
	left: 0;
}

.di-timeline--center .di-timeline-row--even {
	flex-direction: row-reverse;
}

.di-timeline--center .di-timeline-row--odd .di-timeline-side--card {
	padding: 0 0 50px 50px;
}

.di-timeline--center .di-timeline-row--even .di-timeline-side--card {
	padding: 0 50px 50px 0;
}

.di-timeline--center .di-timeline-side--date {
	padding: 10px 50px;
}

.di-timeline--center .di-timeline-row--odd .di-timeline-side--date {
	text-align: right;
}

.di-timeline--center .di-timeline-row--even .di-timeline-side--date {
	text-align: left;
}

.di-timeline--center .di-timeline-row:nth-child(-n+2) .di-timeline-axis .di-timeline-icon {
	top: 22px;
}

.di-timeline--center .di-timeline-row:nth-last-child(-n+2) .di-timeline-side--card {
	padding-bottom: 0;
}

.di-timeline-date span {
	display: inline-block;
	padding: 10px 15px;
	border-radius: 2px;
	overflow: hidden;
	background: #f3f3f3;
}

/* The card's inline meta duplicates the date column on desktop center. */
.di-timeline--center .di-timeline-meta {
	display: none;
}

/* ---------- Horizontal layout ---------- */

.di-timeline--horizontal {
	overflow: hidden;
	padding: 8px 52px;
}

.di-timeline-track {
	display: flex;
	transition: transform 0.4s ease;
	will-change: transform;
}

.di-timeline--horizontal .di-timeline-item {
	flex: 0 0 calc(100% / var(--di-timeline-visible));
	min-width: 0;
	box-sizing: border-box;
	padding: 0 12px 8px;
	padding-top: 64px;
	position: relative;
}

.di-timeline--horizontal .di-timeline-item::before {
	content: "";
	position: absolute;
	top: 31px;
	left: 0;
	right: 0;
	height: var(--di-timeline-line-width);
	background: var(--di-timeline-line-color);
}

.di-timeline--horizontal .di-timeline-item .di-timeline-icon {
	position: absolute;
	top: 31px;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 1;
}

/* Slight stagger for the alternating markers. */
.di-timeline--horizontal .di-timeline-item--bottom .di-timeline-card {
	margin-top: 32px;
}

.di-timeline-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	cursor: pointer;
	z-index: 2;
	padding: 0;
}

.di-timeline-nav::before {
	content: "";
	display: block;
	width: 10px;
	height: 10px;
	margin: 0 auto;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.di-timeline-nav--prev {
	left: 4px;
}

.di-timeline-nav--prev::before {
	transform: rotate(-135deg) translate(-1px, 1px);
}

.di-timeline-nav--next {
	right: 4px;
}

.di-timeline-nav--next::before {
	transform: rotate(45deg) translate(-1px, 1px);
}

.di-timeline-nav:disabled {
	opacity: 0.35;
	cursor: default;
}

/* ---------- Scroll-reveal animation ---------- */

.di-timeline--animate .di-timeline-entry--hidden {
	opacity: 0;
	transform: translateY(24px);
}

.di-timeline--animate .di-timeline-entry--visible {
	opacity: 1;
	transform: none;
	transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
	.di-timeline--animate .di-timeline-entry--hidden {
		opacity: 1;
		transform: none;
	}

	.di-timeline--animate .di-timeline-entry--visible {
		transition: none;
	}

	.di-timeline-track {
		transition: none;
	}
}

/* ---------- Mobile ---------- */

/* Below the legacy `@m` breakpoint the center layout collapses to the left
   geometry (date column gone, meta back in the card). */
@media (max-width: 959px) {
	.di-timeline--center .di-timeline-side--date {
		display: none;
	}

	.di-timeline--center .di-timeline-row {
		flex-direction: row;
	}

	.di-timeline--center .di-timeline-axis {
		width: 100px;
	}

	.di-timeline--center .di-timeline-axis::before,
	.di-timeline--center .di-timeline-axis .di-timeline-icon {
		left: 50%;
	}

	.di-timeline--center .di-timeline-row .di-timeline-side--card {
		flex: 1;
		padding: 0 0 50px 0;
	}

	.di-timeline--center .di-timeline-row:last-child .di-timeline-side--card {
		padding-bottom: 0;
	}

	.di-timeline--center .di-timeline-meta {
		display: flex;
	}
}

@media (max-width: 767px) {
	.di-timeline--horizontal {
		padding: 8px 44px;
	}

	.di-timeline--horizontal .di-timeline-item {
		flex-basis: 100%;
	}
}
