/*
 * Blog listing (templates/home.html), article (templates/single.html) and the
 * blocks that show post data in the cards.
 */

/* Links inside tags and titles take the color of the text around them. */
.cecyber-tag a,
.wp-block-post-title a,
.cecyber-card-blog__type a {
	color: inherit;
	text-decoration: none;
}

/* "Saiba mais", "Leia mais" and "Ler mais" of the post cards (Read More). */
.wp-block-read-more.cecyber-read-more {
	display: inline-flex;
	gap: var(--wp--preset--spacing--20);
	align-items: center;
	width: fit-content;
	padding: 0.6875rem var(--wp--preset--spacing--50);
	border: 1px solid var(--wp--preset--color--primary-darker);
	border-radius: 9999px;
	background: var(--wp--preset--color--primary-darker);
	color: var(--wp--preset--color--white);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	line-height: 2.125;
	text-decoration: none;

	&::after {
		content: "";
		flex: none;
		width: 1.5rem;
		height: 1.5rem;
		background: currentcolor;
		mask: url(../icons/arrow-up-right.svg) no-repeat center / contain;
	}

	&:hover {
		border-color: var(--wp--preset--color--primary-dark);
		background: var(--wp--preset--color--primary-dark);
	}
}

.wp-block-read-more.cecyber-read-more--secondary {
	border-color: var(--wp--preset--color--bg-soft);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--text-main);

	&:hover {
		border-color: var(--wp--preset--color--bg-soft);
		background: var(--wp--preset--color--bg-weak);
	}
}

.wp-block-read-more.cecyber-read-more--link {
	padding: var(--wp--preset--spacing--20) 0 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;

	&::after {
		width: 1rem;
		height: 1rem;
		mask-image: url(../icons/arrow-right.svg);
	}

	&:hover {
		background: none;
		color: var(--wp--preset--color--primary-dark);
		text-decoration: underline;
	}
}

.cecyber-card-featured__content > .cecyber-read-more {
	margin-top: var(--wp--preset--spacing--50);
}

/* Destaques: the section only shows when there are sticky posts. */
.cecyber-blog-featured:not(:has(.wp-block-post)) {
	display: none;
}

/*
 * card-blog (cards-blog in the Figma): image with the lime arrow, type and
 * reading time.
 */
.wp-block-group.cecyber-card-blog {
	height: 100%;
}

.cecyber-card-blog__image {
	overflow: hidden;
	margin: 0;
	border-radius: 0.5rem;
	background: var(--wp--preset--color--primary-darker);

	a {
		position: relative;
		display: block;

		&::before,
		&::after {
			content: "";
			position: absolute;
			top: 50%;
			left: 50%;
			translate: -50% -50%;
			transition: scale 0.2s;
		}

		&::before {
			width: 5rem;
			height: 5rem;
			border-radius: 50%;
			background: var(--wp--preset--color--accent-lime);
			box-shadow: 0 0 0 0.25rem rgb(255 255 255 / 32%), 0 0 0 calc(0.25rem + 1px) rgb(255 255 255 / 19%);
		}

		&::after {
			width: 3rem;
			height: 3rem;
			background: var(--wp--preset--color--text-main);
			mask: url(../icons/arrow-up-right.svg) no-repeat center / contain;
		}

		&:hover::before,
		&:hover::after {
			scale: 1.08;
		}
	}

	img {
		display: block;
		width: 100%;
		height: 16.25rem;
		object-fit: cover;
	}
}

/* Without the lime arrow over the image (home "Nossos artigos"). */
.cecyber-card-blog__image.cecyber-card-blog__image--plain a {

	&::before,
	&::after {
		content: none;
	}
}

.cecyber-card-blog__type {
	display: flex;
	gap: var(--wp--preset--spacing--10);
	align-items: center;
	opacity: 0.8;
	text-transform: uppercase;

	&::before {
		content: "";
		flex: none;
		width: 1.25rem;
		height: 1.25rem;
		background: currentcolor;
		mask: url(../icons/document.svg) no-repeat center / contain;
	}
}

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

/* Page numbers under the blog grid ("1 2 … 23"). */
.cecyber-blog-grid .wp-block-query-pagination {
	margin-top: var(--wp--preset--spacing--60);
	color: var(--wp--preset--color--text-sub);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	letter-spacing: 0.1em;

	.page-numbers {
		padding: var(--wp--preset--spacing--10);
		color: inherit;
		text-decoration: none;
	}

	.page-numbers.current {
		color: var(--wp--preset--color--primary);
		font-weight: 700;
	}

	a.page-numbers:hover {
		color: var(--wp--preset--color--primary);
	}
}

/* Hero of the blog listing: subtitle under the title. */
.cecyber-page-hero__text > * {
	max-width: 43.5rem;
}

/* Hero of the article: text beside the featured image. */
.cecyber-article-hero__title {
	margin: 0;
	letter-spacing: -0.03em;
}

.cecyber-article-hero .cecyber-tag.has-background {
	line-height: 1.25;
}

.cecyber-article-hero__label,
.wp-block-post-author__byline {
	margin: 0;
	color: var(--wp--preset--color--primary-lighter);
	font-size: 0.625rem;
	text-transform: uppercase;
}

.cecyber-article-hero__value,
.wp-block-post-author__name {
	margin: 0;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
}

.cecyber-article-hero__author {
	gap: var(--wp--preset--spacing--60);
	align-items: center;

	.wp-block-post-author__avatar {
		margin: 0;
	}

	.avatar {
		display: block;
		width: 2.875rem;
		height: 2.875rem;
		border-radius: 50%;
		background: rgb(255 255 255 / 15%);
	}

	.wp-block-post-author__content {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}
}

.cecyber-article-hero__image {
	overflow: hidden;
	margin: 0;
	border: 1px solid rgb(255 255 255 / 20%);
	border-radius: 1rem;
	background: var(--wp--preset--color--primary-dark);

	img {
		display: block;
		width: 100%;
	}
}

@media (max-width: 63.9375em) {

	.wp-block-group.cecyber-article-hero__columns {
		flex-direction: column;
		align-items: stretch;
	}
}

@media (min-width: 64em) {

	.cecyber-article-hero {
		min-height: 35rem;
	}

	.cecyber-article-hero__text {
		flex: 0 1 37rem;
	}

	.wp-block-group.cecyber-article-hero__columns > .cecyber-article-hero__image {
		flex: 0 1 35rem;
	}
}

/* Article: index, text and share buttons. */
.cecyber-article {
	display: grid;
	gap: var(--wp--preset--spacing--40);
	align-items: start;
}

.cecyber-article__content {
	min-width: 0;
	color: var(--wp--preset--color--text-sub);
	line-height: 1.7;

	> h2 {
		font-size: var(--wp--preset--font-size--xxxx-large);
		line-height: 1.3;
	}

	> h3 {
		font-size: var(--wp--preset--font-size--xx-large);
		line-height: 1.3;
	}

	> :is(h2, h3) {
		scroll-margin-top: var(--wp--preset--spacing--60);
	}

	.wp-block-image img {
		border-radius: 1rem;
	}

	.wp-block-image figcaption {
		margin-top: var(--wp--preset--spacing--20);
		color: var(--wp--preset--color--text-soft);
		font-size: var(--wp--preset--font-size--small);
		text-align: center;
	}
}

.cecyber-article-index {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--10);
	padding: var(--wp--preset--spacing--50);
	border: 1px solid var(--wp--preset--color--bg-soft);
	border-radius: 1rem;
	background: var(--wp--preset--color--bg-weak);
}

.cecyber-article-index__header {
	display: flex;
	gap: var(--wp--preset--spacing--30);
	align-items: center;
	padding-bottom: var(--wp--preset--spacing--30);
}

.cecyber-article-index__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--large);
	font-weight: 600;
	line-height: 1.3;
}

.cecyber-article-index__list {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--10);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cecyber-article-index__link {
	display: block;
	padding: 0.625rem var(--wp--preset--spacing--30);
	border-radius: 0.5rem;
	color: var(--wp--preset--color--text-sub);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	text-decoration: none;

	&:hover {
		color: var(--wp--preset--color--primary-dark);
	}

	&[aria-current="true"] {
		background: var(--wp--preset--color--bg-surface);
		color: var(--wp--preset--color--primary-dark);
		font-weight: 700;
	}
}

.cecyber-article-share {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
	align-items: center;
}

.cecyber-article-share__label {
	color: var(--wp--preset--color--text-soft);
	font-size: 0.625rem;
	line-height: 1.5;
	text-transform: uppercase;
}

.cecyber-article-share__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border-sub);
	border-radius: 50%;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--text-main);
	cursor: pointer;

	.cecyber-icon {
		width: 1.125rem;
		height: 1.125rem;
	}

	&:hover {
		border-color: var(--wp--preset--color--primary);
		color: var(--wp--preset--color--primary);
	}
}

@media (min-width: 64em) {

	.cecyber-article {
		grid-template-columns: 17.5rem minmax(0, 1fr) auto;
		gap: var(--wp--preset--spacing--70);
	}

	.cecyber-article > :is(.cecyber-article-index, .cecyber-article-share) {
		position: sticky;
		top: var(--wp--preset--spacing--60);
	}

	.cecyber-article-index {
		grid-column: 1;
	}

	.cecyber-article__content {
		grid-column: 2;
	}

	.cecyber-article-share {
		grid-column: 3;
	}

	.cecyber-article-index__title {
		font-size: var(--wp--preset--font-size--x-large);
	}
}

/* Course call to action inside the article (card-cta-course). */
.cecyber-cta-course .cecyber-button-circle .wp-block-button__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 3.5rem;
	height: 3.5rem;
	padding: 0;
	overflow: hidden;
	border-color: var(--wp--preset--color--border-sub);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--text-main);
	font-size: 0;

	&::before {
		content: "";
		width: 1.25rem;
		height: 1.25rem;
		background: currentcolor;
		mask: url(../icons/arrow-right.svg) no-repeat center / contain;
	}

	&:hover {
		border-color: var(--wp--preset--color--primary);
		background: var(--wp--preset--color--white);
		color: var(--wp--preset--color--primary);
	}
}
