/* =========================================
   THE CHOSEN ONE PEPTIDES — Cart, drawer, checkout
   Uses the tokens from style.css. No new colours introduced.
   ========================================= */

/* ---- nav cart button ---- */
.nav__cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.nav__cart:hover { border-color: var(--color-primary); color: var(--color-primary); }
.nav__cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---- add-to-cart rows on the product cards ---- */
.tier-row--buy { gap: var(--space-3); }
.add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.add-btn:hover { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.add-btn[data-added="1"] {
  background: var(--color-primary-dim);
  border-color: var(--color-success);
  color: var(--color-success);
}

/* ---- drawer ---- */
.cart-drawer { position: fixed; inset: 0; z-index: 200; }
.cart-drawer[hidden] { display: none !important; }
.cart-drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
}
.cart-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
}
.cart-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
}
.cart-drawer__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}
.cart-drawer__x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.cart-drawer__x:hover { color: var(--color-text); border-color: var(--color-primary); }
.cart-drawer__body { flex: 1; overflow-y: auto; padding: var(--space-4) var(--space-6); }
.cart-empty { color: var(--color-text-muted); font-size: var(--text-sm); padding: var(--space-8) 0; text-align: center; }
.cart-lines { list-style: none; display: flex; flex-direction: column; gap: var(--space-4); }

.cart-line { padding-bottom: var(--space-4); border-bottom: 1px solid var(--color-divider); }
.cart-line:last-child { border-bottom: 0; }
.cart-line__main { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-3); }
.cart-line__name { font-family: var(--font-display); font-weight: 600; color: var(--color-text); font-size: var(--text-sm); }
.cart-line__size { color: var(--color-text-muted); font-size: var(--text-xs); }
.cart-line__controls { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.cart-line__price {
  margin-left: auto;
  font-weight: 600;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.cart-line__x {
  background: none;
  border: 0;
  padding: 0;
  color: var(--color-text-faint);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  flex-basis: 100%;
}
.cart-line__x:hover { color: var(--color-error); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }
.qty__btn {
  width: 28px;
  height: 28px;
  border: 0;
  background: var(--color-surface-2);
  color: var(--color-text);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background var(--transition);
}
.qty__btn:hover { background: var(--color-primary); color: #fff; }
.qty__n {
  min-width: 32px;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.cart-drawer__foot { padding: var(--space-5) var(--space-6); border-top: 1px solid var(--color-divider); background: var(--color-surface-2); }
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
}
.cart-note { color: var(--color-text-faint); font-size: var(--text-xs); margin-bottom: var(--space-4); }
.cart-checkout { width: 100%; justify-content: center; }

/* ---- checkout page ---- */
.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: var(--space-10);
  align-items: start;
}
@media (max-width: 860px) { .checkout-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); } }

.order-table { width: 100%; border-collapse: collapse; }
.order-table th {
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.order-table th:last-child, .order-table td:last-child { text-align: right; }
.order-table td { padding: var(--space-4) 0; border-bottom: 1px solid var(--color-divider); vertical-align: top; }
.order-table .o-name { font-family: var(--font-display); font-weight: 600; color: var(--color-text); display: block; }
.order-table .o-size { color: var(--color-text-muted); font-size: var(--text-xs); }
.order-table .o-price { font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; white-space: nowrap; }

.order-sum { display: flex; justify-content: space-between; align-items: baseline; padding: var(--space-4) 0; }
.order-sum--total {
  border-top: 1px solid var(--color-border);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.order-sum span:first-child { color: var(--color-text-muted); }
.order-sum--total span:first-child { color: var(--color-text); }

/* ---- researcher attestation ---- */
.attest {
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.attest__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}
.attest__body { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-5); }
.attest__check { display: flex; gap: var(--space-3); align-items: flex-start; cursor: pointer; }
.attest__check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  cursor: pointer;
}
.attest__check span { color: var(--color-text); font-size: var(--text-sm); line-height: 1.55; }

.pay-btn { width: 100%; justify-content: center; }
.pay-btn[disabled] { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.pay-msg { margin-top: var(--space-4); font-size: var(--text-sm); min-height: 1.4em; }
.pay-msg[data-state="error"] { color: var(--color-error); }
.pay-msg[data-state="working"] { color: var(--color-text-muted); }

.checkout-empty { text-align: center; padding: var(--space-16) 0; }
.checkout-empty p { color: var(--color-text-muted); margin-bottom: var(--space-6); }

/* ---- order complete ---- */
.done-wrap { text-align: center; max-width: var(--content-narrow); margin: 0 auto; padding: var(--space-16) 0; }
.done-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-6);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-success);
  background: rgba(52, 199, 122, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-success);
}

@media (prefers-reduced-motion: reduce) {
  .add-btn, .nav__cart, .qty__btn, .cart-drawer__x { transition: none; }
}
