/* ==================================================
   CART & CHECKOUT
   Loaded on the cart and checkout pages only, after the
   ported Customizer CSS (css/fst-custom.css on local, the
   Customizer "Additional CSS" on live). That CSS uses
   !important everywhere, so selectors here start at
   body .fst-page to outrank it.

   Wheel add-ons (installation kit, TPMS) are recognised
   by their "For wheel" detail, which WooCommerce prints as
   .wc-block-components-product-details__for-wheel.
================================================== */

/* ---------- Shared: product name, price, details ---------- */

body .fst-page .wc-block-components-product-name {
    display: block !important;
    margin: 0 0 4px !important;
    color: var(--ink) !important;
    font-family: var(--head) !important;
    font-size: 19px !important;
    font-style: italic !important;
    font-weight: 800 !important;
    line-height: 1.18 !important;
    letter-spacing: .01em;
    text-decoration: none !important;
}

body .fst-page a.wc-block-components-product-name:hover {
    color: var(--red) !important;
}

/* The ported CSS hid all item metadata, which also hid the add-on colour. */
body .fst-page .wc-block-components-product-metadata {
    display: block !important;
    margin: 8px 0 0 !important;
}

/* Short descriptions repeat the title (wheels) or run long (kits). */
body .fst-page .wc-block-components-product-metadata .wc-block-components-product-metadata__description {
    display: none !important;
}

body .fst-page .wc-block-components-product-details {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none;
}

body .fst-page .wc-block-components-product-details > span,
body .fst-page .wc-block-components-product-details > li {
    display: inline-flex !important;
    align-items: baseline;
    gap: 4px;
    max-width: 100%;
    margin: 0 !important;
    padding: 4px 10px !important;
    border-radius: 999px;
    background: #f1f2f5;
    font-size: 12.5px !important;
    line-height: 1.35 !important;
}

/* "/" separators between details: the pills already separate them. */
body .fst-page .wc-block-components-product-details span[aria-hidden="true"] {
    display: none !important;
}

body .fst-page .wc-block-components-product-details .wc-block-components-product-details__name,
body .fst-page .wc-block-components-product-details .wc-block-components-product-details__value {
    display: inline !important;
    font-family: var(--body) !important;
    font-size: 12.5px !important;
    font-style: normal !important;
    line-height: 1.35 !important;
}

body .fst-page .wc-block-components-product-details .wc-block-components-product-details__name {
    color: var(--grey) !important;
    font-weight: 600 !important;
}

body .fst-page .wc-block-components-product-details .wc-block-components-product-details__value {
    color: var(--ink) !important;
    font-weight: 700 !important;
    overflow-wrap: anywhere;
}

/* "Add-on" tag in front of the kit names. */
body .fst-page .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-components-product-name::before,
body .fst-page .wc-block-components-order-summary-item:has(.wc-block-components-product-details__for-wheel) .wc-block-components-product-name::before {
    content: "Add-on";
    display: inline-block;
    margin: 0 8px 3px 0;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(227, 22, 28, .09);
    color: var(--red);
    font-family: var(--body);
    font-size: 10.5px;
    font-style: normal;
    font-weight: 800;
    letter-spacing: .08em;
    line-height: 1.2;
    text-transform: uppercase;
    vertical-align: middle;
}


/* ==================================================
   CART
================================================== */

/* Items in one white card. */
body .fst-page .wc-block-cart .wc-block-cart__main {
    padding: 6px 26px 10px !important;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 40px -32px rgba(17, 18, 20, .35);
}

body .fst-page table.wc-block-cart-items {
    width: 100%;
    margin: 0 !important;
    border: 0 !important;
    border-collapse: collapse;
}

/* Column labels: quiet, like a table header should be. */
body .fst-page table.wc-block-cart-items tr.wc-block-cart-items__header th {
    padding: 18px 0 14px !important;
    border-bottom: 1px solid var(--line) !important;
    color: var(--grey) !important;
    font-family: var(--body) !important;
    font-size: 12px !important;
    font-style: normal !important;
    font-weight: 700 !important;
    letter-spacing: .1em;
    line-height: 1.2 !important;
    text-transform: uppercase;
}

body .fst-page table.wc-block-cart-items .wc-block-cart-items__row td {
    padding: 22px 0 !important;
    border-top: 1px solid var(--line) !important;
    vertical-align: top;
}

body .fst-page table.wc-block-cart-items .wc-block-cart-items__row:first-child td {
    border-top: 0 !important;
}

/* Product photo on a soft tile. */
body .fst-page table.wc-block-cart-items .wc-block-cart-item__image {
    width: 116px;
    padding-right: 18px !important;
}

body .fst-page table.wc-block-cart-items .wc-block-cart-item__image a,
body .fst-page table.wc-block-cart-items .wc-block-cart-item__image > img {
    display: block;
}

body .fst-page table.wc-block-cart-items .wc-block-cart-item__image img {
    width: 98px !important;
    max-width: 98px !important;
    height: 98px !important;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f6f7f9;
    object-fit: contain;
    box-sizing: border-box;
}

body .fst-page .wc-block-cart-item__wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

body .fst-page .wc-block-cart-item__wrap .wc-block-cart-item__prices,
body .fst-page .wc-block-cart-item__wrap .wc-block-cart-item__prices * {
    color: var(--grey) !important;
    font-family: var(--body) !important;
    font-size: 14px !important;
    font-style: normal !important;
    font-weight: 600 !important;
}

body .fst-page .wc-block-cart-item__wrap .wc-block-cart-item__prices .wc-block-components-product-price::after {
    content: " each";
    font-weight: 500;
}

/* Quantity and remove. */
body .fst-page .wc-block-cart-item__quantity {
    display: flex !important;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
}

body .fst-page .wc-block-components-quantity-selector {
    display: inline-flex !important;
    align-items: stretch;
    width: auto !important;
    height: 40px;
    margin: 0 !important;
    border: 1px solid #d7dde6 !important;
    border-radius: 10px !important;
    background: #fff !important;
    overflow: hidden;
}

body .fst-page .wc-block-components-quantity-selector::after {
    display: none !important;
}

body .fst-page .wc-block-components-quantity-selector .wc-block-components-quantity-selector__input {
    width: 44px !important;
    min-width: 44px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    color: var(--ink) !important;
    font-family: var(--body) !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 38px !important;
    text-align: center;
    box-shadow: none !important;
}

body .fst-page .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
    width: 36px !important;
    min-width: 36px !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #f6f7f9 !important;
    color: var(--ink) !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    cursor: pointer;
}

body .fst-page .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:hover:not(:disabled) {
    background: var(--ink) !important;
    color: #fff !important;
}

body .fst-page .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:disabled {
    color: #b7bcc6 !important;
    cursor: default;
}

body .fst-page .wc-block-cart-item__remove-link {
    display: inline-grid !important;
    place-items: center;
    width: 38px;
    height: 38px;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: var(--grey) !important;
    box-shadow: none !important;
    cursor: pointer;
}

body .fst-page .wc-block-cart-item__remove-link:hover {
    border-color: rgba(227, 22, 28, .25) !important;
    background: rgba(227, 22, 28, .07) !important;
    color: var(--red) !important;
}

body .fst-page .wc-block-cart-item__remove-link svg {
    fill: currentColor;
}

/* Line total. */
body .fst-page table.wc-block-cart-items .wc-block-cart-item__total {
    padding-left: 16px !important;
    text-align: right;
    white-space: nowrap;
}

body .fst-page table.wc-block-cart-items .wc-block-cart-item__total .wc-block-components-formatted-money-amount {
    color: var(--ink) !important;
    font-family: var(--head) !important;
    font-size: 22px !important;
    font-style: italic !important;
    font-weight: 800 !important;
}

/* ---------- Add-on rows sit under their wheel ---------- */

body .fst-page table.wc-block-cart-items .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) td {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
    border-top: 1px dashed #e3e5ea !important;
    background: #fbfbfc;
}

body .fst-page table.wc-block-cart-items .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-cart-item__image {
    padding-left: 22px !important;
    box-shadow: inset 3px 0 0 var(--red);
}

body .fst-page table.wc-block-cart-items .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-cart-item__image img {
    width: 72px !important;
    max-width: 72px !important;
    height: 72px !important;
    padding: 6px;
    background: #fff;
}

body .fst-page table.wc-block-cart-items .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-cart-item__total {
    padding-right: 4px !important;
}

body .fst-page .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-components-product-name {
    font-size: 17px !important;
}

body .fst-page .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-cart-item__total .wc-block-components-formatted-money-amount {
    font-size: 19px !important;
}

/* ---------- Cart totals ---------- */

/* The sidebar element is itself the card. */
body .fst-page .wc-block-cart .wc-block-cart__sidebar {
    padding: 24px 26px 26px !important;
    border: 1px solid var(--line) !important;
    border-radius: 20px !important;
    background: #fff !important;
    box-shadow: 0 18px 40px -30px rgba(17, 18, 20, .45) !important;
}

/* WooCommerce leaves an empty totals wrapper when there is nothing to list,
   which drew a second rule and a gap above the total. */
body .fst-page .wc-block-components-totals-wrapper:not(:has(*)),
body .fst-page .wp-block-woocommerce-cart-order-summary-totals-block:not(:has(*)),
body .fst-page .wp-block-woocommerce-checkout-order-summary-totals-block:not(:has(*)) {
    display: none !important;
}

body .fst-page .wc-block-cart .wc-block-cart__totals-title {
    margin: 0 0 8px !important;
    padding: 0 !important;
    color: var(--ink) !important;
    font-family: var(--head) !important;
    font-size: 28px !important;
    font-style: italic !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    text-align: left !important;
    text-transform: uppercase;
}

body .fst-page .wc-block-cart .wc-block-components-totals-wrapper {
    padding: 14px 0 !important;
    border-top: 1px solid var(--line) !important;
}

body .fst-page .wc-block-cart .wc-block-components-totals-wrapper:empty {
    display: none;
}

body .fst-page .wc-block-cart .wc-block-components-totals-footer-item {
    align-items: baseline;
}

body .fst-page .wc-block-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
    font-size: 22px !important;
}

body .fst-page .wc-block-cart .wc-block-components-totals-footer-item .wc-block-components-formatted-money-amount {
    color: var(--red) !important;
    font-family: var(--head) !important;
    font-size: 28px !important;
    font-style: italic !important;
    font-weight: 800 !important;
}

body .fst-page .wc-block-cart .wc-block-cart__submit-container {
    padding-top: 6px;
}

body .fst-page .wc-block-cart .wc-block-cart__submit-button {
    width: 100%;
    min-height: 56px;
    border-radius: 12px !important;
    font-size: 18px !important;
    box-shadow: var(--shadow-red);
}


/* ==================================================
   CHECKOUT
================================================== */

/* One summary card (the block drew a second border inside the first). */
body .fst-page .wc-block-checkout__sidebar {
    padding: 0 !important;
}

body .fst-page .wc-block-checkout__sidebar .wc-block-components-sidebar,
body .fst-page .wc-block-checkout__sidebar > .wp-block-woocommerce-checkout-totals-block {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block {
    overflow: hidden;
    border: 1px solid var(--line) !important;
    border-radius: 20px !important;
    background: #fff !important;
    box-shadow: 0 18px 40px -30px rgba(17, 18, 20, .45) !important;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-checkout-order-summary__title {
    margin: 0 !important;
    padding: 22px 22px 6px !important;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-checkout-order-summary__title-text {
    margin: 0 !important;
    color: var(--ink) !important;
    font-family: var(--head) !important;
    font-size: 26px !important;
    font-style: italic !important;
    font-weight: 800 !important;
    text-transform: uppercase;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-totals-wrapper {
    padding: 14px 22px !important;
    border-top: 1px solid var(--line) !important;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-totals-wrapper:empty {
    display: none;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-order-summary {
    padding: 4px 0 !important;
}

/* Items */
body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item {
    display: grid !important;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: start;
    gap: 14px;
    padding: 14px 0 !important;
    border-top: 1px solid #eff0f3;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item:first-child {
    border-top: 0;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__image {
    position: relative;
    width: 64px !important;
    margin: 0 !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__image img {
    width: 64px !important;
    max-width: 64px !important;
    height: 64px !important;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f6f7f9;
    object-fit: contain;
    box-sizing: border-box;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__quantity {
    top: -7px !important;
    right: -7px !important;
    min-width: 22px !important;
    height: 22px !important;
    padding: 0 6px !important;
    border: 2px solid #fff !important;
    border-radius: 999px !important;
    background: var(--ink) !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    line-height: 18px !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__quantity span {
    color: #fff !important;
    font-size: 11.5px !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description {
    min-width: 0;
    padding: 0 !important;
}

/* The ported CSS made every piece of the description 18px and block level. */
body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-components-product-name {
    font-size: 15.5px !important;
    line-height: 1.22 !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-cart-item__prices,
body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-cart-item__prices * {
    display: inline !important;
    color: var(--grey) !important;
    font-family: var(--body) !important;
    font-size: 13px !important;
    font-style: normal !important;
    font-weight: 600 !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-cart-item__prices .wc-block-components-product-price::after {
    content: " each";
    font-weight: 500;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-components-product-metadata {
    margin-top: 6px !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-components-product-details > span {
    display: inline-flex !important;
    padding: 3px 9px !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-components-product-details span {
    font-size: 12px !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__total-price {
    padding: 0 !important;
    text-align: right;
    white-space: nowrap;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__total-price .wc-block-components-formatted-money-amount {
    color: var(--ink) !important;
    font-family: var(--head) !important;
    font-size: 18px !important;
    font-style: italic !important;
    font-weight: 800 !important;
}

/* Add-ons indent under the wheel; the wheel is right above them. */
body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item:has(.wc-block-components-product-details__for-wheel) {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    padding: 10px 0 10px 30px !important;
    border-top: 1px dashed #e3e5ea;
    /* A thin red guide line, indented under the wheel photo. */
    background: linear-gradient(to right, transparent 16px, rgba(227, 22, 28, .55) 16px, rgba(227, 22, 28, .55) 18px, transparent 18px) no-repeat;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item:has(.wc-block-components-product-details__for-wheel) .wc-block-components-order-summary-item__image,
body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item:has(.wc-block-components-product-details__for-wheel) .wc-block-components-order-summary-item__image img {
    width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item:has(.wc-block-components-product-details__for-wheel) .wc-block-components-product-name {
    font-size: 14px !important;
}

/* Nested right under the wheel, so the wheel name is not repeated here. */
body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-components-product-details > span.wc-block-components-product-details__for-wheel {
    display: none !important;
}

body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item:has(.wc-block-components-product-details__for-wheel) .wc-block-components-order-summary-item__total-price .wc-block-components-formatted-money-amount {
    font-size: 16px !important;
}

/* Totals */
body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-totals-item {
    align-items: baseline;
    padding: 4px 0 !important;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-totals-item__label,
body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-totals-item__value .wc-block-components-formatted-money-amount {
    color: var(--charcoal) !important;
    font-family: var(--body) !important;
    font-size: 15px !important;
    font-style: normal !important;
    font-weight: 600 !important;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-totals-footer-item {
    padding: 6px 0 !important;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
    color: var(--ink) !important;
    font-family: var(--head) !important;
    font-size: 24px !important;
    font-style: italic !important;
    font-weight: 800 !important;
    text-transform: uppercase;
}

body .fst-page .wp-block-woocommerce-checkout-order-summary-block .wc-block-components-totals-footer-item .wc-block-components-totals-item__value .wc-block-components-formatted-money-amount {
    color: var(--red) !important;
    font-family: var(--head) !important;
    font-size: 28px !important;
    font-style: italic !important;
    font-weight: 800 !important;
}

/* Coupon toggle */
body .fst-page .wc-block-components-totals-coupon .wc-block-components-panel__button {
    margin: 0 !important;
    padding: 4px 0 !important;
    color: var(--charcoal) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

/* Form sections: a little more air between the numbered steps. */
body .fst-page .wc-block-checkout__main .wc-block-components-checkout-step {
    margin-bottom: 30px !important;
}

body .fst-page .wc-block-checkout__main .wc-block-components-checkout-place-order-button {
    min-height: 56px;
    border-radius: 12px !important;
    font-size: 18px !important;
    box-shadow: var(--shadow-red);
}


/* ==================================================
   SMALL SCREENS
   WooCommerce switches the cart table to stacked rows.
================================================== */

@media (max-width: 700px) {

    body .fst-page .wc-block-cart .wc-block-cart__main {
        padding: 2px 16px 6px !important;
        border-radius: 16px;
    }

    body .fst-page table.wc-block-cart-items .wc-block-cart-item__image {
        width: 88px;
        padding-right: 12px !important;
    }

    body .fst-page table.wc-block-cart-items .wc-block-cart-item__image img {
        width: 76px !important;
        max-width: 76px !important;
        height: 76px !important;
    }

    body .fst-page table.wc-block-cart-items .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-cart-item__image {
        padding-left: 12px !important;
    }

    body .fst-page table.wc-block-cart-items .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-cart-item__image img {
        width: 58px !important;
        max-width: 58px !important;
        height: 58px !important;
    }

    body .fst-page .wc-block-components-product-name {
        font-size: 16.5px !important;
    }

    body .fst-page table.wc-block-cart-items .wc-block-cart-item__total {
        padding-left: 8px !important;
    }

    body .fst-page table.wc-block-cart-items .wc-block-cart-item__total .wc-block-components-formatted-money-amount,
    body .fst-page .wc-block-cart-items__row:has(.wc-block-components-product-details__for-wheel) .wc-block-cart-item__total .wc-block-components-formatted-money-amount {
        font-size: 16px !important;
    }

    body .fst-page .wc-block-components-order-summary .wc-block-components-order-summary-item:has(.wc-block-components-product-details__for-wheel) {
        padding-left: 24px !important;
        background-position: -4px 0;
    }
}

/* The wrapper above the total already draws the rule. */
body .fst-page .wc-block-components-totals-wrapper .wc-block-components-totals-item.wc-block-components-totals-footer-item {
    border-top: 0 !important;
}
