/* Product page grouped features (components/product-features.php, #53). Mobile first:
   screenshot, then eyebrow + H3, features stacked; from 600px a 2×2 feature grid; from 1024px
   screenshot | features rows that alternate sides (1120 max, 48px gap, 1px dividers). */
@layer components {
	.cp-features { --cp-tint: color-mix(in srgb, var(--cp-teal) 16%, var(--cp-white)); /* light teal tile; teal-ink icon on it is > 5:1 */ }
	.cp-features__head { display: grid; gap: var(--cp-s1); margin-bottom: var(--cp-s3); max-width: var(--cp-prose); }
	.cp-features__head h2 { font-size: clamp(28px, 25.9px + 0.55vw, 32px); }
	.cp-features__intro { font-size: var(--cp-text-md); color: var(--cp-grey-2); }

	.cp-fgroup { display: grid; gap: var(--cp-s3); padding-block: var(--cp-s3); border-top: 1px solid var(--cp-line); }
	.cp-fgroup__media { min-width: 0; }
	.cp-fgroup__img, .cp-fgroup__media .cp-ph {
		display: block;
		width: 100%;
		height: auto;
		aspect-ratio: 16 / 10;
		object-fit: cover;
		object-position: var(--cp-focus-xy, 50% 30%);
		border-radius: var(--cp-radius);
		background: var(--cp-grey);
		border: 1px solid var(--cp-line);
	}
	/* Phones/tablets: only the first group shows its screenshot (#53: keeps the section short; the
	   hidden images are loading=lazy + display:none, so they're never downloaded below 1024px). */
	@media (max-width: 1023.98px) { .cp-features__rest .cp-fgroup__media { display: none; } }
	.cp-fgroup__body { display: grid; align-content: start; justify-items: start; min-width: 0; }
	.cp-fgroup__body .cp-eyebrow { margin-bottom: var(--cp-s1); }
	.cp-fgroup__title { font-size: var(--cp-text-lg); line-height: 1.3; margin-bottom: var(--cp-s3); }

	.cp-fgroup__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--cp-s3); width: 100%; }
	.cp-feature { display: flex; gap: 12px; align-items: flex-start; }
	.cp-feature__icon {
		flex: none;
		display: grid;
		place-items: center;
		width: 40px;
		height: 40px;
		border-radius: 12px;
		background: var(--cp-tint);
		color: var(--cp-teal-ink);
	}
	.cp-feature__icon svg { width: 22px; height: 22px; }
	.cp-feature__text { display: grid; gap: 2px; min-width: 0; }
	.cp-feature__title { font: 600 16px/1.4 var(--cp-font-head); color: var(--cp-charcoal); }
	.cp-feature__body { font-size: 16px; line-height: 1.5; color: var(--cp-grey-2); }

	.cp-fgroup__more { display: inline-flex; align-items: center; min-height: var(--cp-tap); margin-top: var(--cp-s1); font-weight: 600; }

	.cp-features__more, .cp-features__more-phone { margin-top: var(--cp-s3); border-top: 1px solid var(--cp-line); }
	.cp-features__more-title { font-size: var(--cp-text-md); line-height: 1.4; padding-block: var(--cp-s2); }

	/* Phones (< 700px, #53): group 1 in full; groups 2+ and the "more" list behind one toggle.
	   No JS: a visually hidden but focusable checkbox drives the label (as the mobile nav does). */
	.cp-features__cb { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
	.cp-features__toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--cp-s2);
		min-height: var(--cp-tap);
		padding-block: var(--cp-s2);
		border-block: 1px solid var(--cp-line);
		cursor: pointer;
		font: 600 var(--cp-text-md)/1.4 var(--cp-font-head);
		color: var(--cp-charcoal);
	}
	.cp-features__toggle::after {
		content: "+";
		flex: none;
		display: grid;
		place-items: center;
		width: 32px;
		height: 32px;
		border-radius: 50%;
		background: var(--cp-grey);
		color: var(--cp-teal-ink);
		font: 600 22px/1 var(--cp-font-body);
	}
	.cp-features__cb:checked + .cp-features__toggle::after { content: "\2212"; }
	.cp-features__cb:focus-visible + .cp-features__toggle { outline: var(--cp-focus); outline-offset: var(--cp-focus-offset); }
	@media (max-width: 699.98px) {
		.cp-features__rest { display: none; }
		.cp-features__cb:checked ~ .cp-features__rest { display: block; }
		.cp-features__rest > .cp-fgroup:first-child { border-top: 0; } /* the toggle's border is the divider */
		.cp-features__more { display: none; } /* the plain list below replaces it inside the toggle */
		.cp-fgroup__grid { gap: var(--cp-s2); } /* padding-block is already 24px here */
	}
	@media (min-width: 700px) {
		.cp-features__cb, .cp-features__toggle, .cp-features__more-phone { display: none; }
	}
	@media (min-width: 1024px) { .cp-features__more { margin-top: var(--cp-s5); } }
	.cp-features__list { margin: 0; padding-inline-start: 1.2em; display: grid; gap: var(--cp-s1) var(--cp-s4); color: var(--cp-charcoal); }

	@media (min-width: 600px) {
		.cp-fgroup__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
		/* An odd last feature takes the whole row instead of leaving a gap. */
		.cp-feature:last-child:nth-child(odd) { grid-column: 1 / -1; }
		.cp-features__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	}
	@media (min-width: 1024px) {
		.cp-features__head { margin-bottom: var(--cp-s5); }
		.cp-fgroup { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--cp-s6); align-items: center; padding-block: var(--cp-s5); }
		.cp-fgroup--text { grid-template-columns: minmax(0, 1fr); }
		.cp-fgroup--flip .cp-fgroup__media { order: 2; } /* groups 2, 4 … (set in PHP: groups 2+ sit in .cp-features__rest) */
		.cp-features__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	}
	/* No image (production without the upload): one row, up to three features across. */
	@media (min-width: 1024px) {
		.cp-fgroup--text .cp-fgroup__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	}
}
