/**
 * checkout.css — the order-success screen and its copy button. Loaded only by
 * checkout.html.
 *
 * Layout, mobile first: hero (tick, title, order number) → «Узгодимо оплату»
 * («Звʼязатись з продавцем» only) → «Що далі» timeline → summary → actions.
 * No payment details anywhere (client, 2026-11-07). From 1024px the summary
 * becomes a sticky right column. Blocks for one payment method carry
 * data-method; checkout.js sets the same attribute on .order-success.
 *
 * Colour roles: the success tick and «done» steps are --c-success on the tip
 * panel; gold fills the ONE main action (Telegram for «Звʼязатись з продавцем», «Продовжити
 * покупки» for cash on delivery); the sparks are illustration gold
 * (--c-art-line), decoration that is gone in under a second.
 */

/* ── Copy buttons ─────────────────────────────────────────── */
/* A button that IS the thing it copies: the number is inside it, .copy-label
   is the pill that changes to «Скопійовано». */
.copy-btn {
  font: inherit;
  color: inherit;
  text-align: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.copy-label {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sp-3);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-pill);
  font-family: var(--ff-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--c-text-soft);
  white-space: nowrap;
  transition: border-color var(--t), color var(--t);
}
/* Selectable, so the clipboard-less fallback can highlight it for a manual copy. */
.copy-value { user-select: text; }
.copy-btn:hover .copy-label  { border-color: var(--c-primary); color: var(--c-primary); }
.copy-btn.copied .copy-label { border-color: var(--c-success); color: var(--c-success); }

/* ── Success screen ───────────────────────────────────────── */
.order-success { padding: var(--sp-8) 0 var(--sp-16); }
.order-success:not([data-method="contact"]) [data-method="contact"],
.order-success[data-method="contact"] [data-method="cod"] { display: none; }

/* Hero */
.os-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  max-width: 560px;
  margin: 0 auto var(--sp-8);
  text-align: center;
}
.os-badge {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: var(--sp-2);
  border-radius: 50%;
  color: var(--c-success);
  background: var(--c-tip-bg);
  border: 1px solid var(--c-tip-bdr);
}
.os-badge::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 2px solid var(--c-success);
  opacity: 0;
}
.os-spark {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--c-art-line);
}
.os-spark:nth-child(1) { --a: 0deg; }
.os-spark:nth-child(2) { --a: 60deg; }
.os-spark:nth-child(3) { --a: 120deg; }
.os-spark:nth-child(4) { --a: 180deg; }
.os-spark:nth-child(5) { --a: 240deg; }
.os-spark:nth-child(6) { --a: 300deg; }
.os-title {
  margin: 0;
  font-family: var(--ff-head);
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--c-text);
}
.os-lead {
  max-width: 44ch;
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--c-text-soft);
}
.os-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  max-width: 420px;
  margin-top: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
}
.os-number-label { font-size: 13px; color: var(--c-muted); }
.os-number-btn {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2) var(--sp-3);
  min-height: 44px;
}
.os-number-value {
  font-family: var(--ff-num);
  font-variant-numeric: tabular-nums;
  font-size: clamp(20px, 6vw, 28px);
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--c-text);
}
.os-mail { margin: 0; font-size: 14px; line-height: 1.5; color: var(--c-muted); overflow-wrap: anywhere; }

/* Cards */
.os-grid,
.os-main { display: grid; gap: var(--sp-4); min-width: 0; }
.os-card {
  min-width: 0;
  padding: var(--sp-5) var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
}
.os-card-title { margin: 0 0 var(--sp-4); font-size: 18px; font-weight: 700; color: var(--c-text); }
/* The block the buyer acts on now: a hairline of gold along its top edge. */
.os-pay {
  background-image: var(--grad-accent-line);
  background-size: 100% 1px;
  background-repeat: no-repeat;
}

/* Payment */
.os-pay-text { margin: 0; font-size: 15px; line-height: 1.6; color: var(--c-text-soft); }
/* word-spacing: the same 6px thousands gap as every price (style.css, .t-price). */
.os-item-price,
.os-total-value { word-spacing: -0.3em; }
/* Wraps to two lines at 320 rather than overflowing: the label is the instruction. */
.os-tg { margin-top: var(--sp-4); white-space: normal; line-height: 1.25; padding-inline: var(--sp-4); }
.os-note { margin: var(--sp-3) 0 0; font-size: 13px; line-height: 1.5; color: var(--c-muted); text-align: center; }

/* «Що далі» */
.os-steps { list-style: none; margin: 0; padding: 0; }
.os-step {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--sp-3);
  padding-bottom: var(--sp-5);
}
.os-step:last-child { padding-bottom: 0; }
.os-step::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 32px;
  bottom: 4px;
  width: 2px;
  background: var(--c-border);
  transform-origin: top;
}
.os-step:last-child::before { display: none; }
.os-step.is-done::before { background: var(--c-success); }
.os-step-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--c-border-strong);
  background: var(--c-surface);
  font-family: var(--ff-num);
  font-size: 13px;
  color: var(--c-muted);
}
.is-done .os-step-dot { border-color: var(--c-success); color: var(--c-success); background: var(--c-tip-bg); }
.is-now  .os-step-dot { border-color: var(--c-text); color: var(--c-text); }
.is-now  .os-step-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid var(--c-text);
  opacity: 0;
}
.os-step-body { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; min-width: 0; }
.os-step-title { font-size: 15px; font-weight: 600; color: var(--c-text-soft); }
.is-done .os-step-title,
.is-now  .os-step-title { color: var(--c-text); }
.is-now  .os-step-title::after {
  content: "зараз";
  margin-left: var(--sp-2);
  padding: 1px var(--sp-2);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-soft);
  vertical-align: 2px;
}
.os-step-text { font-size: 14px; line-height: 1.5; color: var(--c-muted); }

/* Summary */
.os-items { list-style: none; margin: 0 0 var(--sp-3); padding: 0; }
.os-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--c-border-light);
  font-size: 14px;
}
.os-item-name { min-width: 0; color: var(--c-text-soft); overflow-wrap: anywhere; }
.os-item-qty,
.os-item-price { font-family: var(--ff-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.os-item-qty   { font-size: 13px; color: var(--c-muted); }
.os-item-price { color: var(--c-text); }
.os-ship {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface-2);
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-text-soft);
}
.os-ship svg { flex: none; margin-top: 1px; color: var(--c-muted); }
.os-ship.is-free { background: var(--c-tip-bg); border-color: var(--c-tip-bdr); }
.os-ship.is-free svg,
.os-ship.is-free strong { color: var(--c-tip-ink); }
.os-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  padding-top: var(--sp-3);
  border-top: 2px solid var(--c-border);
  font-size: 15px;
  color: var(--c-text-soft);
}
.os-total-value {
  font-family: var(--ff-num);
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 500;
  color: var(--c-text);
}

/* Actions */
.os-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: var(--sp-8);
}
.os-actions .btn { flex: 1 1 220px; max-width: 320px; white-space: normal; }

/* ── Motion ───────────────────────────────────────────────── */
/* transform and opacity only. The burst and the stagger play on a fresh order
   (.is-fresh), not on every reload of the same screen; the «now» step beats
   three times and stops. Nothing here hides content without an animation
   running: rises fill `backwards`, the sparks only exist while animated. */
@keyframes os-rise  { from { opacity: 0; transform: translateY(14px); } }
@keyframes os-pop {
  0%   { opacity: 0; transform: scale(.5); }
  60%  { opacity: 1; transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes os-ring  { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.9); } }
@keyframes os-spark {
  0%   { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(.4); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(-60px) scale(1); }
}
@keyframes os-line  { from { transform: scaleY(0); } }
@keyframes os-pulse { from { opacity: .8; transform: scale(.85); } to { opacity: 0; transform: scale(1.5); } }
@keyframes os-tick  { 50% { transform: scale(1.08); } }

.os-pay                           { --i: 1; }
.os-main > .os-card:last-child,
.os-summary                       { --i: 2; }
.os-actions                       { --i: 3; }

@media (prefers-reduced-motion: no-preference) {
  .is-fresh .os-badge         { animation: os-pop var(--dur-slow) var(--ease-out) backwards; }
  .is-fresh .os-badge::after  { animation: os-ring var(--dur-celebrate) var(--ease-out) .25s; }
  .is-fresh .os-spark         { display: block; animation: os-spark var(--dur-celebrate) var(--ease-out) .2s both; }
  .is-fresh .os-rise {
    animation: os-rise var(--dur-slow) var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 90ms + 150ms);
  }
  .is-fresh .os-step.is-done::before { animation: os-line var(--dur-slow) var(--ease-out) .7s backwards; }
  .is-now .os-step-dot::after   { animation: os-pulse var(--dur-pulse) var(--ease-out) 1s 3; }
  .copy-btn.copied .copy-label  { animation: os-tick var(--dur-md) var(--ease-out); }
}

/* ── Breakpoints ──────────────────────────────────────────── */
@media (min-width: 600px) {
  .os-card { padding: var(--sp-6); }
}
@media (min-width: 1024px) {
  .os-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .os-summary { position: sticky; top: var(--sticky-top); }
}
