/* The buying flow: cart, checkout, pay, order and lookup pages.
   Colour, radius and motion all come from tokens.css and site.css, so this file adds no new tones. */

/* ---- Shared by every step ---- */

/* Cart, payment, delivery. The step the buyer is on is the only red one. */
.flow-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 26px; padding: 0; list-style: none; color: var(--muted); font-size: .9375rem; font-weight: 500; line-height: 1.2; }
.flow-steps li { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.flow-steps li + li::before { content: ""; width: clamp(14px, 4vw, 44px); height: 1px; margin-right: 2px; background: var(--line-strong); }
@media (max-width: 350px) {
  /* All three steps stay on one line. */
  .flow-steps { flex-wrap: nowrap; gap: 6px; font-size: .875rem; }
  .flow-steps li { gap: 6px; }
  .flow-steps li + li::before { width: 8px; margin-right: 0; }
}
.flow-mark { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.flow-steps .is-done { color: var(--text); }
.flow-steps .is-done .flow-mark { background: var(--surface-2); }
.flow-steps .is-now { color: var(--text); font-weight: 650; }
.flow-steps .is-now .flow-mark { background: var(--red); border-color: var(--red); color: var(--on-red); }

.flow-head { margin: 0 0 28px; }
.flow-head h1 { margin: 0; }

.order-money { font-variant-numeric: tabular-nums; }

/* ---- Cart ---- */

.cart-page > .notice, .cart-page > .notice-error { max-width: 72ch; margin: 0 0 16px; }
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 32px; align-items: start; }
.cart-main { min-width: 0; }

.cart-items { padding-block: 4px; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) auto;
  grid-template-areas: "thumb what money" "thumb controls controls" "problem problem problem";
  gap: 12px 18px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.cart-line:first-child { border-top: 0; }
.cart-thumb { grid-area: thumb; aspect-ratio: 16 / 9; align-self: start; display: grid; place-items: center; overflow: hidden; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-thumb svg { width: 40%; height: auto; }
.cart-what { grid-area: what; min-width: 0; }
.cart-what p { margin: 2px 0 0; }
.cart-name { margin: 0; font-family: var(--font); font-size: 1.1875rem; font-weight: 650; letter-spacing: 0; line-height: 1.3; overflow-wrap: anywhere; }
.cart-name a { text-decoration: none; }
.cart-name a:hover { text-decoration: underline; text-decoration-color: var(--red-text); }
.cart-status { margin-top: 6px; }
.cart-money { grid-area: money; text-align: right; font-variant-numeric: tabular-nums; }
.cart-money p { margin: 0; }
.cart-total { font-size: 1.1875rem; font-weight: 650; }
.cart-money .muted { font-size: .9375rem; }
.cart-controls { grid-area: controls; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cart-controls form { margin: 0; }
.cart-controls .btn-quiet { min-height: 44px; padding: 8px 16px; font-size: 1rem; }
.cart-qty { display: flex; align-items: center; gap: 8px; }
.cart-qty label { color: var(--muted); font-size: 1rem; }
.cart-qty input { width: 72px; min-height: 44px; padding: 8px 10px; font-size: 16px; font-variant-numeric: tabular-nums; text-align: center; }
.cart-qty-fixed { margin: 0; color: var(--muted); }
.cart-controls .cart-remove-form { margin-left: auto; }
/* Removing is the quiet choice: no frame until the pointer or the keyboard is on it. */
.cart-controls .cart-remove { background: none; border-color: transparent; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: .22em; }
.cart-controls .cart-remove:hover { background: none; border-color: var(--line-strong); color: var(--text); transform: none; }
.cart-line.has-problem .cart-thumb img { filter: grayscale(1) brightness(.6); }
.cart-problem { grid-area: problem; margin: 0; padding: 10px 14px; border: 1px solid var(--red-line); border-radius: var(--radius); background: var(--red-soft); color: var(--text); line-height: 1.45; }
.cart-back { margin: 12px 0 0; }

/* The checkout panel stays in view beside a long cart, as long as the whole of it fits the window. */
.cart-pay { box-shadow: var(--shadow); }
@media (min-width: 961px) and (min-height: 720px) {
  .cart-pay { position: sticky; top: calc(var(--head-h) + 20px); max-height: calc(100dvh - var(--head-h) - 40px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  /* An open coupon field or an error makes it taller, so then it scrolls with the page. */
  .cart-pay:has(.coupon[open], .field-error) { position: static; max-height: none; overflow: visible; }
}
.cart-pay h2 { margin: 0 0 16px; font-size: 1.625rem; }
.cart-pay ul { margin: 8px 0 0; padding-left: 20px; }
.cart-subtotal { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 22px; padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.cart-subtotal dt { margin: 0; color: var(--muted); }
.cart-subtotal dd { margin: 0; font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.cart-checkout .buy-action .btn { width: 100%; min-height: 54px; }

.cart-empty { display: grid; justify-items: center; gap: 14px; padding: clamp(36px, 7vw, 64px) 24px; text-align: center; }
.cart-empty p { margin: 0; }
.cart-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--red-text); }
.cart-empty-icon .icon { width: 24px; height: 24px; }
.cart-empty-text { font: 800 1.75rem/1.1 var(--display); }
.cart-empty .btn { margin-top: 6px; min-height: 52px; }

/* ---- Order and lookup pages ---- */

.order-page, .pay-page { max-width: calc(var(--narrow) + 2 * var(--gutter)); }
.order-page > * + *, .pay-page > * + * { margin-top: 20px; }
.order-page > .flow-head, .pay-page > .flow-steps { margin-bottom: 0; }
.order-page > .back-link { margin-bottom: 0; }
.order-page h1 { font-size: clamp(2.25rem, 1.8rem + 1.8vw, 3.25rem); }
.order-page > .flow-head + p { max-width: 62ch; color: var(--muted); font-size: 1.125rem; line-height: 1.5; }

.order-lookup { display: grid; gap: 18px; justify-items: start; }
.order-lookup .field { width: 100%; }
.order-lookup .btn { min-height: 52px; min-width: 180px; }

/* The order's facts: label on the left, value on the right, the money last and heaviest. */
.order-facts.box { padding-block: 8px; }
.order-facts > div { grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 4px 24px; padding: 14px 0; }
.order-facts dd { text-align: right; }
.order-facts > div:last-child dd { font-size: 1.25rem; font-weight: 700; }

/* Key panel: the one object on a delivered order. */
.key-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--red-line);
  border-radius: var(--radius-lg);
  background: radial-gradient(90% 140% at 100% 0%, rgba(208, 12, 56, .2), transparent 62%), var(--surface);
  box-shadow: var(--shadow);
}
/* Third motion moment. A plain solid red line, and .line-wipe runs it in once on a new delivery. */
.key-crack { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--red); }
.key-line + .key-line { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.key-item { margin: 0 0 10px; font-family: var(--font); font-size: 1.0625rem; font-weight: 650; letter-spacing: 0; }
.key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 18px; padding: 14px 14px 14px 20px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.key-row + .key-row { margin-top: 10px; }
.key-value, .key-row .key-value { margin: 0; font-size: clamp(1.25rem, 1rem + 1.7vw, 1.875rem); font-weight: 600; line-height: 1.3; letter-spacing: .02em; overflow-wrap: anywhere; user-select: all; }
.key-row .btn { min-height: 48px; white-space: nowrap; }
.key-ticket { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 18px; padding: 14px 14px 14px 20px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.key-ticket p { margin: 0; max-width: 60ch; }
.key-ticket .mono { white-space: nowrap; }
.key-ticket .btn { min-height: 48px; white-space: nowrap; }
.key-note { margin: 18px 0 0; font-size: 1rem; line-height: 1.45; max-width: 60ch; }

.order-setup .box-title, .order-downloads .box-title { margin-bottom: 14px; }
.order-downloads .list-rows { border-bottom: 0; }
.order-downloads .list-row:first-child { border-top: 0; padding-top: 0; }
.order-downloads .list-row:last-child { padding-bottom: 0; }

/* ---- Pay page: the total, the time left, and one payment method ---- */

.pay-summary { background: radial-gradient(80% 140% at 100% 0%, rgba(208, 12, 56, .16), transparent 62%), var(--surface); }
.pay-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.pay-head-text { min-width: 0; }
.pay-total { font-size: clamp(2.25rem, 1.9rem + 1.8vw, 3.25rem); line-height: 1; font-variant-numeric: tabular-nums; }
.pay-timer { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; margin: 0; padding: 0 16px 0 14px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pay-timer::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.pay-held { margin: 14px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.pay-held [data-seconds-left] { color: var(--text); font-weight: 600; }

.pay-method { display: grid; gap: 16px; }
.pay-method form { margin: 0; }
.pay-method .notice { background: var(--bg); }
.pay-method .btn { width: 100%; min-height: 54px; }

.pay-stripe { display: grid; gap: 1rem; }
.pay-stripe .btn { width: 100%; min-height: 54px; }
/* Keeps the button from jumping while Stripe's iframe loads. */
#payment-element { min-height: 12rem; }

.pay-others { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.pay-box-title { margin: 0 0 14px; font-size: 1.625rem; }

.coin-icon { flex: none; display: block; width: 28px; height: 28px; border-radius: 50%; }
.coin-letter { display: flex; align-items: center; justify-content: center; background: var(--line); color: var(--text); font-size: 0.875rem; font-weight: 700; }
.coin-letter.is-large { width: 40px; height: 40px; font-size: 1.125rem; }
.pay-coin-head .coin-icon:not(.coin-letter) { width: 40px; height: 40px; }
.coin-name { font-weight: 600; overflow-wrap: anywhere; }
.coin-symbol { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.coin-network { padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); font-size: 0.75rem; white-space: nowrap; }

.pay-coin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pay-coin { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon name" "icon symbol"; align-items: center; gap: 0 10px; width: 100%; min-height: 64px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color 140ms, background-color 140ms; }
.pay-coin .coin-icon { grid-area: icon; }
.pay-coin .coin-name { grid-area: name; line-height: 1.25; }
.pay-coin .coin-symbol { grid-area: symbol; line-height: 1.25; }
.pay-coin .coin-network { grid-column: 2; justify-self: start; margin-top: 3px; }
.pay-coin:hover, .coin-row:hover { border-color: var(--text); }
.pay-coin:focus-visible, .coin-row:focus-visible, .coin-search:focus-visible, .coin-drop > summary:focus-visible { outline: 2px solid var(--red-text); outline-offset: 2px; }
.pay-coin.is-busy, .coin-row.is-busy { border-color: var(--red); background: var(--red-soft); }
.pay-coin:disabled, .coin-row:disabled { cursor: progress; }

.coin-drop { margin-top: 8px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.coin-drop > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: var(--radius); font-weight: 600; cursor: pointer; list-style: none; }
.coin-drop > summary::-webkit-details-marker { display: none; }
.coin-drop > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 180ms var(--ease); }
.coin-drop[open] > summary::after { transform: rotate(-135deg); }
.coin-count { padding: 0 8px; background: var(--line); border-radius: 5px; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.coin-panel { padding: 0 8px 8px; border-top: 1px solid var(--line); }
.coin-search { display: block; width: 100%; min-height: 44px; margin: 8px 0; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); font: inherit; }
.coin-search[hidden] { display: none; }
.coin-list { display: grid; gap: 2px; max-height: 320px; margin-top: 8px; overflow-y: auto; overscroll-behavior: contain; }
.coin-search:not([hidden]) + .coin-list { margin-top: 0; }
.coin-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 10px; background: transparent; border: 1px solid transparent; border-radius: var(--radius); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.coin-row[hidden] { display: none; }
.coin-row .coin-network { margin-left: auto; }
.coin-none { margin: 8px 4px; color: var(--muted); }

.pay-coin-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pay-coin-head h2 { margin: 0; font-size: 1.625rem; overflow-wrap: anywhere; }
.pay-change { margin-left: auto; min-height: 44px; padding: 0 14px; font-size: 1rem; text-decoration: none; }

.pay-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.pay-steps li { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 3px solid var(--line); color: var(--muted); font-size: 0.875rem; line-height: 1.25; }
.pay-steps li.is-done { border-top-color: var(--line-strong); }
.pay-steps li.is-now { border-top-color: var(--red); color: var(--text); font-weight: 600; }
.pay-step-mark { flex: none; display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: var(--line); border-radius: 50%; font-size: 0.75rem; font-weight: 700; }
.pay-steps .is-now .pay-step-mark { background: var(--red); color: var(--on-red); }

.pay-warning { padding: 12px 14px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); line-height: 1.45; }

.pay-crypto > * + * { margin-top: 18px; }
.pay-crypto-top { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 24px; align-items: start; }

/* The one light object on the page. A scanner needs dark modules on a light field with a quiet zone. */
.pay-qr { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.pay-qr-note { margin: 8px 0 0; font-size: .9375rem; line-height: 1.45; }
.pay-qr-bg { fill: var(--text); }
.pay-qr-fg { fill: var(--bg); }

.pay-earlier > * + * { margin-top: 10px; }
.pay-page [data-poll] > * + * { margin-top: 20px; }

.pay-facts { margin: 0; display: grid; gap: 12px; }
.pay-row { padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.pay-row dt { color: var(--muted); font-size: .9375rem; }
.pay-row dd { margin: 4px 0 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pay-value { display: block; margin-bottom: 10px; font-family: var(--mono); font-size: 1rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; user-select: all; }
.pay-value.is-big { font-family: var(--font); font-size: 1.625rem; font-weight: 700; line-height: 1.2; }
.pay-copy { min-height: 44px; padding: 8px 14px; font-size: 1rem; }
.pay-status { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.pay-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ---- Narrower screens ---- */

@media (max-width: 960px) {
  .cart-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 560px) {
  .flow-steps { margin-bottom: 20px; }
  .flow-head { margin-bottom: 20px; }

  .cart-line { grid-template-columns: 84px minmax(0, 1fr) auto; grid-template-areas: "thumb what money" "controls controls controls" "problem problem problem"; gap: 12px 12px; padding: 16px 0; }
  .cart-name, .cart-total { font-size: 1.0625rem; }
  .cart-subtotal dd { font-size: 1.375rem; }
  .cart-empty .btn { width: 100%; }
  .cart-qty input { width: 60px; }
  .cart-controls .cart-remove { padding-inline: 6px; }
  .order-setup .setup-buttons li, .order-setup .setup-buttons a { width: 100%; }

  .order-lookup .btn { width: 100%; }
  .order-facts > div { gap: 4px 16px; }
  .key-row { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .key-row .btn { width: 100%; min-height: 52px; }
  .key-ticket { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .key-ticket .btn { width: 100%; min-height: 52px; }

  .pay-coin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pay-steps li { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pay-crypto-top { grid-template-columns: minmax(0, 1fr); }
  .pay-qr { max-width: 14rem; }
  .pay-others .btn-quiet { width: 100%; }
}
