/* =========================================================================
 * CRYSKULL checkout — dark editorial theme (main site, cryskull.com)
 *
 * Layout (desktop):
 *   ┌──────────────────────────────────────┐  ┌───────────────────────┐
 *   │  Express → Contact → Delivery → Ship  │  │  Order Summary       │
 *   │  → Payment → Billing → Pay now       │  │  (sticky)            │
 *   └──────────────────────────────────────┘  └───────────────────────┘
 * ========================================================================= */

/* ─── Shell ─── */
.checkout-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 4vw, 3rem) clamp(4rem, 8vw, 6rem);
  background: var(--bg, #0a0a0b);
  color: var(--text, #e8e6e1);
  font-family: var(--font-body, Inter, -apple-system, BlinkMacSystemFont, sans-serif);
  -webkit-font-smoothing: antialiased;
}

.checkout-message {
  padding: 1rem 1.25rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--text-dim, #8b8b86);
  margin-bottom: 1.5rem;
  background: transparent;
}
.checkout-message[data-tone='error'] {
  color: var(--accent, #e8a257);
  border-left: 3px solid var(--accent, #e8a257);
}
.checkout-message[data-tone='muted'] {
  color: var(--text-dim, #8b8b86);
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 380px);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

/* ─── Left column ─── */
.checkout-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.checkout-section {
  border-top: 1px solid var(--line, #1d1d1e);
  padding-top: 1.75rem;
}
.checkout-section:first-of-type {
  border-top: none;
  padding-top: 0;
}
.checkout-section h3 {
  font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: 0.005em;
  margin: 0 0 1rem;
  color: var(--text, #e8e6e1);
}

/* Section variant hooks — no additional declarations, they just add context to the HTML
   and keep preflight's "every class must be defined in CSS" guard happy. */
.checkout-shipping-section,
.checkout-payment-method,
.checkout-billing,
.checkout-terms-section { }

/* ─── Express checkout ─── */
.checkout-express {
  padding-top: 0;
  margin-bottom: 0;
}
.checkout-express .eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim, #8b8b86);
  margin: 0 0 0.875rem;
  font-family: var(--font-body, Inter, sans-serif);
}
.checkout-express-paypal {
  width: 100%;
  min-height: 48px;
  padding: 0.875rem 1rem;
  border: none;
  border-radius: 4px;
  background: #ffc439;
  color: #111;
  font-family: 'PayPal Sans', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: filter 0.12s, transform 0.08s, opacity 0.15s;
}
.checkout-express-paypal:disabled,
.checkout-express-paypal.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}
.checkout-express-paypal:not(:disabled):not(.is-disabled):hover { filter: brightness(1.05); opacity: 1; }
.checkout-express-paypal:not(:disabled):not(.is-disabled):active { transform: translateY(1px); }

.checkout-express-hint {
  font-size: 0.6875rem;
  color: var(--text-dim, #8b8b86);
  margin: 0.5rem 0 0;
  text-align: center;
  letter-spacing: 0.02em;
}

.checkout-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0 0;
  gap: 1rem;
}
.checkout-divider::before,
.checkout-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line, #1d1d1e);
}
.checkout-divider span {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--text-dim, #8b8b86);
  text-transform: uppercase;
}

/* ─── Form fields ─── */
.checkout-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.checkout-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-dim, #8b8b86);
}
.checkout-fields label > span {
  letter-spacing: 0.01em;
}
.checkout-fields input,
.checkout-fields select {
  font: inherit;
  color: var(--text, #e8e6e1);
  background: transparent;
  border: 1px solid var(--line, #1d1d1e);
  border-radius: 4px;
  padding: 0.6875rem 0.75rem;
  font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
}
.checkout-fields input::placeholder { color: var(--text-dim, #8b8b86); opacity: 0.6; }
.checkout-fields input[readonly],
.checkout-fields input[aria-readonly='true'] {
  background: var(--bg-soft, #0f0f10);
  color: var(--text-dim, #8b8b86);
  cursor: default;
}
.checkout-fields input:focus,
.checkout-fields select:focus {
  outline: none;
  border-color: var(--text, #e8e6e1);
}
.checkout-fields select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23ffffff' opacity='0.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.checkout-wide {
  grid-column: 1 / -1;
}

/* ─── Shipping method ─── */
.checkout-shipping-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 0;
  font-size: 0.875rem;
}
.checkout-shipping-label { color: var(--text, #e8e6e1); }
.checkout-shipping-value { color: var(--text-dim, #8b8b86); }

/* ─── Payment method ─── */
.checkout-note {
  margin: -0.25rem 0 0.875rem;
  font-size: 0.75rem;
  color: var(--text-dim, #8b8b86);
}
.checkout-payment-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 0;
}
.checkout-payment-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--text, #e8e6e1);
  border-radius: 50%;
  box-sizing: border-box;
  position: relative;
}
.checkout-payment-radio::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--text, #e8e6e1);
}
.checkout-payment-name {
  font-size: 0.875rem;
  color: var(--text, #e8e6e1);
}

/* ─── Billing ─── */
.checkout-radio-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.8125rem;
  color: var(--text, #e8e6e1);
  cursor: pointer;
}
.checkout-radio-row input {
  accent-color: var(--text, #e8e6e1);
}

/* ─── Terms ─── */
.checkout-terms {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.8125rem;
  color: var(--text-dim, #8b8b86);
  cursor: pointer;
}
.checkout-terms input {
  margin-top: 2px;
  accent-color: var(--text, #e8e6e1);
}
.checkout-terms a { color: var(--text, #e8e6e1); text-decoration: underline; }
.checkout-terms a:hover { text-decoration: none; }

/* ─── Required-field asterisks ─── */
.required-field { } /* semantic hook only; inherits label rules + carries required-mark */
.required-mark {
  color: #e8a257;
  margin-left: 2px;
  font-weight: 600;
}

/* ─── Pay now button (gold — matches the PayPal express button below) ─── */
.checkout-pay-now {
  margin-top: 0.5rem;
  width: 100%;
  min-height: 54px;
  padding: 0.875rem 1.25rem;
  border: none;
  border-radius: 4px;
  background: #ffc439;
  color: #111;
  font-weight: 700;
  font-size: 0.9375rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  cursor: pointer;
  transition: filter 0.12s, transform 0.08s, opacity 0.15s;
}
.checkout-pay-now:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.checkout-pay-now:not(:disabled):hover { filter: brightness(1.05); }
.checkout-pay-now:not(:disabled):active { transform: translateY(1px); }

.checkout-pay-now-total {
  font-size: 0.8125rem;
  font-weight: 400;
  opacity: 0.75;
  letter-spacing: 0.01em;
}

.checkout-footer {
  text-align: center;
  margin: 1rem 0 0;
  font-size: 0.75rem;
}
.checkout-footer a { color: var(--text-dim, #8b8b86); text-decoration: underline; }
.checkout-footer a:hover { color: var(--text, #e8e6e1); text-decoration: none; }

/* ─── Turnstile ─── */
#checkout-turnstile {
  margin: 0 0 1rem;
  min-height: 65px;
}
#checkout-turnstile iframe { max-width: 100%; }

/* ─── Express Smart Button mount ─── */
.checkout-express-mount {
  width: 100%;
  min-height: 52px;
}

/* ─── Smart Buttons mount ─── */
.checkout-paypal-mount {
  margin-top: 1.5rem;
  width: 100%;
  min-height: 48px;
}
.checkout-paypal-mount.is-empty {
  text-align: center;
}
.checkout-paypal-mount:empty::before {
  content: 'Loading PayPal…';
  font-size: 0.8125rem;
  color: var(--text-dim, #8b8b86);
}
.checkout-paypal-mount > div { /* wrapper PayPal injects */ }
.checkout-paypal-loading {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  border-radius: 4px;
  background: var(--bg-soft, #0f0f10);
  color: var(--text-dim, #8b8b86);
}
.checkout-retry-sdk {
  margin-top: 0.75rem;
  background: transparent;
  color: var(--text, #e8e6e1);
  border: 1px solid var(--line, #1d1d1e);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.checkout-retry-sdk:hover { background: var(--bg-soft, #0f0f10); }

/* ─── Success state ─── */
#checkout-success {
  border-top: 1px solid var(--line, #1d1d1e);
  padding-top: 2rem;
  margin-top: 1rem;
}
#checkout-success h2 {
  font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  font-weight: 500;
  font-size: 1.375rem;
  letter-spacing: 0.005em;
  margin: 0 0 0.75rem;
  color: var(--text, #e8e6e1);
}
#checkout-success p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-dim, #8b8b86);
}
.checkout-reference {
  margin-top: 0.75rem !important;
  font-family: 'SF Mono', ui-monospace, 'Menlo', monospace;
  font-size: 0.75rem !important;
  color: var(--text-dim, #8b8b86);
}
.checkout-back-site {
  margin-top: 1.5rem;
  background: transparent;
  border: 1px solid var(--line, #1d1d1e);
  border-radius: 999px;
  padding: 0.625rem 1.125rem;
  color: var(--text, #e8e6e1);
  font-size: 0.8125rem;
  cursor: pointer;
  font-weight: 500;
}
.checkout-back-site:hover { background: var(--bg-soft, #0f0f10); }

/* ─── Right column: sticky order summary ─── */
.checkout-summary {
  position: sticky;
  top: calc(var(--site-header-height, 80px) + 24px);
  align-self: start;
  background: var(--bg-soft, #0f0f10);
  border: 1px solid var(--line, #1d1d1e);
  border-radius: 4px;
  padding: 1.5rem;
}

.checkout-summary-product {
  display: flex;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line, #1d1d1e);
}
.checkout-summary-image-wrap {
  position: relative;
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
}
.checkout-summary-image-wrap img {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--bg, #0a0a0b);
}
.checkout-summary-qty {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg, #0a0a0b);
  color: var(--text, #e8e6e1);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line, #1d1d1e);
}
.checkout-summary-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.checkout-summary-info .eyebrow {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim, #8b8b86);
  margin: 0;
  font-family: var(--font-body, Inter, sans-serif);
}
.checkout-summary-info h2 {
  font-family: var(--font-display, 'Cormorant Garamond', Georgia, serif);
  font-weight: 500;
  font-size: 1.125rem;
  line-height: 1.15;
  letter-spacing: 0.005em;
  margin: 0;
  color: var(--text, #e8e6e1);
}
.checkout-summary-info .small {
  font-size: 0.6875rem;
  color: var(--text-dim, #8b8b86);
  margin: 0;
}

.checkout-total {
  margin: 0;
  padding-top: 0.25rem;
}
.checkout-total > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: 0.3125rem 0;
}
.checkout-total dt {
  font-size: 0.8125rem;
  color: var(--text-dim, #8b8b86);
}
.checkout-total dd {
  margin: 0;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--text, #e8e6e1);
  font-weight: 500;
}
.checkout-total-line {
  margin-top: 0.5rem;
  padding-top: 0.875rem !important;
  border-top: 1px solid var(--line, #1d1d1e);
}
.checkout-total-line dt {
  color: var(--text, #e8e6e1);
  font-size: 0.9375rem;
  font-weight: 500;
}
.checkout-total-line dd {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  .checkout-layout { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 1.5rem; }
}
@media (max-width: 860px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .checkout-summary {
    position: static;
    order: -1;
    margin-bottom: 0.5rem;
  }
}
@media (max-width: 560px) {
  .checkout-fields { grid-template-columns: 1fr; }
  .checkout-shell { padding: 1rem 1rem 4rem; }
}
