/* The payment page. The home page's bar and footer come from styles.css;
 * this adds only what a form needs, in the app's own checkout order:
 * plan, phone, method, pay. */

.checkout {
  padding-block: clamp(32px, 6vw, 64px) clamp(48px, 8vw, 88px);
}

.checkout h1 {
  margin-block-end: 28px;
  font-size: clamp(30px, 4.4vw, 44px);
  font-weight: 800;
}

/* The summary comes first in the markup, so a screen reader hears what is
 * being bought before the form. On a wide screen it sits beside the form. */
.co-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  gap: 28px;
  align-items: start;
}

.co-summary {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  inset-block-start: 88px;
  padding: 24px;
  border-color: var(--yellow-ink);
}

.co-form {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  gap: 26px;
  min-width: 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-block-end: 12px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
}

/* ─────────────────────────── summary ─────────────────────────── */
.co-summary h2 {
  font-size: 18px;
}

.co-summary dl {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}

.co-summary dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-2);
}

.co-summary dd {
  margin: 0;
  color: var(--text);
  text-align: end;
}

.sum-bonus {
  color: var(--yellow-ink);
  font-weight: 600;
}

.sum-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-block-start: 18px;
  padding-block-start: 16px;
  border-block-start: 1px solid var(--divider);
  font-size: 22px;
  font-weight: 800;
}

.sum-per {
  margin-block-start: 4px;
  color: var(--text-2);
  font-size: 14px;
}

/* ───────────────────── choices: plan and method ───────────────────── */
.opts {
  display: grid;
  gap: 10px;
}

.opts--plans {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.opts--methods {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.opt {
  display: block;
  position: relative;
  cursor: pointer;
}

/* The real radio stays in the page for the keyboard and the screen reader;
 * the card beside it is what is drawn. */
.opt input {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.opt-body {
  display: flex;
  min-height: 100%;
  padding: 16px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-card);
  transition: border-color var(--fast) var(--ease),
    background-color var(--fast) var(--ease);
}

.opt input:checked + .opt-body {
  border-color: var(--yellow);
  background: color-mix(in srgb, var(--yellow) 10%, var(--card));
}

.opt input:focus-visible + .opt-body {
  outline: 2px solid var(--yellow-ink);
  outline-offset: 3px;
}

.opt input:disabled + .opt-body {
  opacity: 0.5;
  cursor: not-allowed;
}

.plan-opt {
  flex-direction: column;
  gap: 4px;
}

.plan-len {
  font-size: 20px;
  font-weight: 800;
}

.plan-price {
  color: var(--text-2);
  font-size: 15px;
}

.plan-flag {
  align-self: flex-start;
  margin-block-start: 4px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--yellow);
  color: var(--on-yellow);
  font-size: 12px;
  font-weight: 700;
}

.pay-opt {
  align-items: center;
  gap: 12px;
}

.mark {
  flex: none;
  width: 56px;
  height: 36px;
  object-fit: contain;
}

.mark--apple {
  display: grid;
  place-items: center;
  color: var(--text);
}

.pay-text {
  display: grid;
  min-width: 0;
  line-height: 1.4;
}

.pay-text strong {
  font-size: 15px;
}

.pay-text small {
  color: var(--text-2);
  font-size: 13px;
}

/* ───────────────────────────── phone ───────────────────────────── */
.field {
  display: block;
  margin-block-end: 6px;
  font-weight: 600;
}

#phone {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-card);
  color: var(--text);
  font: inherit;
  /* 16px or more, so iOS does not zoom the page when the field is focused. */
  font-size: 16px;
  text-align: end;
}

#phone::placeholder {
  color: var(--text-2);
}

#phone:focus-visible {
  border-color: var(--yellow);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 35%, transparent);
}

.help,
.error {
  margin-block-start: 8px;
  font-size: 13px;
}

.help {
  color: var(--text-2);
}

.error {
  color: var(--alert);
}

/* ────────────────────────────── pay ────────────────────────────── */
.pay-button {
  width: 100%;
  min-height: 56px;
  font-size: 18px;
}

.pay-button:disabled {
  background: var(--raised);
  color: var(--text-2);
  cursor: not-allowed;
  filter: none;
}

.status {
  min-height: 1.75em;
  margin-block-start: -12px;
  color: var(--text-2);
  font-size: 14px;
  text-align: center;
}

.fine {
  color: var(--text-2);
  font-size: 13px;
}

.fine a {
  color: var(--text);
}

@media (max-width: 860px) {
  .co-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .co-summary,
  .co-form {
    grid-column: 1;
    grid-row: auto;
  }

  .co-summary {
    position: static;
  }

  .opts--plans {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .opts--methods {
    grid-template-columns: minmax(0, 1fr);
  }
}
