body:has(.basket[open]) { overflow: hidden; }

.basket {
  --basket-border: #e4ded6;
  --basket-ink: #211d19;
  --basket-muted: #57504a;
  position: fixed;
  inset: 0 0 0 auto;
  width: min(100%, 30rem);
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  overflow: hidden;
  color: var(--basket-ink);
  background: #fff;
  box-shadow: -1rem 0 3rem #0003;
}

.basket[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.basket::backdrop { background: #17120db3; }
.basket button:focus-visible, .basket input:focus-visible, .basket-link:focus-visible { outline: 2px solid #ba5619; outline-offset: 3px; }

.basket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.25rem;
  border-top: 4px solid #f58216;
  background: #211d19;
  color: #fff;
}

.basket-header h2 { font-size: 1rem; line-height: 1.2; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.basket-header h2 span { margin-left: .2em; font-size: .9rem; font-weight: 600; color: #ddd1c5; }
.basket-close { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .55rem; background: #3b342e; font-size: 1.55rem; line-height: 1; }
.basket-close:focus-visible { outline-color: #f8b57a; }

.basket-content { overflow: auto; overscroll-behavior: contain; padding: 1rem 1.25rem; }
.basket-notice { margin: -1rem -1.25rem .45rem; padding: .65rem 1.25rem; text-align: center; background: #e9f3ed; color: #215a3b; font-size: .875rem; font-weight: 650; }
.basket-notice:empty { display: none; }
.basket-lines { list-style: none; }
.basket-empty { padding: 1rem 0; color: var(--basket-muted); }

.basket-line {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: .8rem;
  padding: .95rem 0;
  border-bottom: 1px solid var(--basket-border);
}

.basket-product-image {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border: 1px solid var(--basket-border);
  border-radius: .55rem;
  background: #faf7f4;
}

.basket-line-heading, .basket-line-controls, .basket-summary { display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.basket-line-heading { align-items: flex-start; }
.basket-line-heading h3 { font-size: 1rem; line-height: 1.35; }
.basket-line-prices { text-align: right; white-space: nowrap; }
.basket-line-original { display: block; color: var(--basket-muted); font-size: .82rem; }
.basket-line-original[hidden] { display: none; }
.basket-line-price { display: block; font-size: .96rem; }
.basket-line-original:not([hidden]) + .basket-line-price { color: #a91028; }
.basket-line-colour { margin-top: .2rem; color: var(--basket-muted); font-size: .875rem; }
.basket-line-controls { margin-top: .65rem; }

.basket-quantity { display: inline-flex; align-items: center; border: 1px solid var(--basket-border); border-radius: .45rem; }
.basket-quantity button { width: 2.5rem; height: 2.625rem; font-size: 1.15rem; }
.basket-quantity button:disabled { color: #746d68; cursor: default; }
.basket-line-quantity { min-width: 1.35rem; text-align: center; font-size: .95rem; font-weight: 700; }
.basket-remove { padding: .5rem 0 .5rem .15rem; text-decoration: underline; text-underline-offset: .15em; color: var(--basket-muted); font-size: .875rem; }

.basket-offer {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  margin-top: .85rem;
  padding: .65rem .75rem;
  border: 1px solid var(--basket-border);
  border-radius: .75rem;
  background: #fffdfa;
}
.basket-offer-image { width: 4.25rem; height: 4.25rem; border-radius: .45rem; object-fit: cover; }
.basket-offer h3 { font-size: .95rem; line-height: 1.25; }
.basket-offer-price { display: block; margin-top: .2rem; color: #a33419; font-size: .95rem; }
.basket-offer-add { min-height: 2.75rem; padding: .4rem .7rem; border-radius: .4rem; background: #211d19; color: #fff; font-size: .875rem; font-weight: 650; }

.basket-footer { padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--basket-border); background: #faf7f4; }
.basket-extra {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  min-height: 4rem;
  margin-bottom: .9rem;
  padding: .65rem .75rem;
  border: 1px solid var(--basket-border);
  border-radius: .65rem;
  background: #fff;
  cursor: pointer;
}
.basket-extra:has(input:checked) { border-color: #29764d; background: #edf7f0; }
.basket-offer[hidden], .basket-extra[hidden] { display: none; }
.basket-extra input { width: 1.12rem; height: 1.12rem; accent-color: #226440; cursor: inherit; }
.basket-extra strong { display: block; font-size: .875rem; line-height: 1.3; }
.basket-extra small { color: var(--basket-muted); font-size: .8rem; }
.basket-extra-price { white-space: nowrap; }
.basket-savings { display: flex; justify-content: space-between; gap: .65rem; margin-bottom: .4rem; color: #215a3b; font-size: .875rem; }
.basket-savings[hidden] { display: none; }
.basket-summary { margin-bottom: .65rem; font-weight: 700; }
.basket-summary-prices { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 0 .65rem; }
.basket-summary-prices del { color: var(--basket-muted); font-size: .9rem; }
.basket-summary strong { font-size: 1.4rem; color: #a91028; }
.basket-checkout { width: 100%; min-height: 3rem; padding: .7rem 1rem; border-radius: .55rem; background: #211d19; color: #fff; font-weight: 700; }
.basket-checkout:disabled { background: #e6e0db; color: #514b45; cursor: default; }
.basket-checkout-note { margin-top: .55rem; font-size: .875rem; text-align: center; color: var(--basket-muted); }
.basket-link { display: block; width: fit-content; margin: -.25rem auto .75rem; padding: .35rem; font-size: .875rem; font-weight: 650; text-decoration: underline; text-underline-offset: .15em; }
.basket-link[hidden] { display: none; }

@media (max-width: 370px) {
  .basket-header, .basket-content, .basket-footer { padding-inline: .9rem; }
  .basket-notice { margin-inline: -.9rem; }
  .basket-line { grid-template-columns: 3.5rem minmax(0, 1fr); gap: .6rem; }
  .basket-product-image { width: 3.5rem; height: 3.5rem; }
  .basket-offer { grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .45rem; padding-inline: .55rem; }
  .basket-offer-image { width: 3rem; height: 3rem; }
  .basket-offer-add { padding-inline: .45rem; font-size: .8rem; }
}
