/* ============================================================
   CAPELY: basket page
   Lines on the left, a sticky summary on the right, collapsing to one column
   on a phone. Card chrome comes from the shared .card in site.css.
   ============================================================ */

.cart-section { padding-top: calc(var(--nav-h) + 56px); }

/* Every one of these carries an author `display`, which outranks the UA
   sheet's [hidden] { display: none }. Without the matching [hidden] rule the
   empty state and the line list would both be on screen at once. This is the
   exact bug that made the whole site unclickable in round 4; tools/lint.js
   checks for it. */
.cart-loading { color: var(--text-mute); font-size: 14px; }
.cart-loading[hidden] { display: none; }

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  color: var(--text-dim);
}
.cart-empty[hidden] { display: none; }

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--gutter);
  align-items: start;
}
.cart-layout[hidden] { display: none; }

@media (max-width: 860px) {
  .cart-layout { grid-template-columns: 1fr; }
}

/* ---------- lines ---------- */
.cart-lines {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-line {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
}

.cart-line-art {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 96px;
}
.cart-line-thumb {
  width: 52px;
  height: auto;
  aspect-ratio: 10 / 16;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.cart-line-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.cart-line-name {
  font-family: 'Outfit', sans-serif;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  transition: color var(--t-fast);
}
.cart-line-name:hover { color: var(--accent); text-decoration: underline; }

.cart-line-unit { color: var(--text-mute); font-size: 13.5px; }

.cart-line-stock { font-size: 12.5px; font-weight: 600; }
.cart-line-stock.is-warn { color: var(--warn); }
.cart-line-stock.is-danger { color: var(--danger); }

/* ---------- quantity ---------- */
.cart-qty {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  width: fit-content;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--surface-2);
}
.cart-qty-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  color: var(--text-dim);
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transition: color var(--t-fast), background var(--t-fast);
}
.cart-qty-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-3); }
.cart-qty-btn:disabled { color: var(--text-faint); cursor: default; }
.cart-qty-value {
  min-width: 26px;
  text-align: center;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ---------- line side ---------- */
.cart-line-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  text-align: right;
}
.cart-line-total {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.cart-line-remove {
  color: var(--text-mute);
  font-size: 12.5px;
  font-weight: 600;
  transition: color var(--t-fast);
}
.cart-line-remove:hover { color: var(--danger); }

@media (max-width: 520px) {
  .cart-line { grid-template-columns: 64px minmax(0, 1fr); }
  .cart-line-art { height: 76px; }
  .cart-line-thumb { width: 42px; }
  /* The money and the remove control drop under the copy rather than being
     squeezed into a third column that is 40px wide at 320. */
  .cart-line-side {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}

/* ---------- summary ---------- */
.cart-summary {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-summary-title { font-size: 15px; }
.cart-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-dim);
  font-size: 14px;
}
.cart-summary-value {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.cart-summary-note { color: var(--text-mute); font-size: 12.5px; }
.cart-checkout { width: 100%; }

/* ---------- the out-of-stock notice ----------
   Why Checkout is off, and the action that clears it. The tint is theme's own
   --danger mixed toward transparent, exactly the pattern css/03-shop.css uses
   for the sold-out chip on a cape card, so a blocked basket and a sold-out cape
   read as the same signal. Never an invented colour. */
.cart-stock-notice {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}
/* An author `display` outranks the UA sheet's [hidden] { display: none }, so
   without this the notice would sit there permanently on a basket that is
   entirely in stock. Same trap as .cart-loading above. */
.cart-stock-notice[hidden] { display: none; }

.cart-stock-problem {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.cart-stock-help { color: var(--text-dim); font-size: 12.5px; line-height: 1.55; }
/* Width and padding only. .btn-ghost's own identity is untouched; the narrower
   inline padding is there because .btn is white-space: nowrap and this card is
   320px wide, so the label has to clear its own box at 320px too. */
.cart-stock-fix { width: 100%; padding: 0 16px; }

/* Not `disabled`: it is an anchor, so the only honest way to stop it is to
   make it inert AND say so to assistive tech, which the page does with
   aria-disabled beside this class. */
.cart-checkout.is-disabled {
  pointer-events: none;
  opacity: .5;
}

.cart-currency-note { color: var(--text-mute); font-size: 12px; line-height: 1.5; }
.cart-currency-note[hidden] { display: none; }

@media (max-width: 860px) {
  .cart-summary { position: static; }
}
