/* KakiJalae — checkout.html only.
   Loaded after styles.css, so shared tokens (--ink, --gold, --sun, --line,
   .primary-link, .secondary-link, .lang-btn, .site-header, .kicker, etc.)
   are already available. This file adds layout + components specific to
   the checkout flow only. */

.checkout-header {
  grid-template-columns: auto 1fr auto;
}

.checkout-back-link {
  justify-self: center;
  color: rgba(255, 250, 240, 0.78);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.checkout-back-link:hover {
  color: var(--sun);
}

.checkout-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 48px) clamp(16px, 5vw, 48px) 96px;
}

.checkout-badge:not([hidden]) {
  display: inline-flex;
  margin: 0 0 20px;
  padding: 6px 12px;
  border: 1px solid rgba(180, 66, 53, 0.35);
  border-radius: 999px;
  color: var(--red);
  background: rgba(180, 66, 53, 0.08);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.checkout-empty {
  display: grid;
  gap: 14px;
  max-width: 480px;
  padding: 48px 0;
}

.checkout-empty h1 {
  margin: 0;
  font-size: 32px;
}

.checkout-empty p {
  margin: 0;
  color: var(--muted);
}

.checkout-empty .primary-link {
  justify-self: start;
}

/* Buy-now (single-product landing) mode — see checkout.html's
   #checkoutBuyNowHero and checkout.js's initBuyNowMode(). Reuses
   .product-visual/.product-icon/.product-code (styles.css) and
   .qty-controls (styles.css, same as the cart drawer) — only the
   hero-specific layout/typography below is new. */
.checkout-buynow-hero {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
}

.checkout-buynow-hero .product-visual {
  min-height: 160px;
  border-radius: 10px;
}

.checkout-buynow-body h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.checkout-buynow-description {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.checkout-buynow-price-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.checkout-buynow-unit-price {
  font-size: 24px;
  font-weight: 1000;
  color: var(--ink);
}

.checkout-buynow-line-total {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.checkout-buynow-line-total strong {
  color: var(--ink);
  font-size: 16px;
}

@media (max-width: 640px) {
  .checkout-buynow-hero {
    grid-template-columns: 1fr;
  }
}

.checkout-app h1 {
  margin: 0 0 6px;
  font-size: 36px;
}

.checkout-subtitle {
  margin: 0 0 28px;
  color: var(--muted);
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: start;
}

.checkout-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.checkout-card h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.checkout-summary {
  position: sticky;
  top: 96px;
}

.checkout-loading,
.checkout-error {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.checkout-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--red);
}

.checkout-error .secondary-link {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.checkout-items {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.checkout-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.checkout-item h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.checkout-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.checkout-item strong {
  align-self: center;
  white-space: nowrap;
}

.checkout-totals {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.checkout-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.checkout-total-row--main {
  color: var(--ink);
  font-size: 20px;
}

.checkout-total-row--main strong {
  font-size: 24px;
}

.checkout-form {
  display: grid;
  gap: 16px;
  align-content: start;
}

.checkout-field {
  display: grid;
  gap: 6px;
}

.checkout-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.checkout-field input,
.checkout-field textarea,
.checkout-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--paper);
  font: inherit;
}

.checkout-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.checkout-field-hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.checkout-address-fields {
  display: grid;
  gap: 16px;
}

/* #58 — "shipping to someone else" toggle above the recipient fields. */
.checkout-field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}

.checkout-field-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--red);
}

.checkout-field-group-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.checkout-disclaimer {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* #72 C1 (coordinator) — CSS-only spinner for #stripePaymentWaiting; the
   message text + disabled Pay button already cover "not stuck", this is
   purely a visible activity indicator on top. No JS involved. */
#stripePaymentWaiting:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 10px;
}

#stripePaymentWaiting::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: checkout-spin 0.8s linear infinite;
}

@keyframes checkout-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #stripePaymentWaiting::before {
    animation: none;
  }
}

.checkout-submit {
  margin-top: 4px;
}

.checkout-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.checkout-confirmation {
  display: grid;
  gap: 14px;
  max-width: 640px;
  margin: 24px auto 0;
  text-align: left;
}

.checkout-confirmation h1 {
  margin: 0;
  font-size: 32px;
}

.checkout-confirmation h2 {
  margin: 8px 0 0;
  font-size: 18px;
}

.checkout-confirm-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.checkout-confirm-meta div {
  display: grid;
  gap: 4px;
}

.checkout-confirm-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.checkout-confirm-meta strong {
  font-size: 16px;
  word-break: break-all;
}

.checkout-whatsapp-fallback {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
}

.checkout-whatsapp-fallback p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
}

.checkout-payment-step {
  /* .checkout-grid only defines 2 explicit columns (summary + form); without
     this the payment step would auto-place into row 2 under the narrower
     summary column instead of using the full width available once the form
     is hidden. */
  grid-column: 1 / -1;
}

.checkout-payment-step p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

#stripePaymentElement {
  margin-bottom: 16px;
}

.checkout-payment-step .checkout-whatsapp-fallback {
  margin-top: 16px;
}

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

  .checkout-summary {
    position: static;
  }
}

@media (max-width: 640px) {
  .checkout-header {
    grid-template-columns: auto auto;
  }

  .checkout-back-link {
    display: none;
  }

  .checkout-confirm-meta {
    grid-template-columns: 1fr;
  }

  .checkout-field-row {
    grid-template-columns: 1fr;
  }
}
