/* The checkout page (checkout.html): the head and its steps (challenge, profile, payment), the selector across the
 * whole width at step 1, then the flow beside the sticky order summary, the profile with its e-mail code, "What happens
 * next", "Need help?", the bottom bar of a phone. Tokens of style.css only; logical properties (Arabic reads it right
 * to left). Breakpoints of the space: 1099 (summary under the flow), 899 (the frame's tabs), 560 (a phone). */

/* the head */
.page-checkout .co-head { display: grid; gap: 20px; margin-bottom: 4px; }
.co-lede { max-width: 62ch; margin: 8px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--mute); }
.co-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; padding: 0; list-style: none; }
.co-steps li { display: inline-flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; color: var(--dim); }
.co-steps li + li::before { content: ""; width: 40px; height: 1px; background: var(--line-2); }
.co-step-n { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-2); border-radius: 50%; font: 600 12px var(--font-mono); }
.co-steps li[data-status="current"] { color: var(--text); }
.co-steps li[data-status="current"] .co-step-n { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.co-steps li[data-status="done"] { color: var(--mute); }
.co-steps li[data-status="done"] .co-step-n { background: var(--up-soft); border-color: color-mix(in srgb, var(--up) 45%, transparent); color: var(--up); }

/* the grid: one column while choosing, the flow beside the summary after */
.co-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); grid-template-areas: "flow sum" "more sum";
  grid-template-rows: auto 1fr; gap: 20px; align-items: start; }
.co-grid[data-stage="challenge"] { grid-template-columns: minmax(0, 1fr); grid-template-areas: "flow" "more"; }
.co-flow { grid-area: flow; }
.co-sum { grid-area: sum; }
.co-more { grid-area: more; display: grid; gap: 16px; min-width: 0; }
.co-flow { display: grid; gap: 20px; min-width: 0; }
.co-flow > .panel, .co-sum { padding: 24px; border-radius: var(--r-lg); background: var(--surface); }
.co-h { margin: 0 0 6px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.co-choose > .co-h { margin-bottom: 20px; }

/* 2. the profile */
.co-details > .note { max-width: 64ch; margin: 0 0 20px; }
.co-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.co-fields .field { display: grid; gap: 7px; min-width: 0; }
.co-fields .co-wide { grid-column: 1 / -1; }
.co-fields[data-only="email"] .co-idf { display: none; }            /* details kept: only the address to prove */
.co-fields[data-only="email"] { margin-top: 14px; }
.co-fields .text-input { width: 100%; min-height: 48px; font-family: var(--font-sans); font-size: 15px; }   /* names, not figures */
.co-fields [aria-invalid="true"] { border-color: var(--down); }
.co-email-note { margin: -2px 0 0; font-size: 12.5px; }
.co-known { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); }
.co-known-name { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.co-known-line { margin: 0; font-size: 13.5px; color: var(--mute); overflow-wrap: anywhere; }
.co-known-edit { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; color: var(--text); }
.co-prove { margin: 14px 0 0; font-size: 14px; color: var(--text); }
.co-welcome { margin: 0 0 16px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--up) 40%, transparent); border-radius: var(--r); background: var(--up-soft); font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.co-terms { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; font-size: 13.5px; line-height: 1.5; color: var(--mute); cursor: pointer; }
.co-terms input { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--acc); }
.co-terms a, .sp-guest-in, #coDetailsMsg a { color: var(--acc-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.co-details .actions { justify-content: flex-end; margin-top: 8px; }
.co-details .form-msg[data-tone="up"], .co-promo .form-msg[data-tone="up"] { color: var(--up); }

/* the e-mail code, inline in the profile */
.co-code { display: grid; gap: 6px; padding: 20px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--bg-2); }
.co-code-h { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.co-code-to { margin: 0 0 10px; font-size: 14px; color: var(--mute); overflow-wrap: anywhere; }
.co-code-email { color: var(--text); font-weight: 600; }
#coCodeForm { display: grid; gap: 8px; }
#coCodeForm .note, #coCodeForm .co-warn { margin: 0; }
.co-code-expired:empty { display: none; }
.co-code-input { width: 100%; max-width: 260px; min-height: 54px; font-size: 24px; letter-spacing: 0.32em; text-align: center; direction: ltr; }
.co-details .co-code-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.co-code-actions .btn.sm { min-height: 44px; }

/* the order summary */
.co-sum { position: sticky; top: 76px; display: grid; gap: 14px; }
.co-sum .eyebrow { margin: 0; }
.co-sum-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.co-sum-name { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.co-sum-name .mono { color: var(--acc-text); }
.co-sum-head .note { margin: 2px 0 0; }
.co-sum-k { margin: 2px 0 -6px; font: 500 11px var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); }
.co-sum-rules { display: grid; margin: 0; }
.co-sum-rules > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.co-sum-rules dt { color: var(--mute); }
.co-sum-rules dd { margin: 0; text-align: end; }
.co-sum-rules dd span { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.co-sum-rules dd small { display: block; font-size: 11.5px; color: var(--dim); }
.co-sum-lines { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; margin: 0; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.co-sum-lines > div { display: contents; }
.co-sum-lines dt { color: var(--mute); }
.co-sum-lines dd { margin: 0; text-align: end; font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.co-sum-off { color: var(--up); }
.co-promo-row { display: flex; gap: 8px; margin-top: 7px; }
.co-promo-row .text-input { flex: 1; min-width: 0; text-transform: uppercase; }
.co-sum-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-2); font-weight: 700; }
.co-sum-total b { font-size: 30px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.co-sum-total s { margin-inline-end: 8px; font-size: 14px; color: var(--dim); }
.co-sum-safe { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--mute); }
.co-sum-safe li::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-inline-end: 7px; border-radius: 50%; background: var(--up); vertical-align: middle; }
.co-methods { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.co-method-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.co-method-list li { padding: 5px 10px; border: 1px solid var(--line-2); border-radius: var(--r-pill); font-size: 12px; color: var(--text); }

/* the confirmation */
.co-flow > .co-donebox { display: grid; justify-items: center; gap: 12px; padding-block: 32px; text-align: center; }
.co-done-ok { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--up-soft); color: var(--up); }
.co-done-ok svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.co-donebox p { max-width: 44ch; margin: 0; color: var(--mute); }
.co-donebox .actions { justify-content: center; }

/* what happens next, need help */
.co-next { padding: 24px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.co-next-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 16px 0 0; padding: 0; list-style: none; }
.co-next-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
.co-next-n { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-2); border-radius: 50%; font: 600 12px var(--font-mono); color: var(--acc-text); }
.co-next h3 { margin: 3px 0 4px; font-size: 14.5px; letter-spacing: -0.01em; }
.co-next p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--mute); }
.co-help { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; padding-inline: 4px; font-size: 13.5px; color: var(--mute); }
.co-help-h { margin: 0; font-size: 14px; color: var(--text); }
.co-help p { margin: 0; }
.co-help-links { display: flex; flex-wrap: wrap; gap: 0 18px; }
.co-help-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--acc-text); text-decoration: underline; text-underline-offset: 3px; }

/* the bar at the bottom of a phone: the challenge, its total, the summary below */
.co-bar { display: none; }

/* a buyer without an account: no navigation of the space around the checkout, the sign-in in a compact top bar */
body[data-guest] .sp-side, body[data-guest] .sp-tabs, body[data-guest] .sp-logout, body[data-guest] #spTermTop,
body[data-guest] .sp-bell, body[data-guest] .sp-pagehead .eyebrow { display: none; }
body[data-guest] .sp-frame { grid-template-columns: minmax(0, 1fr); }
body[data-guest] .sp-brand-m { display: inline-flex; }                 /* the brand of the hidden side bar, on top */

@media (max-width: 1099px) {
  .co-grid, .co-grid[data-stage="challenge"] { grid-template-columns: minmax(0, 1fr); grid-template-areas: "flow" "sum" "more"; grid-template-rows: none; }
  .co-sum { position: static; }
  .co-bar { position: fixed; z-index: 60; inset-inline: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); background: var(--surface-2); }
  .co-bar[hidden] { display: none; }
  .co-bar-what { display: grid; min-width: 0; margin: 0; }
  .co-bar-name { overflow: hidden; font-size: 13px; color: var(--mute); white-space: nowrap; text-overflow: ellipsis; }
  .co-bar-total { font-size: 18px; color: var(--text); }
  .co-bar .btn { min-height: 44px; }
  .page-checkout .co-layout { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
}
@media (max-width: 899px) {
  .co-bar { bottom: calc(62px + env(safe-area-inset-bottom)); padding-bottom: 10px; }    /* above the tabs of the space */
  body[data-guest] .co-bar { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  body[data-guest] .sp-who { display: flex; font-size: 13px; }       /* the sign-in link stays in the top bar */
  body[data-guest] .sp-foot { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .page-checkout .co-layout { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  body[data-guest].page-checkout .co-layout { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .co-next-list { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}
@media (max-width: 560px) {
  .co-flow > .panel, .co-sum, .co-next { padding: 18px 16px; }
  .co-fields { grid-template-columns: minmax(0, 1fr); }
  .co-steps li:not([data-status="current"]) > span:not(.co-step-n) { display: none; }
  .co-steps li + li::before { width: 18px; }
  .co-details .actions .btn.primary { width: 100%; }
  .co-code-input { max-width: none; }
}
