/* Pincus Matz — Timeline
   Three layouts sharing one set of brand tokens:
     .pmtl--image       vertical, polaroid imagery beside a gold rail
     .pmtl--text        vertical, text only (year above heading or in a side column)
     .pmtl--horizontal  horizontal, text only, snap-scrolling with navigation */

.pmtl {
	--pmtl-rail: #C0A074;
	--pmtl-year: #C0A074;
	--pmtl-heading: #22406E;
	--pmtl-text: #5A5344;
	--pmtl-frame: #FFFFFF;
	--pmtl-img-col: 42%;
	--pmtl-gap: 72px;
	--pmtl-heading-size: 34px;
	--pmtl-rail-gutter: clamp(28px, 5vw, 64px);
	--pmtl-content-align: center; /* text block vs image: start | center | end */
	--pmtl-text-max: none;        /* optional cap on the text column width */
	--pmtl-dot-nudge: 0px;        /* manual fine-tune in heading mode */
	--pmtl-side-col: 160px;       /* text layout: year column width */
	--pmtl-per-view: 3;           /* horizontal: milestones in view */
	--pmtl-h-gap: 48px;           /* horizontal: space between milestones */
	--pmtl-nav: #22406E;
	--pmtl-nav-muted: rgba(34, 64, 110, 0.45);
	--pmtl-nav-contrast: #F2EDE1;
	/* --pmtl-dot-y is measured per entry by JS (heading mode) so the
	   marker follows the heading wherever the text block sits. */

	width: 100%;
}

/* ---------------------------------------------------- Item grid */

.pmtl__item {
	display: grid;
	grid-template-columns: var(--pmtl-img-col) var(--pmtl-rail-gutter) 1fr;
	align-items: start;
	position: relative;
}

.pmtl__item + .pmtl__item {
	margin-top: var(--pmtl-gap);
}

/* ---------------------------------------------------- Rail */

/* The rail column carries a continuous line; consecutive items extend
   the line through the gap between them so it reads as one stroke. */
.pmtl__rail {
	position: relative;
	align-self: stretch;
	height: 100%;
}

.pmtl__rail::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 0;
	bottom: 0;
	width: 1px;
	margin-left: -0.5px;
	background: var(--pmtl-rail);
	opacity: 0.65;
}

/* bridge the gap between items */
.pmtl__item + .pmtl__item .pmtl__rail::after {
	content: "";
	position: absolute;
	left: 50%;
	width: 1px;
	margin-left: -0.5px;
	top: calc(-1 * var(--pmtl-gap));
	height: var(--pmtl-gap);
	background: var(--pmtl-rail);
	opacity: 0.65;
}

/* trim the stroke above the first marker and below the last one */
.pmtl__item:first-child .pmtl__rail::before {
	top: calc(var(--pmtl-dot-y, 50%) + var(--pmtl-dot-nudge));
}

.pmtl__item:last-child .pmtl__rail::before {
	bottom: auto;
	height: calc(var(--pmtl-dot-y, 50%) + var(--pmtl-dot-nudge));
}

/* Heading mode (default rule): centred on the heading's first line.
   Falls back to the entry's middle until JS has measured. */
.pmtl__dot {
	position: absolute;
	left: 50%;
	top: calc(var(--pmtl-dot-y, 50%) + var(--pmtl-dot-nudge));
	width: 9px;
	height: 9px;
	margin-left: -4.5px;
	margin-top: -4.5px;
	border-radius: 50%;
	background: var(--pmtl-rail);
}

/* Middle alignment: marker sits at the vertical centre of the entry
   (which equals the image centre whenever the image is the taller
   column, as in the approved design). */
.pmtl--dot-middle .pmtl__dot {
	top: 50%;
	margin-top: -4.5px;
}

.pmtl--dot-middle .pmtl__item:first-child .pmtl__rail::before {
	top: 50%;
}

.pmtl--dot-middle .pmtl__item:last-child .pmtl__rail::before {
	bottom: auto;
	height: 50%;
}

/* ---------------------------------------------------- Media */

.pmtl__media {
	min-width: 0;
}

.pmtl__frame {
	margin: 0;
}

.pmtl__img {
	display: block;
	width: 100%;
	height: auto;
}

/* Polaroid treatment */
.pmtl--polaroid .pmtl__frame {
	background: var(--pmtl-frame);
	padding: clamp(8px, 1.6vw, 16px);
	padding-bottom: clamp(22px, 4vw, 44px);
	box-shadow: 0 6px 22px rgba(34, 64, 110, 0.10);
	border-radius: 2px;
}

/* ---------------------------------------------------- Content */

.pmtl__content {
	min-width: 0;
	align-self: var(--pmtl-content-align);
	max-width: var(--pmtl-text-max); /* none by default: fills its column */
}

.pmtl__year {
	margin: 0 0 0.7em;
	font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-weight: 500;
	font-size: 0.8rem;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	color: var(--pmtl-year);
}

.pmtl__title {
	margin: 0 0 0.55em;
	font-family: "Cormorant Garamond", Garamond, "Times New Roman", serif;
	font-weight: 600;
	font-size: var(--pmtl-heading-size);
	line-height: 1.15;
	color: var(--pmtl-heading);
}

.pmtl__text {
	margin: 0;
	font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-weight: 300;
	font-size: 0.98rem;
	line-height: 1.75;
	color: var(--pmtl-text);
}

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

.pmtl--reveal .pmtl__item,
.pmtl--reveal .pmtl-h__item {
	opacity: 0;
	transform: translateY(22px);
	transition:
		opacity 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94),
		transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94);
	will-change: opacity, transform;
}

.pmtl--reveal .pmtl__item.pmtl-in,
.pmtl--reveal .pmtl-h__item.pmtl-in {
	opacity: 1;
	transform: translateY(0);
}

/* Until JS runs (or without it), items stay visible */
.pmtl--reveal:not(.pmtl-js) .pmtl__item,
.pmtl--reveal:not(.pmtl-js) .pmtl-h__item {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.pmtl--reveal .pmtl__item,
	.pmtl--reveal .pmtl-h__item {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
}

/* ==================================================== Vertical, text only */

.pmtl--text.pmtl--year-top .pmtl__item {
	grid-template-columns: 24px 1fr;
	column-gap: clamp(20px, 3vw, 40px);
}

.pmtl--text.pmtl--year-side .pmtl__item {
	grid-template-columns: var(--pmtl-side-col) var(--pmtl-rail-gutter) 1fr;
}

/* Until JS measures the heading, assume it sits at the top. */
.pmtl--text .pmtl__item {
	--pmtl-dot-y: 1.15rem;
}

.pmtl--text .pmtl__content {
	align-self: start;
}

/* Year column: the year is pinned level with the marker / heading. */
.pmtl__side {
	position: relative;
	min-width: 0;
}

.pmtl--year-side .pmtl__side .pmtl__year {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(var(--pmtl-dot-y, 1.15rem) + var(--pmtl-dot-nudge));
	transform: translateY(-50%);
	margin: 0;
	text-align: right;
}

/* Low-specificity defaults so Elementor's typography controls win. */
:where(.pmtl--year-side .pmtl__side) .pmtl__year {
	font-family: "Cormorant Garamond", Garamond, "Times New Roman", serif;
	font-weight: 600;
	font-size: 1.65rem;
	letter-spacing: 0.06em;
	line-height: 1.1;
}

/* ==================================================== Horizontal, text only */

.pmtl--horizontal {
	display: flex;
	flex-direction: column;
}

/* Navigation bar: years (left) + arrows (right) */
.pmtl-h__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	margin: 0 0 clamp(28px, 4vw, 48px);
}

.pmtl-h__bar[hidden],
.pmtl-h--static .pmtl-h__bar {
	display: none !important;
}

.pmtl-h--nav-bottom .pmtl-h__bar {
	order: 2;
	margin: clamp(28px, 4vw, 48px) 0 0;
}

.pmtl-h__years {
	position: relative;
	display: flex;
	gap: clamp(18px, 2.4vw, 32px);
	flex: 1 1 auto;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.pmtl-h__years::-webkit-scrollbar {
	display: none;
}

.pmtl-h__spacer {
	flex: 1 1 auto;
}

/* Buttons are prefixed with .pmtl so theme button styles can't leak in. */
.pmtl .pmtl-h__year-btn {
	appearance: none;
	background: none;
	border: 0;
	border-bottom: 1px solid transparent;
	border-radius: 0;
	box-shadow: none;
	margin: 0;
	padding: 6px 0;
	cursor: pointer;
	white-space: nowrap;
	font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 0.78rem;
	font-weight: 500;
	letter-spacing: 0.24em;
	line-height: 1.4;
	text-transform: uppercase;
	color: var(--pmtl-nav-muted);
	transition: color 0.3s ease, border-color 0.3s ease;
}

.pmtl .pmtl-h__year-btn:hover,
.pmtl .pmtl-h__year-btn:focus {
	background: none;
	color: var(--pmtl-nav);
}

.pmtl .pmtl-h__year-btn.is-active {
	color: var(--pmtl-nav);
	border-bottom-color: var(--pmtl-rail);
}

.pmtl .pmtl-h__arrows {
	display: flex;
	gap: 12px;
	flex: none;
}

.pmtl .pmtl-h__arrow {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--pmtl-rail);
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: var(--pmtl-nav);
	cursor: pointer;
	transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}

.pmtl .pmtl-h__arrow:hover:not(:disabled),
.pmtl .pmtl-h__arrow:focus:not(:disabled) {
	background: var(--pmtl-nav);
	border-color: var(--pmtl-nav);
	color: var(--pmtl-nav-contrast);
}

.pmtl .pmtl-h__arrow:disabled {
	background: transparent;
	color: var(--pmtl-nav);
	opacity: 0.35;
	cursor: default;
}

.pmtl .pmtl-h__arrow svg {
	display: block;
	width: 18px;
	height: 18px;
}

.pmtl .pmtl-h__year-btn:focus-visible,
.pmtl .pmtl-h__arrow:focus-visible,
.pmtl .pmtl-h__track:focus-visible {
	outline: 2px solid var(--pmtl-rail);
	outline-offset: 3px;
}

/* Track: native horizontal scroll with snapping (swipe on touch). */
.pmtl .pmtl-h__track {
	position: relative;
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - (var(--pmtl-per-view) - 1) * var(--pmtl-h-gap)) / var(--pmtl-per-view));
	column-gap: var(--pmtl-h-gap);
	align-items: start;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	list-style: none;
	margin: 0;
	padding: 0 0 4px;
}

.pmtl .pmtl-h__track::-webkit-scrollbar {
	display: none;
}

.pmtl .pmtl-h__item {
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
}

/* Rail: each marker carries a segment that bridges into the gap,
   so the dots sit on one continuous line. */
.pmtl-h__marker {
	position: relative;
	height: 9px;
	margin-bottom: clamp(20px, 2.6vw, 30px);
}

.pmtl-h__marker::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 0;
	right: calc(-1 * var(--pmtl-h-gap));
	height: 1px;
	margin-top: -0.5px;
	background: var(--pmtl-rail);
	opacity: 0.65;
}

.pmtl-h__item:last-child .pmtl-h__marker::before {
	right: 0;
}

.pmtl-h__dot {
	position: absolute;
	left: 0;
	top: 0;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--pmtl-rail);
}

.pmtl-h__content {
	padding-right: 8px;
}

/* ---------------------------------------------------- Responsive */

@media (max-width: 1024px) {
	.pmtl {
		--pmtl-heading-size: 28px;
		--pmtl-side-col: 120px;
	}
	.pmtl--horizontal {
		--pmtl-per-view: 2;
	}
}

/* Phones */
@media (max-width: 767px) {
	.pmtl {
		--pmtl-gap: 56px;
		--pmtl-heading-size: 24px;
	}

	.pmtl__year {
		font-size: 0.7rem;
		letter-spacing: 0.26em;
		margin-bottom: 0.55em;
	}

	.pmtl__text {
		font-size: 0.92rem;
		line-height: 1.7;
	}

	/* Image layout: stack — rail on the left, full-width polaroid on
	   top, text beneath. Marker anchors near the top of each entry. */
	.pmtl--image .pmtl__item {
		grid-template-columns: 14px 1fr;
		grid-template-areas:
			"rail media"
			"rail content";
		column-gap: 20px;
		row-gap: 20px;
	}

	.pmtl--image .pmtl__rail    { grid-area: rail; }
	.pmtl--image .pmtl__media   { grid-area: media; }
	.pmtl--image .pmtl__content {
		grid-area: content;
		align-self: start;
		max-width: none;
	}

	.pmtl--image .pmtl__dot,
	.pmtl--image.pmtl--dot-middle .pmtl__dot {
		top: 14px;
		margin-top: 0;
	}

	.pmtl--image .pmtl__item:first-child .pmtl__rail::before,
	.pmtl--image.pmtl--dot-middle .pmtl__item:first-child .pmtl__rail::before {
		top: 14px;
	}

	.pmtl--image .pmtl__item:last-child .pmtl__rail::before,
	.pmtl--image.pmtl--dot-middle .pmtl__item:last-child .pmtl__rail::before {
		bottom: auto;
		height: 28px;
	}

	.pmtl--polaroid .pmtl__frame {
		padding: 8px;
		padding-bottom: 22px;
	}

	/* Text layouts: narrow rail on the left; a side-column year moves
	   above the heading. */
	.pmtl--text.pmtl--year-top .pmtl__item,
	.pmtl--text.pmtl--year-side .pmtl__item {
		grid-template-columns: 14px 1fr;
		column-gap: 20px;
	}

	.pmtl--text.pmtl--year-side .pmtl__item {
		grid-template-areas:
			"rail side"
			"rail content";
	}

	.pmtl--year-side .pmtl__side    { grid-area: side; }
	.pmtl--year-side .pmtl__rail    { grid-area: rail; }
	.pmtl--year-side .pmtl__content { grid-area: content; }

	.pmtl--year-side .pmtl__side .pmtl__year {
		position: static;
		transform: none;
		text-align: left;
		margin: 0 0 0.35em;
	}

	:where(.pmtl--year-side .pmtl__side) .pmtl__year {
		font-size: 1.3rem;
		letter-spacing: 0.06em;
	}

	/* Horizontal */
	.pmtl--horizontal {
		--pmtl-per-view: 1.15;
		--pmtl-h-gap: 24px;
	}

	.pmtl-h__bar {
		gap: 16px;
	}

	.pmtl .pmtl-h__arrow {
		width: 42px;
		height: 42px;
	}
}
