/* M6: cart page (/dev/basket/) */

.xf-cart__title {
  margin: 18px 0 0;
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -1.2px;
  line-height: 1.05;
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
}
.xf-cart__title-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  background: var(--accent-dim);
  color: var(--accent-2);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  position: relative;
  top: -6px;
}

.xf-cart {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.xf-cart__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── Cart item row ─────────────────────────────────────────── */
.xf-cart-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 140px 130px 36px;
  gap: 18px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.xf-cart-item__img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  background: var(--surface-2);
  border-radius: 10px;
  overflow: hidden;
  color: var(--text-3);
}
.xf-cart-item__img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.xf-cart-item__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.xf-cart-item__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  row-gap: 2px;
}
.xf-cart-item__article {
  color: var(--text-3);
  white-space: nowrap;
}
.xf-cart-item__name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (hover: hover) {
  .xf-cart-item__name:hover { color: var(--accent-2); }
}
.xf-cart-item__price {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-2);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  row-gap: 2px;
}
.xf-cart-item__price-cur {
  color: var(--text-3);
  font-size: 0.85em;
  white-space: nowrap;
}
.xf-cart-item__price-each {
  font-family: var(--font-sans);
  color: var(--text-3);
  font-size: 12px;
  margin-left: 4px;
  white-space: nowrap;
}

/* ─── Qty stepper ───────────────────────────────────────────── */
.xf-cart-item__qty form {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: hidden;
}
.xf-cart-item__qty-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
@media (hover: hover) {
  .xf-cart-item__qty-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--accent-2); }
}
.xf-cart-item__qty-btn:disabled { color: var(--text-3); cursor: not-allowed; }
.xf-cart-item__qty-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  width: 36px;
  text-align: center;
}

/* ─── Sum ────────────────────────────────────────────────────── */
.xf-cart-item__sum {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}
.xf-cart-item__sum-cur { color: var(--text-3); font-size: 0.7em; font-weight: 500; }

/* ─── Remove ────────────────────────────────────────────────── */
.xf-cart-item__remove button {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
@media (hover: hover) {
  .xf-cart-item__remove button:hover { background: oklch(0.72 0.2 25 / 0.14); color: var(--danger); }
}

/* ─── Clear-cart row ────────────────────────────────────────── */
.xf-cart__clear-row {
  margin-top: 4px;
  text-align: right;
}
.xf-cart__clear {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 4px;
  transition: color .15s;
}
@media (hover: hover) {
  .xf-cart__clear:hover { color: var(--danger); }
}

/* ─── Summary aside ─────────────────────────────────────────── */
.xf-cart__summary {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.xf-cart__summary-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-2);
  margin-bottom: 6px;
}
.xf-cart__summary-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  color: var(--text-2);
}
.xf-cart__summary-line span:last-child {
  font-family: var(--font-mono);
  color: var(--text);
}
.xf-cart__summary-line--soft span:last-child {
  font-family: var(--font-sans);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
}
.xf-cart__summary-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 6px 0;
}
.xf-cart__summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.xf-cart__summary-total > span:first-child {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  font-family: var(--font-sans);
  letter-spacing: 0;
}
.xf-cart__summary-total-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.4px;
}
.xf-cart__summary-total-cur { font-size: 0.6em; color: var(--text-3); margin-left: 4px; }

.xf-cart__order { width: 100%; margin-top: 4px; }
.xf-cart__summary-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-3);
}
.xf-cart__summary-trust {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.xf-cart__summary-trust-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
}
.xf-cart__summary-trust-row svg {
  flex: 0 0 14px;
  color: var(--text-3);
}

/* ─── Empty cart ────────────────────────────────────────────── */
.xf-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.xf-cart-empty__icon {
  color: var(--text-3);
  margin-bottom: 18px;
  opacity: 0.6;
}
.xf-cart-empty__title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
}
.xf-cart-empty__text {
  margin: 0 0 22px;
  color: var(--text-2);
  font-size: 14px;
}

/* ─── Sticky mini-bar (mobile only) ─────────────────────────── */
/* Reuses m3.6 triple-guard contract: transform+opacity+pointer-events
   hidden in base WITHOUT transition; .is-initialized enables transitions
   (added via double-rAF after first IO callback); .is-visible toggled by
   IntersectionObserver on .xf-cart__summary. */
.xf-cart-sticky { display: none; }

@media (max-width: 767px) {
  /* ─── Cart grid → single column ──────────────────────────── */
  .xf-cart {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-bottom: 84px; /* breathing room for sticky bar */
  }

  /* ─── Item card: 2-row layout ────────────────────────────── */
  /* row 1: img 72 | main (brand·art, name, price); row 2: qty | sum.
     Remove (×) absolutely positioned top-right of card. */
  .xf-cart-item {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 10px 14px;
    padding: 14px;
    position: relative;
  }
  .xf-cart-item__img {
    grid-row: 1;
    grid-column: 1;
    width: 72px;
    height: 72px;
  }
  .xf-cart-item__main {
    grid-row: 1;
    grid-column: 2;
    padding-right: 36px; /* reserve for absolutely-positioned × */
  }
  .xf-cart-item__qty {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-self: start;
  }
  .xf-cart-item__sum {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-self: end;
    align-self: center;
    font-size: 17px;
  }
  .xf-cart-item__remove {
    position: absolute;
    top: 6px;
    right: 6px;
  }

  /* Qty stepper tap-targets from m2.4 already applied; keep. */
  .xf-cart-item__qty-btn { width: 44px; height: 44px; font-size: 20px; }
  .xf-cart-item__qty-val { width: 40px; }
  .xf-cart-item__remove button { width: 44px; height: 44px; }

  /* ─── Summary aside → static block below list ────────────── */
  .xf-cart__summary {
    position: static;
    top: auto;
  }

  /* ─── Sticky mini-bar ─────────────────────────────────────── */
  .xf-cart-sticky {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in oklch, var(--surface) 94%, transparent);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-top: 1px solid var(--line-soft);
    box-shadow: 0 -8px 24px -14px oklch(0.1 0.02 270 / 0.25);

    /* hidden state — no transition in base (m3.6 contract) */
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
    opacity: 0;
    pointer-events: none;
  }
  .xf-cart-sticky.is-initialized {
    transition: transform .22s ease-out, opacity .18s ease-out;
  }
  .xf-cart-sticky.is-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .xf-cart-sticky__total {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  .xf-cart-sticky__label {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--text-3);
  }
  .xf-cart-sticky__val {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.1;
    white-space: nowrap;
  }
  .xf-cart-sticky__val-cur {
    font-size: 0.7em;
    color: var(--text-3);
    margin-left: 3px;
    font-weight: 500;
  }
  .xf-cart-sticky__btn {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 16px;
    white-space: nowrap;
  }
}
