/*
 * Reuses the theme's existing design tokens (--base, --base-2, --contrast,
 * --contrast-2, --contrast-3, --pink) so these blocks sit alongside the
 * existing GenerateBlocks patterns without a second color system.
 *
 * Image sizing is deliberately generous — product photos are what sell on
 * a toy guide, so the feature card gives the image a full 380px column and
 * grid cards use a tall 200px+ slot rather than a thumbnail.
 */

/* ---------- Shared card shell ---------- */

/* Blocks sit flush against surrounding content without this. Grid children
   are excluded — their spacing comes from the container's gap, and a margin
   here made the rows overlap. */
.mmt-amzn-card,
.mmt-amzn-grid-section {
	margin-block: 28px;
}

.mmt-amzn-grid .mmt-amzn-card {
	margin-block: 0;
}

.mmt-amzn-card {
	background: var( --base );
	border-radius: 24px;
	box-shadow: 0 14px 34px rgba( 54, 43, 74, 0.10 );
	box-sizing: border-box;
	padding: 16px;
}

.mmt-amzn-empty {
	background: #fff3f3;
	border: 1px dashed #d88;
	border-radius: 16px;
	color: #a33;
	font-family: 'Nunito', sans-serif;
	font-size: 14px;
	padding: 16px 20px;
}

/* ---------- Feature card (large, image left) ---------- */

.mmt-amzn-feature {
	display: grid;
	grid-template-columns: minmax( 0, 360px ) minmax( 0, 1fr );
	gap: 28px;
	align-items: stretch;
}

.mmt-amzn-feature .mmt-amzn-media {
	/* Fills the full card height whatever the body's length, with the photo
	   centered and free whitespace around it rather than being cropped. */
	align-self: stretch;
	height: 100%;
	min-height: 340px;
}

.mmt-amzn-feature .mmt-amzn-body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
	padding: 16px 20px 16px 0;
}

@media ( max-width: 1024px ) {
	.mmt-amzn-feature { grid-template-columns: 1fr; gap: 18px; }
	.mmt-amzn-feature .mmt-amzn-media { height: 340px; }
	.mmt-amzn-feature .mmt-amzn-body { padding: 0 8px 10px; }
}

@media ( max-width: 520px ) {
	.mmt-amzn-feature { padding: 12px; border-radius: 20px; }
	.mmt-amzn-feature .mmt-amzn-media { height: 300px; }
}

/* ---------- Compact card (horizontal) ---------- */

.mmt-amzn-compact {
	display: flex;
	gap: 18px;
	align-items: stretch;
	padding: 12px;
}

.mmt-amzn-compact .mmt-amzn-media {
	flex-shrink: 0;
	height: 165px;
	width: 165px;
}

.mmt-amzn-compact .mmt-amzn-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
	padding: 8px 8px 8px 0;
}

@media ( max-width: 560px ) {
	.mmt-amzn-compact .mmt-amzn-media { height: 130px; width: 130px; }
}

@media ( max-width: 440px ) {
	.mmt-amzn-compact { flex-direction: column; }
	.mmt-amzn-compact .mmt-amzn-media { width: 100%; height: 240px; }
	.mmt-amzn-compact .mmt-amzn-body { padding: 4px; }
}

/* ---------- Grid ---------- */

.mmt-amzn-grid-section {
	background: var( --base-2 );
	border-radius: 24px;
	box-sizing: border-box;
	padding: 20px;
	width: 100%;
}

.mmt-amzn-grid-intro {
	color: var( --contrast-3 );
	font-family: 'Nunito', sans-serif;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.5;
	margin: 0 0 16px;
	text-align: center;
}

.mmt-amzn-grid {
	display: grid;
	gap: 14px;
}

.mmt-amzn-grid-cols-2 { grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); }
.mmt-amzn-grid-cols-3 { grid-template-columns: repeat( 3, minmax( 0, 1fr ) ); }
.mmt-amzn-grid-cols-4 { grid-template-columns: repeat( 4, minmax( 0, 1fr ) ); }

.mmt-amzn-grid .mmt-amzn-card {
	border-radius: 18px;
	box-shadow: 0 8px 18px rgba( 54, 43, 74, 0.07 );
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
	padding: 10px;
	text-align: center;
}

.mmt-amzn-grid .mmt-amzn-media {
	height: 200px;
	margin-bottom: 10px;
}

.mmt-amzn-grid .mmt-amzn-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
}

.mmt-amzn-grid .mmt-amzn-cta-row {
	justify-content: center;
	margin-top: auto;
	padding-top: 8px;
}

@media ( max-width: 900px ) {
	.mmt-amzn-grid-cols-3,
	.mmt-amzn-grid-cols-4 { grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); }
	.mmt-amzn-grid .mmt-amzn-media { height: 220px; }
}

@media ( max-width: 520px ) {
	.mmt-amzn-grid-section { padding: 16px; }
	.mmt-amzn-grid-cols-2,
	.mmt-amzn-grid-cols-3,
	.mmt-amzn-grid-cols-4 { grid-template-columns: 1fr; }
	.mmt-amzn-grid .mmt-amzn-media { height: 260px; }
}

/* ---------- Classifier pills (age + attributes) ---------- */

.mmt-amzn-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 12px;
}

.mmt-amzn-grid .mmt-amzn-tags {
	justify-content: center;
	margin-bottom: 8px;
}

.mmt-amzn-tag {
	background: #fff;
	border: 1.5px solid var( --contrast, #362B4A );
	border-radius: 999px;
	color: var( --contrast, #362B4A );
	font-family: 'Nunito', sans-serif;
	font-size: 11px;
	font-weight: 800;
	line-height: 1;
	padding: 5px 11px;
	white-space: nowrap;
}

.mmt-amzn-grid .mmt-amzn-tag { font-size: 10px; padding: 4px 9px; }

/* The age pill leads, so give it a touch more presence. */
.mmt-amzn-tag.is-age {
	background: var( --contrast, #362B4A );
	color: #fff;
}

.mmt-amzn-card.is-dark-card .mmt-amzn-tag {
	background: transparent;
	border-color: rgba( 255, 255, 255, 0.55 );
	color: #fff;
}

.mmt-amzn-card.is-dark-card .mmt-amzn-tag.is-age {
	background: #fff;
	border-color: #fff;
	color: var( --contrast, #362B4A );
}

/* ---------- Dark feature treatment ---------- */

.mmt-amzn-card.is-dark-card {
	background: var( --contrast, #362B4A );
	box-shadow: 0 18px 40px rgba( 54, 43, 74, 0.28 );
}

.mmt-amzn-card.is-dark-card .mmt-amzn-title,
.mmt-amzn-card.is-dark-card .mmt-amzn-price {
	color: #fff;
}

.mmt-amzn-card.is-dark-card .mmt-amzn-blurb {
	color: var( --tint, #E4DBFF );
}

.mmt-amzn-card.is-dark-card .mmt-amzn-features {
	color: #D8CCEF;
}

.mmt-amzn-card.is-dark-card .mmt-amzn-list-price,
.mmt-amzn-card.is-dark-card .mmt-amzn-stale-note {
	color: #B8A9D6;
}

/* ---------- Media + carousel ---------- */

.mmt-amzn-media {
	align-items: center;
	background: #fff;
	border-radius: 18px;
	display: flex;
	justify-content: center;
	overflow: hidden;
	position: relative;
}

.mmt-amzn-slides {
	height: 100%;
	min-height: inherit;
	position: relative;
	width: 100%;
}

/* Slides are absolutely positioned so the container's height is the only
   thing that decides the image box. Without this, a percentage height has
   no definite parent to resolve against and every product renders at its
   own natural size — which is what made the grid ragged. */
.mmt-amzn-slide {
	height: 100%;
	inset: 0;
	object-fit: contain;
	opacity: 0;
	padding: 18px;
	pointer-events: none;
	position: absolute;
	box-sizing: border-box;
	width: 100%;
}

.mmt-amzn-slide.is-active {
	opacity: 1;
	pointer-events: auto;
}

.mmt-amzn-nav {
	background: rgba( 255, 255, 255, 0.9 );
	border: 0;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba( 54, 43, 74, 0.18 );
	color: var( --contrast );
	cursor: pointer;
	font-size: 20px;
	height: 32px;
	line-height: 1;
	opacity: 0;
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	transition: opacity 0.15s ease;
	width: 32px;
}

.mmt-amzn-media:hover .mmt-amzn-nav,
.mmt-amzn-media:focus-within .mmt-amzn-nav {
	opacity: 1;
}

/* Touch devices don't hover — always show the arrows there. */
@media ( hover: none ) {
	.mmt-amzn-nav { opacity: 1; }
}

.mmt-amzn-prev { left: 8px; }
.mmt-amzn-next { right: 8px; }

.mmt-amzn-dots {
	bottom: 8px;
	display: flex;
	gap: 5px;
	justify-content: center;
	left: 0;
	position: absolute;
	right: 0;
}

.mmt-amzn-dot {
	background: rgba( 54, 43, 74, 0.25 );
	border-radius: 50%;
	cursor: pointer;
	height: 7px;
	transition: background 0.15s ease;
	width: 7px;
}

.mmt-amzn-dot.is-active {
	background: var( --contrast-2 );
}

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

.mmt-amzn-badge {
	align-self: flex-start;
	background: var( --contrast-2 );
	border-radius: 999px;
	color: var( --base );
	display: inline-block;
	font-family: 'Nunito', sans-serif;
	font-size: 11px;
	font-weight: 800;
	margin-bottom: 10px;
	padding: 5px 14px;
}

.mmt-amzn-grid .mmt-amzn-badge {
	align-self: center;
	font-size: 10.5px;
	padding: 4px 11px;
}

.mmt-amzn-title {
	color: var( --contrast );
	font-family: 'Titan One', sans-serif;
	font-weight: 400;
	line-height: 1.2;
	margin: 0 0 7px;
}

.mmt-amzn-feature .mmt-amzn-title { font-size: 25px; }
.mmt-amzn-compact .mmt-amzn-title { font-size: 17px; }
.mmt-amzn-grid .mmt-amzn-title {
	font-size: 14.5px;
	/* Keeps the price/button row from drifting when titles differ in
	   length — roughly three lines of headroom. */
	min-height: 3.6em;
}

@media ( max-width: 520px ) {
	.mmt-amzn-feature .mmt-amzn-title { font-size: 21px; }
}

.mmt-amzn-blurb {
	color: var( --contrast );
	font-family: 'Nunito', sans-serif;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.55;
	margin: 0 0 10px;
}

.mmt-amzn-features {
	color: var( --contrast-3 );
	font-family: 'Nunito', sans-serif;
	font-size: 13px;
	line-height: 1.55;
	margin: 0 0 12px;
	padding-left: 20px;
	text-align: left;
}

.mmt-amzn-cta-row {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.mmt-amzn-price-group {
	align-items: baseline;
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
}

.mmt-amzn-price {
	color: var( --contrast );
	font-family: 'Nunito', sans-serif;
	font-size: 19px;
	font-weight: 800;
}

.mmt-amzn-grid .mmt-amzn-price { font-size: 15px; }

.mmt-amzn-list-price {
	color: var( --contrast-3 );
	font-family: 'Nunito', sans-serif;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: line-through;
}

.mmt-amzn-savings {
	background: var( --pink, #ffd9ec );
	border-radius: 999px;
	color: var( --contrast );
	font-family: 'Nunito', sans-serif;
	font-size: 10.5px;
	font-weight: 800;
	padding: 3px 9px;
	white-space: nowrap;
}

.mmt-amzn-button {
	background: var( --mmt-btn-bg, var( --contrast-2 ) );
	border-radius: 999px;
	box-shadow: 0 8px 18px rgba( 176, 132, 245, 0.32 );
	box-sizing: border-box;
	/* Explicit #fff rather than var(--base): if the theme's --base ever
	   resolves near the button background the label vanishes, which is
	   exactly what happened in testing. */
	color: var( --mmt-btn-text, #fff );
	display: inline-block;
	font-family: 'Nunito', sans-serif;
	font-size: 13.5px;
	font-weight: 800;
	line-height: 1.2;
	padding: 13px 24px;
	text-align: center;
	text-decoration: none;
}

.mmt-amzn-grid .mmt-amzn-button {
	font-size: 12px;
	padding: 9px 16px;
	width: 100%;
}

/* High specificity + text-fill-color: themes commonly set `a{color:inherit}`,
   which repaints the label to the card's own text color and can make it
   vanish against the button background. */
.mmt-amzn-card a.mmt-amzn-button,
.mmt-amzn-card a.mmt-amzn-button:link,
.mmt-amzn-card a.mmt-amzn-button:hover,
.mmt-amzn-card a.mmt-amzn-button:focus,
.mmt-amzn-card a.mmt-amzn-button:active,
.mmt-amzn-card a.mmt-amzn-button:visited {
	color: var( --mmt-btn-text, #fff );
	-webkit-text-fill-color: var( --mmt-btn-text, #fff );
	text-decoration: none;
}

.mmt-amzn-stale-note {
	color: var( --contrast-3 );
	font-family: 'Nunito', sans-serif;
	font-size: 11.5px;
	font-style: italic;
	margin: 8px 0 0;
}

@media ( max-width: 480px ) {
	.mmt-amzn-feature .mmt-amzn-button,
	.mmt-amzn-compact .mmt-amzn-button { display: block; width: 100%; }
}
