/* foldoy swap: the swap pages, the check and deposit pages, and the guides, on the site's own surfaces and tokens.
   The swap card is the homepage swap card (.qs) grown into a ticket: send and get side by side once the card is wide.
   Surfaces step down for things you fill in (--deep) and up for things you read (--raise). No lines anywhere. */

/* ---------- the swap page: the card, with prices and terms beside it ---------- */
.swap-hero { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 16px; align-items: stretch; padding-top: 28px; }
.swap-col { display: flex; flex-direction: column; min-width: 0; }
.swapcard { flex: none; padding: 28px; gap: 26px; container-type: inline-size; }
.swap-h { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; }
.swap-h h1 { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }
.swap-mode { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }

/* the form: one column like the homepage box, three columns (send, flip, get) once the card is wide */
.swap-form { display: grid; grid-template-columns: minmax(0, 1fr); }
.swap-form > * { min-width: 0; }
.swapcard .qs-box { gap: 2px; padding: 14px 18px 12px; border-radius: 16px; }
.swapcard .qs-l { font-size: 13px; }
.swapcard .qs-line { min-height: 52px; gap: 12px; }
.swapcard input.qs-amt { height: 52px; font-size: 32px; letter-spacing: -0.03em; }
.swapcard .qs-out { font-size: 32px; line-height: 52px; letter-spacing: -0.03em; }
/* messages in the figure's place (Getting a rate, No rate right now) at the homepage box's size, free to wrap */
.qs-out.say { color: var(--faint); }
.swapcard .qs-out.say { font-size: 21px; line-height: 1.25; letter-spacing: -0.02em; white-space: normal; }
.swapcard .qs-usd { min-height: 18px; font-size: 13px; line-height: 18px; }
.swapcard .qs-flip { justify-self: center; width: 40px; height: 40px; margin: -12px 0; border-radius: 12px; box-shadow: 0 0 0 5px var(--card); }
.swapcard .qs-flip:hover { background: var(--hover-2); }
.swapcard .qs-flip img { width: 18px; height: 18px; transition: transform .2s; }
@container (min-width: 650px) {
  /* ten digits and a coin chip fit in each box: the figures shrink with the card down to 24px */
  .swap-form { grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); }
  .swapcard input.qs-amt, .swapcard .qs-out { font-size: clamp(24px, calc(8.3cqi - 30px), 32px); }
  .swap-form > :not(.qs-box):not(.qs-flip) { grid-column: 1 / -1; }
  .swapcard .qs-flip { grid-column: 2; grid-row: 1; justify-self: center; align-self: center; margin: 0; box-shadow: none; }
  .swapcard .qs-flip img { transform: rotate(90deg); }
  .swapcard .swap-coin select { max-width: 172px; }
}

/* coin picker: the native list, with a chip (icon, ticker, network) over it once the script runs */
.swap-coin { height: 44px; max-width: 100%; border-radius: 12px; }
.swapcard .swap-coin select { width: auto; max-width: 200px; height: 44px; padding: 0 34px 0 14px; overflow: hidden; text-overflow: ellipsis; background-position: right 12px center; font: 600 15px var(--ui); field-sizing: content; }
.swap-chip { display: none; }
.swap-form.js .swap-chip { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 36px 0 10px; background: url("../img/icons/chev-d.248a6f81a6f7.svg") no-repeat right 12px center / 14px; font: 600 15px/1 var(--ui); white-space: nowrap; pointer-events: none; }
.swap-form.js .swap-coin select { position: absolute; inset: 0; width: 100%; max-width: none; height: 100%; padding: 0; opacity: 0; cursor: pointer; }
.swap-coin .chip-ic { position: static; flex: none; width: 24px; height: 24px; }
.chip-ic.mono { display: grid; place-items: center; border-radius: 50%; background: var(--hover-2); color: var(--text); font: 600 11px/1 var(--ui); }
.chip-net { color: var(--muted); font-size: 12.5px; font-weight: 500; }

/* the rate, right under the amounts */
.swap-quote { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 20px; min-height: 20px; margin-top: 12px; padding: 0 4px; font-size: 13px; }
.swap-rate { min-height: 0; margin: 0; color: var(--muted); font-size: 13px; text-align: left; font-variant-numeric: tabular-nums; }

/* the addresses: the same boxes as the amounts, label inside */
.swap-fields { display: grid; gap: 8px; margin-top: 22px; }
.swap-field { display: flex; flex-direction: column; gap: 2px; padding: 12px 18px 10px; border-radius: 16px; background: var(--deep); color: var(--muted); cursor: text; transition: background .15s; }
.swap-field:focus-within { background: var(--hover); }
.swap-field span { font-size: 13px; font-weight: 500; }
.swapcard .swap-field input { height: 30px; padding: 0; border-radius: 0; background: none; color: var(--text); font: 400 15px var(--mono); }
.swapcard .swap-field input:focus, .swapcard .swap-field input:focus-visible { background: none; box-shadow: none; }
.swap-field input::placeholder { font-family: var(--ui); }
.swap-msg { margin-top: 14px; padding: 0 4px; }
.swap-notice { margin-top: 16px; padding: 14px 18px; border-radius: 14px; background: var(--raise); color: var(--text); font-size: 13.5px; line-height: 1.55; text-wrap: pretty; }
/* .btn.big also picks up site.css's account-balance .big (display font, -0.03em, 4px margin): set all of it here */
.swapcard .btn.big, .swap-sheet .btn.big { height: 54px; margin-top: 16px; border-radius: 14px; font: 600 16px/1 var(--ui); letter-spacing: 0; }
.swap-fine { margin-top: 12px; color: var(--faint); font-size: 13px; text-align: center; }
.swap-notice a, .swap-more a, .swap-about a, .sx-guide a { text-decoration: underline; text-decoration-color: rgba(243, 241, 236, .3); text-underline-offset: 3px; }
.swap-notice a:hover, .swap-more a:hover, .swap-about a:hover, .sx-guide a:hover { text-decoration-color: var(--text); }

/* beside the card: coin prices (the homepage card), then the terms; the price rows spread over any height the card adds */
.swap-hero .lside { gap: 16px; }
.swap-hero .coins .coin-list { flex: 1; justify-content: space-evenly; }
.swap-terms { gap: 0; padding: 22px 20px 20px; }
.swap-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.swap-facts li { display: flex; flex-direction: column; gap: 3px; padding: 0; border-radius: 0; background: none; }
.swap-facts span { color: var(--muted); font-size: 13px; }
.swap-facts strong { font: 600 18px/1.25 var(--display); letter-spacing: -0.02em; }
.swap-more { margin-top: 24px; border-radius: var(--r-ctl); background: var(--deep); transition: background .15s; }
.swap-more[open], .swap-more:hover { background: var(--raise); }
.swap-more summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: var(--muted); font-size: 13.5px; font-weight: 500; list-style: none; cursor: pointer; transition: color .15s; }
.swap-more summary:hover, .swap-more[open] summary { color: var(--text); }
.swap-more summary::-webkit-details-marker { display: none; }
.swap-more summary::after { content: "+"; color: var(--muted); font-size: 18px; line-height: 1; transition: transform .2s; }
.swap-more[open] summary::after { transform: rotate(45deg); }
.swap-more p { padding: 0 14px 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ---------- under the hero: the homepage's section rhythm ---------- */
.swap-sec { margin-top: 56px; }
.swap-sec > h2 { margin-bottom: 14px; font-size: 22px; }
.swap-hero ~ .swap-sec { margin-top: 80px; }
.swap-hero ~ .swap-sec > h2 { margin-bottom: 20px; font-size: 28px; letter-spacing: -0.03em; }

/* how it works: the homepage's How buying works */
.how-steps { display: grid; gap: 14px; counter-reset: step; }
.how-steps li { counter-increment: step; }
.swap-how .how-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.swap-how .how-steps li { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.swap-how .how-steps li::before { content: counter(step); display: block; width: auto; height: auto; margin-bottom: 14px; border-radius: 0; background: none; color: var(--text); font: 600 28px/1 var(--display); letter-spacing: -0.03em; }
.swap-how .how-steps strong { font: 600 18px/1.15 var(--display); letter-spacing: -0.02em; }
.swap-how .how-steps span { max-width: 34ch; color: var(--muted); font-size: 14.5px; line-height: 1.55; text-wrap: pretty; }

/* pair links (the guides) */
.pair-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.pair-chips a { display: block; padding: 11px 10px; border-radius: var(--r-ctl); background: var(--card); color: var(--muted); font-size: 14px; font-weight: 500; text-align: center; white-space: nowrap; transition: background .15s, color .15s; }
.pair-chips a:hover { background: var(--raise); color: var(--text); }
.pair-chips a.on { background: var(--blue-wash); color: var(--blue-ink); }

/* the pair's own text */
.swap-about { max-width: 720px; }
.swap-about p { margin-top: 14px; color: var(--muted); font-size: 15.5px; line-height: 1.75; text-wrap: pretty; }
.swap-about .swap-checked { margin-top: -10px; color: var(--faint); font-size: 13px; }
.swap-about > h2 { margin-bottom: 20px; }

/* the pair's text, with its questions beside it on the hero's grid */
.swap-pair { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 56px 16px; align-items: start; margin-top: 80px; }
.swap-pair > .swap-sec { margin-top: 0; }
.swap-pair > .swap-sec > h2 { margin-bottom: 20px; font-size: 28px; letter-spacing: -0.03em; }
.swap-pair > .swap-sec + .swap-sec { position: sticky; top: calc(var(--head-h, 116px) + 24px); }
.swap-pair .faq-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* guides */
.guide-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.guide-links a { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 22px 24px 24px; border-radius: var(--r); background: var(--card); transition: background .15s; }
.guide-links a:hover { background: var(--raise); }
.guide-links strong { display: block; font: 600 17px/1.3 var(--display); letter-spacing: -0.015em; text-wrap: balance; }
.guide-links span { display: block; margin-top: 0; color: var(--muted); font-size: 14px; line-height: 1.55; text-wrap: pretty; }

/* ---------- check page and deposit page: the swap card's parts, in a narrower card ---------- */
.swap-narrow { max-width: 680px; margin: 28px auto 0; }
.swap-sheet { padding: 28px; gap: 16px; }
.swap-sheet .swap-h h1 { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }
.swap-lede { margin-top: -6px; color: var(--muted); font-size: 15px; }
.swap-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.swap-sum > div { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px 16px; border-radius: 16px; background: var(--deep); }
.swap-sum span, .swap-pay .lbl { color: var(--muted); font-size: 13px; font-weight: 500; }
.swap-big { font: 600 26px/1.2 var(--mono); letter-spacing: -0.03em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.swap-sheet .kv { gap: 8px; }
.swap-sheet .kv > div { align-items: baseline; padding: 4px 4px 0; }
.swap-sheet .kv dt { color: var(--muted); font-size: 14px; }
.swap-sheet .kv dd { max-width: 70%; overflow-wrap: anywhere; }
/* an address reads as the swap card's address box: label inside, the whole address on the left */
.swap-sheet .kv > div:has(> dd.mono) { flex-direction: column; gap: 4px; padding: 12px 18px 14px; border-radius: 16px; background: var(--deep); }
.swap-sheet .kv > div:has(> dd.mono) dt { font-size: 13px; font-weight: 500; }
.swap-sheet .kv dd.mono { max-width: none; text-align: left; font: 400 14.5px/1.6 var(--mono); letter-spacing: .01em; }
.swap-sheet .kv > div:has(> dd.mono) + div:not(:has(> dd.mono)), .swap-sheet .kv > div:not(:has(> dd.mono)) + div:has(> dd.mono) { margin-top: 6px; }
.swap-sheet .swap-notice { margin-top: 0; }
.swap-actions { display: flex; gap: 8px; }
.swap-actions .btn.primary { flex: 1; }
.swap-actions .btn:not(.primary) { flex: none; width: auto; height: 54px; padding: 0 24px; border-radius: 14px; font-size: 15px; }
.swap-sheet .btn.big { margin-top: 0; }
.swap-sheet .swap-fine { margin-top: -4px; }
.swap-state { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; }
.swap-state strong { font: 600 22px/1.2 var(--display); letter-spacing: -0.02em; }
.swap-state span { color: var(--faint); font-size: 13px; }
/* the deposit: amount and network beside the QR, then the address across the whole panel (one line for 42 characters) */
.swap-pay { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto 1fr; gap: 6px 24px; align-items: start; margin-top: -4px; padding: 20px; border-radius: 16px; background: var(--deep); }
.swap-pay-l { display: contents; }
.swap-pay-l > * { grid-column: 1; min-width: 0; }
.swap-pay-l > :first-child { grid-row: 1; }
.swap-pay .swap-big { grid-row: 2; font-size: 32px; }
.swap-pay .swap-big + .lbl:not(.to) { grid-row: 3; justify-self: start; padding: 3px 10px; border-radius: 8px; background: var(--raise); color: var(--text); }
.swap-pay .to, .swap-pay .swap-copy { grid-column: 1 / -1; }
.swap-pay .to { margin-top: 10px; }
.swap-pay .swap-qr { grid-column: 2; grid-row: 1 / 5; }
.swap-copy { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--raise); }
.swap-copy code { flex: 1; min-width: 0; font: 400 15px/1.55 var(--mono); letter-spacing: .01em; overflow-wrap: anywhere; }
.swap-copy .btn { background: var(--blue); color: #fff; }
.swap-copy .btn:hover { background: var(--blue-2); }
.swap-copy .js-copy[hidden] { display: none; }
.swap-qr { display: block; width: 164px; height: 164px; padding: 10px; border-radius: 14px; background: #fff; }
.swap-qr svg { display: block; width: 100%; height: 100%; }
.swap-sheet > .btn.wide:not(.primary) { align-self: flex-start; width: auto; margin-top: 4px; }

/* ---------- guides ---------- */
.sx-read { max-width: 720px; margin: 28px auto 0; }
.sx-guide h1 { font-size: 40px; letter-spacing: -0.035em; line-height: 1.08; }
.sx-guide .sx-lede { margin-top: 14px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.sx-guide .sx-meta { margin-top: 12px; color: var(--faint); font-size: 13px; }
.sx-guide h2 { margin: 40px 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.sx-guide p, .sx-guide li { color: #d8dbe1; font-size: 15.5px; line-height: 1.72; }
.sx-guide p { margin-top: 14px; }
.sx-guide ol, .sx-guide ul.sx-list { display: grid; gap: 10px; margin-top: 14px; padding-left: 22px; }
.sx-guide ol { list-style: decimal; }
.sx-guide ul.sx-list { list-style: disc; }
.sx-guide li::marker { color: var(--faint); }
.sx-guide strong { color: var(--text); font-weight: 600; }
.sx-guide table { width: 100%; margin-top: 16px; border-collapse: separate; border-spacing: 0 6px; font-size: 14px; }
.sx-guide th { padding: 4px 12px; color: var(--muted); font-weight: 500; text-align: left; }
.sx-guide td { padding: 11px 12px; background: var(--card); vertical-align: top; line-height: 1.5; }
.sx-guide td:first-child { border-radius: 10px 0 0 10px; }
.sx-guide td:last-child { border-radius: 0 10px 10px 0; }
.sx-guide td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sx-guide .swap-sec { margin-top: 48px; }
.sx-guide .guide-links { grid-template-columns: 1fr; gap: 8px; }
.sx-guide .guide-links a { gap: 6px; padding: 16px 18px; border-radius: 16px; }
.sx-guide .guide-links strong { font-size: 16px; letter-spacing: -0.01em; text-wrap: wrap; }
.sx-guide .guide-links span { font-size: 13.5px; line-height: 1.5; text-wrap: wrap; }
.sx-guide .guide-links a, .sx-guide .pair-chips a { text-decoration: none; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .swap-hero, .swap-pair { grid-template-columns: minmax(0, 1fr); }
  .swap-pair > .swap-sec + .swap-sec { position: static; }
  .swap-pair .faq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* under the card: prices as four tiles across, then the three facts across */
  .swap-hero .lside { display: flex; flex-direction: column; }
  .swap-hero .lside .coin-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .swap-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 980px) {
  .guide-links { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .swap-how .how-steps { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 640px) {
  .swap-hero { padding-top: 12px; }
  .swapcard { padding: 20px 16px 18px; gap: 20px; }
  .swap-sheet { padding: 20px 16px; }
  .swap-sheet .swap-h h1 { font-size: 30px; }
  .swap-sum { grid-template-columns: minmax(0, 1fr); }
  .swap-big { font-size: 22px; }
  .swap-pay .swap-big { font-size: 26px; }
  .swap-pay { padding: 16px; }
  .swap-actions .btn:not(.primary) { padding: 0 20px; }
  .swap-copy code { font-size: 14px; }
  .swap-h h1 { font-size: 30px; }
  .sx-guide h1 { font-size: 26px; }
  .swapcard input.qs-amt, .swapcard .qs-out { font-size: 26px; }
  .swapcard .qs-box, .swap-field { padding-left: 14px; padding-right: 14px; }
  .swapcard .swap-coin select { max-width: 150px; }
  .swapcard .swap-field input { font-size: 14px; }
  .swap-field input::placeholder { font-size: 13.5px; }
  .swap-quote { flex-direction: column; align-items: flex-start; }
  .swap-pair .faq-grid { grid-template-columns: minmax(0, 1fr); }
  .swap-hero .lside .coin-list { display: flex; }
  .swap-terms { padding: 10px 20px 20px; }
  .swap-facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .swap-facts li { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 0; }
  .swap-facts strong { font-size: 16px; text-align: right; }
  .swap-more { margin-top: 12px; }
  .swap-hero ~ .swap-sec { margin-top: 64px; }
  .swap-hero ~ .swap-sec > h2 { font-size: 24px; }
  .swap-about p { font-size: 15px; }
  .swap-pay { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .swap-pay-l > *, .swap-pay .swap-big, .swap-pay .swap-big + .lbl:not(.to) { grid-row: auto; }
  .swap-pay .swap-qr { grid-column: 1; grid-row: auto; justify-self: center; margin-top: 10px; }
}
