/**
 * Timeline Module
 * Desktop: 3-column grid — image | numbered line | content, alternating odd/even.
 * Mobile: 2-column grid — numbered line left, image + content stacked right.
 */

/* ===========================
   # Section
=========================== */

.timeline-module {
	padding:    80px 0;
	background: #fff;
}

/* ===========================
   # Header
=========================== */

.timeline-module__header {
	padding-bottom: 32px;
}

.timeline-module__sub-header {
	display:       flex;
	align-items:   center;
	gap:           12px;
	margin-bottom: 16px;
}

.timeline-module__dot {
	display:       block;
	width:         10px;
	height:        10px;
	border-radius: 50%;
	background:    var(--nec-orange);
	box-shadow:    0 0 0 5px rgba(235, 110, 0, 0.18);
	flex-shrink:   0;
}

.timeline-module__sub-header-text {
	font-size:      clamp(0.8125rem, calc(0.769rem + 0.188vw), 0.9375rem);
	line-height:    1;
	font-weight:    400;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color:          var(--nec-grey);
}

.timeline-module__heading {
	margin: 0;
	color:  var(--nec-grey);
}

/* ===========================
   # Items wrapper
=========================== */

.timeline-module__items {
	display:        flex;
	flex-direction: column;
}

/* ===========================
   # Item row (desktop 3-col grid)
=========================== */

.timeline-module__item {
	display:               grid;
	grid-template-columns: 1fr 80px 1fr;
	column-gap:            48px;
	align-items:           start;
}

/* Inter-item spacing: padding-bottom on sides lets the line flow continuously
   through the gap between items (centre col inherits the full row height). */
.timeline-module__item:not(:last-child) .timeline-module__side {
	padding-bottom: 80px;
}

/* ===========================
   # Grid placement — default (odd: image left, content right)
=========================== */

.timeline-module__center {
	grid-column: 2;
	grid-row:    1;
}

.timeline-module__side--image {
	grid-column: 1;
	grid-row:    1;
}

.timeline-module__side--content {
	grid-column: 3;
	grid-row:    1;
}

/* ===========================
   # Grid placement — even items (content left, image right)
=========================== */

.timeline-module__item--even .timeline-module__side--image {
	grid-column: 3;
}

.timeline-module__item--even .timeline-module__side--content {
	grid-column: 1;
}

/* ===========================
   # Centre column: marker + vertical line
=========================== */

.timeline-module__center {
	position:        relative;
	display:         flex;
	flex-direction:  column;
	align-items:     center;
	/* Override the grid's align-items: start so this column stretches to the
	   full row height — the line pseudo-element (top/bottom) depends on it. */
	align-self:      stretch;
	--tl-marker:     28px; /* keep in sync with .timeline-module__marker size */
}

/* Continuous vertical line behind the marker — inset 10px top/bottom so it
   doesn't run flush into the marker above/below it. Top is offset by the
   marker's own height first, otherwise the gap is hidden underneath it. */
.timeline-module__center::before {
	content:    '';
	position:   absolute;
	top:        calc(var(--tl-marker) + 10px);
	bottom:     10px;
	left:       50%;
	transform:  translateX(-50%);
	width:      1.5px;
	background: var(--nec-grey20, #ebeced);
	z-index:    0;
}

/* Last item: line ends at marker centre */
.timeline-module__item:last-child .timeline-module__center::before {
	top:    0;
	bottom: auto;
	height: 24px;
}

/* ===========================
   # Numbered marker circle
=========================== */

.timeline-module__marker {
	position:      relative;
	z-index:       1;
	width:         28px;
	height:        28px;
	border-radius: 50%;
	background:    var(--nec-orange);
	color:         #fff;
	display:       flex;
	align-items:   center;
	justify-content: center;
	font-family:   var(--nec-font);
	font-size:     12px;
	font-weight:   500;
	letter-spacing: 0.04em;
	flex-shrink:   0;
}

/* ===========================
   # Image
=========================== */

.timeline-module__image {
	display:    block;
	width:      100%;
	height:     auto;
	object-fit: cover;
}

/* ===========================
   # Content side
=========================== */

.timeline-module__side--content {
	display:        flex;
	flex-direction: column;
	gap:            20px;
	padding-top:    8px;
}

.timeline-module__title {
	margin:      0;
	color:       var(--nec-grey);
	font-family: var(--nec-font);
	font-weight: 500;
}

.timeline-module__body {
	color:       var(--nec-grey);
	line-height: 1.7;
}

.timeline-module__body p:first-child {
	margin-top: 0;
}

.timeline-module__body p:last-child {
	margin-bottom: 0;
}

/* ===========================
   # CTA link
=========================== */

.timeline-module__cta {
	display:         inline-flex;
	align-items:     center;
	gap:             12px;
	color:           var(--nec-grey);
	font-family:     var(--nec-font);
	font-weight:     500;
	text-decoration: none;
	transition:      color 0.2s ease;
}

.timeline-module__cta:hover,
.timeline-module__cta:focus-visible {
	color:   var(--nec-grey);
	outline: none;
}

.timeline-module__cta-icon {
	display:     flex;
	align-items: center;
	flex-shrink: 0;
	transition:  transform 0.25s ease;
}

.timeline-module__cta:hover .timeline-module__cta-icon,
.timeline-module__cta:focus-visible .timeline-module__cta-icon {
	transform: translateX(5px);
}

.timeline-module__cta .timeline-module__cta-icon svg {
	width:  34px;
	height: 34px;
	color:  var(--nec-orange);
}

/* ===========================
   # Responsive — 1280px
=========================== */

@media (max-width: 1280px) {
	.timeline-module {
		padding: 64px 0;
	}

	.timeline-module__item {
		grid-template-columns: 1fr 64px 1fr;
		column-gap:            40px;
	}

	.timeline-module__item:not(:last-child) .timeline-module__side {
		padding-bottom: 64px;
	}
}

/* ===========================
   # Responsive — 991px (switch to single column, line on left)
=========================== */

@media (max-width: 991px) {
	.timeline-module {
		padding: 48px 0;
	}

	/* 2-column: [56px marker col] [content col] */
	.timeline-module__item {
		grid-template-columns: 56px 1fr;
		grid-template-rows:    auto auto;
		column-gap:            24px;
		align-items:           start;
	}

	/* Centre col spans both image and content rows */
	.timeline-module__center {
		grid-column: 1;
		grid-row:    1 / 3;
	}

	/* Image: top of right col */
	.timeline-module__side--image {
		grid-column: 2;
		grid-row:    1;
	}

	/* Content: below image in right col */
	.timeline-module__side--content {
		grid-column: 2;
		grid-row:    2;
		padding-top: 20px;
	}

	/* Reset even-item swap — both sides stay in col 2 on mobile */
	.timeline-module__item--even .timeline-module__side--image {
		grid-column: 2;
	}

	.timeline-module__item--even .timeline-module__side--content {
		grid-column: 2;
	}

	/* Tighten inter-item spacing */
	.timeline-module__item:not(:last-child) .timeline-module__side {
		padding-bottom: 48px;
	}

	/* Remove desktop bottom padding on image side — spacing handled by content's padding-top */
	.timeline-module__item:not(:last-child) .timeline-module__side--image {
		padding-bottom: 0;
	}

	/* Line clips: last item ends at marker centre */
	.timeline-module__item:last-child .timeline-module__center::before {
		top:    0;
		bottom: auto;
		height: 20px;
	}
}

/* ===========================
   # Responsive — 599px
=========================== */

@media (max-width: 599px) {
	.timeline-module {
		padding: 36px 0;
	}

	.timeline-module__item {
		grid-template-columns: 48px 1fr;
		column-gap:            16px;
	}

	.timeline-module__item:not(:last-child) .timeline-module__side {
		padding-bottom: 36px;
	}
}
