/*
Theme Name: Asfelia
Version: 1.0.1
*/

:root {
	scroll-behavior: smooth;

	--min-screen-tablet: 640px;
	--min-screen-laptop: 960px;
	--min-screen-desktop: 1280px;
}

/* Templates */

.site {
	display: flex;
	flex-direction: column;
	min-height: 100svh;

	.site-main {
		flex: 1;
	}
}

.front-page-template {
	display: flex;
	flex-direction: column;

	.hero {
		display: flex;
		justify-content: center;
		align-items: center;
		min-height: 80svh;
		padding-block: 64px;
		background: linear-gradient(
			to bottom,
			var(--wp--preset--color--secondary) calc(100% - 64px),
			transparent
		);
		color: var(--wp--preset--color--secondary-content);

		> .container {
			display: flex;
			flex-direction: row;
			justify-content: center;
			align-items: center;
			gap: 64px;
		}

		.hero-left {
			width: 100%;
			max-width: 512px;

			> h1 {
				text-wrap: balance;
				margin-bottom: 16px;
				font-size: 32px;
				font-weight: 700;
				line-height: 1.2;
			}

			> .button {
				margin-top: 32px;
				font-weight: 500;
			}
		}

		.hero-right {
			position: relative;
			z-index: 0;
			width: 100%;
			height: 512px;
			max-width: 512px;
			overflow: hidden;
			border-radius: 16px;

			@media (width < 960px) {
				display: none;
			}

			> img {
				position: absolute;
				z-index: -1;
				width: 100%;
				height: 100%;
				inset: 0;
				object-fit: cover;
			}

			.overlay {
				display: flex;
				align-items: end;
				height: 100%;
				padding: 32px;
				background: linear-gradient(
					to bottom,
					transparent,
					var(--wp--preset--color--primary) 80%
				);
				color: var(--wp--preset--color--primary-content);

				> h2 {
					text-wrap: balance;
					font-size: 28px;
					font-weight: 700;
					line-height: 1.2;
				}
			}
		}
	}

	> section {
		margin-top: 64px;

		.section-title {
			font-size: 28px;
			font-weight: 700;
			margin-bottom: 32px;
		}

		.section-cta {
			display: block;
			max-width: fit-content;
			margin-top: 32px;
			margin-inline: auto;
		}
	}

	.posts-section .list {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 8px;

		@media (width < 640px) {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}

		.post {
			flex: 1;
		}
	}

	.categories-section .list {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		grid-auto-rows: 1fr;
		gap: 16px;

		@media (width < 960px) {
			grid-template-columns: repeat(4, minmax(0, 1fr));

			> li:nth-child(n + 9) {
				display: none;
			}
		}

		@media (width < 640px) {
			grid-template-columns: repeat(2, minmax(0, 1fr));

			> li:nth-child(n + 7) {
				display: none;
			}
		}

		> li {
			padding: 24px 16px;
			border-radius: 16px;
			border: 2px solid
				color-mix(
					in oklab,
					var(--wp--preset--color--base-200),
					var(--wp--preset--color--base-content) 30%
				);
			background: var(--wp--preset--color--base-200);
			color: var(--wp--preset--color--base-content);
			cursor: pointer;
			transition: transform 0.2s ease, box-shadow 0.2s ease,
				border-color 0.2s ease;

			&:hover {
				transform: translateY(-4px);
				border-color: var(--wp--preset--color--primary);
				box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1),
					0 2px 4px -2px rgb(0 0 0 / 0.1);
			}

			&:hover .category-icon {
				transform: scale(1.1);
			}

			> a {
				display: flex;
				flex-direction: column;
				align-items: center;
				gap: 8px;

				.category-icon {
					width: 48px;
					transition: transform 0.2s ease;
				}

				.category-title {
					overflow: hidden;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					font-size: 18px;
					font-weight: 600;
					text-align: center;
				}
			}
		}
	}

	.courses-section .card {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 4px;
		padding: 64px 32px;
		border-radius: 16px;
		font-size: 22px;
		font-weight: 600;
		background: var(--wp--preset--color--base-200);
		color: color-mix(
			in oklab,
			var(--wp--preset--color--base-content),
			var(--wp--preset--color--base-200) 30%
		);

		> svg {
			width: 48px;
		}
	}

	.newsletter-section {
		padding-block: 64px;
		background: var(--wp--preset--color--secondary);
		color: var(--wp--preset--color--secondary-content);

		.section-title {
			text-align: center;
		}
	}

	.newsletter-soon-section {
		.section-title {
			text-align: center;
		}

		.description {
			max-width: 500px;
			margin-inline: auto;
			font-size: 18px;
			/* text-wrap: balance; */
		}

		.tnp.tnp-subscription {
			border-radius: 16px;
			padding: 32px;
			background: var(--wp--preset--color--base-200);
			color: var(--wp--preset--color--base-content);
		}
	}

	.about-section {
		.about p {
			margin-bottom: 16px;
		}

		.list {
			display: grid;
			grid-template-columns: repeat(5, minmax(0, 1fr));
			gap: 32px;
			margin-top: 32px;

			@media (width < 960px) {
				grid-template-columns: repeat(3, minmax(0, 1fr));
			}

			@media (width < 640px) {
				grid-template-columns: repeat(2, minmax(0, 1fr));
			}

			.card {
				.card-image {
					width: 100%;
					aspect-ratio: 1 / 1;

					> img {
						width: 100%;
						height: 100%;
						object-fit: cover;
						border-radius: 16px;
					}
				}

				.card-title {
					margin-top: 8px;
					font-weight: 600;
				}

				.card-content {
					font-size: 14px;
				}
			}
		}
	}

	.faq-section .list {
		display: grid;
		grid-template-columns: 1fr;
		gap: 16px;
		width: 100%;

		@media (width > 960px) {
			grid-template-columns: repeat(2, minmax(0, 1fr));
			grid-auto-rows: auto;
			align-items: start;
			max-width: 1248px;
			margin: 0 auto;
		}

		> details {
			width: 100%;
			height: fit-content;
			border-radius: 16px;
			border: 2px solid
				color-mix(
					in oklab,
					var(--wp--preset--color--base-200),
					var(--wp--preset--color--base-content) 30%
				);
			background: var(--wp--preset--color--base-200);
			color: var(--wp--preset--color--base-content);

			&:is([open], :popover-open, :open) {
				.only-close {
					display: none;
				}
				.only-open {
					display: initial;
				}

				> summary {
					padding-bottom: 16px;
				}
			}

			.only-open {
				display: none;
			}

			> summary {
				display: flex;
				justify-content: space-between;
				gap: 16px;
				padding: 24px 32px;
				font-size: 18px;
				font-weight: 600;
				cursor: pointer;
			}

			> p {
				padding: 0 32px 24px 32px;
			}
		}
	}
}

.error404-template {
	display: flex;
	align-items: center;
	padding-block: 64px;

	h1 {
		font-size: 32px;
		font-weight: 700;
		line-height: 1.2;
	}

	ul {
		margin-top: 16px;
		padding-left: 16px;
		list-style-type: disc;

		a {
			text-decoration: underline;
		}
	}
}

/* Templates parts */

.site-header {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 32px;
	padding: 16px;
	background: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--secondary-content);

	.logo-link img {
		width: 100px;
	}

	> nav {
		flex: 1;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		gap: 16px;

		@media (width < 640px) {
			justify-content: end;
		}

		.left-nav {
			display: flex;
			flex-direction: row;
			gap: 16px;

			@media (width < 640px) {
				display: none;
			}
		}

		.right-nav {
			display: flex;
			flex-direction: row;
			gap: 16px;

			@media (width < 960px) {
				display: none;
			}
		}

		.action-nav {
			@media (width >= 960px) {
				display: none;
			}

			> button {
				width: 32px;
				height: 32px;
				padding: 4px;
				cursor: pointer;
			}
		}
	}

	.mobile-menu {
		width: 100%;
		max-width: 512px;
		margin: auto;

		&::backdrop {
			background: #0008;
		}

		> nav {
			display: flex;
			flex-direction: column;
			padding: 16px;

			.action-nav {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;

				> p {
					font-size: 14px;
					font-weight: 600;
				}

				> button {
					width: 32px;
					height: 32px;
					padding: 4px;
					align-self: flex-end;
					cursor: pointer;
				}
			}

			> a {
				padding-block: 8px;
			}

			> hr {
				margin-block: 8px;
			}

			.cta {
				margin-top: 8px;
				align-self: center;
			}
		}
	}
}

.site-footer {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
	gap: 32px;
	padding: 32px;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-content);

	.logo-link img {
		width: 100px;
	}

	> nav {
		display: flex;
		flex-direction: row;
		gap: 32px;

		@media (width < 640px) {
			flex-direction: column;
		}

		> ul {
			display: flex;
			flex-direction: column;
			gap: 8px;

			> li:first-child {
				font-weight: 700;
			}
		}
	}
}

/* Components */

.container {
	width: 100%;
	max-width: calc(var(--wp--style--global--wide-size) - 16px);
	padding-inline: 16px;
	margin-inline: auto;
}

.button {
	display: inline-block;
	padding: 8px 16px;
	border-radius: 8px;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-content);
	cursor: pointer;
}

.post-card {
	display: flex;
	flex-direction: column;
	padding: 8px;
	border-radius: 20px;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease,
		background-color 0.2s ease;

	.post-thumbnail {
		width: 100%;
		overflow: hidden;
		aspect-ratio: 1/1;
		border-radius: 16px;

		img {
			width: 100%;
			height: 100%;
			object-fit: cover;
			transition: transform 0.3s ease;
		}
	}

	.post-title {
		flex: 1;
		margin-top: 8px;
		font-size: 18px;
		font-weight: 600;
		transition: color 0.2s ease;
	}

	.post-meta {
		overflow: hidden;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
		margin-top: 6px;
		font-size: 14px;
	}

	.post-desc {
		margin-top: 8px;
		color: color-mix(
			in oklab,
			var(--wp--preset--color--base-content),
			var(--wp--preset--color--base-100) 30%
		);
		font-weight: 500;
		font-size: 14px;
		overflow: hidden;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 4;
	}
}

.post-card:hover {
	transform: translateY(-2px);
	background-color: var(--wp--preset--color--base-200);
	box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.post-card:hover .post-thumbnail img {
	transform: scale(1.03);
}

.post-card:hover .post-title {
	color: var(--wp--preset--color--primary);
}

/* Plugins */

.tnp {
	&.tnp-subscription,
	&.tnp-subscription-minimal,
	&.tnp-profile {
		input[type="text"],
		input[type="email"],
		select,
		textarea {
			border-radius: 8px;
			background-color: var(--wp--preset--color--base-100);
			color: var(--wp--preset--color--base-content);
			border: 1px solid
				color-mix(
					in oklab,
					var(--wp--preset--color--base-100),
					var(--wp--preset--color--base-content) 30%
				);
		}

		.tnp-submit {
			display: inline-block;
			padding: 8px 16px;
			border-radius: 8px;
			border: none;
			background: var(--wp--preset--color--primary);
			color: var(--wp--preset--color--primary-content);
			cursor: pointer;
		}

		.tnp-field:last-child,
		.tnp-field:last-child {
			margin-bottom: 0;
		}

		.tnp-privacy-field a {
			color: color-mix(in oklab, black, white 30%);
			text-decoration: underline;
		}
	}

	&.tnp-subscription-minimal {
		.tnp-submit {
			width: fit-content;
		}
	}
}

/* Utils */

.screen-reader-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}
