/* =============================================================================
   TinySpacer — featured-categories.css
   -----------------------------------------------------------------------------
   Layout + card styling for the homepage "Browse by Room" section
   (template-parts/home/featured-categories.php).

   Scope: this file styles ONLY .ts-featured-cats and its .ts-room-card grid.
   It composes with global.css tokens and the .ts-section-heading component —
   it never redefines a shared component.

   Mobile-first. Min-width media queries only. No framework.

   Contents:
     1. Section shell
     2. Responsive grid
     3. Room card (media, body, arrow cue)
     4. Interaction (hover / focus-within / stretched link)
     5. Reduced-motion & forced-colors
   ========================================================================== */

/* =============================================================================
   1. SECTION SHELL
   ========================================================================== */

.ts-featured-cats {
	background-color: var(--ts-color-bg);
}

/* =============================================================================
   2. RESPONSIVE GRID
   -----------------------------------------------------------------------------
   1 column (mobile) → 2 columns (>=40em) → 3 columns (>=64em).
   Built locally rather than via .ts-grid--cols-3 so the card wall reads as a
   semantic <ul> list with its own reset.
   ========================================================================== */

.ts-room-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--ts-grid-gap);
	grid-template-columns: 1fr;
}

@media (min-width: 40em) { /* 640px */
	.ts-room-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 64em) { /* 1024px */
	.ts-room-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* =============================================================================
   3. ROOM CARD
   -----------------------------------------------------------------------------
   Whole card is clickable via the stretched-link pattern: the <a> inside the
   title projects a pseudo-element over the entire card, so the card is a single
   pointer target while remaining one accessible tab stop.
   ========================================================================== */

.ts-room-card {
	position: relative; /* Anchor for the stretched link. */
	display: flex;
	flex-direction: column;
	background-color: var(--ts-color-surface);
	border: 1px solid var(--ts-color-border);
	border-radius: var(--ts-radius-lg);
	box-shadow: var(--ts-shadow-sm);
	overflow: hidden;
	transition:
		transform var(--ts-transition-slow),
		box-shadow var(--ts-transition-slow),
		border-color var(--ts-transition-base);
}

/* ---- Media ---------------------------------------------------------------- */

.ts-room-card__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background-color: var(--ts-color-surface-alt);
}

.ts-room-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--ts-transition-slow);
}

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

.ts-room-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--ts-space-2);
	padding: var(--ts-space-5);
	flex: 1 1 auto;
}

.ts-room-card__title {
	font-family: var(--ts-font-heading);
	font-size: var(--ts-text-xl);
	font-weight: var(--ts-weight-semibold);
	line-height: var(--ts-leading-snug);
	color: var(--ts-color-heading);
	margin: 0;
}

.ts-room-card__link {
	color: inherit;
	text-decoration: none;
}

/* Stretched link — cover the whole card without adding a second tab stop. */
.ts-room-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: var(--ts-z-base);
}

.ts-room-card__desc {
	margin: 0;
	font-size: var(--ts-text-base);
	line-height: var(--ts-leading-normal);
	color: var(--ts-color-text-muted);
}

/* ---- Arrow cue ------------------------------------------------------------ */

.ts-room-card__cue {
	display: inline-flex;
	align-items: center;
	gap: var(--ts-space-2);
	margin-block-start: auto;
	padding-block-start: var(--ts-space-3);
	font-family: var(--ts-font-heading);
	font-size: var(--ts-text-sm);
	font-weight: var(--ts-weight-medium);
	color: var(--ts-color-link);
}

.ts-room-card__arrow {
	flex-shrink: 0;
	transition: transform var(--ts-transition-base);
}

/* =============================================================================
   4. INTERACTION
   -----------------------------------------------------------------------------
   Lift + soft shadow on hover; :focus-within mirrors it for keyboard users.
   ========================================================================== */

.ts-room-card:hover,
.ts-room-card:focus-within {
	transform: translateY(-4px);
	box-shadow: var(--ts-shadow-lg);
	border-color: color-mix(in srgb, var(--ts-color-primary) 35%, var(--ts-color-border));
}

.ts-room-card:hover .ts-room-card__image,
.ts-room-card:focus-within .ts-room-card__image {
	transform: scale(1.04);
}

.ts-room-card:hover .ts-room-card__cue,
.ts-room-card:focus-within .ts-room-card__cue {
	color: var(--ts-color-link-hover);
}

.ts-room-card:hover .ts-room-card__arrow,
.ts-room-card:focus-within .ts-room-card__arrow {
	transform: translateX(4px);
}

/* Keep the keyboard focus ring on the actual link, above the stretched overlay. */
.ts-room-card__link:focus-visible {
	outline: none;
	border-radius: var(--ts-radius-sm);
	box-shadow: var(--ts-shadow-focus);
}

/* =============================================================================
   5. REDUced-MOTION & FORCED-COLORS
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.ts-room-card,
	.ts-room-card__image,
	.ts-room-card__arrow {
		transition: none;
	}

	.ts-room-card:hover,
	.ts-room-card:focus-within {
		transform: none;
	}

	.ts-room-card:hover .ts-room-card__image,
	.ts-room-card:focus-within .ts-room-card__image {
		transform: none;
	}

	.ts-room-card:hover .ts-room-card__arrow,
	.ts-room-card:focus-within .ts-room-card__arrow {
		transform: none;
	}
}

@media (forced-colors: active) {
	.ts-room-card {
		border: 1px solid CanvasText;
	}
}
