/* ==========================================================================
   JC Posts – Latest posts grid
   Shortcode: [jc_posts]
   Colours are CSS variables – override them in style.css or on a custom class
   ========================================================================== */

.jcp-wrap {
	--jcp-link:      #1F8189;   /* post title link                    */
	--jcp-link-hover:#e2703a;   /* title on hover                     */
	--jcp-text:      #000000;   /* excerpt text                       */
	--jcp-heading:   #1c8b83;   /* section heading                    */
	--jcp-frame-1:   #8cc63f;   /* image frame colour, card 1, 4, 7…  */
	--jcp-frame-2:   #1b75bb;   /* image frame colour, card 2, 5, 8…  */
	--jcp-frame-3:   #27b7bc;   /* image frame colour, card 3, 6, 9…  */
	--jcp-frame:     var(--jcp-frame-1);
	--jcp-frame-w:   4px;
	--jcp-radius:    3px;
	--jcp-ratio:     16 / 10;   /* image aspect ratio                 */
	--jcp-gap:       28px;
	--jcp-cols:        3;
	--jcp-cols-tablet: 2;
	--jcp-cols-mobile: 1;

	width: 100%;
	box-sizing: border-box;
}

.jcp-wrap *,
.jcp-wrap *::before,
.jcp-wrap *::after { box-sizing: border-box; }

.jcp-title {
	margin: 0 0 26px;
	color: var(--jcp-heading);
	font-size: 30px;
	line-height: 1.25;
	font-weight: 700;
	text-align: center;
}

/* ---------- Grid ---------------------------------------------------------- */
.jcp-grid {
	display: grid;
	grid-template-columns: repeat(var(--jcp-cols), minmax(0, 1fr));
	gap: var(--jcp-gap);
	align-items: start;
}

/* ---------- Card ---------------------------------------------------------- */
.jcp-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

/* rotating frame colour, matches the three-up layout */
.jcp-card:nth-child(3n + 1) { --jcp-frame: var(--jcp-frame-1); }
.jcp-card:nth-child(3n + 2) { --jcp-frame: var(--jcp-frame-2); }
.jcp-card:nth-child(3n + 3) { --jcp-frame: var(--jcp-frame-3); }

/* ---------- Thumbnail ----------------------------------------------------- */
.jcp-card__thumb {
	display: block;
	position: relative;
	overflow: hidden;
	margin: 0 0 16px;
	border: var(--jcp-frame-w) solid var(--jcp-frame);
	border-radius: var(--jcp-radius);
	line-height: 0;
}

.jcp-card__thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--jcp-ratio);
	object-fit: cover;
	transition: transform .45s ease;
}

.jcp-card__thumb:hover img { transform: scale(1.04); }

/* corner accent like the reference design */
.jcp-card__thumb::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	width: 34px;
	height: 34px;
	background: linear-gradient(to bottom left, transparent 48%, rgba(255, 255, 255, .85) 49%, rgba(255, 255, 255, .85) 52%, transparent 53%);
	pointer-events: none;
}

/* ---------- Title --------------------------------------------------------- */
.jcp-card__title {
	margin: 0 0 10px;
	font-size: 17px;
	line-height: 1.4;
	font-weight: 700;
	overflow-wrap: break-word;
}

.jcp-card__title a {
	color: var(--jcp-link);
	text-decoration: underline;
	text-underline-offset: 2px;
	transition: color .2s ease;
}

.jcp-card__title a:hover,
.jcp-card__title a:focus { color: var(--jcp-link-hover); }

/* ---------- Meta / excerpt ------------------------------------------------ */
.jcp-card__date {
	margin: 0 0 8px;
	color: #7b8585;
	font-size: 13px;
}

.jcp-card__excerpt {
	margin: 0;
	color: var(--jcp-text);
	font-size: 15px !important;
	line-height: 1.65 !important;
}

.jcp-card__more {
	align-self: flex-start;
	margin-top: 14px;
	padding: 9px 20px;
	border-radius: 40px;
	background: var(--jcp-heading);
	color: #fff;
	font-size: 14px;
	text-decoration: none;
	transition: background .2s ease;
}

.jcp-card__more:hover { background: var(--jcp-link-hover); color: #fff; }

.jcp-empty {
	padding: 14px;
	border: 1px dashed #cfd6d6;
	color: #777;
	text-align: center;
}

/* ---------- Responsive ---------------------------------------------------- */
@media (max-width: 991px) {
	.jcp-grid  { grid-template-columns: repeat(var(--jcp-cols-tablet), minmax(0, 1fr)); }
	.jcp-title { font-size: 26px; }
}

@media (max-width: 600px) {
	.jcp-wrap  { --jcp-gap: 24px; }
	.jcp-grid  { grid-template-columns: repeat(var(--jcp-cols-mobile), minmax(0, 1fr)); }
	.jcp-title { margin-bottom: 20px; font-size: 22px; }
	.jcp-card__title   { font-size: 16px; }
	.jcp-card__excerpt { font-size: 14px; }
}

/* very old browsers without aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
	.jcp-card__thumb img { height: 200px; }
}
