/*
 * Single posts: heads (section tint or neutral), metadata, step index, quick facts,
 * archive notice and sidebar, related posts and read-only comments.
 */

/* Head */
.single-head {
	padding-block: 14px 40px;
}

.single-head--section {
	background: var(--section-tint, var(--cm-tint-neutral));
}

.single-head--neutral {
	background: var(--cm-tint-neutral);
	border-bottom: 1px solid var(--cm-line);
}

.single-head__row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px 48px;
}

.single-head__text {
	flex: 1 1 560px;
	max-width: 760px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: 22px;
}

.single-head__tags {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
}

.single-head__tags a {
	display: inline-flex;
	align-items: center;
	min-height: 24px; /* WCAG 2.5.8: target of at least 24 px */
}

.tag-archive {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 6px;
	background: var(--cm-green);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

.tag-archive:hover {
	color: #fff;
	box-shadow: inset 0 0 0 2px var(--cm-focus-on-dark);
}

.single-head__title {
	margin: 0;
	font-size: clamp(2rem, 3.4vw, 2.75rem);
	line-height: 1.12;
	text-wrap: balance;
}

.single-head__dek {
	max-width: 36em;
	margin: 0;
	font-size: 1.1875rem;
	line-height: 1.55;
	color: var(--cm-muted-strong);
	text-wrap: pretty;
}

.single-head__byline {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
}

.meta {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 32px;
	margin: 6px 0 0;
	font-size: var(--wp--preset--font-size--small);
}

.meta dt {
	color: var(--cm-muted-strong);
}

.meta dd {
	margin: 0;
	font-weight: 600;
}

/* Decorative small packet, only from 700 px up */
.deco-packet {
	display: none;
}

@media (min-width: 700px) {
	.deco-packet {
		display: block;
		position: relative;
		flex: 0 0 auto;
		width: 150px;
		padding-top: 14px;
		transform: rotate(2deg);
	}
}

.deco-packet__clip {
	position: absolute;
	z-index: 2;
	top: 0;
	left: 50%;
	width: 30px;
	height: 22px;
	margin-left: -15px;
	border-radius: 3px;
	background: linear-gradient(#e6cb86, #a8823a);
	box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
}

.deco-packet__body {
	display: flex;
	flex-direction: column;
	filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.25));
}

.deco-packet__edge {
	display: block;
	height: 10px;
	background: var(--section-color, #ccc);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Cpath d='M0 10L5 1L10 10z'/%3E%3C/svg%3E") repeat-x 0 0 / 10px 10px;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Cpath d='M0 10L5 1L10 10z'/%3E%3C/svg%3E") repeat-x 0 0 / 10px 10px;
}

.deco-packet__art {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 120px;
	background-color: var(--section-color, #ccc);
	background-image: radial-gradient(rgba(36, 31, 28, 0.12) 1px, transparent 1.3px);
	background-size: 7px 7px;
}

.deco-packet__art .illus {
	width: 88px;
	height: 88px;
}

.deco-packet__name {
	padding: 8px 10px 10px;
	border-radius: 0 0 3px 3px;
	background: #fff;
	font-family: var(--cm-serif);
	font-size: 0.9375rem;
	line-height: 1.2;
}

/* Featured image */
.single__figure {
	margin: 0;
	overflow: hidden;
	border-radius: 0 0 10px 10px;
	background: var(--cm-tint-neutral);
}

.single__figure img {
	display: block;
	width: 100%;
	max-height: 420px;
	object-fit: cover;
}

.single__figure figcaption {
	padding: 8px 4px 0;
	font-size: 0.8125rem;
	color: var(--cm-muted);
}

/* Body: index and facts on the left (above the text on small screens), text at 700 px */
.single__body {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 32px 64px;
	padding-block: 36px 56px;
}

.single__aside {
	flex: 1 1 260px;
	max-width: 320px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.single__main {
	flex: 999 1 560px;
	min-width: 0;
	max-width: var(--wp--style--global--content-size, 700px);
}

@media (min-width: 900px) {
	.single__body {
		padding-block: 48px 64px;
	}

	.single__aside {
		position: sticky;
		top: 24px;
	}
}

@media (max-width: 899px) {
	.single__aside {
		flex-basis: 100%;
		max-width: none;
	}
}

/* Step index */
.toc {
	padding-top: 14px;
	border-top: 2px solid var(--cm-ink);
}

.toc__title {
	margin: 0 0 8px;
	font-family: var(--cm-sans);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: 1.3;
}

.toc__list {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
	counter-reset: step;
}

.toc__list li {
	counter-increment: step;
}

.toc__list a {
	display: grid;
	grid-template-columns: 26px minmax(0, 1fr);
	align-items: center;
	min-height: 44px;
	padding-block: 4px;
	text-decoration: none;
}

.toc--steps .toc__list a::before {
	content: counter(step);
	color: var(--cm-muted);
	font-variant-numeric: tabular-nums;
}

.toc:not(.toc--steps) .toc__list a {
	grid-template-columns: minmax(0, 1fr);
}

.toc__list a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Quick facts, shaped like a tag */
.facts {
	position: relative;
	padding: 34px 22px 66px;
	background: var(--cm-sage);
	clip-path: polygon(0 0, 100% 0, 100% 86%, 50% 100%, 0 86%);
}

.facts__hole {
	position: absolute;
	top: 12px;
	left: 50%;
	width: 12px;
	height: 12px;
	margin-left: -6px;
	border: 2px solid var(--cm-field-line);
	border-radius: 50%;
	background: #fff;
}

.facts__title {
	margin: 0 0 12px;
	font-size: 1.3125rem;
	text-align: center;
}

.facts__list {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 6px 14px;
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
}

.facts__list dt {
	color: var(--cm-muted-strong);
}

.facts__list dd {
	margin: 0;
	font-weight: 600;
}

/* Guide text: the first steps are not numbers in the text; editors write them if the guide is a sequence */
.entry-content--guide > :first-child {
	margin-top: 0;
}

.single-foot {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 32px;
	margin-top: 36px;
	padding-top: 20px;
	border-top: 1px solid var(--cm-line);
	font-size: var(--wp--preset--font-size--small);
	color: var(--cm-muted-strong);
}

/* Archive: notice, then text and sidebar */
.single__body--archive {
	padding-block: 36px 56px;
}

.single__side {
	flex: 1 1 260px;
	max-width: 340px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.age-notice {
	display: grid;
	grid-template-columns: 36px minmax(0, 1fr);
	gap: 4px 14px;
	margin: 0 0 32px;
	padding: 18px 20px;
	border-radius: 10px;
	background: var(--wp--preset--color--tint-start);
}

.age-notice__icon {
	grid-row: span 2;
}

.age-notice__title {
	font-size: 1.0625rem;
}

.age-notice__text p {
	margin: 0;
	font-size: 1rem;
	line-height: 1.5;
}

.age-notice__text p + p {
	margin-top: 8px;
	font-weight: 600;
}

.about-archive {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	padding: 24px;
	border-radius: 10px;
	background: var(--cm-green);
	color: #fff;
}

.about-archive :focus-visible {
	outline-color: var(--cm-focus-on-dark);
}

.about-archive__title {
	margin: 0;
	font-size: 1.3125rem;
}

.about-archive p {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: #d6e5da;
}

.about-archive__sections {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.about-archive__sections a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 16px;
	border-radius: 8px;
	background: var(--wp--preset--color--mustard);
	color: var(--cm-ink);
	font-weight: 700;
	text-decoration: none;
}

.about-archive__sections a:hover {
	background: #fff;
	color: var(--cm-ink);
}

.more-side {
	padding-top: 14px;
	border-top: 2px solid var(--cm-ink);
}

.more-side__title {
	margin: 0 0 8px;
	font-family: var(--cm-sans);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	line-height: 1.3;
}

.more-side__list {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
}

.more-side__list a {
	display: block;
	padding: 10px 0;
	border-bottom: 1px solid var(--cm-line);
	text-decoration: none;
}

.more-side__list a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.more-side__list span {
	display: block;
	font-size: 0.8125rem;
	color: var(--cm-muted);
}

@media (max-width: 899px) {
	.single__side {
		flex-basis: 100%;
		max-width: none;
	}
}

/* More in the section */
.more {
	background: var(--cm-tint-neutral);
}

.more > .container {
	padding-block: 48px 56px;
}

.more__title {
	margin: 0 0 18px;
	font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);
}

.more__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.more__card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	height: 100%;
	padding: 20px;
	border-radius: 10px;
	background: #fff;
	text-decoration: none;
}

.more__card:hover .more__name {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.more__type {
	font-size: 0.8125rem;
	color: var(--cm-muted);
}

.more__name {
	font-family: var(--cm-serif);
	font-size: 1.25rem;
	line-height: 1.25;
}

/* Read-only comments */
.comments {
	margin-top: 48px;
}

.comments__title {
	margin: 0 0 6px;
	font-size: 1.5rem;
}

.comments__note {
	margin: 0 0 18px;
	font-size: var(--wp--preset--font-size--small);
	color: var(--cm-muted);
}

.comments__list,
.comments__list .children {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 1rem;
}

.comments__list .children {
	margin-top: 14px;
	padding-left: clamp(12px, 4vw, 32px);
}

.comment {
	padding: 16px 18px;
	border-radius: 10px;
	background: #f7f4f0;
	overflow-wrap: anywhere;
}

.comment .children .comment {
	background: #fff;
	box-shadow: inset 0 0 0 1px var(--cm-line);
}

.comment__meta {
	margin: 0 0 6px;
	font-size: var(--wp--preset--font-size--small);
	color: var(--cm-muted);
}

.comment__author {
	color: var(--cm-ink);
}

.comment__text > :last-child {
	margin-bottom: 0;
}

.comment__text p {
	margin: 0 0 0.8em;
}

.comments__pages {
	margin-top: 24px;
}

.comments__pages .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	margin: 0 4px 4px 0;
	padding: 0 14px;
	border: 1px solid var(--cm-field-line);
	border-radius: 8px;
	color: var(--cm-ink);
	font-weight: 600;
	text-decoration: none;
}

.comments__pages a.page-numbers:hover {
	background: var(--cm-tint-neutral);
}

.comments__pages .page-numbers.current {
	background: var(--cm-ink);
	border-color: var(--cm-ink);
	color: #fff;
}

.comments__pages .page-numbers.dots {
	border-color: transparent;
}

/* Ad slot (inactive, inc/ads.php): the height is reserved inline per position, so no layout shift */
.ad-slot {
	margin-block: 32px;
}

.ad-slot__label {
	margin: 0 0 8px;
	color: var(--cm-muted);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}
