/*
 * WittySprout — блог „The Witty Sprout Journal“ (от 0.13.0).
 *
 * Зарежда се само на страницата на блога, в статиите, в категориите и в
 * редактора на статии (виж inc/journal.php).
 *
 * Цветовете са взети от визуализациите на Илияна — по нейно желание блогът
 * следва тях, а не Brand Book-а. Сменят се само тук, в първия блок.
 *
 * 1. Токени
 * 2. Декорации (лъчи)
 * 3. Навигационен път
 * 4. Страницата на блога
 * 5. Карта на статия
 * 6. Статия — горна част и подредба
 * 7. Меню „In this article“
 * 8. Текстът на статията (важи и в редактора)
 * 9. Таблет и телефон
 */

/* =========================================================================
   1. Токени
   ====================================================================== */

:root {
	--wsj-ink: #0B3519;      /* заглавия */
	--wsj-text: #1E1E1E;     /* текст */
	--wsj-pill: #F2F3D3;     /* етикет с категорията */
	--wsj-toc: #F7F7E1;      /* кутията „In this article“ */
	--wsj-line: #B4BC86;     /* пунктирът между колоните и над източниците */
	--wsj-sticky: 120px;     /* под залепналия header */
}

/* =========================================================================
   2. Декорации — лъчите от визуализациите
   ====================================================================== */

/* Жълти лъчи горе вдясно от заглавие */
.ws-rays-gold {
	position: relative;
	display: inline-block;
}

.ws-rays-gold::after {
	content: "";
	position: absolute;
	top: -0.42em;
	right: -1.15em;
	width: 0.8em;
	height: 1.05em;
	background: url("../img/journal/rays-gold.webp") center / contain no-repeat;
	pointer-events: none;
}

/* journal.js мери края на първия ред и слага лъчите там */
.ws-rays-gold.is-placed::after {
	right: auto;
	left: var(--wsj-ray-x);
}

/* Светлозелени лъчи вляво — етикет, заглавие на колона, H2, цитат */
.ws-rays-lime,
:is(.ws-article__body, .editor-styles-wrapper) :is(h2, .wp-block-quote) {
	position: relative;
}

.ws-rays-lime::before,
:is(.ws-article__body, .editor-styles-wrapper) :is(h2, .wp-block-quote)::before {
	content: "";
	position: absolute;
	left: -1.5em;
	top: -0.4em;
	width: 1.05em;
	height: 1.35em;
	background: url("../img/journal/rays-lime.webp") center / contain no-repeat;
	transform: scaleX(-1);
	pointer-events: none;
}

/* =========================================================================
   3. Навигационен път
   ====================================================================== */

.ws-crumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em;
	margin: 0;
	padding: 1.4rem 0 0;
	list-style: none;
	font-size: 0.93rem;
	color: var(--wsj-text);
}

.ws-crumbs li {
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.ws-crumbs li + li::before {
	content: "›";
	font-size: 1.15em;
	line-height: 1;
}

.ws-crumbs a {
	color: inherit;
	text-decoration: none;
}

.ws-crumbs a:hover {
	color: var(--wsj-ink);
	text-decoration: underline;
}

.ws-crumbs__home {
	display: inline-flex;
}

/* =========================================================================
   4. Страницата на блога
   ====================================================================== */

.ws-journal,
.ws-article {
	overflow-x: clip; /* декорациите не бива да дават хоризонтален скрол */
}

.ws-journal {
	color: var(--wsj-text);
	padding-bottom: var(--ws-space);
}

.ws-journal__head {
	position: relative;
	text-align: center;
	padding-block: clamp(2.25rem, 5vw, 3.5rem) clamp(1.75rem, 4vw, 3rem);
}

.ws-journal__eyebrow {
	font-family: var(--ws-font-display);
	font-weight: 800;
	font-size: 0.98rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wsj-ink);
}

.ws-journal__title {
	margin: 0.3em 0 0.45em;
	font-size: clamp(2rem, 4.2vw, 3.1rem);
	color: var(--wsj-ink);
}

.ws-journal__text {
	max-width: 36em;
	margin-inline: auto;
	font-size: 1.12rem;
	line-height: 1.55;
}

.ws-journal__deco {
	position: absolute;
	height: auto;
	pointer-events: none;
}

.ws-journal__deco--a {
	left: 11%;
	top: 1.6rem;
	width: 34px;
}

.ws-journal__deco--b {
	right: 9%;
	top: 62%;
	width: 36px;
}

/* Колоните — по категория, с пунктир между тях */
.ws-journal__cols {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	row-gap: clamp(2rem, 5vw, 3rem);
	padding-bottom: 3rem;
}

.ws-journal__col {
	min-width: 0;
}

.ws-journal__coltitle {
	margin: 0 0 1.5rem 1.55em;
	font-size: clamp(1.55rem, 2.6vw, 2rem);
	color: var(--wsj-ink);
}

.ws-journal__list {
	display: grid;
	gap: clamp(1.25rem, 2.5vw, 1.75rem);
}

.ws-journal__more {
	margin-top: 1.5rem;
	font-weight: 700;
}

.ws-journal__more a {
	color: var(--wsj-ink);
}

.ws-journal__trail {
	display: none;
}

@media (min-width: 860px) {
	.ws-journal__cols {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ws-journal__cols.is-single {
		grid-template-columns: minmax(0, 640px);
		justify-content: center;
	}

	.ws-journal__col:nth-child(odd) {
		padding-right: clamp(24px, 4vw, 56px);
	}

	.ws-journal__col:nth-child(even) {
		padding-left: clamp(24px, 4vw, 56px);
		background: linear-gradient(var(--wsj-line) 55%, transparent 0) left top / 2px 11px repeat-y;
	}

	.ws-journal__cols:not(.is-single) .ws-journal__trail {
		display: block;
		position: absolute;
		left: 50%;
		bottom: 0;
		width: 110px;
		height: auto;
		transform: translateX(-12px);
		pointer-events: none;
	}
}

/* Категория — картите в мрежа */
.ws-journal--category .ws-journal__head {
	padding-top: clamp(1.25rem, 3vw, 2rem);
}

.ws-journal__list--grid {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr));
	column-gap: clamp(24px, 4vw, 56px);
}

/* =========================================================================
   5. Карта на статия
   ====================================================================== */

.ws-jcard {
	display: grid;
	grid-template-columns: clamp(108px, 31%, 180px) minmax(0, 1fr);
	align-items: center;
	gap: clamp(14px, 2.2vw, 26px);
}

.ws-jcard__media {
	display: block;
}

.ws-jcard__media img {
	width: 100%;
	height: auto;
	border-radius: 18px;
	transition: transform .25s ease;
}

.ws-jcard:hover .ws-jcard__media img {
	transform: scale(1.03);
}

.ws-jcard__placeholder {
	display: grid;
	place-items: center;
	aspect-ratio: 3 / 2;
	border-radius: 48% 52% 45% 55% / 55% 45% 55% 45%;
	background: var(--wsj-toc);
}

.ws-jcard__placeholder img {
	width: 48px;
}

.ws-jcard__title {
	font-size: clamp(1.05rem, 1.55vw, 1.2rem);
	line-height: 1.25;
	text-wrap: pretty;
}

.ws-jcard__title a {
	color: var(--wsj-ink);
	text-decoration: none;
}

.ws-jcard__title a:hover {
	text-decoration: underline;
}

.ws-jcard__excerpt {
	margin-top: 0.45em;
	font-size: 0.98rem;
	line-height: 1.5;
	color: var(--wsj-text);
}

/* =========================================================================
   6. Статия — горна част и подредба
   ====================================================================== */

.ws-article {
	color: var(--wsj-text);
	padding-bottom: var(--ws-space);
}

.ws-article__shell {
	max-width: 1120px;
}

.ws-article__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas:
		"head"
		"hero"
		"toc"
		"body";
	padding-top: clamp(1.5rem, 3vw, 2.25rem);
}

.ws-article__head {
	grid-area: head;
	min-width: 0;
}

.ws-article__hero {
	grid-area: hero;
	margin: clamp(1rem, 2vw, 1.5rem) 0 clamp(1.25rem, 2.5vw, 1.75rem);
}

.ws-toc {
	grid-area: toc;
}

.ws-article__body {
	grid-area: body;
	min-width: 0;
}

.ws-article__pill {
	display: inline-block;
	margin-left: 1.55rem;
	padding: 0.3em 1em;
	border-radius: 999px;
	background: var(--wsj-pill);
	color: var(--wsj-ink);
	font-family: var(--ws-font-display);
	font-weight: 700;
	font-size: 0.98rem;
	text-decoration: none;
}

.ws-article__pill:hover {
	color: var(--wsj-ink);
	text-decoration: underline;
}

.ws-article__pill.ws-rays-lime::before {
	left: -1.45em;
}

.ws-article__title {
	margin: 0.45em 0 0.4em;
	font-size: clamp(1.9rem, 3.5vw, 2.7rem);
	line-height: 1.12;
	color: var(--wsj-ink);
}

.ws-article__lead {
	font-size: clamp(1.08rem, 1.5vw, 1.22rem);
	line-height: 1.5;
}

.ws-article__hero img {
	width: 100%;
	max-width: 640px;
	height: auto;
	border-radius: 24px;
}

@media (min-width: 960px) {
	.ws-article__grid.has-toc {
		grid-template-columns: minmax(0, 1fr) 290px;
		grid-template-areas:
			"head ."
			"hero toc"
			"body toc";
		column-gap: clamp(32px, 5vw, 72px);
	}

	.ws-toc {
		align-self: start;
		position: sticky;
		top: var(--wsj-sticky);
		margin-top: clamp(1rem, 2vw, 1.5rem);
	}
}

/* =========================================================================
   7. Меню „In this article“
   ====================================================================== */

.ws-toc__box {
	padding: 1.5rem 1.6rem 1.35rem;
	border-radius: 28px;
	background: var(--wsj-toc);
}

.ws-toc__title {
	position: relative;
	display: inline-block;
	margin-bottom: 0.8rem;
	font-family: var(--ws-font-display);
	font-weight: 800;
	font-size: 1.5rem;
	line-height: 1.2;
	color: var(--wsj-ink);
}

.ws-toc__title::after {
	content: "";
	position: absolute;
	top: -0.45em;
	right: -1.25em;
	width: 0.85em;
	height: 1.05em;
	background: url("../img/journal/rays-glossy.webp") center / contain no-repeat;
}

.ws-toc__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ws-toc__list li,
:is(.ws-article__body, .editor-styles-wrapper) ul:not([class*="wp-block-social"]) > li {
	position: relative;
	padding-left: 2.1em;
	background: url("../img/journal/leaf-bullet.webp") left 0.32em / 1.35em auto no-repeat;
}

.ws-toc__list li + li {
	margin-top: 0.6em;
}

.ws-toc__list a {
	display: block;
	color: var(--wsj-text);
	line-height: 1.35;
	text-decoration: none;
}

.ws-toc__list a:hover,
.ws-toc__list a:focus-visible {
	color: var(--wsj-ink);
	text-decoration: underline;
}

/* =========================================================================
   8. Текстът на статията (важи и в редактора)
   ====================================================================== */

.ws-article__body {
	font-size: 1.06rem;
	line-height: 1.65;
}

.ws-article__body > * + * {
	margin-top: 0.9em;
}

:is(.ws-article__body, .editor-styles-wrapper) h2 {
	margin-top: 1.9em;
	margin-bottom: 0.15em;
	font-size: clamp(1.45rem, 2.4vw, 1.75rem);
	color: var(--wsj-ink);
	scroll-margin-top: calc(var(--wsj-sticky) + 8px);
}

:is(.ws-article__body, .editor-styles-wrapper) h3 {
	margin-top: 1.5em;
	margin-bottom: 0.1em;
	font-size: clamp(1.15rem, 1.8vw, 1.28rem);
	color: var(--wsj-ink);
}

:is(.ws-article__body, .editor-styles-wrapper) strong {
	color: var(--wsj-ink);
}

/* Цитат — „Look! A butterfly!“ */
:is(.ws-article__body, .editor-styles-wrapper) .wp-block-quote {
	margin: 1.4em 0;
	padding: 0;
	border: 0;
	background: none;
	font-style: normal;
}

:is(.ws-article__body, .editor-styles-wrapper) .wp-block-quote p {
	font-family: var(--ws-font-display);
	font-style: italic;
	font-weight: 800;
	font-size: clamp(1.25rem, 2vw, 1.45rem);
	line-height: 1.3;
	color: var(--wsj-ink);
}

:is(.ws-article__body, .editor-styles-wrapper) .wp-block-quote cite {
	display: block;
	margin-top: 0.4em;
	font-size: 0.9rem;
	font-style: normal;
	color: var(--wsj-text);
}

/* Списъци — листенца вместо точки */
:is(.ws-article__body, .editor-styles-wrapper) ul:not([class*="wp-block-social"]) {
	padding-left: 0;
	list-style: none;
}

:is(.ws-article__body, .editor-styles-wrapper) ul:not([class*="wp-block-social"]) > li + li {
	margin-top: 0.55em;
}

:is(.ws-article__body, .editor-styles-wrapper) ol {
	padding-left: 1.4em;
}

.ws-article__body a {
	color: var(--ws-green-action);
}

.ws-article__body img {
	border-radius: 18px;
}

/* Източници — Group със стил „Блог — източници“ */
.is-style-wsj-sources {
	margin-top: 2.6em !important;
	padding-top: 1.4em;
	background: linear-gradient(90deg, var(--wsj-line) 55%, transparent 0) left top / 11px 2px repeat-x;
	font-size: 0.9rem;
	line-height: 1.55;
	color: #444;
}

.is-style-wsj-sources > * + * {
	margin-top: 0.7em;
}

.is-style-wsj-sources h3,
.is-style-wsj-sources h2 {
	margin-top: 0;
	font-size: 1.05rem;
	color: var(--wsj-ink);
}

:is(.ws-article__body, .editor-styles-wrapper) .is-style-wsj-sources h2::before {
	content: none;
}

.is-style-wsj-sources a {
	overflow-wrap: anywhere;
}

/* =========================================================================
   9. Таблет и телефон — лъчите влизат навътре, за да не излизат от екрана
   ====================================================================== */

/* Под 1200 px полето вляво е тясно — лъчите на H2 и цитата влизат навътре */
@media (max-width: 1199px) {
	.ws-article__body :is(h2, .wp-block-quote) {
		padding-left: 1.45em;
	}

	:is(.ws-article__body, .editor-styles-wrapper) :is(h2, .wp-block-quote)::before {
		left: 0;
	}

	.ws-article__body .is-style-wsj-sources h2 {
		padding-left: 0;
	}
}

@media (max-width: 700px) {
	.ws-journal__head {
		padding-top: 3rem;
	}

	.ws-journal__deco--a {
		left: 4%;
		top: 0.75rem;
		width: 24px;
	}

	.ws-journal__deco--b {
		right: 4%;
		top: 0.75rem;
		width: 24px;
	}

}

@media (max-width: 959px) {
	.ws-toc {
		margin-bottom: 1.75rem;
	}
}
