/**
 * SMM Fame final responsive and reflow safeguards.
 *
 * Loaded after the design-system, component, and page layers. Keep this file
 * focused on cross-page overflow fixes and breakpoint corrections only.
 */

/* Shared overflow and reflow guards -------------------------------------- */

.site-page__content input,
.site-page__content select,
.site-page__content textarea,
.woocommerce-area input,
.woocommerce-area select,
.woocommerce-area textarea,
.woocommerce-MyAccount-content input,
.woocommerce-MyAccount-content select,
.woocommerce-MyAccount-content textarea {
	box-sizing: border-box;
	max-width: 100%;
	min-width: 0;
}

.woocommerce nav.woocommerce-pagination ul,
.woocommerce .woocommerce-pagination ul.page-numbers {
	display: inline-flex;
	max-width: 100%;
	justify-content: center;
	flex-wrap: wrap;
	white-space: normal;
}

.site-page__content img,
.site-page__content video,
.site-page__content audio,
.site-page__content iframe,
.site-page__content embed,
.site-page__content object,
.site-page__content canvas,
.site-page__content figure,
.woocommerce-area img,
.woocommerce-area video,
.woocommerce-area audio,
.woocommerce-area iframe,
.woocommerce-area embed,
.woocommerce-area object,
.woocommerce-area canvas,
.woocommerce-area figure,
.woocommerce-MyAccount-content img,
.woocommerce-MyAccount-content video,
.woocommerce-MyAccount-content audio,
.woocommerce-MyAccount-content iframe,
.woocommerce-MyAccount-content embed,
.woocommerce-MyAccount-content object,
.woocommerce-MyAccount-content canvas,
.woocommerce-MyAccount-content figure {
	max-width: 100%;
}

.site-page__content pre,
.woocommerce-area pre,
.woocommerce-MyAccount-content pre {
	max-width: 100%;
	overflow-x: auto;
	white-space: pre;
	-webkit-overflow-scrolling: touch;
}

/* Account shell, classic checkout, and mobile navigation ---------------- */

@media (max-width: 900px) {
	.woocommerce-account.logged-in .site-page__content > .woocommerce {
		grid-template-columns: minmax(0, 1fr);
	}

	.woocommerce-account .woocommerce-MyAccount-navigation {
		position: static;
		top: auto;
	}

	.woocommerce-account .woocommerce-MyAccount-navigation ul {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 4px;
	}

	.woocommerce-account .woocommerce-MyAccount-navigation li + li {
		margin-top: 0;
	}

	.woocommerce-checkout form.checkout {
		grid-template-columns: minmax(0, 1fr);
	}

	.woocommerce-checkout form.checkout .col2-set,
	.woocommerce-checkout form.checkout #order_review_heading,
	.woocommerce-checkout form.checkout #order_review {
		min-width: 0;
		grid-column: 1;
	}

	.admin-bar .main-navigation {
		max-height: calc(100vh - 100px);
		max-height: calc(100dvh - 100px);
	}
}

/* Product and Cart Block composition ------------------------------------ */

@media (max-width: 820px) {
	.single-product .woocommerce div.product div.images,
	.single-product .woocommerce div.product div.summary {
		float: none;
		clear: both;
		width: 100%;
	}

	.wc-block-components-sidebar-layout.wc-block-cart,
	.wc-block-cart .wc-block-components-sidebar-layout {
		flex-direction: column;
	}

	.wc-block-cart .wc-block-components-main,
	.wc-block-cart .wc-block-components-sidebar {
		width: 100%;
		max-width: none;
		min-width: 0;
		flex-basis: auto;
	}

	.wc-block-cart .wc-block-components-main {
		padding-right: 0;
		padding-left: 0;
	}
}

/* WordPress admin-bar and Checkout Block corrections -------------------- */

@media (max-width: 782px) {
	.admin-bar .main-navigation {
		max-height: calc(100vh - 114px);
		max-height: calc(100dvh - 114px);
	}

	.woocommerce-checkout .wp-block-woocommerce-checkout .wc-block-components-checkout-step {
		padding: 18px !important;
	}

	.wp-block-woocommerce-checkout .wc-block-checkout__actions_row {
		width: 100%;
		align-items: stretch;
		flex-direction: column;
	}

	.wp-block-woocommerce-checkout .wc-block-checkout__actions_row .wc-block-components-checkout-place-order-button,
	.wp-block-woocommerce-checkout .wc-block-components-checkout-place-order-button {
		width: 100%;
		max-width: none;
	}
}

/* Critical 200% zoom and narrow-screen reflow --------------------------- */

@media (max-width: 640px) {
	.smm-fame-auth-register .smm-fame-name-row {
		grid-template-columns: minmax(0, 1fr) !important;
	}

	.smm-fame-auth-register .smm-fame-name-row .form-row,
	.smm-fame-auth-register .smm-fame-name-row .woocommerce-form-row {
		float: none !important;
		width: 100% !important;
		max-width: none !important;
		min-width: 0;
	}

	.smm-fame-auth-register .smm-fame-name-row input {
		width: 100% !important;
		max-width: none !important;
		min-width: 0;
	}

	.woocommerce-account .woocommerce-MyAccount-navigation ul,
	.smm-account-stats,
	.smm-campaign-row,
	.smm-detail-grid,
	.smm-detail-item dl,
	.woocommerce-account .woocommerce-Addresses,
	.smm-fame-tracker__form,
	.smm-fame-tracking-result dl,
	.smm-fame-order-dashboard dl,
	.single-product .smm-fame-campaign-info dl {
		grid-template-columns: minmax(0, 1fr);
	}

	.smm-detail-item dl > div,
	.smm-fame-tracking-result dl > div,
	.smm-fame-order-dashboard dl > div,
	.single-product .smm-fame-campaign-info dl > div {
		grid-template-columns: minmax(0, 1fr);
		gap: 4px;
	}

	.smm-campaign-row > .button,
	.smm-fame-tracker__form button {
		width: 100%;
	}

	.smm-account-table {
		width: 100%;
		min-width: 0;
	}

	.woocommerce-cart table.cart .product-name {
		min-width: 0;
	}

	.woocommerce-cart table.cart td.actions .coupon {
		width: 100%;
		align-items: stretch;
		flex-direction: column;
	}

	.woocommerce-cart table.cart td.actions .coupon .input-text,
	.woocommerce-cart table.cart td.actions .coupon .button {
		float: none;
		width: 100% !important;
		max-width: none;
		margin: 0;
	}

	.single-product .woocommerce div.product form.cart .woocommerce-variation-add-to-cart {
		display: flex;
		align-items: stretch;
		flex-direction: column;
		gap: 10px;
	}

	.single-product .woocommerce div.product form.cart div.quantity {
		float: none;
		width: 100%;
		margin: 0 0 10px;
	}

	.single-product .woocommerce div.product form.cart div.quantity .qty,
	.single-product .woocommerce div.product form.cart .single_add_to_cart_button {
		float: none;
		width: 100%;
		max-width: none;
		margin: 0;
	}
}

/* Small platform archive identity --------------------------------------- */

@media (max-width: 520px) {
	.campaign-directory-filter,
	.platform-help .site-container,
	.platform-assurance__grid {
		grid-template-columns: 1fr;
	}

	.campaign-directory-filter .button,
	.campaign-directory-filter__clear {
		width: 100%;
		justify-content: center;
	}

	.platform-assurance__grid > div {
		min-height: auto;
		padding: 20px 0;
	}

	.platform-assurance__grid > div + div {
		border-top: 1px solid rgba(255, 255, 255, 0.17);
		border-left: 0;
	}

	.platform-archive-header {
		align-items: flex-start;
		flex-direction: column;
	}

	.platform-archive-header > div {
		width: 100%;
		min-width: 0;
	}
}

/* Very narrow controls and confirmation actions ------------------------- */

@media (max-width: 390px) {
	.button,
	.woocommerce a.button,
	.woocommerce button.button,
	.woocommerce input.button,
	.woocommerce #respond input#submit {
		height: auto;
		min-height: 48px;
		white-space: normal;
		overflow-wrap: anywhere;
	}

	.campaign-card__top,
	.campaign-card__identity {
		align-items: flex-start;
		flex-wrap: wrap;
	}

	.campaign-card__featured {
		white-space: normal;
	}

	.smm-fame-order-actions,
	.woocommerce-order-received .woocommerce-thankyou-order-failed-actions {
		width: 100%;
		align-items: stretch;
		flex-direction: column;
	}

	.smm-fame-order-actions .button,
	.woocommerce-order-received .woocommerce-thankyou-order-failed-actions .button {
		width: 100%;
	}
}

/* Minimum supported viewport -------------------------------------------- */

@media (max-width: 320px) {
	.site-container {
		width: min(var(--smm-container), calc(100% - 24px));
	}

	.smm-account-auth__panel,
	.woocommerce-account .woocommerce-MyAccount-content,
	.smm-account-empty,
	.smm-detail-grid article,
	.smm-detail-item,
	.woocommerce-account .woocommerce-Address,
	.single-product .woocommerce div.product,
	.single-product .woocommerce div.product form.cart,
	.single-product .smm-fame-campaign-info,
	.woocommerce-cart .cart-collaterals .cart_totals,
	.wc-block-cart .wc-block-components-sidebar,
	.smm-fame-confirmation,
	.smm-fame-order-dashboard,
	.smm-fame-next {
		padding: 18px;
	}
}
