/* ============================================================
   Lunelle — checkout page
   Uses the tokens from styles.css; no new colours.
   ============================================================ */

.checkout-page { background: var(--wash); }

.checkout-back {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.9rem; color: var(--muted); text-decoration: none;
  transition: color var(--t);
}
.checkout-back:hover { color: var(--accent-strong); }

.checkout { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem); }

.checkout-title { font-size: clamp(1.9rem, 4vw, 2.5rem); margin-bottom: 1.75rem; }

/* ---- layout ---- */
.checkout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.75rem, 4vw, 3rem);
  align-items: start;
}
@media (min-width: 60rem) {
  .checkout-grid { grid-template-columns: 1.5fr 1fr; }
}
/* the display:grid above would otherwise override the [hidden] attribute */
.checkout-grid[hidden] { display: none; }

/* ---- form ---- */
.checkout-form { min-width: 0; }

.field-group {
  border: 0; margin: 0 0 1.75rem; padding: 0;
}
.field-group legend {
  font-family: var(--font-display); font-size: 1.15rem; color: var(--ink);
  padding: 0; margin-bottom: 0.9rem;
}

.field { margin-bottom: 1rem; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.01em;
  color: var(--muted); margin-bottom: 0.4rem;
}

.field-row {
  display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr; gap: 0.8rem;
  margin-bottom: 1rem;
}
@media (max-width: 26rem) { .field-row { grid-template-columns: 1fr 1fr; } }

.checkout-form input,
.checkout-form select,
.ifield-shell {
  width: 100%;
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color var(--t), box-shadow var(--t);
}
.checkout-form input,
.checkout-form select { padding: 0.7rem 0.85rem; height: 48px; }
.checkout-form select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23786C65' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center; padding-right: 2rem;
}
.checkout-form input::placeholder { color: color-mix(in srgb, var(--muted) 60%, transparent); }

.checkout-form input:focus,
.checkout-form select:focus,
.ifield-shell.is-focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.checkout-form input:user-invalid { border-color: color-mix(in srgb, #b4534b 55%, var(--line-strong)); }

/* ---- the iFields iframes, dressed to look like our inputs ---- */
.ifield-shell { height: 48px; padding: 0; overflow: hidden; position: relative; }
.ifield-shell iframe { display: block; width: 100%; height: 100%; border: 0; background: transparent; }

.ifield-error {
  display: block; min-height: 1.1rem; margin-top: 0.5rem;
  font-size: 0.82rem; color: #b4534b;
}

/* ---- errors + submit ---- */
.pay-error {
  background: color-mix(in srgb, #b4534b 10%, var(--surface));
  border: 1px solid color-mix(in srgb, #b4534b 35%, transparent);
  color: #8f3f38; border-radius: var(--radius);
  padding: 0.75rem 1rem; font-size: 0.9rem; margin: 0 0 1.1rem;
}

.pay-btn {
  width: 100%; justify-content: center;
  font-size: 1.05rem; padding: 0.95rem 1.25rem; margin-top: 0.25rem;
}
.pay-btn[disabled] { opacity: 0.6; cursor: progress; }

.pay-secure {
  display: flex; align-items: flex-start; gap: 0.5rem;
  margin-top: 1rem; font-size: 0.8rem; line-height: 1.5; color: var(--muted);
}
.pay-secure svg { flex: none; margin-top: 0.15rem; color: var(--accent-strong); }

/* ---- order summary ---- */
.order-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: var(--shadow-sm);
}
@media (min-width: 60rem) {
  .order-summary { position: sticky; top: 1.5rem; }
}
.order-summary h2 { font-size: 1.3rem; margin-bottom: 1.1rem; }

.summary-lines { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.9rem; }
.summary-line { display: flex; align-items: center; gap: 0.85rem; }
.summary-thumb {
  width: 52px; height: 52px; flex: none; border-radius: 12px; overflow: hidden;
  background: var(--wash); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.summary-thumb img { width: 100%; height: 100%; object-fit: cover; }
.summary-thumb span { font-family: var(--font-display); color: var(--accent-strong); font-size: 1.1rem; }
.summary-line-main { flex: 1 1 auto; min-width: 0; }
.summary-line-name { display: block; font-size: 0.92rem; color: var(--ink); }
.summary-line-qty { display: block; font-size: 0.78rem; color: var(--muted); }
.summary-line-price { font-size: 0.92rem; color: var(--ink); white-space: nowrap; }

.summary-totals { margin: 0; padding-top: 1rem; border-top: 1px solid var(--line); display: grid; gap: 0.55rem; }
.summary-row { display: flex; justify-content: space-between; align-items: baseline; margin: 0; font-size: 0.9rem; color: var(--muted); }
.summary-row dt { margin: 0; }
.summary-row dd { margin: 0; color: var(--ink); }
.summary-row.is-save dd { color: var(--accent-strong); }
.summary-row.is-total { padding-top: 0.6rem; border-top: 1px solid var(--line); font-size: 1.05rem; }
.summary-row.is-total dt { font-family: var(--font-display); color: var(--ink); }
.summary-row.is-total dd { font-family: var(--font-display); font-size: 1.35rem; color: var(--ink); }
.summary-note {
  margin: 0.9rem 0 0; font-size: 0.8rem; color: var(--accent-strong);
  background: var(--blush); border-radius: var(--radius); padding: 0.6rem 0.8rem;
}

/* ---- empty + done states ---- */
.checkout-empty, .checkout-done { max-width: 34rem; margin: clamp(2rem,6vw,4rem) auto; text-align: center; }
.checkout-empty h1, .checkout-done h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin-bottom: 0.75rem; }
.checkout-empty p, .checkout-done .done-text { color: var(--muted); margin-bottom: 1.5rem; }
.done-mark {
  width: 4.5rem; height: 4.5rem; margin: 0 auto 1.25rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sage-soft); color: var(--accent-strong);
}
.done-ref { font-size: 0.9rem; color: var(--muted); margin: 1rem 0 1.75rem; }
.done-ref strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.checkout-footer { margin-top: 0; background: transparent; border-top: 1px solid var(--line); }
