/* The checkout tab, drawn like the web app's Account sheet: its colours (app.css's tokens, the 3.0 website's system,
   dark by default and light with the system), its cards, captions and buttons. Keep the tokens in step with app.css;
   this page loads nothing else from the shell. FastSpring's form is light whatever the theme, so it sits on its own
   white sheet. */
:root {
  color-scheme: dark;
  --bg: #0E1A19; --panel: #152021; --panel-2: #1B2526; --line: #2E393A; --ink: #E8EEEC; --muted: #B5C3C1;
  --accent: #4CC1B8; --accent-hover: #3DB3AA; --accent-ink: #0E1A19; --accent-text: #7ED8CE; --accent-soft: #1D3F3B;
  --amber: #D9A441;
  --pay-sheet: #FFFFFF; /* under FastSpring's form, in both themes */
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #EEF1EF; --panel: #FFFFFF; --panel-2: #EEF1EF; --line: #E6E4DD; --ink: #1B2526; --muted: #5E6869;
    --accent-text: #1F6F66; --accent-soft: #DDF5F1; --amber: #8B641C;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { color: var(--ink); font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; }
[hidden] { display: none !important; }

/* ---- Arkio's bar: the wordmark, what this tab is for, who is buying ---- */
.bc-top { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 22px; background: var(--panel); border-bottom: 1px solid var(--line); }
.bc-brand { display: inline-flex; flex: 0 0 auto; color: var(--ink); }
.bc-brand svg { display: block; width: 62px; height: 23px; }
.bc-divider { flex: 0 0 1px; height: 20px; background: var(--line); }
.bc-title { flex: 0 0 auto; font-size: 15px; font-weight: 600; }
.bc-who { flex: 1 1 auto; min-width: 0; text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- the column ---- */
main { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 720px; margin: 0 auto; padding: 24px 22px 40px; }
main.is-ended { max-width: 560px; padding-top: max(24px, 10vh); }
.bc-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.bc-cap { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.bc-order-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.bc-account { min-width: 0; font-size: 20px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.bc-pack { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bc-order-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bc-line { font-size: 12.5px; }
.bc-pack.is-renews { font-size: 12px; font-weight: 400; color: var(--muted); text-align: right; white-space: normal; }
.bc-sub { margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }

/* The one line of status: a pulsing dot while Arkio waits for the purchase, quiet otherwise */
.bc-status { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0 4px; font-size: 13px; }
.bc-status.is-waiting::before { content: ''; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: bc-pulse 1.6s ease-in-out infinite; }
.bc-status.is-problem { color: var(--amber); }
@keyframes bc-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .bc-status.is-waiting::before { animation: none; } }

/* FastSpring's form, on its white sheet; the provider sizes its own frame inside */
.bc-pay { position: relative; width: 100%; min-height: 420px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--pay-sheet); color-scheme: light; overflow: hidden; }

.bc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 0 4px; font-size: 12.5px; }
.bc-actions:not(:has(button:not([hidden]))) { display: none; }
.bc-textbtn { padding: 0; border: 0; background: transparent; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.bc-textbtn:hover { text-decoration: underline; }
.bc-textbtn:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.bc-primary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 18px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.bc-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }

/* ---- the end of the checkout: one card in place of the form, saying what happened and to go back to Arkio ---- */
.bc-end { align-items: center; gap: 10px; padding: 36px 24px 30px; text-align: center; }
.bc-end-glyph { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 4px; border-radius: 50%; background: var(--panel-2); color: var(--muted); }
.bc-end-glyph svg { width: 26px; height: 26px; }
.bc-end .bc-glyph-done, .bc-end.is-done .bc-glyph-stop { display: none; }
.bc-end.is-done .bc-glyph-done { display: block; }
.bc-end.is-done { border-color: var(--accent); }
.bc-end.is-done .bc-end-glyph { background: var(--accent); color: var(--accent-ink); }
.bc-end h1 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.25; }
.bc-end p { margin: 0; max-width: 46ch; font-size: 13.5px; color: var(--muted); }
.bc-end .bc-primary { margin-top: 10px; }
.bc-end .bc-sub { margin-top: 2px; }

.bc-note { display: flex; align-items: flex-start; justify-content: center; gap: 6px; margin: 4px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); text-align: center; }
.bc-note svg { flex: 0 0 auto; width: 13px; height: 13px; margin-top: 1px; }

@media (max-width: 520px) {
  .bc-top { gap: 10px; padding: 0 16px; }
  .bc-who { display: none; }
  main { padding: 16px 16px 32px; }
  .bc-pay { padding: 4px; }
}
