/* Greenlake Martial Arts landing: embedded Stripe checkout dialog and its toast (GMA-359).
   Opened by js/checkout.js over the page (home page and program pages), which stays as it is behind the backdrop.
   Every value comes from tokens.css. Mobile first: a full-screen sheet on phones, a centered
   dialog from 760px (the approved mock's breakpoint). */

html.checkout-open { overflow: hidden; }

.checkout-overlay {
  position: fixed; inset: 0; z-index: var(--checkout-z);
  display: flex; align-items: stretch; justify-content: center;
  background: var(--c-backdrop);
}
.checkout-overlay[hidden] { display: none; }

.checkout-sheet {
  width: 100%; max-height: 100%; overflow: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: var(--gap);
  padding: var(--card-pad);
  background: var(--c-bg); color: var(--c-text);
  border-top: var(--accent-w) solid var(--c-cta-bg);
}
.checkout-sheet:focus { outline: none; }

.checkout-head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); }
.checkout-title { font-size: var(--h3-size); line-height: var(--h3-lh); font-weight: 700; margin: 0; }
.checkout-cancel { flex: none; }

.checkout-pay { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); align-items: start; }
.checkout-pay[hidden] { display: none; }

.checkout-summary {
  background: var(--c-surface); border-radius: var(--radius-md); padding: var(--card-pad);
  display: flex; flex-direction: column; gap: var(--gap-sm);
}
.checkout-row { display: flex; justify-content: space-between; gap: var(--gap-sm); font-variant-numeric: tabular-nums; }
.checkout-row-total { border-top: var(--line-w) solid var(--c-line); padding-top: var(--gap-sm); font-weight: 700; }
.checkout-muted { color: var(--c-muted); font-size: var(--small-size); }
.checkout-muted a { color: var(--c-text); text-underline-offset: 3px; }

.checkout-form {
  position: relative; min-height: var(--checkout-form-min-h);
  background: var(--c-checkout-form-bg); border-radius: var(--radius-md); overflow: hidden;
}
.checkout-loading { position: absolute; inset: 0; display: grid; place-items: center; }
.checkout-loading[hidden] { display: none; }
.checkout-spinner {
  width: var(--checkout-spinner); height: var(--checkout-spinner); border-radius: 50%;
  border: var(--accent-w) solid var(--c-line); border-top-color: var(--c-cta-bg);
}

.checkout-done {
  background: var(--c-surface); border-radius: var(--radius-md); padding: var(--card-pad);
  display: flex; flex-direction: column; gap: var(--gap);
}
.checkout-done[hidden] { display: none; }
.checkout-check {
  width: var(--touch); height: var(--touch); border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--c-band); color: var(--c-success);
}
.checkout-check svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.checkout-done-title { font-size: var(--h2-size); line-height: var(--h2-lh); font-weight: 800; letter-spacing: -0.01em; margin: 0; }
.checkout-done-title:focus { outline: none; }
.checkout-done-plan { font-size: var(--h3-size); line-height: var(--h3-lh); font-weight: 800; }
.checkout-done-note:empty { display: none; }
.checkout-done .btn { align-self: flex-start; }

.checkout-toast {
  position: fixed; left: 50%; bottom: var(--checkout-toast-bottom); z-index: var(--checkout-z);
  transform: translateX(-50%); width: max-content; max-width: calc(100% - 2 * var(--gutter));
  padding: var(--gap-sm) var(--gap); border-radius: var(--radius-md);
  background: var(--c-surface-raised); color: var(--c-text); border: var(--line-w) solid var(--c-line);
  box-shadow: var(--shadow-card); font-size: var(--small-size);
}
.checkout-toast:empty { display: none; }

/* From 760px: a centered dialog, the summary beside the form. */
@media (min-width: 760px) {
  .checkout-overlay { align-items: center; padding: var(--gutter); }
  .checkout-sheet {
    max-width: var(--checkout-max-w); border: var(--line-w) solid var(--c-line);
    border-top: var(--accent-w) solid var(--c-cta-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  }
  .checkout-pay { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr); }
}

@media (prefers-reduced-motion: no-preference) {
  .checkout-overlay:not([hidden]) .checkout-sheet { animation: checkout-in var(--checkout-enter); }
  .checkout-spinner { animation: checkout-spin 900ms linear infinite; }
}
@keyframes checkout-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes checkout-spin { to { transform: rotate(360deg); } }
