/**
 * Promotion of the meta boxes area on the block-editor product screen.
 *
 * Free scope: it belongs to the compatibility bridge, and losing the product
 * data to a 32px strip is not a paid feature.
 *
 * Phase 0 (`docs/phase-0-spikes.md`) measured the two states of the drawer core
 * renders the metaboxes in: 32px collapsed, 971px open. Nothing here moves,
 * clones or re-parents a postbox - `assets/js/bridge.js` only opens the drawer
 * (a click on core's own toggle) and marks it; this file makes the result a
 * place where a third-party box can be read and used.
 *
 * Enqueued by `Modules\LegacyMetaboxBridgeModule` on the product screen of the
 * block editor only.
 */

/* The drawer handle reads as a section header once the area is promoted.
   Core sizes it to a 32px strip (measured: 32px at every window width), which
   is the height of a collapsed drawer - the thing this promotion exists to
   replace. A promoted area gets a header tall enough to aim at. */
.bpe-bridge-drawer > .edit-post-meta-boxes-main__presenter > button {
	min-height: 44px;
	padding-top: 4px;
	padding-bottom: 4px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.01em;
}

/* The promoted area is a column of boxes, not a strip: room to breathe and a
   clear edge against the canvas behind it. */
.bpe-bridge-host {
	padding: 8px 16px 24px;
	border-top: 1px solid var( --wp-components-color-gray-200, #e0e0e0 );
}

.bpe-bridge-host .postbox {
	margin-bottom: 16px;
}

.bpe-bridge-host .postbox:last-child {
	margin-bottom: 0;
}

/* WooCommerce's product data tabs were laid out for a full-width screen; in the
   drawer the panels need their own padding, or the first field touches the
   tab rail. */
.bpe-bridge-host #woocommerce-product-data .inside {
	padding: 0 12px 12px;
}

/* The tab rail keeps its own background, so the panels below it read as one
   surface instead of two boxes stacked by accident. */
.bpe-bridge-host #woocommerce-product-data .woocommerce_options_panel {
	padding-top: 8px;
}

/* Keyboard users must see where they are in a promoted area as everywhere else. */
.bpe-bridge-host .postbox-header .hndle:focus-visible,
.bpe-bridge-host .woocommerce-tabs ul.wc-tabs a:focus-visible {
	outline: 2px solid var( --wp-admin-theme-color, #3858e9 );
	outline-offset: 2px;
}

/* Below 900px WooCommerce turns the product-data tab rail into a 10% icon
   strip: the label stays in the DOM but is parked off the box with
   `text-indent: -999px` and only the Dashicon remains (`admin.css`,
   `@media only screen and (max-width: 900px)`, measured rail width 46px at an
   800px window). The promoted drawer is narrower than a full screen at almost
   every window size, so this is the state a shop manager actually meets - and
   the tab the variations gate is about ("Variations") is then a glyph nobody
   can name. In the promoted area the rail keeps a fixed width that fits its
   labels, and the panel beside it takes the rest; outside the promoted area
   nothing changes, so the classic screens stay exactly as WooCommerce draws
   them. */
@media only screen and ( max-width: 900px ) {
	.bpe-bridge-host #woocommerce-product-data ul.product_data_tabs {
		width: 150px;
	}

	.bpe-bridge-host #woocommerce-product-data ul.product_data_tabs li a {
		text-indent: 0;
	}

	.bpe-bridge-host #woocommerce-product-data .woocommerce_options_panel,
	.bpe-bridge-host #woocommerce-product-data .wc-metaboxes-wrapper {
		width: calc( 100% - 150px );
	}
}

/* Respect the user's motion preference: no drawn-out drawer transition here. */
@media ( prefers-reduced-motion: reduce ) {
	.bpe-bridge-drawer,
	.bpe-bridge-host {
		transition: none !important;
	}
}
