/* =========================================================================
   Pelliarts U.S. Duties — v0.4.0
   Per-item duty box (styled like the PDP "Natural Variation" note), duty
   totals, notes and the "Estimated" tag.
   Colours follow the site: ink #1A1A1A, muted #6B6B6B, hairline #E5DFD5,
   cream #F5F1EB, gold #B9A16B.
   ========================================================================= */

:root {
	--pelli-duty-ink:        #1A1A1A;
	--pelli-duty-muted:      #6B6B6B;
	--pelli-duty-line:       #E5DFD5;
	--pelli-duty-cream:      #F5F1EB;
	--pelli-duty-gold:       #B9A16B;
	--pelli-duty-gold-tint:  rgba(185, 161, 107, 0.10);
	--pelli-duty-green:      #1E7A46;
	--pelli-duty-green-tint: rgba(30, 122, 70, 0.09);
}

/* -------------------------------------------------------------------------
   1. The duty box under each item
   ------------------------------------------------------------------------- */

.pelli-duty-box {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 2px 12px;
	box-sizing: border-box;
	width: 100%;
	max-width: 420px;
	margin: 0;
	padding: 9px 14px;
	border-left: 2px solid var(--pelli-duty-gold);
	border-radius: 0 8px 8px 0;
	background: var(--pelli-duty-gold-tint);
	font-size: 13px;
	line-height: 1.4;
	text-align: left;
	color: var(--pelli-duty-ink);
}

.pelli-duty-box__label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(26, 26, 26, 0.74);
}

.pelli-duty-box__amount {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	color: var(--pelli-duty-ink);
}

.pelli-duty-box__amount .woocommerce-Price-amount {
	color: inherit;
	font-weight: inherit;
}

/* Duty-free: a clear green, like a benefit */
.pelli-duty-box--free {
	border-left-color: var(--pelli-duty-green);
	background: var(--pelli-duty-green-tint);
}

.pelli-duty-box--free .pelli-duty-box__label,
.pelli-duty-box--free .pelli-duty-box__amount,
.pelli-duty-box--free .pelli-duty-box__amount .woocommerce-Price-amount {
	color: var(--pelli-duty-green);
}

.pelli-duty-box--free .pelli-duty-box__label {
	font-weight: 700;
}

.pelli-duty-box--free .pelli-duty-box__label::before {
	content: "";
	display: inline-block;
	width: 11px;
	height: 11px;
	margin-right: 6px;
	vertical-align: -1px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 8.5l3.5 3.5 7.5-8' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* -------------------------------------------------------------------------
   2. Inside WooCommerce's item details (cart page, checkout summary)
   The box carries its own label, so WooCommerce's label is hidden —
   the same approach as the Final Sale pill.
   ------------------------------------------------------------------------- */

dl.variation dt:has(+ dd .pelli-duty-box) {
	display: none !important;
}

dl.variation dd:has(.pelli-duty-box) {
	display: block;
	float: none !important;
	clear: both;
	width: 100%;
	margin: 10px 0 0 !important;
	padding: 0 !important;
}

dl.variation dd:has(.pelli-duty-box) p {
	margin: 0 !important;
	padding: 0 !important;
}

/* Checkout "Your Order" summary (desktop sidebar and the mobile summary).
   The name column there is only about 110px wide, so on items that carry a
   duty box the item details run under the name AND the price. Items without
   a box (and every item for non-U.S. customers) keep the original layout. */

.pelli-sidebar-items .pelli-sidebar-item:has(.pelli-duty-box) {
	row-gap: 0;
}

.pelli-sidebar-items .pelli-sidebar-item:has(.pelli-duty-box) .pelli-sidebar-item-thumb {
	grid-column: 1;
	grid-row: 1 / span 2;
}

.pelli-sidebar-items .pelli-sidebar-item:has(.pelli-duty-box) .pelli-sidebar-item-details {
	display: contents;
}

.pelli-sidebar-items .pelli-sidebar-item:has(.pelli-duty-box) .pelli-sidebar-item-name {
	grid-column: 2;
	grid-row: 1;
}

.pelli-sidebar-items .pelli-sidebar-item:has(.pelli-duty-box) .pelli-sidebar-item-price {
	grid-column: 3;
	grid-row: 1;
}

.pelli-sidebar-items .pelli-sidebar-item:has(.pelli-duty-box) .pelli-sidebar-item-details > dl.variation {
	grid-column: 2 / -1;
	grid-row: 2;
	min-width: 0;
	margin: 0 !important;
}

.pelli-sidebar-items .pelli-sidebar-item .pelli-duty-box {
	max-width: none;
}

/* Desktop checkout: a wider "Your Order" summary (380px instead of the 320px
   in checkout.css), so item names wrap less and each duty box fits on one
   line. Applies to every visitor, so the layout never shifts when the
   country changes. Tablet and phone layouts are unchanged. */
@media (min-width: 1025px) {
	body.woocommerce-checkout .pelli-checkout-layout {
		grid-template-columns: minmax(0, 1fr) 380px;
	}
}

/* Orders (thank-you page, My Account → View order): the same box under each
   item, showing what was charged. */

.pelli-duty-order-line {
	margin-top: 10px;
}

.pelli-duty-order-line .pelli-duty-box {
	max-width: 360px;
}

/* -------------------------------------------------------------------------
   3. Mini-cart: box under each item, duty total under Subtotal
   ------------------------------------------------------------------------- */

.pa-minicart__item-body .pelli-duty-box {
	margin-top: 2px;
}

.pa-minicart__duties {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: 4px 12px;
	margin: -4px 0 12px;
	font-size: 14px;
	color: var(--pelli-duty-ink);
}

.pa-minicart__duties .pelli-duty-total__label {
	font-weight: 500;
}

.pa-minicart__duties .pelli-duty-total__amount {
	font-weight: 600;
	white-space: nowrap;
}

/* -------------------------------------------------------------------------
   4. Notes: "Ships from Toronto…" and the non-refundable notice
   ------------------------------------------------------------------------- */

.pelli-duty-note {
	margin: 0 0 14px;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--pelli-duty-muted);
}

.pelli-duty-note--cart {
	text-align: center;
}

.pelli-duty-note--sidebar {
	margin: 14px 0 0;
	font-size: 12px;
}

.pelli-duty-note--minicart {
	margin: 8px 0 0;
	font-size: 12px;
	text-align: center;
}

.pelli-duty-disclosure {
	margin: 0 0 14px;
	font-size: 12px;
	line-height: 1.5;
	color: var(--pelli-duty-muted);
}

.pelli-duty-disclosure a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* -------------------------------------------------------------------------
   5. Cart totals: no extra hairline between the duty row and the Total
   (the Total row already draws its own rule above)
   ------------------------------------------------------------------------- */

body.woocommerce-cart .cart_totals table.shop_table tr.fee:has(+ tr.order-total) {
	border-bottom: none !important;
}

/* -------------------------------------------------------------------------
   6. "Estimated" tag (on the duty total until a postcode is entered)
   ------------------------------------------------------------------------- */

.pelli-duty-tag {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 7px 0;
	font-size: 10px;
	font-weight: 500;
	line-height: 1.6;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
	vertical-align: middle;
	color: var(--pelli-duty-muted);
	background: var(--pelli-duty-cream);
	border: 1px solid var(--pelli-duty-line);
	border-radius: 999px;
}
