/* Checkout: the order on the left, what it costs and the button beside it; then where to send coins, or
   the welcome. */
@layer features {
  .checkout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: var(--space-20);
    align-items: start;
    padding-block: var(--space-14) var(--space-32);
  }
  .checkout fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .checkout .lead {
    margin-top: var(--space-5);
    font-size: var(--text-lg);
  }
  .checkout .step {
    display: block;
    margin-top: var(--space-12);
  }
  .pricing.pick {
    display: grid;
    gap: var(--space-3);
    max-width: none;
    margin-bottom: 0;
  }
  .pricing.pick label {
    padding: var(--space-6) var(--space-4);
    border: 1px solid var(--color-line);
    cursor: pointer;
  }
  .pick b {
    font-weight: var(--weight-medium);
  }
  .pick .price {
    margin-top: var(--space-4);
    font-size: var(--figure-sm);
  }
  .pick .price span {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
  }
  .pick .saving {
    margin-top: var(--space-3);
    font-size: var(--text-xs);
  }
  .pick .terms {
    margin: auto 0 0;
    padding-top: var(--space-2);
    font-size: var(--text-xs);
  }
  .pricing label input,
  .option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
  /* A chosen plan, red or grey, has the same ring outside it. */
  .pricing label:has(:checked) {
    box-shadow: var(--ring-chosen);
  }
  .option:has(:checked) {
    border-color: var(--color-text);
    box-shadow: var(--ring-option);
  }
  .pricing label:has(:focus-visible),
  .option:has(:focus-visible) {
    outline: 2px solid var(--color-focus);
    outline-offset: 3px;
  }
  .options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }
  .option {
    position: relative;
    display: grid;
    gap: var(--space-half);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    cursor: pointer;
  }
  .option b {
    font-weight: var(--weight-medium);
  }
  .option .marks {
    margin: var(--space-half) 0;
    color: var(--color-text);
  }
  .option .marks svg {
    width: 30px;
    height: 30px;
  }
  .option:has(.coin) {
    grid-template-columns: 26px minmax(0, 1fr);
    column-gap: var(--space-3);
  }
  .coin {
    grid-row: span 2;
    align-self: center;
    width: 26px;
    height: 26px;
  }
  .option span,
  .coins p {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
  }
  .checkout .pay {
    margin-top: var(--space-5);
  }
  .or {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-5) 0;
    font-size: var(--text-xs);
  }
  .or::before,
  .or::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--color-line);
  }
  .coins {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .coins p {
    grid-column: 1 / -1;
    margin-top: var(--space-1);
  }
  .summary {
    position: sticky;
    top: 32px;
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    background: var(--color-surface);
  }
  .summary h2 {
    font-size: var(--text-2xl);
    letter-spacing: var(--tracking-title);
  }
  .summary dl {
    margin: var(--space-5) 0 0;
  }
  .summary dl div {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-line);
    font-size: var(--text-md);
  }
  .summary dt {
    color: var(--color-text-muted);
  }
  .summary dd {
    margin: 0;
    text-align: end;
  }
  .summary .pill {
    width: 100%;
    margin-top: var(--space-7);
  }
  .summary p {
    margin-top: var(--space-4);
    font-size: var(--text-xs);
  }
  .summary p a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .summary .saved dd {
    color: var(--color-accent-text);
  }
  /* A promo code: one line until it is asked for; the code in the field goes with the payment. */
  .promo {
    margin-top: var(--space-2);
    font-size: var(--text-sm);
  }
  .promo summary {
    display: flex;
    align-items: center;
    width: fit-content;
    min-height: 44px;
    list-style: none;
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .promo summary::-webkit-details-marker {
    display: none;
  }
  .promo .field {
    display: block;
    margin-top: var(--space-2);
  }
  .promo + .pill {
    margin-top: var(--space-5);
  }
  /* Crypto: the coin and its network, then the address and the exact amount, each with its copy button. */
  .send {
    display: grid;
    gap: var(--space-7);
    max-width: 640px;
    padding-block: var(--space-14) var(--space-32);
  }
  .send .lead {
    font-size: var(--text-lg);
  }
  .send-pick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }
  .send-to {
    display: grid;
    gap: var(--space-5);
    margin: 0;
  }
  .send-to dt {
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
  }
  .send-to .command {
    margin: 0;
    background: var(--color-surface);
    box-shadow: none;
  }
  .send-to .command code {
    color: var(--color-text);
    font-size: var(--text-md);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* On a tablet the order takes the whole width and what it costs comes under it, as on a phone: beside each other
     the three plans had no room for their prices. */
  @media (max-width: 980px) {
    .checkout {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--space-12);
    }
    .summary {
      position: static;
    }
  }

  @media (max-width: 760px) {
    .checkout {
      grid-template-columns: 1fr;
      gap: var(--space-8);
      padding-block: var(--space-4) var(--space-22);
    }
    .checkout .step {
      margin-top: var(--space-9);
    }
    /* A plan is a row on a phone: its name, saving and billing on the left, the price and a month's price on the
       right; the year still red and first, the ring of the choice the same (SPEC-PAGES §0.19.7). */
    .pricing.pick label {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: var(--space-1) var(--space-4);
      padding: var(--space-4) var(--space-5);
      text-align: start;
    }
    .pick b,
    .pick .saving,
    .pick .terms {
      grid-column: 1;
      margin: 0;
      padding: 0;
    }
    .pick .saving {
      justify-content: start;
    }
    .pick .price {
      grid-column: 2;
      grid-row: 1 / span 3;
      margin: 0;
      text-align: end;
    }
    /* The ways to pay show their marks; the line under them says the same in words, and what crypto changes is
       said by the page once it is chosen. */
    .options:not(.coins) .option > span:last-child {
      display: none;
    }
    .summary {
      position: static;
      padding: var(--space-6);
    }
    .coins {
      grid-template-columns: 1fr 1fr;
    }
  }

  /* On the narrowest phones a month's price wraps under the plan's price instead of widening it: the plan's name,
     saving and billing keep their room. */
  @media (max-width: 380px) {
    .pick .price span {
      contain: inline-size;
    }
  }
}
