:root {
	--card-height: 40vw;
	--card-margin: 4vw;
	--card-top-offset: 1em;
	--numcards: 3;
	--outline-width: 0px;
}

#cards {
	padding-bottom: calc(var(--numcards) * var(--card-top-offset)); /* Make place at bottom, as items will slide to that position*/
	margin-bottom: var(--card-margin); /* Don't include the --card-margin in padding, as that will affect the scroll-timeline*/
}

#card_1 {
	--index: 1;
}

#card_2 {
	--index: 2;
}

#card_3 {
	--index: 3;
}

/* #card_4 {
	--index: 4;
} */

.card {
	position: sticky;
	top: 0;
	padding-top: calc(var(--index) * var(--card-top-offset));
	
}

@supports (animation-timeline: works) {

	@scroll-timeline cards-element-scrolls-in-body {
		source: selector(body);
		scroll-offsets:
			/* Start when the start edge touches the top of the scrollport */
			selector(#cards) start 1,
			/* End when the start edge touches the start of the scrollport */
			selector(#cards) start 0
		;
		start: selector(#cards) start 1; /* Start when the start edge touches the top of the scrollport */
		end: selector(#cards) start 0; /* End when the start edge touches the start of the scrollport */
		time-range: 4s;
	}

	.card {
		--index0: calc(var(--index) - 1); /* 0-based index */
		--reverse-index: calc(var(--numcards) - var(--index0)); /* reverse index */
		--reverse-index0: calc(var(--reverse-index) - 1); /* 0-based reverse index */
	}
	
	.card__content {
		transform-origin: 50% 0%;
		will-change: transform;

		--duration: calc(var(--reverse-index0) * 1s);
		--delay: calc(var(--index0) * 1s);

		animation: var(--duration) linear scale var(--delay) forwards;
		animation-timeline: cards-element-scrolls-in-body;
	}

	@keyframes scale {
		to {
			transform:
				scale(calc(
					1.1
					-
					calc(0.1 * var(--reverse-index))
				));
		}
	}
}


/** PAGE STYLING **/




/* 
header, */
main {
	

	text-align: center;
    display: grid;
	place-items: center;
	font-size: calc(1em + 0.5vw);  
	
	margin: auto auto;
}


/* header {
	height: 100vh;
	
} */

#cards {
	list-style: none;
	outline: calc(var(--outline-width) * 10) solid blue;
	width: 80vw;
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: repeat(var(--numcards), var(--card-height));
	gap: var(--card-margin);
}

.card {
	outline: var(--outline-width) solid hotpink;
}

.card__content {
	box-shadow: 0 0.2em 1em rgba(0, 0, 0, 0.1), 0 1em 2em rgba(0, 0, 0, 0.1);
	background-image: linear-gradient(to bottom, #FFC069,#FF5B7D	); 
	color: rgb(8, 8, 8);
	border-radius: 1em;
	overflow: hidden;

	display: grid;
	grid-template-areas: "text img";
	grid-template-columns: 1fr 1fr;
	grid-template-rows: auto;

	align-items: stretch;
	outline: var(--outline-width) solid lime;
}

.card__content > div {
	grid-area: text;
	width: 80%;
	place-self: center;
	text-align: left;

	display: grid;
	gap: 1em;
	place-items: start;
}

.card__content > figure {
	grid-area: img;
	overflow: hidden;
}

.card__content > figure > img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}



.btn {
	background:linear-gradient(to bottom right, blue 20%,black 90%	);
	color: rgb(255 255 255);
	text-decoration: none;
	display: inline-block;
	padding: 0.5em;
	border-radius: 0.25em;
}






@media screen and (max-width: 900px) {

	:root {
		--card-height:auto;
	}
	.btn {
		padding: 0.3em;
		font-size: 10px;
		border-radius: 0.25em;
	}
	p{
		font-size: 16px;
		align-content: justify;
		
	}
	h2{
		font-size: 22px;
	}
} 

@media screen and (max-width: 767px) {

	:root {
		--card-height:auto;
	}
	.btn {
		padding: 0.3em;
		font-size: 10px;
		border-radius: 0.25em;
	}
	p{
		font-size: 14px;
		align-content: justify;
		
	}
	h2{
		font-size: 20px;
	}
} 
@media screen and (max-width: 576px) {

	:root {
		--card-height:auto;
	}
	.btn {
		padding: 0.3em;
		font-size: 10px;
		border-radius: 0.25em;
	}
	p{
		font-size: 12px;
		align-content: justify;
		
	}
	h2{
		font-size: 15px;
	}
} 