/* Checkout.
 *
 * Two columns collapsing to one below 860px, matching the breakpoint the nav
 * already uses, so the page changes shape in one place rather than two.
 *
 * Colour grammar, per the 2026-08-14 design decision: CORAL (--accent) IS
 * ACTION ONLY -- here the single submit button and the input focus ring.
 * Marine (--accent-voice) is brand voice: legends, headings, in-text links.
 * No new colours are defined; every value below is a token already on body.v2
 * in base.css.
 */

.checkout-section { padding-top: 48px; }

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-top: 32px;
}

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

/* --- fields --- */

.checkout-fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px 22px 22px;
  margin: 0 0 20px;
  background: var(--bg-surface);
}

.checkout-fieldset legend {
  padding: 0 8px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .02em;
  color: var(--accent-voice);
}

.field { display: block; margin: 0 0 16px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.field-optional {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="email"],
.field select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-void);
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-hint {
  display: block;
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

/* --- consents ---
 * Generous spacing on purpose. These are three separate decisions and must not
 * read as one block of small print to be clicked through. */

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}

.consent input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.consent a { color: var(--accent-voice); text-decoration: underline; }

.consent-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.consent-note a { color: var(--accent-voice); text-decoration: underline; }

/* --- summary --- */

.checkout-summary {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 22px;
  background: var(--bg-surface);
}

@media (max-width: 860px) {
  /* Sticky in a single column would pin the panel over the fields it belongs
   * beside. */
  .checkout-summary { position: static; }
}

.summary-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-voice);
}

/* Billing-period switch. Two real radios, styled as a segmented control --
 * a real choice rather than a display of one. */
.summary-period-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 18px;
}

.period-option {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}

.period-option input { position: absolute; opacity: 0; pointer-events: none; }
.period-option em { display: block; font-size: 12px; font-style: normal; color: var(--text-muted); }

.period-option:has(input:checked) {
  border-color: var(--accent-voice);
  background: var(--bg-surface-alt);
  font-weight: 600;
}

/* Keyboard users must still see which option has focus, since the real radio
 * is visually hidden above. */
.period-option:has(input:focus-visible) {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--hairline);
}

.summary-period {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
}

.summary-total {
  border-bottom: none;
  padding-top: 14px;
  font-size: 18px;
  font-weight: 700;
}

.summary-note {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  min-height: 1.5em;   /* reserve the line so the button below does not jump */
}

.checkout-submit { width: 100%; margin-top: 18px; justify-content: center; }

.summary-fineprint {
  margin: 12px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
}

/* While a quote is in flight. Dimmed, never blanked: a total that vanishes
 * reads as an error, and the previous one is still the best answer we have. */
.checkout-summary.is-pending .summary-line {
  opacity: .55;
  transition: opacity .12s ease;
}

.checkout-error {
  margin: 0 0 24px;
  padding: 12px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 14px;
}
