/* =============================================================
   Rivertown Timeline Widget  v1.3
   Author : logicfire  —  logicfire.in
   ─────────────────────────────────────────────────────────────
   KEY RULES
   • Card body text is ALWAYS left-aligned — no exceptions.
   • Alignment cascading is blocked at the card level.
   • Equal column-gap (not side padding) keeps both sides level.
   ============================================================= */

/* ─── CSS Variables ─────────────────────────────────────────── */
.rt-timeline {
	--rt-line-color:       #ffffff;
	--rt-line-width:       2px;
	--rt-line-opacity:     0.35;
	--rt-marker-size:      40px;
	--rt-marker-bg:        #7ec8a0;
	--rt-marker-color:     #ffffff;
	--rt-title-color:      #ffffff;
	--rt-content-color:    rgba(255,255,255,0.88);
	--rt-card-bg:          rgba(255,255,255,0.07);
	--rt-card-radius:      12px;
	--rt-card-padding:     20px 24px;
	--rt-gap:              48px;
	--rt-content-gap:      20px;   /* space between marker and content */

	position:   relative;
	width:      100%;
	box-sizing: border-box;
}

/* ─── Vertical connector track ──────────────────────────────── */
.rt-timeline__track {
	position:       absolute;
	top:            0;
	bottom:         0;
	pointer-events: none;
	z-index:        0;
}

.rt-timeline--left   .rt-timeline__track,
.rt-timeline--stacked .rt-timeline__track { left: calc(var(--rt-marker-size) / 2); }

.rt-timeline--right  .rt-timeline__track  { right: calc(var(--rt-marker-size) / 2); left: auto; }

/* Center: line sits at dead-centre of the widget */
.rt-timeline--center .rt-timeline__track  { left: 50%; transform: translateX(-50%); }

/* The line bar */
.rt-timeline__line {
	width:            var(--rt-line-width);
	height:           100%;
	background-color: var(--rt-line-color);
	opacity:          var(--rt-line-opacity);
	position:         relative;
}

/* Scroll-progress overlay */
.rt-timeline__line-progress {
	position:         absolute;
	inset-inline:     0;
	top:              0;
	height:           0%;
	background-color: var(--rt-marker-bg);
	opacity:          1;
	transition:       height 0.12s linear;
}

/* ─── Items list ─────────────────────────────────────────────── */
.rt-timeline__items {
	display:        flex;
	flex-direction: column;
	gap:            var(--rt-gap);
	position:       relative;
	z-index:        1;
}

/* ─── Shared item reset ──────────────────────────────────────── */
.rt-item { box-sizing: border-box; }

/* =============================================================
   LEFT LAYOUT  (default)  ·  marker — content →
   ============================================================= */
.rt-timeline--left   .rt-item,
.rt-timeline--stacked .rt-item {
	display:     flex;
	align-items: flex-start;
}

.rt-timeline--left   .rt-item__marker-wrap,
.rt-timeline--stacked .rt-item__marker-wrap {
	flex-shrink: 0;
	padding-top: 3px;
}

.rt-timeline--left   .rt-item__content,
.rt-timeline--stacked .rt-item__content {
	flex:        1;
	min-width:   0;
	margin-left: var(--rt-content-gap);
}

/* =============================================================
   RIGHT LAYOUT  ·  ← content — marker
   ============================================================= */
.rt-timeline--right .rt-item {
	display:        flex;
	flex-direction: row-reverse;
	align-items:    flex-start;
}

.rt-timeline--right .rt-item__marker-wrap {
	flex-shrink: 0;
	padding-top: 3px;
}

.rt-timeline--right .rt-item__content {
	flex:         1;
	min-width:    0;
	margin-right: var(--rt-content-gap);
}

/* Right layout — only the heading is right-aligned */
.rt-timeline--right .rt-item__header {
	display:        flex;
	flex-direction: column;
	align-items:    flex-end;
}
.rt-timeline--right .rt-item__title,
.rt-timeline--right .rt-item__subtitle { text-align: right; }

/* =============================================================
   CENTER LAYOUT  ·  ← content | marker | content →
   ─────────────────────────────────────────────────────────────
   3-column CSS grid:
     col 1 = 1fr          (left content — odd rows)
     col 2 = marker-size  (marker bubble — always on the line)
     col 3 = 1fr          (right content — even rows)

   column-gap is the ONLY source of spacing from the marker,
   applied equally to both sides — no padding on side cells.
   ============================================================= */
.rt-timeline--center .rt-item {
	display:               grid;
	grid-template-columns: 1fr var(--rt-marker-size) 1fr;
	grid-template-areas:   "left  marker  right";
	column-gap:            var(--rt-content-gap);
	align-items:           flex-start;
}

/* Marker column — centered horizontally on the line */
.rt-timeline--center .rt-item__marker-col {
	grid-area:       marker;
	display:         flex;
	justify-content: center;
	align-items:     flex-start;
	padding-top:     3px;
}

/* Side cells */
.rt-timeline--center .rt-item__side--left  { grid-area: left;  min-width: 0; }
.rt-timeline--center .rt-item__side--right { grid-area: right; min-width: 0; }

/*
   ODD items — content on the LEFT side
   ──────────────────────────────────────
   Title/year:  right-aligned so it reads toward the line ✓
   Card + body: STRICTLY left-aligned — stops all cascade     ✓
*/
.rt-timeline--center .rt-item--odd .rt-item__header {
	display:        flex;
	flex-direction: column;
	align-items:    flex-end;   /* title flush against the gap */
}
.rt-timeline--center .rt-item--odd .rt-item__title    { text-align: right !important; }
.rt-timeline--center .rt-item--odd .rt-item__subtitle { text-align: right !important; }

/* Firewall: nothing inside the card inherits right-alignment */
.rt-timeline--center .rt-item--odd .rt-item__card           { text-align: left !important; }
.rt-timeline--center .rt-item--odd .rt-item__card *         { text-align: left !important; }
.rt-timeline--center .rt-item--odd .rt-item__body           { text-align: left !important; }
.rt-timeline--center .rt-item--odd .rt-item__body *         { text-align: left !important; }

/*
   EVEN items — content on the RIGHT side
   ──────────────────────────────────────
   Everything left-aligned (natural reading direction).
*/
.rt-timeline--center .rt-item--even .rt-item__header {
	display:        flex;
	flex-direction: column;
	align-items:    flex-start;
}
.rt-timeline--center .rt-item--even .rt-item__title    { text-align: left; }
.rt-timeline--center .rt-item--even .rt-item__subtitle { text-align: left; }
.rt-timeline--center .rt-item--even .rt-item__card     { text-align: left; }
.rt-timeline--center .rt-item--even .rt-item__body     { text-align: left; }
.rt-timeline--center .rt-item--even .rt-item__body *   { text-align: left; }

/* =============================================================
   MARKER BUBBLE
   ============================================================= */
.rt-marker {
	width:            var(--rt-marker-size);
	height:           var(--rt-marker-size);
	min-width:        var(--rt-marker-size);
	border-radius:    50%;
	background-color: var(--rt-marker-bg);
	display:          flex;
	align-items:      center;
	justify-content:  center;
	flex-shrink:      0;
	position:         relative;
	z-index:          2;
	transition:       transform 0.22s ease, box-shadow 0.22s ease;
}

.rt-marker:hover {
	transform:  scale(1.12);
	box-shadow: 0 0 0 7px color-mix(in srgb, var(--rt-marker-bg) 30%, transparent);
}

/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
	.rt-marker:hover { box-shadow: 0 0 0 7px rgba(126,200,160,0.28); }
}

.rt-marker--dot {
	width:  14px;
	height: 14px;
}

.rt-marker__icon {
	font-size:   calc(var(--rt-marker-size) * 0.44);
	color:       var(--rt-marker-color);
	line-height: 1;
	display:     flex;
	align-items: center;
}
.rt-marker__icon svg {
	width:  calc(var(--rt-marker-size) * 0.44);
	height: calc(var(--rt-marker-size) * 0.44);
	fill:   var(--rt-marker-color);
}
.rt-marker__image {
	width:         var(--rt-marker-size);
	height:        var(--rt-marker-size);
	object-fit:    cover;
	border-radius: inherit;
}
.rt-marker__text {
	font-size:   calc(var(--rt-marker-size) * 0.40);
	font-weight: 700;
	color:       var(--rt-marker-color);
	line-height: 1;
	white-space: nowrap;
}

/* =============================================================
   CONTENT — title, subtitle, card, body, image
   ============================================================= */

/* Header block */
.rt-item__header { margin-bottom: 8px; }

/* Title */
.rt-item__title {
	margin:      0 0 3px;
	color:       var(--rt-title-color);
	font-style:  italic;
	font-weight: 700;
	line-height: 1.15;
}
.rt-item__title a { color: inherit; text-decoration: none; }
.rt-item__title a:hover { opacity: 0.78; }

/* Sub-label */
.rt-item__subtitle {
	display:     block;
	font-size:   0.82em;
	line-height: 1.3;
	color:       rgba(255,255,255,0.60);
	font-style:  italic;
	margin-top:  2px;
}

/* Card shell */
.rt-item__card {
	background:    var(--rt-card-bg);
	border-radius: var(--rt-card-radius);
	padding:       var(--rt-card-padding);
	text-align:    left;      /* hard default — never inherit from parent */
}
.rt-item__card:empty { display: none; }

/* Card body */
.rt-item__body {
	color:       var(--rt-content-color);
	font-style:  italic;
	line-height: 1.68;
	text-align:  left;        /* hard reset */
}
.rt-item__body *    { text-align: left; }   /* catch all inline WP/Elementor nodes */
.rt-item__body p    { margin: 0 0 8px; color: inherit; }
.rt-item__body p:last-child { margin-bottom: 0; }
.rt-item__body ul,
.rt-item__body ol   { padding-left: 1.4em; margin: 0 0 8px; }

/* Featured image */
.rt-item__image { margin-bottom: 14px; }
.rt-item__image img {
	width:         100%;
	height:        auto;
	display:       block;
	border-radius: 8px;
}
.rt-item__image-caption {
	font-size:  0.78em;
	color:      rgba(255,255,255,0.48);
	margin-top: 5px;
	text-align: center !important;  /* captions stay centered */
}

/* Elementor template containers inside card */
.rt-item__body .elementor-section,
.rt-item__body .e-con {
	padding: 0 !important;
	margin:  0 !important;
}

/* Editor notice */
.rt-notice {
	padding:       8px 12px;
	background:    rgba(126,200,160,0.14);
	border-left:   3px solid #7ec8a0;
	border-radius: 4px;
	font-size:     0.83em;
	color:         rgba(255,255,255,0.7);
	font-style:    normal !important;
	text-align:    left   !important;
}

/* =============================================================
   ANIMATIONS
   ============================================================= */
.rt-timeline--animated .rt-item--will-animate {
	opacity:    0;
	transform:  translateY(28px);
	transition: opacity 0.52s ease, transform 0.52s ease;
}

/* Fade-in */
[data-animation="fade-in"] .rt-item--will-animate {
	transform: none;
}

/* Slide-in — default slides from left */
[data-animation="slide-in"] .rt-item--will-animate {
	transform: translateX(-32px);
}
.rt-timeline--right[data-animation="slide-in"]              .rt-item--will-animate,
.rt-timeline--center[data-animation="slide-in"] .rt-item--even .rt-item--will-animate {
	transform: translateX(32px);
}

/* Zoom-in */
[data-animation="zoom-in"] .rt-item--will-animate {
	transform: scale(0.87);
}

/* Triggered state */
.rt-timeline--animated .rt-item--in-view {
	opacity:   1 !important;
	transform: none !important;
}

/* =============================================================
   RESPONSIVE ≤ 767px — all layouts collapse to stacked-left
   ============================================================= */
@media (max-width: 767px) {

	/* ── Center collapses to: marker | content ── */
	.rt-timeline--center .rt-item {
		grid-template-columns: var(--rt-marker-size) 1fr;
		grid-template-areas:   "marker  content";
		column-gap:            16px;
	}

	.rt-timeline--center .rt-item__marker-col {
		grid-area:       marker;
		justify-content: flex-start;
	}

	.rt-timeline--center .rt-item__side--left,
	.rt-timeline--center .rt-item__side--right {
		grid-area: content;   /* both collapse to the same cell */
	}

	/* Hide whichever side cell is empty */
	.rt-timeline--center .rt-item__side:empty { display: none; }

	/* Force all text left on mobile */
	.rt-timeline--center .rt-item__header,
	.rt-timeline--center .rt-item--odd  .rt-item__header,
	.rt-timeline--center .rt-item--even .rt-item__header {
		align-items: flex-start !important;
	}
	.rt-timeline--center .rt-item__title,
	.rt-timeline--center .rt-item__subtitle {
		text-align: left !important;
	}
	.rt-timeline--center .rt-item__card *,
	.rt-timeline--center .rt-item__body * {
		text-align: left !important;
	}

	/* Move track to left */
	.rt-timeline--center .rt-timeline__track {
		left:      calc(var(--rt-marker-size) / 2);
		transform: none;
	}

	/* ── Right collapses to left ── */
	.rt-timeline--right .rt-item { flex-direction: row !important; }

	.rt-timeline--right .rt-item__content {
		margin-left:  16px !important;
		margin-right: 0    !important;
	}
	.rt-timeline--right .rt-item__header,
	.rt-timeline--right .rt-item__title,
	.rt-timeline--right .rt-item__subtitle {
		align-items: flex-start !important;
		text-align:  left       !important;
	}
	.rt-timeline--right .rt-timeline__track {
		left:  calc(var(--rt-marker-size) / 2) !important;
		right: auto !important;
	}

	/* ── General ── */
	.rt-item__card  { padding: 14px 16px; }
}
