/*
 * Universal Temple Theme – Components
 *
 * Reusable component styles for post cards, archive grids, single article
 * layout, page layout, metadata, featured images, pagination, search,
 * 404, and comments. All values reference --utt-* design tokens.
 *
 * Phase 3: Universal component set. No temple-specific or pilot content.
 *
 * @package UniversalTempleTheme
 * @version 0.3.0
 */

/* =========================================================================
 * Archive Grid
 * Responsive grid for post cards in home.php and archive.php.
 * ====================================================================== */

.archive-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--utt-space-8);
	margin-bottom: var(--utt-space-12);
}

@media (min-width: 600px) {
	.archive-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 900px) {
	.archive-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* =========================================================================
 * Post Card
 * Card layout for blog index and archive listings.
 * ====================================================================== */

.post-card {
	display: flex;
	flex-direction: column;
	background-color: var(--utt-color-surface);
	border: var(--utt-border);
	border-radius: var(--utt-radius-lg);
	overflow: hidden;
	transition: box-shadow var(--utt-transition-base),
	            transform var(--utt-transition-base);
}

.post-card:hover {
	box-shadow: var(--utt-shadow-md);
	transform: translateY(-2px);
}

.post-card__image {
	flex-shrink: 0;
}

.post-card__image a {
	display: block;
}

.post-card__image img {
	width: 100%;
	height: 200px;
	object-fit: cover;
}

.post-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: var(--utt-space-6);
	gap: var(--utt-space-4);
}

.post-card__header {
	display: flex;
	flex-direction: column;
	gap: var(--utt-space-2);
}

.post-card__category {
	margin: 0;
	font-size: var(--utt-text-xs);
	font-weight: var(--utt-weight-semibold);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.post-card__category a {
	color: var(--utt-color-accent);
	text-decoration: none;
}

.post-card__category a:hover {
	text-decoration: underline;
	text-decoration-color: currentColor;
}

.post-card__title {
	margin: 0;
	font-size: var(--utt-text-lg);
	line-height: var(--utt-leading-snug);
}

.post-card__title a {
	color: var(--utt-color-text);
	text-decoration: none;
}

.post-card__title a:hover {
	color: var(--utt-color-primary);
}

.post-card__meta {
	margin: 0;
}

.post-card__excerpt {
	flex: 1;
	font-size: var(--utt-text-sm);
	color: var(--utt-color-text-muted);
	line-height: var(--utt-leading-relaxed);
}

.post-card__excerpt p {
	margin-bottom: 0;
	max-width: none;
}

.post-card__footer {
	margin-top: auto;
}

.post-card__link {
	display: inline-flex;
	align-items: center;
	font-size: var(--utt-text-sm);
	font-weight: var(--utt-weight-semibold);
	color: var(--utt-color-primary);
	text-decoration: none;
	gap: var(--utt-space-1);
}

.post-card__link::after {
	content: '\2192'; /* → */
}

.post-card__link:hover {
	color: var(--utt-color-primary-hover);
	text-decoration: underline;
	text-decoration-color: var(--utt-color-accent);
}

/* Search variant – no image column */
.post-card--search {
	border-radius: var(--utt-radius-md);
}

.post-card__post-type {
	margin: 0;
	font-size: var(--utt-text-xs);
	color: var(--utt-color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* =========================================================================
 * Entry Metadata
 * Shared styles for date, author, and category inline metadata.
 * ====================================================================== */

.entry-meta {
	font-size: var(--utt-text-sm);
	color: var(--utt-color-text-muted);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--utt-space-2);
}

.entry-meta a {
	color: var(--utt-color-text-muted);
	text-decoration: underline;
	text-decoration-color: transparent;
	transition: color var(--utt-transition-fast),
	            text-decoration-color var(--utt-transition-fast);
}

.entry-meta a:hover {
	color: var(--utt-color-primary);
	text-decoration-color: var(--utt-color-accent);
}

.entry-meta__sep {
	opacity: 0.4;
}

/* =========================================================================
 * Single Article Layout
 * ====================================================================== */

.entry {
	max-width: var(--utt-content-width);
	margin-right: auto;
	margin-left: auto;
}

/* Wide and full-width blocks break out of the constrained entry column. */
.entry .alignwide {
	max-width: var(--utt-wide-width);
	margin-right: calc( ( var(--utt-wide-width) - var(--utt-content-width) ) / -2 );
	margin-left: calc( ( var(--utt-wide-width) - var(--utt-content-width) ) / -2 );
	width: auto;
}

.entry .alignfull {
	max-width: 100vw;
	margin-right: calc( 50% - 50vw );
	margin-left: calc( 50% - 50vw );
	width: 100vw;
}

/* Featured image – spans full content width above the header */
.entry-featured-image {
	margin-bottom: var(--utt-space-10);
}

.entry-featured-image img {
	width: 100%;
	border-radius: var(--utt-radius-md);
	max-height: 480px;
	object-fit: cover;
}

/* Article header */
.entry-header {
	margin-bottom: var(--utt-space-8);
}

.entry-category {
	margin: 0 0 var(--utt-space-3);
	font-size: var(--utt-text-sm);
	font-weight: var(--utt-weight-semibold);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.entry-category a {
	color: var(--utt-color-accent);
	text-decoration: none;
}

.entry-category a:hover {
	text-decoration: underline;
}

.entry-title {
	margin-bottom: var(--utt-space-5);
	color: var(--utt-color-primary);
}

/* Article content */
.entry-content {
	margin-bottom: var(--utt-space-10);
}

.entry-content > * + * {
	margin-top: 0; /* base.css handles element spacing */
}

/* Multi-page pagination within a single post */
.page-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--utt-space-2);
	margin-top: var(--utt-space-10);
	padding-top: var(--utt-space-6);
	border-top: var(--utt-border);
	font-size: var(--utt-text-sm);
}

.page-links__label {
	font-weight: var(--utt-weight-semibold);
	color: var(--utt-color-text-muted);
}

.page-links a,
.page-links span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2em;
	padding: var(--utt-space-1) var(--utt-space-2);
	border: var(--utt-border);
	border-radius: var(--utt-radius-base);
	font-size: var(--utt-text-sm);
	text-decoration: none;
	color: var(--utt-color-text);
	transition: background-color var(--utt-transition-fast);
}

.page-links a:hover {
	background-color: var(--utt-color-surface-alt);
}

.page-links > .post-page-numbers:not(a) {
	background-color: var(--utt-color-primary);
	border-color: var(--utt-color-primary);
	color: var(--utt-color-text-inverse);
}

/* Tags and edit link */
.entry-footer {
	padding-top: var(--utt-space-6);
	border-top: var(--utt-border);
	font-size: var(--utt-text-sm);
}

.entry-tags {
	margin-bottom: var(--utt-space-3);
	color: var(--utt-color-text-muted);
}

.entry-tags__label {
	font-weight: var(--utt-weight-medium);
	margin-right: var(--utt-space-2);
}

.entry-tags a {
	color: var(--utt-color-text-muted);
	text-decoration: underline;
	text-decoration-color: var(--utt-color-border);
}

.entry-tags a:hover {
	color: var(--utt-color-primary);
	text-decoration-color: var(--utt-color-accent);
}

.edit-link {
	margin: 0;
}

.edit-link a {
	font-size: var(--utt-text-sm);
	color: var(--utt-color-text-muted);
	text-decoration: underline;
	text-decoration-color: transparent;
	transition: color var(--utt-transition-fast),
	            text-decoration-color var(--utt-transition-fast);
}

.edit-link a:hover {
	color: var(--utt-color-primary);
	text-decoration-color: var(--utt-color-accent);
}

/* =========================================================================
 * Page Layout
 * Pages have less constrained width than articles.
 * ====================================================================== */

.entry--page {
	max-width: none;
}

.entry--page .entry-content {
	max-width: var(--utt-content-width);
}

/* =========================================================================
 * Posts Pagination (archive/home next/prev page)
 * WordPress outputs .nav-links with .nav-previous and .nav-next.
 * ====================================================================== */

.posts-navigation,
.posts-pagination {
	margin-top: var(--utt-space-12);
	padding-top: var(--utt-space-8);
	border-top: var(--utt-border);
}

.posts-navigation .nav-links {
	display: flex;
	justify-content: space-between;
	gap: var(--utt-space-4);
}

.posts-navigation .nav-previous,
.posts-navigation .nav-next {
	flex: 1;
}

.posts-navigation .nav-next {
	text-align: right;
}

.posts-navigation a {
	display: inline-flex;
	align-items: center;
	gap: var(--utt-space-2);
	font-size: var(--utt-text-sm);
	font-weight: var(--utt-weight-semibold);
	color: var(--utt-color-primary);
	text-decoration: none;
	padding: var(--utt-space-3) var(--utt-space-5);
	border: var(--utt-border);
	border-radius: var(--utt-radius-md);
	background-color: var(--utt-color-surface);
	transition: background-color var(--utt-transition-fast),
	            border-color var(--utt-transition-fast);
}

.posts-navigation a:hover {
	background-color: var(--utt-color-surface-alt);
	border-color: var(--utt-color-border-strong);
}

/* Numbered pagination (when wp_pagenavi or get_the_posts_pagination is used) */
.pagination {
	margin-top: var(--utt-space-12);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--utt-space-2);
}

.page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 var(--utt-space-3);
	border: var(--utt-border);
	border-radius: var(--utt-radius-md);
	font-size: var(--utt-text-sm);
	font-weight: var(--utt-weight-medium);
	color: var(--utt-color-text);
	text-decoration: none;
	background-color: var(--utt-color-surface);
	transition: background-color var(--utt-transition-fast),
	            border-color var(--utt-transition-fast);
}

a.page-numbers:hover {
	background-color: var(--utt-color-surface-alt);
	border-color: var(--utt-color-border-strong);
}

.page-numbers.current {
	background-color: var(--utt-color-primary);
	border-color: var(--utt-color-primary);
	color: var(--utt-color-text-inverse);
}

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

/* =========================================================================
 * Search Form (standalone and within 404 / content-none)
 * ====================================================================== */

.search-form {
	max-width: 480px;
}

.search-form label {
	margin-bottom: var(--utt-space-3);
	font-size: var(--utt-text-sm);
	font-weight: var(--utt-weight-semibold);
}

.search-form__row {
	display: flex;
	gap: var(--utt-space-2);
}

.search-form__input {
	flex: 1;
	min-width: 0; /* allow flex shrinking */
}

.search-form__submit {
	flex-shrink: 0;
	padding: var(--utt-space-3) var(--utt-space-5);
}

/* Search query highlight */
.search-query {
	color: var(--utt-color-primary);
	font-style: italic;
}

/* =========================================================================
 * 404 Page
 * ====================================================================== */

.error-404 {
	max-width: 540px;
	margin: 0 auto;
	padding: var(--utt-space-20) 0;
	text-align: center;
}

.error-404__header {
	margin-bottom: var(--utt-space-10);
}

.error-404__title {
	font-size: var(--utt-text-4xl);
	color: var(--utt-color-primary);
	margin-bottom: var(--utt-space-4);
}

.error-404__description {
	font-size: var(--utt-text-md);
	color: var(--utt-color-text-muted);
	max-width: none;
}

.error-404__actions {
	margin-bottom: var(--utt-space-10);
}

.button-primary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--utt-space-3) var(--utt-space-8);
	background-color: var(--utt-color-primary);
	color: var(--utt-color-text-inverse);
	border-radius: var(--utt-radius-md);
	font-size: var(--utt-text-base);
	font-weight: var(--utt-weight-semibold);
	text-decoration: none;
	min-height: 44px;
	transition: background-color var(--utt-transition-fast);
}

.button-primary:hover {
	background-color: var(--utt-color-primary-hover);
	color: var(--utt-color-text-inverse);
	text-decoration: none;
}

.error-404__search {
	text-align: left;
	background-color: var(--utt-color-surface);
	border: var(--utt-border);
	border-radius: var(--utt-radius-lg);
	padding: var(--utt-space-8);
}

.error-404__search > p {
	margin-bottom: var(--utt-space-4);
	font-size: var(--utt-text-sm);
	color: var(--utt-color-text-muted);
	font-weight: var(--utt-weight-medium);
	max-width: none;
}

.error-404__search .search-form {
	max-width: none;
}

/* =========================================================================
 * Content-None (no results state)
 * ====================================================================== */

.content-none {
	padding: var(--utt-space-16) 0;
	text-align: center;
}

.content-none__title {
	font-size: var(--utt-text-2xl);
	color: var(--utt-color-text-muted);
	margin-bottom: var(--utt-space-6);
}

.content-none__body {
	max-width: 480px;
	margin: 0 auto;
}

.content-none__body p {
	color: var(--utt-color-text-muted);
	max-width: none;
}

.content-none__body .search-form {
	margin-top: var(--utt-space-6);
	text-align: left;
	max-width: none;
}

/* =========================================================================
 * Comments Area
 * ====================================================================== */

.comments-area {
	max-width: var(--utt-content-width);
	margin: var(--utt-space-16) auto 0;
	padding-top: var(--utt-space-10);
	border-top: var(--utt-border-strong);
}

.comments-title {
	font-size: var(--utt-text-2xl);
	margin-bottom: var(--utt-space-8);
	color: var(--utt-color-primary);
}

/* Comment list */
.comment-list {
	list-style: none;
	margin: 0 0 var(--utt-space-10);
	padding: 0;
}

.comment-list .children {
	list-style: none;
	margin: 0;
	padding-left: var(--utt-space-8);
}

.comment {
	padding: var(--utt-space-6) 0;
	border-bottom: var(--utt-border);
}

.comment:last-child {
	border-bottom: none;
}

.comment-body {
	display: grid;
	grid-template-columns: 48px 1fr;
	gap: var(--utt-space-4);
	align-items: start;
}

.comment-author .avatar {
	border-radius: 50%;
	display: block;
}

.comment-author .says {
	/* Screen-reader accessible, visually hidden */
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
}

.comment-author b {
	font-weight: var(--utt-weight-semibold);
	font-size: var(--utt-text-sm);
}

.comment-meta {
	font-size: var(--utt-text-xs);
	color: var(--utt-color-text-muted);
	margin-bottom: var(--utt-space-3);
}

.comment-meta a {
	color: var(--utt-color-text-muted);
	text-decoration: underline;
	text-decoration-color: transparent;
}

.comment-meta a:hover {
	color: var(--utt-color-primary);
	text-decoration-color: var(--utt-color-accent);
}

.comment-content p {
	font-size: var(--utt-text-sm);
	max-width: none;
}

.reply {
	margin-top: var(--utt-space-3);
}

.comment-reply-link {
	font-size: var(--utt-text-xs);
	font-weight: var(--utt-weight-semibold);
	color: var(--utt-color-accent);
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.comment-reply-link:hover {
	text-decoration: underline;
}

/* Comment navigation */
.comment-navigation {
	display: flex;
	justify-content: space-between;
	gap: var(--utt-space-4);
	padding: var(--utt-space-4) 0;
	border-top: var(--utt-border);
	border-bottom: var(--utt-border);
	margin-bottom: var(--utt-space-8);
}

.comment-navigation a {
	font-size: var(--utt-text-sm);
	font-weight: var(--utt-weight-semibold);
}

/* Comments closed notice */
.comments-closed {
	font-size: var(--utt-text-sm);
	color: var(--utt-color-text-muted);
	padding: var(--utt-space-4);
	background-color: var(--utt-color-surface-alt);
	border-radius: var(--utt-radius-md);
	margin-top: var(--utt-space-8);
}

/* Comment form */
.comment-respond {
	margin-top: var(--utt-space-10);
}

.comment-reply-title {
	font-size: var(--utt-text-xl);
	margin-bottom: var(--utt-space-6);
}

.comment-form .logged-in-as {
	font-size: var(--utt-text-sm);
	color: var(--utt-color-text-muted);
	margin-bottom: var(--utt-space-6);
}

.comment-form p {
	margin-bottom: var(--utt-space-5);
	max-width: none;
}

.comment-form-comment textarea {
	min-height: 140px;
	resize: vertical;
}

.comment-form .required-field-message,
.comment-form .comment-notes {
	font-size: var(--utt-text-xs);
	color: var(--utt-color-text-muted);
}

.comment-form .required {
	color: var(--utt-color-error);
}

.comment-form-cookies-consent label {
	display: inline;
	font-size: var(--utt-text-sm);
	font-weight: var(--utt-weight-normal);
}

.comment-form-cookies-consent input[type="checkbox"] {
	width: auto;
	min-height: auto;
	margin-right: var(--utt-space-2);
}

.comment-form .submit {
	padding: var(--utt-space-3) var(--utt-space-8);
}

/* =========================================================================
 * Responsive adjustments
 * ====================================================================== */

@media (max-width: 600px) {

	.archive-grid {
		grid-template-columns: 1fr;
	}

	.comment-body {
		grid-template-columns: 40px 1fr;
	}

	.comment-list .children {
		padding-left: var(--utt-space-5);
	}

	.entry .alignwide {
		margin-right: 0;
		margin-left: 0;
		max-width: 100%;
	}

	.entry .alignfull {
		margin-right: calc( 0px - var(--utt-container-padding) );
		margin-left: calc( 0px - var(--utt-container-padding) );
		width: auto;
		max-width: calc( 100% + 2 * var(--utt-container-padding) );
	}

}
