/* Shop by type (patterns/home-types.php), round 3. Loaded after home.css on the homepage and in the editor. Owner: hero.

   Three tall photo tiles (4:5) on white: the engine, the transmission gears, the turbo. The name sits at the
   foot of the photo in the display face over a dark gradient that is the same on every tile, so the text
   reads whatever photo Hamid drops in. Hover or focus: the photo scales 1.03, the arrow moves. The whole tile
   is the link. Phones stack the tiles at 16:10.

   The markup keeps .jkd-types (for the page rhythm in home.css) but not .jkd-tiles or .jkd-tile, so the old
   "Shop by type" rules in home.css, and the .jkd-tile lines in its tablet and phone blocks, match nothing any
   more: delete them at integration. The shared .jkd-head rules are reused on purpose. */

.jkd-sec.jkd-types {
	--jkd-type-h3: clamp(30px, 1.5vw + 12px, 50px);            /* 34 at 1440, 41 at 1920, 50 from 2530 */
	--jkd-type-pad: clamp(20px, 1.8vw, 36px);
	--jkd-type-gap: clamp(14px, 1.4vw, 28px);
}
/* Head: the title left, one line of note right, both on the same baseline (last baseline, in case the note ever wraps) */
.jkd-sec.jkd-types .jkd-types__head { margin-bottom: clamp(20px, 2vw, 36px); align-items: last baseline; row-gap: 8px; }
.jkd-sec.jkd-types .jkd-types__head h2 { font-size: clamp(30px, 1.5vw + 12px, 52px); line-height: .95; }
.jkd-sec.jkd-types .jkd-types__note { max-width: none; line-height: 1.3; text-wrap: balance; }

.jkd-sec.jkd-types .jkd-types__grid { gap: var(--jkd-type-gap); margin: 0; }
.jkd-sec.jkd-types .jkd-types__grid > .wp-block-column { min-width: 0; }

.jkd-types .jkd-type.wp-block-cover {
	position: relative;
	display: flex;
	align-items: flex-end;
	min-height: 0; /* the block's own 430px default; the tile takes its height from the ratio */
	aspect-ratio: 4 / 5;
	margin: 0;
	padding: var(--jkd-type-pad);
	border-radius: var(--jkd-radius);
	overflow: hidden;
	isolation: isolate;
	background: var(--jkd-black);
}
.jkd-types .jkd-type .wp-block-cover__image-background {
	transition: transform .8s var(--jkd-ease);
	will-change: transform;
}
.jkd-types .jkd-type:hover .wp-block-cover__image-background,
.jkd-types .jkd-type:has(a:focus-visible) .wp-block-cover__image-background { transform: scale(1.03); }
/* One gradient for every tile, whatever the photo: clear at the top, near-black at the foot where the words are */
.jkd-types .jkd-type.wp-block-cover .wp-block-cover__background {
	opacity: 1;
	background: linear-gradient(to top,
		rgba(14, 15, 17, .94) 0%,
		rgba(14, 15, 17, .72) 26%,
		rgba(14, 15, 17, .28) 52%,
		rgba(14, 15, 17, 0) 76%) !important;
}
.jkd-types .jkd-type .wp-block-cover__inner-container { position: static; width: 100%; max-width: 100% !important; margin: 0; }
.jkd-types .jkd-type .wp-block-cover__inner-container > * { margin: 0; }

.jkd-types .jkd-type h3 {
	margin: 0;
	color: #fff;
	font: 800 var(--jkd-type-h3)/.92 var(--jkd-display);
	letter-spacing: -.005em;
	text-transform: uppercase;
}
.jkd-types .jkd-type p {
	margin: .55em 0 0;
	max-width: 22em;
	color: var(--jkd-on-dark);
	font-size: var(--jkd-fs);
	line-height: 1.45;
}
.jkd-types .jkd-type .jkd-type__go {
	margin-top: clamp(14px, 1.2vw, 22px);
	font-size: var(--jkd-btn-fs);
	font-weight: 700;
	line-height: 1;
	letter-spacing: .06em;
	text-transform: uppercase;
}
.jkd-types .jkd-type .jkd-type__go a {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 0; /* a 44px tap target without moving the text */
	margin: -14px 0;
	color: #fff;
	text-decoration: none;
}
/* The arrow, white; it slides right when the tile is hovered or focused */
.jkd-types .jkd-type .jkd-type__go a::before {
	content: "";
	order: 1;
	width: 1.5em;
	height: 1.5em;
	background: currentColor;
	-webkit-mask: url(../home/icon-arrow.svg) center / contain no-repeat;
	mask: url(../home/icon-arrow.svg) center / contain no-repeat;
	transition: transform .3s var(--jkd-ease), background-color .3s;
}
.jkd-types .jkd-type:hover .jkd-type__go a::before,
.jkd-types .jkd-type:has(a:focus-visible) .jkd-type__go a::before { transform: translateX(6px); background: var(--jkd-red); }
/* The whole tile is the link */
.jkd-types .jkd-type .jkd-type__go a::after { content: ""; position: absolute; inset: 0; z-index: 2; }
/* Keyboard: one red ring around the tile, none inside it */
.jkd-types .jkd-type:has(a:focus-visible) { outline: 2px solid var(--jkd-red); outline-offset: 3px; }
.home .entry-content .jkd-types .jkd-type a:focus-visible { outline: none; }

/* ------------------------------------------------------------------ Tablets in landscape (782 to 1024): the tiles are narrow, so the line of text goes */
@media (max-width: 1024px) and (min-width: 782px) {
	.jkd-sec.jkd-types { --jkd-type-pad: 18px; }
	.jkd-types .jkd-type p:not(.jkd-type__go) { display: none; }
	.jkd-types .jkd-type .jkd-type__go { margin-top: 12px; }
}

/* ------------------------------------------------------------------ Phones and small tablets: stacked, wide, the text kept */
@media (max-width: 781px) {
	.jkd-sec.jkd-types { --jkd-type-h3: clamp(30px, 8vw, 44px); --jkd-type-pad: 20px; --jkd-type-gap: 12px; }
	.jkd-sec.jkd-types .jkd-types__head { margin-bottom: 18px; }
	.jkd-sec.jkd-types .jkd-types__note { flex-basis: 100%; max-width: none; }
	.jkd-types .jkd-type.wp-block-cover { aspect-ratio: 16 / 10; }
	.jkd-types .jkd-type p:not(.jkd-type__go) { max-width: 24em; font-size: 15px; }
}
/* Larger phones and small tablets (600 to 781): three across, portrait, name and link only */
@media (max-width: 781px) and (min-width: 600px) {
	.jkd-sec.jkd-types .jkd-types__grid { flex-wrap: nowrap; }
	.jkd-sec.jkd-types .jkd-types__grid > .wp-block-column { flex-basis: 0 !important; flex-grow: 1; }
	.jkd-types .jkd-type.wp-block-cover { aspect-ratio: 3 / 4; padding: 16px; }
	.jkd-types .jkd-type p:not(.jkd-type__go) { display: none; }
	.jkd-types .jkd-type .jkd-type__go { margin-top: 12px; }
}

/* ------------------------------------------------------------------ Less motion: no scale, the arrow just changes colour */
@media (prefers-reduced-motion: reduce) {
	.jkd-types .jkd-type .wp-block-cover__image-background,
	.jkd-types .jkd-type .jkd-type__go a::before { transition: none; }
	.jkd-types .jkd-type:hover .wp-block-cover__image-background,
	.jkd-types .jkd-type:has(a:focus-visible) .wp-block-cover__image-background { transform: none; }
	.jkd-types .jkd-type:hover .jkd-type__go a::before,
	.jkd-types .jkd-type:has(a:focus-visible) .jkd-type__go a::before { transform: none; }
}
