/*
 * The "Edit" control on the cart page — see includes/class-ysr-cart-controls.php.
 *
 * Product Bundles renders it as `<a class="edit_bundle_in_cart_text edit_in_cart_text">
 * <small>Edit</small></a>`, unstyled, directly under the product title. Inheriting the
 * theme's small grey meta type, it lands looking like another line of product metadata
 * sitting between the title and "Child's Name" — and it reads as one. On the first
 * production check the client, who knew the feature had just shipped and was looking for
 * it, reported the Edit link as missing while it was visible in their own screenshot.
 *
 * That is the whole feature failing: a customer who cannot find Edit goes back to clearing
 * the cart and re-scanning the QR code, which is exactly the complaint this was built to
 * answer. So this file is not decoration — it is the difference between shipped and not.
 *
 * Deliberately SECONDARY. Outlined rather than filled, and it must never compete with
 * "Proceed to checkout": the customer who wants to amend needs to find this, the customer
 * who is finished needs not to be pulled sideways by it. Same reasoning, and same outlined
 * treatment, as the "Continue shopping" button in checkout.css.
 */

/*
 * Specificity is load-bearing, for the reason checkout.css documents at length: SiteGround's
 * optimizer concatenates every stylesheet into one file in an order this plugin does not
 * control, and it has already put our rules BEFORE the theme's once. Two class selectors
 * plus the element (0,2,1) clears the theme's own `.woocommerce-cart-form .product-name a`
 * and anything painting the generic small print.
 *
 * Edit is a TEXT link, matching Remove beside it — the client's call, and the right one.
 * It was briefly an outlined button, which fixed the "I cannot find it" problem but created
 * two others: on the desktop cart the theme squeezes this column to 118px, against 67px of
 * button plus 54px of Remove, so the pair could not share a line; and a button next to a
 * plain link reads as the louder of two unrelated things rather than as one pair of
 * controls. Sized and weighted to be findable without being a button.
 */
a.edit_bundle_in_cart_text.edit_in_cart_text {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	/*
	 * Red, at the client's request (2026-08-27). It replaces `color: inherit`, which took
	 * the theme's grey meta colour — the same inheritance that made this control hard to
	 * find in the first place.
	 *
	 * #c0392b is the one red already in this plugin (configurator.css uses it for Gravity
	 * Forms validation messages). Reusing it keeps a single red in the palette rather than
	 * introducing a second that is nearly but not quite the same. It measures 5.44:1 on
	 * white — clear of the 4.5:1 AA minimum for normal text, which matters at this size:
	 * tests/browser/cart-amend.cjs computes that ratio rather than trusting the value here,
	 * because the theme paints this cell and a future theme update could change what sits
	 * behind it.
	 *
	 * Worth recording that red conventionally means destructive, and Remove — the actually
	 * destructive control — sits immediately to its right in muted grey. That is the
	 * opposite of the usual signal. The underline and the ordering are what keep the pair
	 * readable; if customers are ever seen hesitating over Edit, this is the first thing to
	 * look at.
	 */
	color: #c0392b;
	text-decoration: underline;
}

/*
 * PB wraps the label in <small>, which is where the theme's fine-print size actually comes
 * from — sizing the anchor alone leaves the text unchanged.
 *
 * `inherit` rather than a number, so Edit is exactly the size of the Remove link beside it
 * whatever the theme sets that to — measured at 13.3px today. Matching its neighbour is the
 * actual requirement; a hardcoded 14px met the readability minimum but left the pair
 * visibly mismatched.
 *
 * Beware rem here: XStore sets the ROOT font-size to 14px, not the 16px a rem value is
 * usually reasoned about, so the obvious `0.875rem` renders at 12.25px. That fine print is
 * what let the client look straight at this control and report it as missing, which is why
 * tests/browser/cart-amend.cjs asserts the size rather than leaving it to the cascade.
 */
a.edit_bundle_in_cart_text.edit_in_cart_text small {
	font-size: inherit;
	font-weight: 600;
}

a.edit_bundle_in_cart_text.edit_in_cart_text:hover,
a.edit_bundle_in_cart_text.edit_in_cart_text:focus-visible {
	/* Restated rather than inherited: the theme styles `a:hover` and, with the stylesheet
	   order this file's opening comment describes, can otherwise repaint the label on hover
	   — the one moment the customer is certain to be looking at it. */
	color: #c0392b;
	text-decoration: underline;
	opacity: 1;
}

/*
 * Edit and Remove sit on one row at the bottom of the cell, rather than Edit under the
 * title and Remove three lines below it with the School and Child's Name meta in between.
 * Baseline-aligned so the button and the plain link read as one group.
 */
.ysr-cart-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
	margin-top: 8px;
}

/*
 * Both controls sit at their own content width. Measured, not assumed: XStore renders its
 * remove link as `display: block` at full width, which as a flex item pushed it onto a
 * second line — the row was flex and still looked stacked. `flex: 0 0 auto` with an
 * explicit auto width is what actually holds them side by side.
 */
.ysr-cart-actions > a {
	flex: 0 0 auto;
	width: auto;
	display: inline-flex;
	align-items: center;
}

/*
 * Remove is the theme's own link and keeps the theme's own weight; Edit is set slightly
 * bolder above so the constructive control reads first without becoming a second button.
 */

/*
 * Remove is quieter than Edit: same size and same treatment, less emphasis. Deleting the
 * whole subscription should not have the same pull as amending it, and amending is what
 * customers on this page are actually trying to do.
 */
.ysr-cart-actions a.remove-item,
.ysr-cart-actions a.remove {
	font-weight: 400;
	opacity: 0.75;
}

.ysr-cart-actions a.remove-item:hover,
.ysr-cart-actions a.remove:hover {
	opacity: 1;
}

/*
 * The wrapper that keeps a magazine row's Remove link out of reach of the theme's delegated
 * `.product-remove > a` click handler (see YSR_Cart_Controls::child_remove_markup()). It is
 * structural, so it must not introduce a layout of its own.
 */
.ysr-child-actions {
	display: inline;
}

/*
 * The bundled child rows have had their remove link and quantity control taken away
 * server-side (YSR_Cart_Controls), so their cells are now empty. Some themes reserve
 * height for them anyway, leaving a ragged column; collapse it rather than leave a gap
 * that reads as something failing to load.
 */
.woocommerce-cart-form tr.bundled_table_item td.product-remove,
.woocommerce-cart-form tr.bundled_table_item .product-remove:empty {
	padding-top: 0;
	padding-bottom: 0;
}
