/**
 * Mimus Configurator — cart and checkout.
 *
 * Loaded by Frontend\Assets::enqueue_cart() on is_cart() || is_checkout() only.
 * Until 1.28.0 no stylesheet of ours reached either page, so .mimus-cart-edit,
 * .mimus-addon-qty and the personalisation rows were all emitted with nothing
 * behind them — which is why "Seçimleri düzenle" ran straight on from the
 * product name.
 *
 * Light-mode only by house rule: one explicit palette, no prefers-color-scheme
 * block, and every rule that sets a background also sets a colour, so a client
 * forcing a dark ground cannot produce unreadable text.
 *
 * No class here is named ux-*. Flatsome installs delegated click handlers on its
 * own class names and re-arms them on every ajaxComplete.
 *
 * No text-transform: uppercase anywhere. CSS maps i to I, not to İ, so an
 * uppercased Turkish string is a string the shop does not sell.
 *
 * Everything is scoped under .woocommerce-cart / .woocommerce-checkout, which
 * WordPress puts on <body>, so nothing here can reach the shop or a product
 * page if the gate is ever widened.
 */

:root {
	--mimus-cart-ink: #23282d;
	--mimus-cart-muted: #6b6560;
	--mimus-cart-line: #e6e1db;
	--mimus-cart-paper: #ffffff;
	--mimus-cart-sand: #f8f5f1;
	--mimus-cart-accent: #6b5b4e;
	--mimus-cart-accent-ink: #3d332b;

	/* A pencil, inlined: one more request for 12px of glyph is a bad trade,
	   and an icon font would tie this to whatever Flatsome ships. */
	--mimus-cart-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------- the edit affordance */

/*
 * Cart\Edit::render_link() prints this anchor into the product-name cell
 * between the product name and the personalisation list, with no wrapper of its
 * own. A block-level display is the whole of the fix: inline-block with a
 * margin-top — what configurator.css had, on a page it never loaded on — still
 * leaves the link on the title's line, and unstyled the browser draws it as the
 * next word of the title. flex rather than block so fit-content keeps the
 * underline and the focus ring tight to the text; the cell itself is left alone,
 * because Flatsome puts its own .mobile-product-price block in there.
 */
.woocommerce-cart .mimus-cart-edit,
.woocommerce-checkout .mimus-cart-edit {
	display: flex;
	width: fit-content;
	align-items: center;
	gap: 0.35em;
	margin: 0.4em 0 0;
	padding: 0.25em 0;
	color: var(--mimus-cart-accent);
	font-size: 0.85em;
	line-height: 1.3;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/*
 * Behind @supports in full, content included: without mask support the
 * declarations that are left would paint a filled currentColor square, and a
 * zero-size pseudo-element would still claim the flex gap. Unsupported means no
 * pseudo-element at all, and the link reads as a plain underlined link.
 */
@supports (mask: none) or (-webkit-mask: none) {
	.woocommerce-cart .mimus-cart-edit::before,
	.woocommerce-checkout .mimus-cart-edit::before {
		content: "";
		width: 0.85em;
		height: 0.85em;
		flex: 0 0 auto;
		background-color: currentColor;
		-webkit-mask: var(--mimus-cart-pencil) center / contain no-repeat;
		mask: var(--mimus-cart-pencil) center / contain no-repeat;
	}
}

.woocommerce-cart .mimus-cart-edit:hover,
.woocommerce-cart .mimus-cart-edit:focus,
.woocommerce-checkout .mimus-cart-edit:hover,
.woocommerce-checkout .mimus-cart-edit:focus {
	color: var(--mimus-cart-accent-ink);
}

/* Flatsome removes outlines on a lot of anchors; a keyboard user still has to
   be able to see where they are. */
.woocommerce-cart .mimus-cart-edit:focus-visible,
.woocommerce-checkout .mimus-cart-edit:focus-visible {
	outline: 2px solid var(--mimus-cart-accent);
	outline-offset: 2px;
}

/* --------------------------------------------- the personalisation row list */

/*
 * WooCommerce renders woocommerce_get_item_data() through
 * templates/cart/cart-item-data.php as
 *   <dl class="variation"><dt>Label:</dt><dd><p>Value</p></dd></dl>
 * and Flatsome does not override that template. So the whole list can be
 * restyled from here with no template override at all.
 *
 * The dt/dd classes are NOT usable as hooks: the template builds them with
 * sanitize_html_class( 'variation-' . $key ) and our key is the Turkish label,
 * so "İsim Rengi" becomes .variation-simRengi — the dotted I is simply dropped.
 * Anything per-field has to travel inside the value, which is what the colour
 * dot does.
 */
.woocommerce-cart .product-name dl.variation,
.woocommerce-checkout dl.variation {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 0.15em 0.6em;
	margin: 0.5em 0 0;
	padding: 0.6em 0.75em;
	border-radius: 4px;
	background: var(--mimus-cart-sand);
	color: var(--mimus-cart-ink);
	font-size: 0.85em;
	line-height: 1.45;
}

.woocommerce-cart .product-name dl.variation dt,
.woocommerce-checkout dl.variation dt {
	margin: 0;
	color: var(--mimus-cart-muted);
	font-weight: 400;
}

.woocommerce-cart .product-name dl.variation dd,
.woocommerce-checkout dl.variation dd {
	margin: 0;
	color: var(--mimus-cart-ink);
	font-weight: 600;
}

/* wpautop() wraps every value in a <p>; without this each row gains a blank
   line and the grid stops looking like a grid. */
.woocommerce-cart .product-name dl.variation dd p,
.woocommerce-checkout dl.variation dd p {
	margin: 0;
}

/* ---------------------------------------------------------- the colour dot */

/*
 * Cart\Hooks::swatch() emits the fill inline, and nothing else — the geometry
 * is here on purpose. Two things follow from that: a style that
 * safecss_filter_attr() strips leaves a bordered ring next to a label that
 * still names the colour in words, and a page without this sheet (the header
 * mini-cart) renders the text with no stray box beside it.
 *
 * The border is not decoration either: Bebek Pembe is #FBD2E0 and Krem is
 * paler still, and neither is visible on white without it.
 */
.mimus-cart-swatch {
	display: inline-block;
	width: 0.85em;
	height: 0.85em;
	margin-right: 0.45em;
	vertical-align: -0.1em;
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 50%;
	background-color: transparent;
}

/* ------------------------------------------------------------- addon lines */

/*
 * Cart\Addons replaces an addon child's quantity input with this span and
 * suppresses its remove link, because a comb removed on its own would leave the
 * set claiming something the cart no longer holds. It reads as a fixed value
 * rather than as a control that failed to render.
 */
.woocommerce-cart .mimus-addon-qty {
	color: var(--mimus-cart-muted);
	font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- the table */

.woocommerce-cart table.cart thead th {
	padding-bottom: 0.75em;
	border-bottom: 1px solid var(--mimus-cart-line);
	color: var(--mimus-cart-muted);
	font-size: 0.8em;
	font-weight: 600;
	letter-spacing: 0.02em;
}

/* "ARA TOPLAM" was breaking onto two lines and dragging the header's baseline
   with it. */
.woocommerce-cart table.cart thead th.product-subtotal,
.woocommerce-cart table.cart thead th.product-price {
	white-space: nowrap;
}

.woocommerce-cart table.cart td {
	padding-top: 1.1em;
	padding-bottom: 1.1em;
	border-bottom: 1px solid var(--mimus-cart-line);
	vertical-align: top;
}

.woocommerce-cart table.cart td.product-price,
.woocommerce-cart table.cart td.product-subtotal {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.woocommerce-cart table.cart td.product-subtotal {
	font-weight: 600;
}

.woocommerce-cart table.cart td.product-name > a {
	color: var(--mimus-cart-ink);
	font-weight: 600;
	line-height: 1.35;
}

/*
 * Held at the thumbnail's own scale. woocommerce_thumbnail is a modest size and
 * pushing it much past this only buys a soft picture — the personalisation list
 * is what the customer is actually checking on this page.
 */
.woocommerce-cart table.cart td.product-thumbnail img {
	width: 80px;
	max-width: 80px;
	height: auto;
	border-radius: 4px;
	background: var(--mimus-cart-paper);
}

/*
 * Only this selector, so Flatsome keeps its own button styling. The update
 * button sits disabled until something changes, which reads as broken rather than
 * as secondary; this makes the resting state deliberate.
 */
.woocommerce-cart table.cart td.actions button[name="update_cart"] {
	background-color: var(--mimus-cart-sand);
	color: var(--mimus-cart-accent-ink);
	border: 1px solid var(--mimus-cart-line);
}

.woocommerce-cart table.cart td.actions button[name="update_cart"]:disabled {
	color: var(--mimus-cart-muted);
	opacity: 1;
}

/* -------------------------------------------------- the suggestion block */

.mimus-cart-upsell {
	margin: 2.5em 0 0;
	padding: 1.5em 0 0;
	border-top: 1px solid var(--mimus-cart-line);
	background: transparent;
	color: var(--mimus-cart-ink);
}

.mimus-cart-upsell__heading {
	margin: 0 0 0.2em;
	color: var(--mimus-cart-ink);
	font-size: 1.15em;
	line-height: 1.3;
}

.mimus-cart-upsell__lead {
	margin: 0 0 1.5em;
	color: var(--mimus-cart-muted);
	font-size: 0.9em;
	line-height: 1.45;
}

.mimus-cart-upsell__group + .mimus-cart-upsell__group {
	margin-top: 2em;
}

.mimus-cart-upsell__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5em;
	margin: 0 0 0.9em;
}

.mimus-cart-upsell__title {
	margin: 0;
	color: var(--mimus-cart-ink);
	font-size: 1em;
	line-height: 1.3;
}

.mimus-cart-upsell__all {
	color: var(--mimus-cart-accent);
	font-size: 0.85em;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.mimus-cart-upsell__all:hover,
.mimus-cart-upsell__all:focus {
	color: var(--mimus-cart-accent-ink);
}

/*
 * auto-fit rather than a fixed four, because a category may have only two
 * sellable products (Anı Küpü has exactly two) and Upsell::MIN_PRODUCTS lets it
 * through on purpose. The grid then shows two proper boxes instead of two
 * quarter-width ones.
 */
.mimus-cart-upsell__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 1em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mimus-cart-upsell__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * The whole box is one anchor. Nothing here is a <button> or an input: this
 * block renders inside form.woocommerce-cart-form, where either one would
 * submit the cart.
 */
.mimus-cart-upsell__link {
	display: flex;
	height: 100%;
	flex-direction: column;
	gap: 0.4em;
	padding: 0.65em;
	border: 1px solid var(--mimus-cart-line);
	border-radius: 6px;
	background: var(--mimus-cart-paper);
	color: var(--mimus-cart-ink);
	text-decoration: none;
}

.mimus-cart-upsell__link:hover,
.mimus-cart-upsell__link:focus {
	border-color: var(--mimus-cart-accent);
	background: var(--mimus-cart-paper);
	color: var(--mimus-cart-ink);
}

.mimus-cart-upsell__link:focus-visible {
	outline: 2px solid var(--mimus-cart-accent);
	outline-offset: 2px;
}

.mimus-cart-upsell__media {
	display: block;
	overflow: hidden;
	border-radius: 4px;
	background: var(--mimus-cart-sand);
}

.mimus-cart-upsell__media img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
}

.mimus-cart-upsell__name {
	display: block;
	color: var(--mimus-cart-ink);
	font-size: 0.85em;
	font-weight: 600;
	line-height: 1.35;
}

.mimus-cart-upsell__price {
	display: block;
	color: var(--mimus-cart-muted);
	font-size: 0.85em;
	line-height: 1.3;
}

/* A variable product's range arrives as two <span class="amount"> either side of
   a del/ins pair; keep it on one line's worth of rhythm. */
.mimus-cart-upsell__price .amount {
	color: var(--mimus-cart-ink);
	font-weight: 600;
	white-space: nowrap;
}

.mimus-cart-upsell__cta {
	display: block;
	margin-top: auto;
	padding-top: 0.2em;
	color: var(--mimus-cart-accent);
	font-size: 0.8em;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* ---------------------------------------------------------------- phone */

@media ( max-width: 640px ) {
	/*
	 * Flatsome wraps the table in .cart-wrapper.sm-touch-scroll, which scrolls
	 * horizontally. That is the right answer for a table and the wrong one for
	 * the cards below, which would sit inside a scroller as wide as the screen
	 * and gain a scrollbar for nothing.
	 */
	.woocommerce-cart .cart-wrapper {
		overflow: visible;
	}

	/*
	 * WooCommerce puts shop_table_responsive on the table and a data-title on
	 * every cell, which is what lets each row become a card with no template
	 * override. The header row has nothing left to label.
	 */
	.woocommerce-cart table.cart thead {
		display: none;
	}

	.woocommerce-cart table.cart,
	.woocommerce-cart table.cart tbody,
	.woocommerce-cart table.cart tr {
		display: block;
		width: 100%;
	}

	.woocommerce-cart table.cart tr.cart_item {
		position: relative;
		display: grid;
		grid-template-columns: 80px minmax(0, 1fr);
		gap: 0.25em 0.9em;
		margin: 0 0 0.9em;
		padding: 0.9em;
		border: 1px solid var(--mimus-cart-line);
		border-radius: 6px;
		background: var(--mimus-cart-paper);
		color: var(--mimus-cart-ink);
	}

	.woocommerce-cart table.cart tr.cart_item td {
		padding: 0;
		border: 0;
	}

	.woocommerce-cart table.cart tr.cart_item td.product-thumbnail {
		grid-column: 1;
		grid-row: 1 / span 2;
	}

	.woocommerce-cart table.cart tr.cart_item td.product-name {
		grid-column: 2;
	}

	/*
	 * Flatsome prints its own "2 x 1.750 ₺" line inside the name cell and hides
	 * the price and subtotal cells below 550px. The cards below show those cells
	 * again with their labels, so its line would be the price a third time.
	 */
	.woocommerce-cart table.cart tr.cart_item .mobile-product-price {
		display: none;
	}

	/* Price, quantity and subtotal share one line under the name. */
	.woocommerce-cart table.cart tr.cart_item td.product-price,
	.woocommerce-cart table.cart tr.cart_item td.product-quantity,
	.woocommerce-cart table.cart tr.cart_item td.product-subtotal {
		grid-column: 2;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.5em;
		padding-top: 0.35em;
	}

	/* The label WooCommerce already carries per cell, shown only here. */
	.woocommerce-cart table.cart tr.cart_item td.product-price::before,
	.woocommerce-cart table.cart tr.cart_item td.product-quantity::before,
	.woocommerce-cart table.cart tr.cart_item td.product-subtotal::before {
		content: attr( data-title );
		color: var(--mimus-cart-muted);
		font-size: 0.8em;
	}

	/*
	 * The remove link is absolutely positioned out of the grid flow rather than
	 * given a cell: as a grid item it either took a column of its own or pushed
	 * the thumbnail down, and it is a 12px glyph.
	 */
	.woocommerce-cart table.cart tr.cart_item td.product-remove {
		position: absolute;
		top: 0.35em;
		right: 0.5em;
	}

	.woocommerce-cart table.cart td.product-thumbnail img {
		width: 80px;
		max-width: 80px;
	}

	.woocommerce-cart table.cart tr:not(.cart_item) td.actions {
		display: block;
		padding: 0;
		border: 0;
	}

	.mimus-cart-upsell__grid {
		grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
		gap: 0.75em;
	}
}
