/**
 * St Michael's Custom — cards
 * Styles for the [stm_cards] shortcode (News & Events card grid).
 *
 * Standalone: nothing here depends on styles.css or on the theme.
 */

/* -------------------------------------------------------------------------
 * Grid — 3 across, wrapping. Two up on tablet, one up on phones.
 * ---------------------------------------------------------------------- */

.stm-cards {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

@media (max-width: 1024px) {

	.stm-cards {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {

	.stm-cards {
		grid-template-columns: 1fr;
	}
}

/* -------------------------------------------------------------------------
 * Card — the whole card is the link.
 * ---------------------------------------------------------------------- */

.stm-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #ffffff;
	border: 1px solid #DDD0C4;
	border-radius: 6px;
	color: inherit;
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stm-card:hover,
.stm-card:focus-visible {
	box-shadow: 0 6px 18px rgba(46, 26, 24, 0.1);
	transform: translateY(-2px);
	text-decoration: none;
}

.stm-card:focus-visible {
	outline: 2px solid #6B0F36;
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * Featured image — a fixed 3:2 box so images line up across a row. The cream
 * background doubles as the placeholder when a post has no featured image.
 * ---------------------------------------------------------------------- */

.stm-card__media {
	position: relative;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	background: #F4EDE8;
}

/*
 * Absolutely positioned so the image always fills the 3:2 box and crops to fit,
 * whatever shape it is. Themes and Elementor both ship a global
 * `img {height: auto}`, which otherwise lets a wide, short image sit at its
 * natural height with the background showing below it — hence the !important.
 */
.stm-card__image {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: cover;
	object-position: center;
}

/* -------------------------------------------------------------------------
 * Date bar — events only.
 * ---------------------------------------------------------------------- */

.stm-card__date {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 16px 20px;
	background: #6B0F36;
}

.stm-card__day {
	font-family: "ivypresto-headline", Sans-serif, serif;
	font-size: 36px;
	font-weight: 300;
	line-height: 1;
	color: #ffffff;
}

.stm-card__month {
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #bf9b67;
}

/* -------------------------------------------------------------------------
 * Body.
 * ---------------------------------------------------------------------- */

.stm-card__body {
	flex: 1;
	padding: 20px;
}

.stm-card__type {
	margin-bottom: 8px;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: #6B0F36;
}

/*
 * font-weight is !important here only to beat the global
 * `h1, h2, h3 {font-weight: 300 !important}` rule at the bottom of styles.css.
 */
.stm-card__title {
	margin: 0 0 8px;
	font-family: "ivypresto-headline", Sans-serif, serif;
	font-size: 20px;
	font-weight: 600 !important;
	line-height: 1.3;
	color: #2E1A18;
	transition: color 0.2s ease;
}

.stm-card:hover .stm-card__title,
.stm-card:focus-visible .stm-card__title {
	color: #6B0F36;
}

.stm-card__meta {
	font-size: 13px;
	line-height: 1.5;
	color: #8A7070;
}
