/*
 * AGP kroz vreme — page-agp-kroz-vreme.php
 *
 * Loaded after services.css so the layout primitives
 * (.service-hero, .service-content, .service-sidebar) and the
 * overlay-header rule are already in scope. This file owns only the
 * page-specific bits:
 *   - overlay-header keyed to .page-template-page-agp-kroz-vreme,
 *   - hero typography tuned to Figma (40px Tahoma Bold uppercase),
 *   - founding "intro" card,
 *   - zig-zag timeline with a central spine + per-item year header.
 *
 * Maps Figma frame 90:699 "AGP KROZ VREME".
 */

.page-template-page-agp-kroz-vreme .site-header {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	z-index: 10;
}

.page-template-page-agp-kroz-vreme .site-main {
	margin-top: 0;
	overflow-x: clip;
}

/* Hero --------------------------------------------------------------- */
.agp-hero {
	min-height: 630px;
	padding: 220px 0 96px;
}

.agp-hero .service-hero__title {
	max-width: 760px;
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: 40px;
	line-height: 53px;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #fff;
}

.agp-hero .service-hero__text {
	max-width: 558px;
	font-family: var(--font-body);
	font-weight: 400;
	font-size: 18px;
	line-height: 28px;
	letter-spacing: 0.5px;
	color: #fff;
}

/* Article shell ------------------------------------------------------ */
.agp-article {
	color: #424242;
	font-family: var(--font-body);
	font-weight: 400;
	font-size: 16px;
	line-height: 26px;
}

.agp-article > * + * {
	margin-top: 48px;
}

/* Timeline ---------------------------------------------------------- *
 * Cards zig-zag down a central vertical spine. Each card is placed
 * explicitly in a 2-column CSS Grid via PHP-emitted `--row` (the grid
 * row at which the card starts) and a `--left` / `--right` BEM
 * modifier (the column it sits in). Each card spans 2 grid rows; rows
 * are sized so consecutive cards offset by one row visually overlap
 * by half a card height, matching the staggered alignment in Figma.
 * The intro / founding card is just the first list item with the
 * `--intro` modifier — it shares row 1 with the first year card. */
.agp-timeline {
	--agp-timeline-row: 135px;
	--agp-timeline-gap: 56px;
	position: relative;
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: var(--agp-timeline-gap);
	grid-auto-rows: var(--agp-timeline-row);
	margin: 0;
	padding: 12px 0 8px;
	list-style: none;
}

.agp-timeline::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 1px;
	background: #bb2548;
	transform: translateX(-50%);
}

.agp-timeline__item {
	position: relative;
	grid-row: var(--row, 1) / span 2;
	border-radius: 10px;
}

.agp-timeline__item--left {
	grid-column: 1;
}

.agp-timeline__item--right {
	grid-column: 2;
}

/* Marker dot pinned to the spine — 16px ring with a white core,
 * sitting on the central 1px line. Offset = half the column gap plus
 * half the marker width, so the dot's center always lands on the
 * spine regardless of the active gap. */
.agp-timeline__item::before {
	content: "";
	position: absolute;
	top: 15px;
	width: 16px;
	height: 16px;
	background: radial-gradient(circle, #fff 0 4px, #bb2548 4px);
	border: 1px solid #bb2548;
	border-radius: 50%;
	box-sizing: border-box;
}

.agp-timeline__item--left::before {
	right: calc(var(--agp-timeline-gap) / -2);
	transform: translateX(50%);
}

.agp-timeline__item--right::before {
	left: calc(var(--agp-timeline-gap) / -2);
	transform: translateX(-50%);
}

/* Year header pill — also the accordion toggle button */
.agp-timeline__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 9px 20px;
	background: #bb2548;
	border: 0;
	border-radius: 6px 6px 0 0;
	font: inherit;
	color: inherit;
	text-align: left;
	cursor: pointer;
	appearance: none;
}

/* Toggle indicator (+ / −) shown only when the accordion is active. */
.agp-timeline__toggle {
	position: relative;
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	display: none;
}

.agp-timeline.is-accordion .agp-timeline__toggle {
	display: block;
}

.agp-timeline__toggle::before,
.agp-timeline__toggle::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	background: #fff;
	transform: translate(-50%, -50%);
}

.agp-timeline__toggle::before {
	width: 14px;
	height: 2px;
}

.agp-timeline__toggle::after {
	width: 2px;
	height: 14px;
	transition: transform 180ms ease, opacity 180ms ease;
}

/* Open state: vertical bar collapses so the icon reads as a minus. */
.agp-timeline__item.is-open .agp-timeline__toggle::after {
	transform: translate(-50%, -50%) scaleY(0);
	opacity: 0;
}

/* Collapse the body of every closed card once the accordion is engaged,
 * animating max-height / padding / opacity for a smooth expand & collapse. */
.agp-timeline.is-accordion .agp-timeline__body {
	max-height: 360px;
	overflow: hidden;
	opacity: 1;
	transition: max-height 320ms ease, padding 320ms ease, border-width 320ms ease, opacity 240ms ease;
}

.agp-timeline.is-accordion .agp-timeline__item:not(.is-open) .agp-timeline__body {
	max-height: 0;
	padding-top: 0;
	padding-bottom: 0;
	border-bottom-width: 0;
	opacity: 0;
}

/* A closed card is just the rounded pill (no attached body below). */
.agp-timeline.is-accordion .agp-timeline__header {
	transition: border-radius 220ms ease;
}

.agp-timeline.is-accordion .agp-timeline__item:not(.is-open) .agp-timeline__header {
	border-radius: 6px;
}

.agp-timeline__year {
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: 18px;
	line-height: 26px;
	letter-spacing: 2px;
	color: #fff;
	text-transform: uppercase;
}

.agp-timeline__body {
	padding: 18px 22px 20px;
	background: #fff;
	border: 1px solid #c3c3c3;
	border-top: 0;
	border-radius: 0 0 6px 6px;
}

.agp-timeline__body p {
	margin: 0 0 14px;
	font-size: 13px;
	line-height: 22px;
}

.agp-timeline__body p:last-child {
	margin-bottom: 0;
}

/* Intro / founding card — no red header pill, larger date text. The
 * marker dot still sits on the spine; the body inherits the `--intro`
 * variant typography. */
.agp-timeline__item--intro {
	padding-top: 4px;
}

.agp-timeline__intro-date {
	margin: 0;
	font-family: var(--font-heading);
	font-weight: 700;
	font-size: 28px;
	line-height: 39px;
	letter-spacing: 2px;
	color: #0a0a0a;
	text-transform: uppercase;
}

.agp-timeline__intro-title {
	margin: 12px 0 0;
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 16px;
	line-height: 26px;
	letter-spacing: 3px;
	color: #424242;
	text-transform: uppercase;
}

.agp-timeline__intro-body {
	margin-top: 12px;
	max-width: 558px;
}

.agp-timeline__intro-body p {
	margin: 0 0 12px;
	font-size: 13px;
	line-height: 22px;
}

.agp-timeline__intro-body p:last-child {
	margin-bottom: 0;
}

/* Responsive -------------------------------------------------------- */
@media screen and (max-width: 1499px) {
	.agp-hero {
		min-height: 560px;
		padding: 200px 0 80px;
	}

	.agp-timeline {
		--agp-timeline-gap: 48px;
	}
}

@media screen and (max-width: 991px) {
	.agp-hero {
		min-height: 480px;
		padding: 180px 0 72px;
	}

	.agp-hero .service-hero__title {
		font-size: 32px;
		line-height: 1.3;
		letter-spacing: 1.5px;
	}

	.agp-hero .service-hero__text {
		font-size: 16px;
		line-height: 26px;
	}

	.agp-article > * + * {
		margin-top: 36px;
	}

	.agp-timeline__intro-date {
		font-size: 24px;
		line-height: 32px;
	}

	/* Collapse to a single column with a left rail; drop the stagger.
	 * --agp-timeline-rail = distance from .agp-timeline left edge to the
	 * spine's center; --agp-timeline-rail-gap = horizontal distance from
	 * spine to the item's left edge. Markers then anchor at item's left
	 * minus rail-gap (= the spine's x) and self-center via translateX. */
	.agp-timeline {
		--agp-timeline-rail: 7px;
		--agp-timeline-rail-gap: 22px;
		grid-template-columns: 1fr;
		grid-auto-rows: auto;
		column-gap: 0;
		row-gap: 28px;
		padding-left: calc(var(--agp-timeline-rail) + var(--agp-timeline-rail-gap));
	}

	.agp-timeline::before {
		left: var(--agp-timeline-rail);
	}

	.agp-timeline__item,
	.agp-timeline__item--left,
	.agp-timeline__item--right {
		grid-column: 1;
		grid-row: auto;
	}

	.agp-timeline__item--left::before,
	.agp-timeline__item--right::before {
		right: auto;
		left: calc(-1 * var(--agp-timeline-rail-gap));
		transform: translateX(-50%);
	}
}

@media screen and (max-width: 599px) {
	.agp-hero {
		min-height: 420px;
		padding: 160px 0 56px;
	}

	.agp-hero .service-hero__title {
		font-size: 26px;
		line-height: 1.25;
	}

	.agp-hero .service-hero__text {
		font-size: 15px;
		line-height: 24px;
	}

	.agp-article {
		font-size: 15px;
		line-height: 24px;
	}

	.agp-timeline__intro-date {
		font-size: 22px;
		line-height: 30px;
	}

	.agp-timeline__intro-title {
		letter-spacing: 2px;
	}

	.agp-timeline {
		--agp-timeline-rail: 6px;
		--agp-timeline-rail-gap: 18px;
		row-gap: 22px;
	}

	.agp-timeline__body {
		padding: 14px 16px 16px;
	}
}
