/*
Theme Name:   TruckDistrictUSA Child
Theme URI:    https://truckdistrictusa.com/
Description:  Child theme of Kadence for TruckDistrictUSA: brand tokens, article patterns, spec tables, a click-to-load YouTube embed, reading time, like/dislike buttons and the approved home and article layouts.
Author:       TruckDistrictUSA
Template:     kadence
Version:      0.7.0
Requires at least: 6.5
Requires PHP: 8.1
License:      GNU General Public License v2 or later
License URI:  https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  truckdistrict-child
*/

/* Brand tokens. Kadence's global palette carries the main colors (see docs/kadence-settings.md);
   these cover the pieces the Customizer has no setting for. */
:root {
	--tdu-charcoal: #111827;
	--tdu-accent: #E84A20;      /* bars, icons, large type only: 3.9:1 on white */
	--tdu-accent-deep: #C93A12; /* links, buttons, labels: 5.1:1 on white */
	--tdu-slate: #475569;
	--tdu-gray: #F3F4F6;
	--tdu-border: #D1D5DB;
	--tdu-radius: 8px;
}

/* Visible focus for keyboard users; white on the dark header and footer. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--tdu-charcoal);
	outline-offset: 2px;
}
.site-header :focus-visible,
.site-footer :focus-visible,
.tdu-yt :focus-visible {
	outline-color: #FFFFFF;
}

/* Accent rule under the header, as in the approved mockup. */
.site-header {
	border-bottom: 4px solid var(--tdu-accent);
}

/* Article meta line ("Last fact-checked"); author and dates come from Kadence's post meta. */
.tdu-meta {
	color: var(--tdu-slate);
	font-size: 0.875em;
	font-weight: 500;
}

/* Short answer under the title: the self-contained reply search and AI answers quote. */
.tdu-answer {
	border-left: 4px solid var(--tdu-accent);
	background: var(--tdu-gray);
	border-radius: 0 var(--tdu-radius) var(--tdu-radius) 0;
	padding: 1rem 1.25rem;
	font-size: 1.05em;
}

/* Affiliate notice: sits before the first affiliate link so the disclosure is seen first. */
.tdu-affiliate-note {
	border: 1px solid var(--tdu-border);
	border-left: 4px solid var(--tdu-slate);
	border-radius: 0 var(--tdu-radius) var(--tdu-radius) 0;
	padding: 0.75rem 1rem;
	color: var(--tdu-charcoal);
	font-size: 0.9em;
}
.tdu-affiliate-note a {
	color: var(--tdu-accent-deep);
}

/* Key takeaways box. */
.tdu-takeaways {
	border: 2px solid var(--tdu-charcoal);
	border-radius: var(--tdu-radius);
	padding: 1.25rem 1.5rem;
}
.tdu-takeaways > :first-child {
	margin-top: 0;
}

/* Confirmed vs not confirmed: told apart by border style and label, not color alone. */
.tdu-status {
	border-radius: var(--tdu-radius);
	padding: 1rem 1.25rem;
}
.tdu-status--confirmed {
	border: 2px solid var(--tdu-charcoal);
}
.tdu-status--unconfirmed {
	border: 2px dashed var(--tdu-slate);
}
.tdu-status > :first-child {
	margin-top: 0;
	font-weight: 700;
}

/* Spec table block style. The table block's figure already scrolls sideways;
   the minimum width keeps columns readable instead of squeezing them on phones. */
.wp-block-table.is-style-tdu-specs {
	border: 1px solid var(--tdu-border);
	border-radius: var(--tdu-radius);
}
.wp-block-table.is-style-tdu-specs table {
	min-width: 640px;
	border-collapse: collapse;
	font-size: 0.9em;
	line-height: 1.5;
}
.wp-block-table.is-style-tdu-specs th,
.wp-block-table.is-style-tdu-specs td {
	border: 0;
	border-bottom: 1px solid #E5E7EB;
	padding: 0.75rem 1rem;
	text-align: left;
	vertical-align: top;
}
.wp-block-table.is-style-tdu-specs thead {
	border: 0;
}
.wp-block-table.is-style-tdu-specs thead th {
	background: var(--tdu-charcoal);
	color: #FFFFFF;
	font-weight: 700;
}
.wp-block-table.is-style-tdu-specs tbody tr:nth-child(even) {
	background: #F9FAFB;
}
.wp-block-table.is-style-tdu-specs tbody td:first-child {
	font-weight: 600;
}
.wp-block-table.is-style-tdu-specs figcaption {
	margin: 0;
	padding: 0.75rem 1rem;
	color: var(--tdu-slate);
	font-size: 0.8em;
	text-align: left;
}
.tdu-swipe-hint {
	display: none;
	color: var(--tdu-slate);
	font-size: 0.85em;
	font-weight: 600;
}
@media (max-width: 700px) {
	.tdu-swipe-hint {
		display: block;
	}
}

/* Click-to-load YouTube embed: nothing is requested from YouTube until the reader clicks. */
.tdu-yt__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: var(--tdu-radius);
	overflow: hidden;
	background: #1F2937;
}
.tdu-yt__frame iframe,
.tdu-yt__button {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.tdu-yt__button {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	padding: 1rem;
	background: #1F2937;
	color: #FFFFFF;
	font: inherit;
	cursor: pointer;
}
.tdu-yt__play {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: var(--tdu-accent);
	position: relative;
}
.tdu-yt__play::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 14px 0 14px 22px;
	border-color: transparent transparent transparent #FFFFFF;
}
.tdu-yt__label {
	font-size: 1rem;
	font-weight: 600;
}
.tdu-yt__note {
	font-size: 0.875rem;
	color: #D1D5DB;
}

/* Like and dislike buttons: the pressed one is told apart by fill and heavier type, not color alone. */
.tdu-reactions {
	margin-top: 2em;
	padding-top: 1.5em;
	border-top: 1px solid var(--tdu-border);
}
.tdu-reactions[hidden] {
	display: none;
}
.tdu-reactions__label {
	margin: 0 0 0.75em;
	font-weight: 700;
}
.tdu-reactions__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75em;
}
.tdu-reactions__button,
.tdu-reactions__button:hover,
.tdu-reactions__button:focus {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	min-height: 44px;
	padding: 0.5em 1em;
	border: 1px solid var(--tdu-slate);
	border-radius: var(--tdu-radius);
	background: #FFFFFF;
	color: var(--tdu-charcoal);
	box-shadow: none;
	font-size: 0.9375rem;
	font-weight: 500;
	cursor: pointer;
}
.tdu-reactions__button:hover {
	background: var(--tdu-gray);
}
.tdu-reactions__button[aria-pressed="true"],
.tdu-reactions__button[aria-pressed="true"]:hover,
.tdu-reactions__button[aria-pressed="true"]:focus {
	border-color: var(--tdu-accent-deep);
	background: var(--tdu-accent-deep);
	color: #FFFFFF;
	font-weight: 700;
}
.tdu-reactions__count {
	font-variant-numeric: tabular-nums;
}
.tdu-reactions__status {
	margin: 0.75em 0 0;
	color: var(--tdu-slate);
	font-size: 0.875em;
}
.tdu-reactions__status:empty {
	display: none;
}

/* The feed's lead card title is the page's <h1> (see entry_loop_title.php); same look as Kadence's <h2> on the other cards. */
.loop-entry h1.entry-title {
	font-weight: 700;
	font-size: 28px;
	line-height: 1.25;
}
@media (max-width: 767px) {
	.loop-entry h1.entry-title {
		font-size: 24px;
	}
}

/* Page layouts from the approved design (Home and Article artboards): white page, 1200 px container. */
body {
	background: #FFFFFF;
}
.tdu-label {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--tdu-accent-deep);
}
.tdu-photo {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--tdu-radius);
	background: #E5E7EB;
}
.tdu-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.tdu-more {
	font-size: 16px;
	font-weight: 700;
}
.tdu-home a:not(.tdu-band__button):not(.tdu-more):not(.tdu-photo) {
	color: var(--tdu-charcoal);
	text-decoration: none;
}
.tdu-home a:not(.tdu-band__button):not(.tdu-more):not(.tdu-photo):hover {
	color: var(--tdu-accent-deep);
	text-decoration: underline;
}

/* Header and footer type from the design: 16 px menu with the current item underlined in the accent color. */
.site-header .main-navigation .primary-menu-container > ul > li.menu-item > a {
	font-size: 16px;
	font-weight: 500;
}
.site-header .main-navigation .primary-menu-container > ul > li.current-menu-item > a {
	font-weight: 600;
}
.site-header .header-navigation[class*="header-navigation-style-underline"] .header-menu-container > ul > li > a::after {
	background: var(--tdu-accent);
}
.site-footer .widget-title {
	font-size: 14px;
	letter-spacing: 0.06em;
}
.site-footer .widget a,
.site-footer .widget p {
	font-size: 16px;
}

/* Home */
.tdu-home-area {
	margin: 40px 0 72px;
}
.tdu-home {
	display: flex;
	flex-direction: column;
	gap: 64px;
}
.tdu-top {
	display: flex;
	flex-wrap: wrap;
	gap: 40px;
}
.tdu-lead {
	flex: 2 1 560px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.tdu-lead__text {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.tdu-lead__title {
	margin: 0;
	font-size: 40px;
	font-weight: 800;
	line-height: 1.2;
}
.tdu-lead__excerpt {
	margin: 0;
	font-size: 18px;
	line-height: 1.7;
	color: #374151;
}
.tdu-story__meta {
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	color: var(--tdu-slate);
}
.tdu-home .tdu-story__meta a {
	color: var(--tdu-slate);
	text-decoration: underline;
}
/* Only one published post: nothing to list beside it, so the photo and text share the width. */
@media (min-width: 900px) {
	.tdu-top--solo .tdu-lead {
		flex-direction: row;
		align-items: center;
		gap: 40px;
	}
	.tdu-top--solo .tdu-photo {
		flex: 6 1 0;
		min-width: 0;
	}
	.tdu-top--solo .tdu-lead__text {
		flex: 5 1 0;
		min-width: 0;
	}
	.tdu-top--solo .tdu-lead__title {
		font-size: 32px;
	}
}
.tdu-latest {
	flex: 1 1 300px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 22px;
}
.tdu-latest__heading {
	margin: 0;
	padding-bottom: 10px;
	border-bottom: 3px solid var(--tdu-charcoal);
	font-size: 24px;
	font-weight: 700;
}
.tdu-latest__item {
	display: flex;
	gap: 16px;
}
.tdu-latest__item .tdu-photo {
	flex: none;
	width: 128px;
	align-self: flex-start;
	border-radius: 6px;
}
.tdu-latest__text {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.tdu-latest__text .tdu-label {
	font-size: 12px;
}
.tdu-latest__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.35;
}
.tdu-latest__text .tdu-story__meta {
	font-size: 14px;
	font-weight: 400;
}
.tdu-section {
	display: flex;
	flex-direction: column;
	gap: 24px;
}
.tdu-section__head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 8px;
	padding-bottom: 10px;
	border-bottom: 3px solid var(--tdu-charcoal);
}
.tdu-section__head h2 {
	margin: 0;
	font-size: 28px;
	font-weight: 700;
}
.tdu-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 28px;
}
.tdu-story {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.tdu-story--panel {
	padding: 24px;
	border-radius: var(--tdu-radius);
	background: var(--tdu-gray);
}
.tdu-story__title {
	margin: 0;
	font-size: 21px;
	font-weight: 700;
	line-height: 1.35;
}
.tdu-story__excerpt {
	margin: 0;
	font-size: 16px;
	line-height: 1.6;
	color: var(--tdu-slate);
}
.tdu-story .tdu-story__meta {
	font-size: 14px;
	font-weight: 400;
}
.tdu-band {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 24px 48px;
	padding: 40px;
	border-radius: var(--tdu-radius);
	background: var(--tdu-charcoal);
	color: #FFFFFF;
}
.tdu-band__text {
	flex: 1 1 480px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.tdu-band__label {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--tdu-accent);
}
.tdu-band h2 {
	margin: 0;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.3;
	color: #FFFFFF;
}
.tdu-band p {
	margin: 0;
	font-size: 18px;
	line-height: 1.7;
	color: #E5E7EB;
}
.tdu-band__button,
.tdu-band__button:hover {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	box-sizing: border-box;
	padding: 12px 22px;
	border-radius: 6px;
	background: var(--tdu-accent-deep);
	color: #FFFFFF;
	font-size: 16px;
	font-weight: 700;
	text-decoration: none;
}
.tdu-band__button:hover {
	background: #9A2C0D;
	color: #FFFFFF;
}
.tdu-band :focus-visible {
	outline-color: #FFFFFF;
}
@media (max-width: 767px) {
	.tdu-home-area {
		margin: 20px 0 48px;
	}
	.tdu-home {
		gap: 44px;
	}
	.tdu-lead__title {
		font-size: 30px;
	}
	.tdu-lead__excerpt {
		font-size: 17px;
	}
	.tdu-latest__item .tdu-photo {
		width: 112px;
	}
	.tdu-section__head h2 {
		font-size: 24px;
	}
	.tdu-story__title {
		font-size: 19px;
	}
	.tdu-band {
		padding: 24px;
	}
	.tdu-band h2 {
		font-size: 22px;
	}
	.tdu-band p {
		font-size: 16px;
	}
	.tdu-band__button {
		width: 100%;
		justify-content: center;
	}
}

/* Article */
.single-post .content-area {
	margin: 28px 0 72px;
}
.single-post.content-width-narrow .content-container.site-container {
	max-width: var(--global-content-width);
}
.tdu-article {
	display: flex;
	flex-direction: column;
	gap: 28px;
}
.tdu-article .entry-header {
	max-width: 860px;
	margin: 0;
}
/* Kadence pulls .alignwide items past the column on narrow-layout posts. */
.single-post .wp-site-blocks .content-container .tdu-article .article-post-thumbnail {
	width: auto;
	max-width: 100%;
	margin: 0;
	padding-bottom: 42.857%;
	border-radius: var(--tdu-radius);
	overflow: hidden;
}
.tdu-article__columns {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 40px 56px;
}
.tdu-article__body {
	flex: 999 1 560px;
	min-width: 0;
	max-width: 760px;
}
.tdu-article__body .entry-content {
	margin: 0;
}
.tdu-article__body h2 {
	scroll-margin-top: 16px;
}
.tdu-article__body .entry-author {
	margin: 2em 0 0;
}
.tdu-toc {
	box-sizing: border-box;
	border-radius: var(--tdu-radius);
	background: var(--tdu-gray);
}
.tdu-toc--side {
	flex: 1 1 220px;
	min-width: 0;
	padding: 20px;
}
.tdu-toc--box {
	display: none;
	width: 100%;
	padding: 0 16px;
}
.tdu-toc__title {
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--tdu-charcoal);
}
.tdu-toc nav {
	display: flex;
	flex-direction: column;
}
.tdu-toc a {
	padding: 6px 0;
	color: var(--tdu-charcoal);
	font-size: 15px;
	line-height: 1.4;
	text-decoration: none;
}
.tdu-toc a:hover {
	color: var(--tdu-accent-deep);
	text-decoration: underline;
}
.tdu-toc summary.tdu-toc__title {
	display: flex;
	align-items: center;
	min-height: 52px;
	margin: 0;
	font-size: 16px;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
}
.tdu-toc--box nav {
	padding-bottom: 14px;
}
.tdu-toc--box a {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0;
}
.single-post .tdu-article .entry-related {
	width: auto;
	max-width: none;
	margin: 0;
	padding: 32px 0 0;
	border-top: 3px solid var(--tdu-charcoal);
	background: transparent;
}
.single-post .wp-site-blocks .content-container .tdu-article .entry-related-inner,
.single-post .wp-site-blocks .content-container .tdu-article .entry-related-inner-content {
	width: auto;
	max-width: none;
	margin: 0;
	padding: 0;
}
.tdu-article .entry-related-title {
	margin: 0 0 24px;
	font-size: 28px;
	font-weight: 700;
}
@media (max-width: 899px) {
	.tdu-toc--side {
		display: none;
	}
	.tdu-toc--box {
		display: block;
	}
}
@media (max-width: 767px) {
	.single-post .content-area {
		margin: 16px 0 48px;
	}
	.single-post .wp-site-blocks .content-container .tdu-article .article-post-thumbnail {
		padding-bottom: 56.25%;
	}
}

/* FAQ details blocks with comfortable tap targets. */
.wp-block-details {
	border: 1px solid var(--tdu-border);
	border-radius: var(--tdu-radius);
	padding: 0 1.25rem;
}
.wp-block-details summary {
	min-height: 52px;
	display: flex;
	align-items: center;
	font-weight: 600;
	cursor: pointer;
}
.wp-block-details[open] {
	padding-bottom: 1rem;
}
