/*
Research masthead: a short statement on a solid Porcelain panel with the orange rule, like the other pages' intros (intro.css),
and the journal's busiest topics as grained index tabs (counts come from the articles' tags; see
internal.CountTopics). The last tab opens a list of every topic.
*/
.journal__masthead {
	display: flex;
	flex-direction: column;
	gap: 2rem;
	margin-bottom: 4rem;
}

.journal__statement {
	max-width: 39.75rem; /* The same width as the other pages' intros (intro.css). */
	padding: 1.25rem 1.25rem 1.5rem;
	border-left: 0.3rem solid var(--color-spicy-orange);
	background-color: var(--color-porcelain);

	p {
		margin: 0;
	}

	/* The panel is the background; a band per line would overlap the line above and clip it (see intro.css). */
	.highlight {
		background-color: transparent;
	}
}

.journal__lead {
	margin: 0 0 0.4em; /* The page's h1. */
	font-family: "Oswald", "Oswald Fallback", sans-serif;
	font-size: clamp(1.9rem, 5vw, 2.75rem);
	font-weight: 700;
	line-height: 1.2;
	text-transform: none; /* Sentence case, as written, rather than the site's all-caps headings. */
}

.journal__text {
	font-size: clamp(1.15rem, 3vw, 1.6rem);
	line-height: 1.5;
}

/* Topic tabs, like the header's index tabs: grained, in the menu's four colours in turn, count above name. */
.journal__topics {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 6px;
}

.journal__topic {
	--topic-color: var(--color-spicy-orange--darker);

	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 2px;
	box-sizing: border-box;
	width: 8.25rem;
	height: 5.1rem;
	padding: 0 0.65rem 0.65rem;
	background-color: var(--topic-color);
	background-image: url("/assets/images/noise.svg");
	background-repeat: repeat;
	color: var(--color-porcelain);
	font-family: "Oswald", "Oswald Fallback", sans-serif;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.2s ease;

	b {
		font-size: 1.9rem;
		font-weight: 700;
		line-height: 1;
	}

	span {
		font-size: 1rem;
		font-weight: 500;
		letter-spacing: 0.03em;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	&:hover,
	&:focus-visible {
		filter: brightness(1.2);
	}
}

/* No link underline on the tabs (links.css underlines every other link; this is more specific). */
.journal__topics .journal__topic {
	text-decoration: none;
}

.journal__topic:nth-of-type(4n + 2) {
	--topic-color: var(--color-spicy-black);
}

.journal__topic:nth-of-type(4n + 3) {
	--topic-color: var(--color-blueprint);
}

.journal__topic:nth-of-type(4n + 4) {
	--topic-color: var(--color-pine-teal);
}

/* "All topics": a dashed outline tab that opens the full list below the row. */
.journal__topic--all {
	border: 2px dashed var(--color-spicy-black);
	background-color: var(--color-porcelain);
	background-image: none;
	color: var(--color-spicy-black);
	list-style: none;

	&::-webkit-details-marker {
		display: none;
	}
}

.journal__all[open] .journal__topic--all {
	border-style: solid;
}

.journal__all-list {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 6px);
	z-index: 3;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	max-width: none !important;
	margin: 0;
	padding: 1.1rem 1.25rem;
	border: 3px solid var(--color-spicy-black);
	background-color: var(--color-porcelain);
	font-size: 1.05rem;

	/* At least 24px each way, the WCAG 2.2 minimum target, even for a two-letter topic like "ai". */
	a {
		display: inline-block;
		min-width: 24px;
		min-height: 24px;
	}

	small {
		font-family: "Oswald", "Oswald Fallback", sans-serif;
		color: var(--color-spicy-orange--darker);
	}
}

/* Phones: three tabs to a row; the All topics tab's wrapper takes a third too. */
@media (max-width: 559px) {
	.journal__topics > .journal__topic,
	.journal__all {
		width: calc((100% - 12px) / 3); /* A third of the row, less the two gaps. */
	}

	.journal__topic {
		height: 4.4rem;

		b {
			font-size: 1.5rem;
		}

		span {
			font-size: 0.9rem;
		}
	}

	.journal__all .journal__topic {
		width: 100%;
	}
}

/* On the journal's own list the articles line up on the left under the masthead (they stay centered on article and topic pages). */
.journal article {
	margin-inline: 0;
}
