/* Cart page */

body.page-cart {
  background-color: var(--pi-bg);
  color: #fff;
  height: auto;
  min-height: 100vh;
}

body.page-cart .site-logo svg path,
body.page-cart .site-logo svg text,
body.page-cart .site-logo svg polygon,
body.page-cart .site-logo svg circle,
body.page-cart .site-logo svg ellipse,
body.page-cart .site-logo svg rect {
  fill: #fff !important;
}

body.page-cart .menu,
body.page-cart .menu a {
  color: #fff;
}

.cart {
  position: relative;
  padding: 6vh 6% 8vh;
}

.cart-close {
  position: absolute;
  top: 3vh;
  right: 6%;
  background: none;
  border: none;
  color: #fff;
  text-decoration: none;
  font-size: 1.2rem;
  font-family: inherit;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.cart-close:hover {
  opacity: 1;
}

.cart-title {
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 4vh;
}

/* ── Notice (stock changed / checkout unavailable) ───────────────────────── */

.cart-notice {
  margin-bottom: 3vh;
  padding-bottom: 1rem;
  border-bottom: 1px solid currentColor;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.cart-empty {
  font-size: 1.1rem;
  opacity: 0.6;
  margin-bottom: 1.5rem;
}

.cart-back {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 1rem;
}

.cart-back:hover {
  opacity: 0.65;
}

/* ── Items ───────────────────────────────────────────────────────────────── */

.cart-items {
  list-style: none;
  padding: 0;
  margin: 0 0 2vh;
}

.cart-item {
  align-items: center;
  padding: 1.5vh 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  column-gap: 0;
}

.cart-items .cart-item:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.cart-item img {
  width: 100%;
  display: block;
}

.cart-item .col-6 {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0 1rem;
}

.cart-item .col-6 a {
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
}

.cart-item .col-6 a:hover {
  text-decoration: underline;
}

.cart-item .col-6 span {
  font-size: 0.95rem;
  opacity: 0.6;
}

.cart-item .col-1 {
  font-size: 0.95rem;
  text-align: right;
}

/* ── Qty controls ────────────────────────────────────────────────────────── */

.cart-qty {
  display: flex;
  align-items: center;
}

.cart-qty form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-qty span {
  min-width: 1.2em;
  text-align: center;
}

.cart-qty button {
  width: 1.6em;
  height: 1.6em;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: none;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}

.cart-qty button:hover:not(:disabled) {
  background: #fff;
  color: var(--pi-bg);
  border-color: #fff;
}

.cart-qty button:disabled {
  opacity: 0.25;
  cursor: default;
}

/* ── Total ───────────────────────────────────────────────────────────────── */

.cart-total {
  text-align: right;
  font-size: 1.5rem;
  font-weight: 900;
  margin: 1.5vh 0 3vh;
}

/* ── Checkout form ───────────────────────────────────────────────────────── */

.cart-checkout-form {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: flex-end;
}

.cart-country {
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.2rem 0;
  appearance: none;
  -webkit-appearance: none;
  min-width: 180px;
}

.cart-country option,
.cart-country optgroup {
  color: #000;
  background: #fff;
}

.cart-shipping {
  font-size: 0.95rem;
  opacity: 0.75;
  white-space: nowrap;
}

.cart-checkout-btn {
  color: #fff;
  white-space: nowrap;
}

.cart-checkout-btn:hover {
  color: var(--pi-bg);
}

/* ── Cart menu badge (quantity only) ────────────────────────────────────── */

.cart-count {
  white-space: nowrap;
}

/* ── Cart overlay (docked panel, right-aligned, one column wide) ────────── */

.cart-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 33.3333%;
  height: 100vh;
  background-color: #fff;
  color: #000;
  z-index: 50;
  overflow-y: auto;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
}

.cart-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cart-overlay .cart {
  padding: 4vh 6% 4vh;
}

.cart-overlay .cart-close,
.cart-overlay .cart-back,
.cart-overlay .cart-item .col-6 a,
.cart-overlay .cart-country,
.cart-overlay .cart-qty button,
.cart-overlay .cart-checkout-btn {
  color: #000;
}

/* Title and close cross on one row, vertically centred (desktop and phone) */
.cart-overlay .cart-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2vh;
}

.cart-overlay .cart-title {
  font-size: 1.6rem;
  text-transform: uppercase;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.cart-overlay .cart-close {
  position: static;
  display: flex;
  padding: 0.3rem;
  margin-right: -0.3rem;
  opacity: 1;
  cursor: pointer;
}

/* The cross is drawn, so its stroke can be as heavy as the bold CART title */
.cart-close-icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: square;
}

.cart-overlay .cart-items {
  margin-top: 2vh;
}

.cart-overlay .cart-item,
.cart-overlay .cart-items .cart-item:first-child {
  border-color: #000;
}

/* Compact two-row item layout, matching the docked panel's narrow width */
.cart-overlay .cart-item {
  display: grid !important;
  grid-template-columns: 25% 1fr auto;
  grid-template-rows: auto auto;
  align-items: start;
  row-gap: 0.6rem;
  column-gap: 0;
}

.cart-overlay .cart-item > .col-2:first-child {
  grid-column: 1 !important;
  grid-row: 1 / 3 !important;
}

.cart-overlay .cart-item > .col-6 {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

.cart-overlay .cart-qty {
  grid-column: 2 !important;
  grid-row: 2 !important;
  padding: 0 1rem;
}

.cart-overlay .cart-subtotal {
  grid-column: 3 !important;
  grid-row: 2 !important;
  text-align: right;
}

.cart-overlay .cart-qty button {
  border-color: #000;
}

.cart-overlay .cart-qty button:hover:not(:disabled) {
  background: #000;
  color: #fff;
  border-color: #000;
}

.cart-overlay .cart-checkout-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.8rem 1rem;
}

.cart-overlay .cart-country {
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid #000;
  border-radius: 4px;
  padding: 0.6rem 1rem;
  min-width: 0;
}

.cart-overlay .cart-shipping {
  grid-column: 1;
  text-align: left;
  opacity: 1;
}

.cart-overlay .cart-checkout-btn {
  grid-column: 2;
  justify-self: end;
}

.cart-overlay .cart-total {
  font-size: 0.95rem;
}

.cart-overlay .cart-checkout-btn:hover {
  color: #fff;
}

.cart-overlay .cart-checkout-btn:hover .btn-border path {
  fill: #000;
  stroke: #000;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media only screen and (max-width: 800px) {

  .cart-overlay {
    width: 100%;
  }

  .cart-item {
    display: grid !important;
    grid-template-columns: 4.5rem 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 0;
  }

  .cart-item > .col-2:first-child {
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;
  }

  .cart-item > .col-6 {
    grid-column: 2 !important;
    grid-row: 1 !important;

  }

  .cart-qty {
    grid-column: 2 !important;
    grid-row: 2 !important;
    padding: 0 1rem;  
  }

  .cart-subtotal {
    grid-column: 3 !important;
    grid-row: 2 !important;
    text-align: right;
  }

  .cart-checkout-form {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .cart-country {
    width: 100%;
  }

  .cart-shipping {
    text-align: center;
  }

  .cart-title{
    font-size: 2em;
    padding-bottom: 0;
    padding-top: 2rem;
    margin-bottom: 0;
  }

  .cart-checkout-btn {
    width: 100%;
    text-align: center;
  }

}

/* Ordering unavailable (invitation only / paused) */
.cart-checkout-btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Legal links under the checkout ─────────────────────────────────────── */

.cart-legal {
  margin-top: 1rem;
  font-size: 0.8rem;
  line-height: 1.4;
  text-align: right;
  opacity: 0.85;
}

.cart-legal a { color: inherit; }

.cart-overlay .cart-legal { text-align: left; opacity: 1; }
