/* Schön — phone layer: home. Printed after responsive.css; see inc/enqueue.php.
 *
 * Phone-first composition for the CaveArt toy-store home page:
 *
 *   Row A > shop-by-age > shop-by-category > Row B > best sellers > partners
 *
 * Every tile CSS box matches the registered mobile image size, so
 * object-fit:cover discards nothing from the file generated at that ratio.
 *
 * Loaded AFTER responsive.css at the same specificity -- same selectors win
 * on source order.
 */

/* ==========================================================================
   <=767px -- phone home-page grid
   ========================================================================== */

@media (max-width: 767px) {

	/* Section ordering -- move age/category up, Row B down.
	   .container becomes flex column so CSS order takes effect. */

	body.home #mt-main > .container {
		display: flex;
		flex-direction: column;
	}

	/* Remove the desktop negative horizontal margins on banner rows so all
	   sections share the same gutter (the container padding). */
	.banner-frame {
		margin-left: 0;
		margin-right: 0;
	}

	.banner-frame.toppadding-zero   { order: 1; }
	.mt-ages                        { order: 2; }
	.mt-categories                  { order: 3; }
	.banner-frame.mt-paddingsmzero  { order: 4; }
	.mt-producttabs.style3          { order: 5; }
	.mt-patners                     { order: 6; }
	.schon-front-content            { order: 7; }

	body.home #mt-main > .container > * {
		width: 100%;
	}

	/* Row A -- hero + tall-lead / stacked-pair trio.
	   A1 hero     1:1   full width   schon-m-hero  780x780
	   A2 tall     left col           desktop file  552x1126
	   A3 stack-top right col upper   desktop file  640x600
	   A4 stack-bot right col lower   desktop file  640x600  */

	.banner-frame.toppadding-zero {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--schon-banner-gap);
	}

	.banner-frame.toppadding-zero > .banner-5,
	.banner-frame.toppadding-zero > .banner-6,
	.banner-frame.toppadding-zero > .banner-box.two {
		flex: none;
		max-width: none;
		margin: 0;
	}

	/* A1 hero: full-width, 1:1 -- matches the 780x780 mobile file. */
	.banner-frame.toppadding-zero > .banner-5 {
		grid-column: 1 / -1;
		aspect-ratio: 1 / 1;
	}

	/* A2 tall: left column, stretches to match the stacked pair. */
	.banner-frame.toppadding-zero > .banner-6 {
		grid-column: 1;
		aspect-ratio: auto;
		height: 100%;
	}

	/* Stacked pair: right column. */
	.banner-frame.toppadding-zero > .banner-box.two {
		grid-column: 2;
		display: flex;
		flex-direction: column;
		gap: var(--schon-banner-gap);
	}

	.banner-frame.toppadding-zero .banner-box.two > div {
		margin: 0;
		flex: 1 1 0%;
		aspect-ratio: 32 / 30;
	}

	/* Force cover on phones -- phone files match their CSS box ratio exactly,
	   so cover discards nothing. Override fit-contain/fit-fill Customizer
	   classes. Specificity (0,2,1) matches schon.css, source order wins. */

	.banner-frame .fit-contain > img,
	.banner-frame .fit-contain > picture > img,
	.banner-frame .fit-fill > img,
	.banner-frame .fit-fill > picture > img {
		object-fit: cover;
	}

	/* Row B -- three full-width tiles, each at its own ratio.
	   B1 feature-1 780/440 schon-m-wide    780x440
	   B2 feature-2 5/4     schon-m-feature 780x624
	   B3 slider    4/3     schon-m-slide   780x585  */

	.banner-frame.mt-paddingsmzero {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		gap: var(--schon-banner-gap);
	}

	.banner-frame.mt-paddingsmzero > .banner-box.third {
		display: contents;
	}

	.banner-frame.mt-paddingsmzero .banner-12,
	.banner-frame.mt-paddingsmzero .banner-13,
	.banner-frame.mt-paddingsmzero > .slider-7 {
		flex: none;
		max-width: none;
		margin: 0;
	}

	.banner-frame.mt-paddingsmzero .banner-12 {
		aspect-ratio: 780 / 440;
	}

	.banner-frame.mt-paddingsmzero .banner-13 {
		aspect-ratio: 5 / 4;
	}

	.slider-7 .s-holder {
		aspect-ratio: 4 / 3;
	}

	.banner-frame.mt-paddingsmzero .banner-box.third > div {
		margin: 0;
		aspect-ratio: unset;
	}

	/* Shop grid -- 2 columns at ALL phone widths. */

	ul.products.columns-2,
	ul.products.columns-3,
	ul.products.columns-4,
	ul.products.columns-5,
	ul.products.columns-6 {
		--schon-cols: 2;
	}

	.mt-product1 .img {
		aspect-ratio: 4 / 5;
		overflow: hidden;
	}

	.mt-product1 .img img {
		width: 100%;
		height: 100%;
		object-fit: contain;
	}

	.mt-product1 .title a {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.mt-product1 .txt .description {
		display: none;
	}

	/* Card action bar on phones: one "Add to cart" row. The wishlist and
	   quick-view cells are desktop hover affordances; at a 165px card they
	   squeezed the cart label into three stacked lines (measured 19 Oct). */
	.mt-product1 .links > li:not(.links-cart) {
		display: none;
	}

	.mt-product1 .links a,
	.mt-product1 .links button,
	.mt-product1 .links > li > span {
		padding: 10px 8px;
		font-size: 11px;
		white-space: nowrap;
	}

	/* Category cards -- 2-up at all phone widths (never 3). */

	.category-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}

	.category-card__title {
		font-size: 12px;
		line-height: 16px;
	}

	.category-card__media {
		aspect-ratio: 1 / 1;
	}

	.category-card__media img {
		object-fit: contain;
	}

	/* Age circles strip */

	.mt-ages {
		padding-top: 24px;
	}

	.mt-categories {
		padding-top: 24px;
	}

	/* Partners */

	.mt-patners {
		padding-bottom: 16px;
	}

	/* Section headings -- consistent 20px on phones */

	.mt-producttabs.style3 .heading,
	.patners-heading,
	.ages-heading,
	.categories-heading {
		font-size: 20px;
		line-height: 26px;
	}

	/* Text overlays */

	.banner-5 .holder {
		padding: 18px;
	}

	.banner-5 .banner-display {
		font-size: 26px;
		line-height: 32px;
	}

	.banner-6 h3 {
		font-size: 14px;
		line-height: 18px;
	}

	.banner-6 .sub-title {
		font-size: 10px;
		letter-spacing: 2px;
	}

	.banner-12 h2 strong,
	.banner-13 h2 strong {
		font-size: 14px;
		line-height: 18px;
	}

	.banner-12 h2 span,
	.banner-13 h2 span {
		font-size: 11px;
	}

	.slider-7 .s-box {
		max-width: 84%;
		left: 5%;
		bottom: 15%;
	}

}

/* ==========================================================================
   <=479px -- small phone tightening
   ========================================================================== */

@media (max-width: 479px) {

	ul.products.columns-2,
	ul.products.columns-3,
	ul.products.columns-4,
	ul.products.columns-5,
	ul.products.columns-6 {
		--schon-cols: 2;
		gap: 20px 10px;
	}

	.mt-product1 .img {
		aspect-ratio: 4 / 5;
	}

	.category-cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.banner-5 .banner-display {
		font-size: 20px;
		line-height: 26px;
	}

	.banner-frame .banner-6 > .holder > .offer {
		position: static;
		width: auto;
		height: auto;
		margin: 0;
		padding: 0;
		border-radius: 0;
		background: none;
	}

	.banner-6 .sub-title,
	.banner-6 h3 {
		padding-right: 0;
	}

	.banner-frame .banner-6 > .holder > .btn-shop {
		position: static;
		right: auto;
		bottom: auto;
		left: auto;
	}
}
