/*
 * Editorial layer: journal, documentation, search and generic page templates.
 *
 * landing.css covers the marketing vocabulary only. Everything the content
 * templates reference lives here, built from the same tokens.
 */

/* Page frame ------------------------------------------------------------- */

.tf-content-page {
	padding: 80px 0 100px;
}

.tf-content-hero {
	max-width: 760px;
	margin-bottom: 56px;
}

.tf-content-hero h1,
.tf-content-hero .wp-block-query-title {
	margin: 16px 0 20px;
	font-size: clamp(34px, 4.6vw, 52px);
	line-height: 1.05;
	letter-spacing: -0.02em;
}

.tf-content-hero-copy,
.tf-content-hero .wp-block-term-description {
	color: var(--tf-muted);
	font-size: 17px;
}

.tf-content-hero-copy p:last-child {
	margin-bottom: 0;
}

/* Card grid -------------------------------------------------------------- */

.tf-card-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 24px;
}

.tf-card-grid > li,
.tf-content-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--tf-border);
	border-radius: 14px;
	background: var(--tf-surface);
	box-shadow: var(--tf-shadow-sm);
	transition: border-color 140ms ease-out, box-shadow 140ms ease-out, transform 140ms ease-out;
}

.tf-card-grid > li:hover,
.tf-content-card:hover {
	transform: translateY(-2px);
	border-color: var(--tf-border-strong);
	box-shadow: var(--tf-shadow-md);
}

.tf-content-card-media,
.tf-card-grid .wp-block-post-featured-image {
	display: block;
	margin: 0;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--tf-inset);
}

.tf-content-card-media img,
.tf-card-grid .wp-block-post-featured-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tf-content-card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 12px;
	padding: 24px;
}

.tf-content-card-eyebrow {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	color: var(--tf-muted);
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 11.5px;
	font-weight: 600;
}

.tf-content-card-eyebrow a {
	color: inherit;
	text-decoration: none;
}

.tf-content-card-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.tf-content-card-title a {
	color: var(--tf-text);
	text-decoration: none;
}

.tf-content-card-title a:hover {
	color: var(--tf-accent-ink);
}

.tf-content-card-excerpt {
	margin: 0;
	color: var(--tf-text-2);
	font-size: 15px;
}

.tf-content-card-excerpt .wp-block-post-excerpt__more-link {
	display: none;
}

.tf-content-card-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 0;
	color: var(--tf-muted-2);
	font-size: 13px;
}

.tf-content-card-meta > * + *::before {
	content: "·";
	margin-right: 10px;
	color: var(--tf-border-strong);
}

.tf-content-card-link,
.wp-block-read-more.tf-content-card-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	align-self: flex-start;
	margin-top: auto;
	padding-top: 4px;
	color: var(--tf-accent-ink);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.tf-content-card-link .tf-btn-arrow {
	display: inline-grid;
	place-items: center;
}

/* Pagination ------------------------------------------------------------- */

.wp-block-query-pagination {
	margin-top: 48px;
	padding-top: 28px;
	border-top: 1px solid var(--tf-rule);
	font-size: 14px;
	font-weight: 600;
}

.wp-block-query-pagination a,
.wp-block-query-pagination .page-numbers {
	color: var(--tf-text-2);
	text-decoration: none;
}

.wp-block-query-pagination a:hover {
	color: var(--tf-text);
}

.wp-block-query-pagination .page-numbers.current {
	color: var(--tf-accent-ink);
}

/* Empty states ----------------------------------------------------------- */

.tf-content-empty {
	max-width: 620px;
	padding: 48px 32px;
	border: 1px dashed var(--tf-border-strong);
	border-radius: 16px;
	background: var(--tf-surface-alt);
	text-align: center;
	margin-inline: auto;
}

.tf-content-empty h1,
.tf-content-empty h2 {
	margin: 12px 0 10px;
}

.tf-content-empty p {
	color: var(--tf-muted);
}

.tf-content-search {
	margin-top: 24px;
}

.tf-content-search .wp-block-search__input {
	border: 1px solid var(--tf-border-strong);
	border-radius: 8px;
	padding: 10px 14px;
	background: var(--tf-surface);
	font-size: 15px;
}

.tf-content-search .wp-block-search__button {
	border: 1px solid var(--tf-text);
	border-radius: 8px;
	background: var(--tf-text);
	color: var(--tf-bg);
	font-size: 14px;
	font-weight: 600;
}

/* Single entry ----------------------------------------------------------- */

.tf-article-hero {
	max-width: 760px;
	margin-bottom: 48px;
}

.tf-article-hero h1,
.tf-article-hero .wp-block-post-title {
	margin: 18px 0 20px;
	font-size: clamp(34px, 4.6vw, 52px);
	line-height: 1.05;
	letter-spacing: -0.02em;
}

.tf-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	color: var(--tf-muted);
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 12px;
	font-weight: 600;
}

.tf-breadcrumb a {
	color: var(--tf-accent-ink);
	text-decoration: none;
}

.tf-article-excerpt {
	margin: 0 0 22px;
	color: var(--tf-text-2);
	font-size: 19px;
	line-height: 1.5;
}

.tf-article-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin: 0;
	color: var(--tf-muted);
	font-size: 14px;
}

.tf-article-meta > * {
	margin: 0;
}

.tf-article-meta > * + *::before {
	content: "·";
	margin-right: 10px;
	color: var(--tf-border-strong);
}

.tf-article-author {
	color: var(--tf-text-2);
	font-weight: 600;
}

/*
 * Core renders an empty modified date for entries that were never edited
 * after publishing, which would leave the "Updated" label dangling.
 */
.tf-doc-updated:not(:has(time)) {
	display: none;
}

.tf-article-layout {
	display: block;
}

.tf-article-layout-aside {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 260px;
	gap: 56px;
	align-items: start;
}

/* A document with no headings and no siblings gets its width back. */
.tf-article-layout-aside:has(> .tf-article-aside:not(:has(> *))) {
	grid-template-columns: minmax(0, 1fr);
}

.tf-article-aside:not(:has(> *)) {
	display: none;
}

.tf-article {
	max-width: 760px;
	min-width: 0;
}

.tf-content-page .tf-article {
	margin-inline: auto;
}

.tf-article-featured-image {
	margin: 0 0 32px;
}

.tf-article-featured-image img {
	width: 100%;
	height: auto;
	border-radius: 14px;
}

.tf-article-content {
	color: var(--tf-text-2);
	font-size: 17px;
	line-height: 1.7;
}

.tf-article-content > * + * {
	margin-top: 24px;
}

.tf-article-content h2 {
	margin-top: 48px;
	font-size: 28px;
	scroll-margin-top: 110px;
}

.tf-article-content h3 {
	margin-top: 36px;
	font-size: 21px;
	scroll-margin-top: 110px;
}

.tf-article-content a {
	color: var(--tf-accent-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tf-article-content img {
	border-radius: 12px;
}

/* Tables -----------------------------------------------------------------
 *
 * Documentation leans on tables for settings references, so they are styled
 * as data rather than as a decorative block: a quiet header row, ruled rows
 * and left-aligned text. Core's own table block gets the same treatment, so
 * hand-written HTML and an editor-inserted table look identical.
 */

.tf-table-scroll {
	overflow-x: auto;
	/* A scroll container is only reachable by keyboard if it can take focus. */
	scrollbar-width: thin;
}

.tf-table-scroll:focus-visible {
	outline: 2px solid var(--tf-accent-ink);
	outline-offset: 3px;
}

.tf-article-content table,
.tf-article-content .wp-block-table table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	/* Long settings names must not squeeze the explanation column to nothing. */
	table-layout: auto;
	font-size: 15px;
	line-height: 1.55;
}

.tf-article-content .wp-block-table {
	margin: 0;
}

.tf-article-content :is(th, td) {
	padding: 11px 16px;
	border: 0;
	border-bottom: 1px solid var(--tf-border);
	text-align: left;
	vertical-align: top;
	/*
	 * break-word, not anywhere: `anywhere` is allowed to break a word to reach a
	 * narrower intrinsic width, which crushes the first column and hyphenates
	 * labels like "Enable/Disable" mid-word even when there is room.
	 */
	overflow-wrap: break-word;
}

/* Keep the label column readable without letting it eat the explanation. */
.tf-article-content :is(th, td):first-child {
	min-width: 8rem;
}

.tf-article-content th {
	border-bottom: 1px solid var(--tf-border-strong);
	background: color-mix(in oklch, var(--tf-accent) 5%, var(--tf-surface));
	color: var(--tf-text);
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
}

/* The first column names the thing being described, so it carries the weight. */
.tf-article-content td:first-child {
	color: var(--tf-text);
	font-weight: 600;
}

.tf-article-content tr:last-child :is(th, td) {
	border-bottom: 0;
}

.tf-article-content tbody tr:hover td {
	background: color-mix(in oklch, var(--tf-accent) 3%, transparent);
}

/*
 * The rounded frame lives on the scroll container rather than the table, so a
 * table wider than the page clips against the border instead of spilling past
 * it. overflow: hidden would kill the scrolling, hence the clip on the frame.
 */
.tf-table-scroll {
	margin: 0;
	border: 1px solid var(--tf-border);
	border-radius: 12px;
	background: var(--tf-surface);
}

@media (max-width: 600px) {
	.tf-article-content :is(th, td) {
		padding: 10px 12px;
	}

	/*
	 * Below this width a three-column reference table degenerates into columns
	 * two or three words wide and rows ten lines tall. Holding a floor width and
	 * letting the container scroll sideways reads far better than compressing.
	 */
	.tf-table-scroll table {
		min-width: 34rem;
		font-size: 14px;
	}

	/* A hint that there is more table to the right of the fold. */
	.tf-table-scroll {
		background:
			linear-gradient(to left, var(--tf-surface), transparent) right / 26px 100% no-repeat local,
			radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.10), transparent) right / 12px 100% no-repeat scroll;
	}
}

.tf-article-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 44px;
}

.tf-article-tags a {
	padding: 5px 12px;
	border: 1px solid var(--tf-border);
	border-radius: 999px;
	background: var(--tf-surface);
	color: var(--tf-text-2);
	font-size: 13px;
	text-decoration: none;
}

.tf-article-tags a:hover {
	border-color: var(--tf-border-strong);
	color: var(--tf-text);
}

/* Adjacent entries ------------------------------------------------------- */

.tf-article-nav {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 16px;
	margin-top: 56px;
	padding-top: 32px;
	border-top: 1px solid var(--tf-rule);
}

.tf-article-nav-link {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 18px 20px;
	border: 1px solid var(--tf-border);
	border-radius: 12px;
	background: var(--tf-surface);
	text-decoration: none;
	transition: border-color 140ms ease-out;
}

.tf-article-nav-link:hover {
	border-color: var(--tf-border-strong);
}

.tf-article-nav-next {
	text-align: right;
}

.tf-article-nav-label {
	color: var(--tf-muted);
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 11px;
	font-weight: 600;
}

.tf-article-nav-title {
	color: var(--tf-text);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
}

/* Documentation ---------------------------------------------------------- */

.tf-docs-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 48px;
	padding: 16px;
	border: 1px solid var(--tf-border);
	border-radius: 12px;
	background: var(--tf-surface);
}

.tf-docs-filter label {
	color: var(--tf-muted);
	font-size: 13px;
	font-weight: 600;
}

.tf-docs-filter input[type="search"] {
	flex: 1;
	min-width: 220px;
	padding: 10px 14px;
	border: 1px solid var(--tf-border-strong);
	border-radius: 8px;
	background: var(--tf-bg);
	font-size: 15px;
}

.tf-docs-filter button {
	min-height: 42px;
	padding: 10px 18px;
	border: 1px solid var(--tf-text);
	border-radius: 8px;
	background: var(--tf-text);
	color: var(--tf-bg);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.tf-docs-group + .tf-docs-group {
	margin-top: 64px;
}

.tf-docs-group > h2 {
	margin: 0 0 24px;
	font-size: 22px;
}

.tf-docs-group[hidden] {
	display: none;
}

/* Documentation sidebar -------------------------------------------------- */

.tf-article-aside {
	position: sticky;
	top: 110px;
	display: flex;
	flex-direction: column;
	gap: 32px;
	font-size: 14px;
}

.tf-article-toc[hidden] {
	display: none;
}

.tf-article-toc ol {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	border-left: 1px solid var(--tf-rule);
}

.tf-article-toc li a {
	display: block;
	padding: 6px 0 6px 16px;
	margin-left: -1px;
	border-left: 2px solid transparent;
	color: var(--tf-muted);
	text-decoration: none;
	line-height: 1.4;
}

.tf-article-toc li a:hover {
	color: var(--tf-text);
}

.tf-article-toc li a[aria-current="true"] {
	border-left-color: var(--tf-accent);
	color: var(--tf-text);
	font-weight: 600;
}

.tf-article-toc li.is-sub a {
	padding-left: 28px;
	font-size: 13px;
}

.tf-article-toc-title,
.tf-related-documents h2 {
	margin: 0;
	color: var(--tf-muted);
	font-family: "JetBrains Mono", ui-monospace, monospace;
	font-size: 11.5px;
	font-weight: 600;
}

.tf-related-documents-list {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tf-related-documents-list h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
}

.tf-related-documents-list a {
	color: var(--tf-text-2);
	text-decoration: none;
}

.tf-related-documents-list a:hover {
	color: var(--tf-accent-ink);
}

/* Related articles ------------------------------------------------------- */

.tf-related-articles {
	margin-top: 88px;
	padding-top: 48px;
	border-top: 1px solid var(--tf-rule);
}

.tf-related-articles > h2 {
	margin: 0 0 28px;
	font-size: 24px;
}

/* Generic entry content -------------------------------------------------- */

.tf-entry-content {
	color: var(--tf-text-2);
	font-size: 17px;
}

.tf-entry-content a {
	color: var(--tf-accent-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 1024px) {
	.tf-article-layout-aside {
		grid-template-columns: minmax(0, 1fr);
		gap: 48px;
	}

	.tf-article-aside {
		position: static;
	}
}

/* Trademark notice --------------------------------------------------------- */

.tf-trademark-list {
	display: grid;
	gap: 1px;
	margin: 28px 0 32px;
	border: 1px solid var(--tf-border);
	border-radius: 12px;
	background: var(--tf-border);
	overflow: hidden;
}

.tf-trademark-group {
	padding: 16px 20px;
	background: var(--tf-surface);
}

.tf-entry-content .tf-trademark-group h3 {
	margin: 0 0 4px;
	color: var(--tf-text-2);
	font-family: "JetBrains Mono", monospace;
	font-size: 11px;
	font-weight: 600;
}

.tf-entry-content .tf-trademark-group p {
	margin: 0;
	font-size: 15px;
}

@media (max-width: 720px) {
	.tf-content-page {
		padding: 56px 0 72px;
	}

	.tf-content-hero,
	.tf-article-hero {
		margin-bottom: 36px;
	}

	.tf-card-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.tf-article-nav-next {
		text-align: left;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tf-card-grid > li,
	.tf-content-card {
		transition: none;
	}

	.tf-card-grid > li:hover,
	.tf-content-card:hover {
		transform: none;
	}
}
