/**
 * GPCID E-News Archive — single stylesheet for front end, block editor, and admin.
 *
 * @package GPCID_ENews_Archive
 * @version 1.0.5
 */

/* -------------------------------------------------------------------------
 * Tokens
 * ---------------------------------------------------------------------- */

.gpcid-enews {
	--gpcid-enews-title: #14161a;
	--gpcid-enews-title-hover: #263b91;
	--gpcid-enews-date: #5b6270;
	--gpcid-enews-frame: #e4e6ec;
	--gpcid-enews-frame-hover: #f58020;
	--gpcid-enews-placeholder: #f1f2f6;
	--gpcid-enews-thumb-width: 25%;
	--gpcid-enews-body-width: 75%;
	--gpcid-enews-thumb-ratio: 3 / 4;
	--gpcid-enews-row-gap: 3.25rem;
	--gpcid-enews-column-gap: 2.25rem;
	--gpcid-enews-title-size: clamp(1.125rem, 1.9vw, 1.625rem);
	--gpcid-enews-focus: #263b91;
}

/* -------------------------------------------------------------------------
 * Shared item structure
 * ---------------------------------------------------------------------- */

.gpcid-enews__items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gpcid-enews__item {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gpcid-enews__link {
	align-items: center;
	color: inherit;
	display: flex;
	gap: var(--gpcid-enews-column-gap);
	text-decoration: none;
}

a.gpcid-enews__link:hover,
a.gpcid-enews__link:focus-visible {
	text-decoration: none;
}

a.gpcid-enews__link:focus-visible {
	outline: 3px solid var(--gpcid-enews-focus);
	outline-offset: 6px;
}

.gpcid-enews__thumb {
	background: var(--gpcid-enews-placeholder);
	border: 1px solid var(--gpcid-enews-frame);
	box-sizing: border-box;
	display: block;
	flex: 0 0 var(--gpcid-enews-thumb-width);
	max-width: var(--gpcid-enews-thumb-width);
	overflow: hidden;
	width: var(--gpcid-enews-thumb-width);
}

.gpcid-enews__image,
.gpcid-enews__thumb-empty {
	aspect-ratio: var(--gpcid-enews-thumb-ratio);
	display: block;
	height: auto;
	object-fit: cover;
	object-position: top center;
	width: 100%;
}

.gpcid-enews__thumb-empty {
	background: repeating-linear-gradient(
		45deg,
		var(--gpcid-enews-placeholder),
		var(--gpcid-enews-placeholder) 8px,
		#e8eaf0 8px,
		#e8eaf0 16px
	);
}

a.gpcid-enews__link:hover .gpcid-enews__thumb,
a.gpcid-enews__link:focus-visible .gpcid-enews__thumb {
	border-color: var(--gpcid-enews-frame-hover);
}

.gpcid-enews__body {
	box-sizing: border-box;
	display: block;
	flex: 1 1 var(--gpcid-enews-body-width);
	min-width: 0;
}

.gpcid-enews__title {
	color: var(--gpcid-enews-title);
	display: block;
	font-size: var(--gpcid-enews-title-size);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.12;
	text-wrap: balance;
}

a.gpcid-enews__link:hover .gpcid-enews__title,
a.gpcid-enews__link:focus-visible .gpcid-enews__title {
	color: var(--gpcid-enews-title-hover);
}

.gpcid-enews__date {
	color: var(--gpcid-enews-date);
	display: block;
	font-size: 0.9375rem;
	font-weight: 500;
	letter-spacing: 0.04em;
	margin-top: 0.6rem;
	text-transform: uppercase;
}

/* -------------------------------------------------------------------------
 * List layout — matches the reference design
 * ---------------------------------------------------------------------- */

.gpcid-enews--list .gpcid-enews__items {
	display: flex;
	flex-direction: column;
	gap: var(--gpcid-enews-row-gap);
}

/* -------------------------------------------------------------------------
 * Grid layout
 * ---------------------------------------------------------------------- */

.gpcid-enews--grid {
	--gpcid-enews-thumb-width: 100%;
	--gpcid-enews-body-width: 100%;
	--gpcid-enews-title-size: clamp(1rem, 1.3vw, 1.25rem);
	--gpcid-enews-row-gap: 2.5rem;
}

.gpcid-enews--grid .gpcid-enews__items {
	display: grid;
	gap: var(--gpcid-enews-row-gap) var(--gpcid-enews-column-gap);
}

.gpcid-enews--grid .gpcid-enews__link {
	align-items: stretch;
	flex-direction: column;
	gap: 1.125rem;
	height: 100%;
}

.gpcid-enews--grid .gpcid-enews__thumb {
	flex: 0 0 auto;
	width: 100%;
}

.gpcid-enews--cols-2 .gpcid-enews__items {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gpcid-enews--cols-3 .gpcid-enews__items {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gpcid-enews--cols-4 .gpcid-enews__items {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.gpcid-enews__pagination {
	margin-top: 3rem;
}

.gpcid-enews__pagination .page-numbers {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gpcid-enews__pagination ul.page-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
}

.gpcid-enews__pagination li {
	list-style: none;
	margin: 0;
}

.gpcid-enews__pagination a.page-numbers,
.gpcid-enews__pagination span.page-numbers {
	border: 1px solid var(--gpcid-enews-frame);
	color: var(--gpcid-enews-title);
	display: block;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1;
	min-width: 2.75rem;
	padding: 0.75rem 0.9rem;
	text-align: center;
	text-decoration: none;
}

.gpcid-enews__pagination a.page-numbers:hover,
.gpcid-enews__pagination a.page-numbers:focus-visible {
	border-color: var(--gpcid-enews-frame-hover);
	color: var(--gpcid-enews-title-hover);
}

.gpcid-enews__pagination a.page-numbers:focus-visible {
	outline: 3px solid var(--gpcid-enews-focus);
	outline-offset: 2px;
}

.gpcid-enews__pagination span.current {
	background: var(--gpcid-enews-focus);
	border-color: var(--gpcid-enews-focus);
	color: #fff;
}

.gpcid-enews__pagination .dots {
	border-color: transparent;
}

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

@media (max-width: 1024px) {
	.gpcid-enews--cols-4 .gpcid-enews__items {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 782px) {
	.gpcid-enews {
		--gpcid-enews-thumb-width: 32%;
		--gpcid-enews-body-width: 68%;
		--gpcid-enews-column-gap: 1.25rem;
		--gpcid-enews-row-gap: 2rem;
	}

	.gpcid-enews--grid {
		--gpcid-enews-thumb-width: 100%;
		--gpcid-enews-body-width: 100%;
	}

	.gpcid-enews--cols-3 .gpcid-enews__items,
	.gpcid-enews--cols-4 .gpcid-enews__items {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	.gpcid-enews--grid .gpcid-enews__items,
	.gpcid-enews--cols-2 .gpcid-enews__items,
	.gpcid-enews--cols-3 .gpcid-enews__items,
	.gpcid-enews--cols-4 .gpcid-enews__items {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.gpcid-enews * {
		transition: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Admin: meta box
 * ---------------------------------------------------------------------- */

.gpcid-enews-box .gpcid-enews-label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}

.gpcid-enews-box .gpcid-enews-field {
	margin: 0 0 16px;
}

.gpcid-enews-box .description {
	display: block;
	margin-top: 4px;
}

.gpcid-enews-actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 18px;
}

.gpcid-enews-status {
	font-size: 13px;
}

.gpcid-enews-status[data-state="ok"] {
	color: #1a7f37;
}

.gpcid-enews-status[data-state="warn"] {
	color: #8a6100;
}

.gpcid-enews-status[data-state="error"] {
	color: #b32d2e;
}

.gpcid-enews-status[data-state="busy"] {
	color: #50575e;
	font-style: italic;
}

.gpcid-enews-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 28px;
}

.gpcid-enews-col {
	flex: 1 1 320px;
	min-width: 0;
}

.gpcid-enews-preview-col {
	flex: 0 0 220px;
}

.gpcid-enews-preview {
	align-items: center;
	background: #f6f7f7;
	border: 1px solid #dcdcde;
	display: flex;
	justify-content: center;
	min-height: 240px;
	overflow: hidden;
	padding: 8px;
}

.gpcid-enews-preview img {
	display: block;
	height: auto;
	max-width: 100%;
}

.gpcid-enews-preview-empty {
	color: #787c82;
	font-size: 13px;
}

.gpcid-enews-remove {
	color: #b32d2e;
}

.gpcid-enews-meta-list {
	margin: 0;
	padding: 0;
}

.gpcid-enews-meta-list li {
	font-size: 13px;
	margin: 0 0 4px;
}

.gpcid-enews-meta-list .is-pending {
	color: #8a6100;
}

.gpcid-enews-meta-list .is-failed {
	color: #b32d2e;
}

.gpcid-enews-meta-list .is-ok {
	color: #1a7f37;
}

/* -------------------------------------------------------------------------
 * Admin: list table and settings
 * ---------------------------------------------------------------------- */

.column-gpcid_thumb {
	width: 72px;
}

.gpcid-enews-col-thumb {
	border: 1px solid #dcdcde;
	display: block;
	height: auto;
	max-width: 60px;
}

.gpcid-enews-col-empty {
	color: #a7aaad;
}

.gpcid-enews-badge {
	border-radius: 3px;
	display: inline-block;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.6;
	padding: 1px 8px;
}

.gpcid-enews-badge.is-pending {
	background: #fcf3d4;
	color: #8a6100;
}

.gpcid-enews-badge.is-failed {
	background: #fce8e8;
	color: #b32d2e;
}

.gpcid-enews-badge.is-ok {
	background: #e6f4ea;
	color: #1a7f37;
}

.gpcid-enews-attr-list {
	list-style: disc;
	margin-left: 20px;
}

/* -------------------------------------------------------------------------
 * Admin: background queue notice
 * ---------------------------------------------------------------------- */

.gpcid-enews-queue-actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 12px;
}
