/* ============================================================
   CHECKOUT page. The shell (left rail, background, footer) comes
   from site.css; this file owns the checkout itself.
   The column body keeps the shared footer pinned to the bottom on
   a short cart, since .subpage grows to fill instead.
   ============================================================ */
body { display: flex; flex-direction: column; min-height: 100vh; }
.subpage { flex: 1 0 auto; }

/* ============================================================
   CHECKOUT (prefix: buy-)
   ============================================================ */
.buy-head { text-align: center; max-width: 640px; margin: 0 auto clamp(28px, 4.4vw, 46px); }
.buy-title { font-size: clamp(28px, 4.2vw, 40px); line-height: 1.08; margin-top: 12px; }
.buy-sub { color: var(--text-dim); font-size: clamp(15px, 1.6vw, 16.5px); margin-top: 13px; line-height: 1.6; }

.buy-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 24px; align-items: start;
  max-width: 1000px; margin: 0 auto;
}
.buy-grid.buy-empty-mode { grid-template-columns: 1fr; max-width: 540px; }
.buy-col-summary { position: sticky; top: 84px; align-self: start; }

/* ---------- shared card shell ---------- */
.buy-card {
  position: relative; border-radius: var(--r-lg);
  border: 1px solid var(--hairline); background: var(--surface);
  backdrop-filter: blur(20px) saturate(120%); -webkit-backdrop-filter: blur(20px) saturate(120%);
  padding: 26px;
}
.buy-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent 42%);
  -webkit-mask: linear-gradient(#000, transparent 46%); mask: linear-gradient(#000, transparent 46%);
}
.buy-card > * { position: relative; }

/* ---------- order summary ---------- */
.buy-summary {
  border-color: rgba(180,204,228,.34);
  background: linear-gradient(180deg, rgba(180,204,228,.06), rgba(180,204,228,.012) 60%), var(--surface-2);
  box-shadow: var(--glow-soft);
}
.buy-card-label { display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); }
.buy-card-label svg { width: 15px; height: 15px; color: var(--accent); }
.buy-card-label .buy-count-pill { margin-left: auto; text-transform: none; letter-spacing: 0; font-family: var(--font-price); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; color: var(--text-dim); padding: 3px 10px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--hairline); }

/* line items */
.buy-lines { list-style: none; margin: 18px 0 0; display: flex; flex-direction: column; }
.buy-line { display: grid; grid-template-columns: 46px 1fr auto; gap: 13px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.buy-line:first-child { padding-top: 4px; }
.buy-line-media {
  width: 46px; height: 46px; border-radius: var(--r-xs); flex: 0 0 auto; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(150deg, rgba(207,224,242,.14), rgba(134,166,204,.06)); border: 1px solid var(--hairline);
}
.buy-line-media img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.buy-line-media svg { width: 24px; height: 24px; color: var(--ice-200); }
.buy-line-main { min-width: 0; }
.buy-line-name { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.25; }
.buy-line-tag { font-size: 11.5px; font-weight: 600; color: var(--text-mute); margin-top: 4px; }
.buy-line-tag .buy-tag-type { color: var(--ice-300); }
.buy-line-amt { text-align: right; white-space: nowrap; }
.buy-line-total { font-family: var(--font-price); font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700; color: var(--text); }
.buy-line-unit { font-family: var(--font-price); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--text-mute); margin-top: 3px; }

.buy-totals { margin-top: 18px; display: flex; flex-direction: column; gap: 11px; }
.buy-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--text-dim); }
.buy-total-row.buy-grand { padding-top: 14px; border-top: 1px solid var(--hairline); font-size: 15px; color: var(--text); }
.buy-total-row.buy-grand .buy-total-k { font-weight: 700; }
.buy-total-v { font-family: var(--font-price); font-variant-numeric: tabular-nums lining-nums; }
.buy-total-row.buy-grand .buy-total-v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.buy-summary-note { margin-top: 16px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); display: inline-flex; align-items: center; gap: 8px; }
.buy-summary-note svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--accent); }

.buy-change { display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; font-size: 13px; font-weight: 600; color: var(--text-mute); transition: color var(--t); }
.buy-change:hover { color: var(--accent); }
.buy-change svg { width: 14px; height: 14px; }

/* empty cart state */
.buy-empty { text-align: center; padding: 20px 6px 12px; }
.buy-empty-ic { width: 76px; height: 76px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--hairline); color: var(--text-mute); }
.buy-empty-ic svg { width: 34px; height: 34px; }
.buy-empty-title { font-size: 21px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.buy-empty-msg { margin: 12px auto 22px; max-width: 340px; font-size: 14.5px; line-height: 1.6; color: var(--text-dim); }

/* ---------- payment card ---------- */
.buy-pay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.buy-pay-title { font-size: 17px; font-weight: 700; color: var(--text); }
.buy-secure-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-mute); padding: 6px 11px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--hairline); }
.buy-secure-chip svg { width: 14px; height: 14px; color: var(--safe); }

.buy-methods-label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 9px; }
.buy-methods { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.buy-method {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-dim); cursor: pointer;
  transition: color var(--t), background var(--t), border-color var(--t);
}
.buy-method:hover { border-color: var(--hairline-strong); color: var(--text); }
.buy-method.active { border-color: rgba(180,204,228,.55); background: var(--accent-grad-soft); color: var(--ice-100); }
.buy-method-ic { height: 18px; min-width: 26px; padding: 0 4px; border-radius: 4px; background: #fff; display: inline-grid; place-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.buy-method-ic img { height: 12px; width: auto; display: block; }
.buy-method-crypto svg { width: 15px; height: 15px; color: var(--accent); }

.buy-form { display: flex; flex-direction: column; gap: 15px; }
.buy-field { display: flex; flex-direction: column; gap: 7px; }
.buy-label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); display: flex; align-items: center; gap: 7px; }
.buy-label .buy-opt { font-weight: 500; color: var(--text-faint); font-size: 11.5px; }
.buy-label .buy-req { color: var(--ice-300); }
.buy-hint-ic { width: 14px; height: 14px; color: var(--text-mute); }
.buy-input-wrap { position: relative; }
.buy-input {
  width: 100%; padding: 13px 15px; border-radius: var(--r-sm);
  background: var(--bg-2); border: 1px solid var(--hairline); color: var(--text);
  font-size: 15px; letter-spacing: .01em;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.buy-input::placeholder { color: var(--text-faint); }
.buy-input:focus { outline: none; border-color: rgba(180,204,228,.55); box-shadow: 0 0 0 3px rgba(180,204,228,.14); background: var(--bg-1); }
.buy-input.buy-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255,107,122,.14); }
.buy-input--icon { padding-left: 42px; }
.buy-input--card { padding-right: 46px; letter-spacing: .08em; }
.buy-field-lead { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-mute); pointer-events: none; display: inline-flex; }
.buy-field-lead svg { width: 18px; height: 18px; }
.buy-field-mark { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--text-mute); pointer-events: none; display: inline-flex; }
.buy-field-mark svg { width: 22px; height: 22px; }
.buy-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.buy-card-fields { display: flex; flex-direction: column; gap: 15px; }
.buy-card-fields[hidden], .buy-method-note[hidden] { display: none; }

.buy-method-note {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: var(--r-sm);
  background: var(--accent-grad-soft); border: 1px solid rgba(180,204,228,.24);
  font-size: 13.5px; line-height: 1.5; color: var(--text-dim);
}
.buy-method-note svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.buy-method-note a { color: var(--ice-200); font-weight: 600; }

.buy-err { min-height: 16px; font-size: 12.5px; font-weight: 500; color: var(--danger); margin-top: -4px; opacity: 0; transition: opacity var(--t); }
.buy-err.buy-show { opacity: 1; }

.buy-pay-btn { margin-top: 6px; }
.buy-pay-btn svg { width: 18px; height: 18px; }
.buy-secure-line { display: inline-flex; align-items: center; gap: 8px; justify-content: center; margin-top: 15px; font-size: 12.5px; color: var(--text-mute); text-align: center; }
.buy-secure-line svg { width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto; }

.buy-trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.buy-trust-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-mute); }
.buy-trust-item svg { width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto; }

.buy-demo-note { margin-top: 14px; font-size: 11.5px; color: var(--text-faint); text-align: center; }

/* ---------- success state ---------- */
.buy-card.buy-done > :not(.buy-success) { display: none; }
.buy-success { text-align: center; padding: 14px 6px 8px; }
.buy-success-badge {
  width: 74px; height: 74px; margin: 6px auto 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(87,217,163,.14); color: var(--safe);
  box-shadow: 0 0 0 8px rgba(87,217,163,.06), 0 0 40px -6px rgba(87,217,163,.5);
  animation: buyPop .5s var(--e-spring) both;
}
.buy-success-badge svg { width: 36px; height: 36px; }
.buy-success-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.buy-success-msg { margin: 12px auto 0; max-width: 400px; font-size: 14.5px; line-height: 1.6; color: var(--text-dim); }
.buy-success-user { color: var(--accent); font-weight: 700; word-break: break-word; }
.buy-success-receipt { margin-top: 8px; font-size: 13px; color: var(--text-mute); }
.buy-success-receipt span { color: var(--text-dim); }
.buy-success-ref { margin-top: 16px; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--text-mute); }
.buy-success-ref span { color: var(--text-dim); font-family: var(--font-price); }
.buy-success-btn { margin-top: 24px; }
.buy-success-btn svg { width: 18px; height: 18px; }
@keyframes buyPop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }

/* ---------- compact inside the in-page overlay ---------- */
html.is-framed .buy-head { margin-bottom: 16px; }
html.is-framed .buy-title { font-size: 25px; }
html.is-framed .buy-sub { display: none; }
html.is-framed .buy-card { padding: 20px; }
html.is-framed .buy-form { gap: 12px; }
html.is-framed .buy-methods { margin-bottom: 14px; }
html.is-framed .buy-trust { display: none; }
html.is-framed .buy-demo-note { margin-top: 10px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .buy-grid { grid-template-columns: 1fr; max-width: 540px; gap: 20px; }
  .buy-col-summary { position: static; }
}
@media (max-width: 600px) {
  .subbar-inner { padding: 0 20px; }
  .buy-card { padding: 22px; }
}
@media (max-width: 400px) {
  .buy-card { padding: 19px; }
  .subbar-brand .wm { font-size: 16px; }
  .buy-method { padding: 7px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .buy-success-badge { animation: none; }
}
