/*
 * css/pages/market.css: /marketplace and /service/:id (group market, SPEC 5.2).
 * Colours come from css/tokens.css only; buttons, chips, states, tables, the feed and code blocks are the shared
 * components of css/site.css. What is here: the category mark, the marketplace head, toolbar and tabs, the
 * category sections and their rows, the launch index, and the service page (crumbs, head, facts, route table,
 * call block, settlement list). Designed at 360px first; the row grows its number columns at 820px.
 */

/* ------------------------------------------------------------------------------------------------ category mark */
/* the category tone as a small square: .tone-* (css/site.css) sets --chip from CATEGORIES[].tone */
.mk-mark { display: block; width: 12px; height: 12px; border-radius: 3px; background: var(--chip, var(--spec-slate)); flex: none; }
.mk-mark--l { width: 18px; height: 18px; border-radius: 4px; }

/* ------------------------------------------------------------------------------------------------ marketplace head */
.mk-head { display: flex; flex-direction: column; gap: var(--s7); padding-block: calc(var(--section) * .7) var(--s6); }
.mk-head__row { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s6); }
.mk-head__copy { min-width: 0; }
.mk-head .lede { margin-top: var(--s5); max-width: 58ch; }
@media (min-width: 820px) {
  .mk-head__row { flex-direction: row; justify-content: space-between; gap: var(--s9); }
  .mk-head__sell { flex: none; margin-top: 12px; }
}

.mk-tools { display: flex; flex-wrap: wrap; gap: 10px; }
.mk-search { flex: 1 1 320px; }
.mk-search .input::-webkit-search-cancel-button { cursor: pointer; }
.mk-sort { flex: 1 1 180px; max-width: 220px; }
@media (max-width: 559px) { .mk-sort { max-width: none; } }

.mk-tabs [role="tab"] { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 8px; min-width: 44px; }
.mk-tab__n { font: 500 11px/1 var(--font-mono); color: var(--faint); font-variant-numeric: tabular-nums; }
.mk-tab__n:empty { display: none; }
.mk-tabs [role="tab"][aria-selected="true"] .mk-tab__n { color: var(--accent); }

/* ------------------------------------------------------------------------------------------------ marketplace list */
.mk-body { padding-bottom: var(--section); }
.mk-status { min-height: 24px; margin-top: var(--s2); margin-bottom: var(--s7); font-size: 14px; line-height: 1.55; color: var(--muted); }
.mk-status:empty { display: none; }
.mk-status .btn--quiet { min-height: 32px; font-size: 14px; vertical-align: baseline; }
.mk-list { display: flex; flex-direction: column; gap: var(--s9); }
.mk-skel { gap: 18px; padding: 8px 12px; }
.mk-skel i { height: 14px; }
.mk-source { margin-top: var(--s10); max-width: 84ch; }

/* one category: a heading row, then a flat list of rows with no borders between them */
.mk-sec { min-width: 0; }
.mk-sec__head, .mk-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) 16px; column-gap: 14px; }
.mk-sec__head { align-items: start; padding: 0 12px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.mk-sec__head .mk-mark { margin-top: 8px; }
.mk-sec__copy { min-width: 0; }
.mk-sec__title { display: flex; align-items: baseline; gap: 10px; font: 700 20px/1.3 var(--font-body); letter-spacing: -0.01em; color: var(--text); }
.mk-sec__n { font: 500 12px/1 var(--font-mono); color: var(--faint); font-variant-numeric: tabular-nums; }
.mk-sec__line { margin-top: 2px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.mk-sec__cols { display: none; }

.mk-rows { list-style: none; display: flex; flex-direction: column; }
.mk-row {
  align-items: start; row-gap: 6px; padding: 14px 12px; border-radius: var(--r2); color: var(--body);
  transition: background-color var(--t2) var(--ease-out);
}
.mk-row:hover { background: var(--panel-2); }
.mk-row .mk-mark { grid-column: 1; grid-row: 1; margin-top: 7px; }
.mk-row__main { grid-column: 2; grid-row: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mk-row__name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.mk-row__title { min-width: 0; font: 600 16px/1.4 var(--font-body); color: var(--text); overflow-wrap: anywhere; }
.mk-row__name .chip { height: 22px; padding: 0 8px; }
/* one line of summary, cut hard at the edge (the full text is in the title attribute) */
.mk-row__sum { font-size: 14.5px; line-height: 1.5; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-row__go { grid-column: 3; grid-row: 1; margin-top: 4px; color: var(--faint); transition: color var(--t1), transform var(--t2) var(--ease-out); }
.mk-row:hover .mk-row__go { color: var(--text); transform: translateX(2px); }

/* the three figures: a mono meta line under the name on a phone, three right aligned columns from 820px */
.mk-row__nums { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; gap: 2px 18px; min-width: 0; font: 400 12.5px/1.5 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.mk-num { white-space: nowrap; }
.mk-num b { font-weight: 500; color: var(--dim); }
.mk-num--price.is-none { display: none; }
.mk-num__none { color: var(--muted); }
.mk-num__short { display: none; }
.mk-num.unknown { color: var(--muted); }

@media (min-width: 820px) {
  .mk-sec__head, .mk-row { grid-template-columns: 12px minmax(0, 1fr) 316px 16px; column-gap: 16px; }
  .mk-sec__cols {
    grid-column: 3; display: grid; grid-template-columns: 84px 108px 108px; column-gap: 8px; align-self: end;
    text-align: right; font: 600 11px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
  }
  .mk-row { align-items: center; padding-block: 16px; }
  .mk-row .mk-mark { align-self: start; margin-top: 7px; }
  .mk-row__nums { grid-column: 3; grid-row: 1; display: grid; grid-template-columns: 84px 108px 108px; column-gap: 8px; text-align: right; font-size: 13px; }
  .mk-num { white-space: normal; }
  .mk-num__u { color: var(--muted); }
  .mk-num__k {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .mk-num--price.is-none { display: block; color: var(--faint); }
  .mk-num__none {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .mk-num__short { display: inline; color: var(--muted); }
  .mk-row__go { grid-column: 4; align-self: center; margin-top: 0; }
}

/* before launch: the nine categories the registry will hold */
.mk-index { margin-top: var(--s9); }
.mk-index__title { font: 700 20px/1.3 var(--font-body); letter-spacing: -0.01em; color: var(--text); }
.mk-index__line { margin-top: 6px; max-width: 64ch; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.mk-index__list { list-style: none; margin-top: var(--s5); display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--s8); }
@media (min-width: 820px) { .mk-index__list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .mk-index__list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mk-index__row { display: grid; grid-template-columns: 12px minmax(0, 1fr); column-gap: 14px; row-gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--line-row); }
.mk-index__row .mk-mark { grid-row: 1 / span 2; margin-top: 6px; }
.mk-index__name { font-weight: 600; color: var(--text); }
.mk-index__desc { grid-column: 2; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ------------------------------------------------------------------------------------------------ service page */
.svc { padding-block: calc(var(--section) * .5) var(--section); min-width: 0; }
.svc-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; }
.svc-crumbs li { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.svc-crumbs li + li::before { content: "/"; color: var(--accent); font-family: var(--font-mono); }
.svc-crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--dim); }
.svc-crumbs a:hover { color: var(--text); }
@media (max-width: 819px) { .svc-crumbs a { min-height: 44px; min-width: 44px; } }

.svc-head { margin-top: var(--s6); display: flex; flex-direction: column; gap: var(--s4); }
.svc-head__title { display: flex; align-items: flex-start; gap: 16px; min-width: 0; }
.svc-head__mark { margin-top: .5em; }
.svc-title { min-width: 0; overflow-wrap: anywhere; }
.svc-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.svc-chips__id { font: 500 12px/1.4 var(--font-mono); color: var(--faint); }
.svc-summary { max-width: 64ch; overflow-wrap: anywhere; }
.svc-state { margin-top: var(--s8); max-width: 720px; }

.svc-body { margin-top: var(--s8); display: flex; flex-direction: column; gap: var(--s10); min-width: 0; }

/* facts: a two column definition grid that folds to one on a phone */
.svc-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s8); border-top: 1px solid var(--line); }
.svc-fact { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line-row); min-width: 0; }
.svc-fact dt { font: 600 11px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.svc-fact dd { min-width: 0; font-size: 15px; color: var(--dim); overflow-wrap: anywhere; }
.svc-fact .mono { font-size: 13.5px; }
@media (min-width: 820px) {
  .svc-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .svc-fact--wide { grid-column: 1 / -1; }
}
.svc-ext { display: inline; overflow-wrap: anywhere; }
.svc-ext .icon { width: 14px; height: 14px; margin-left: 4px; vertical-align: -2px; color: var(--muted); }
.svc-ext:hover .icon { color: currentColor; }
@media (max-width: 819px) { .svc-ext { display: inline-flex; align-items: center; min-height: 44px; flex-wrap: wrap; } }

.svc-band dd .unknown { color: var(--muted); }

/* sections */
.svc-sec { min-width: 0; display: flex; flex-direction: column; gap: var(--s5); }
.svc-sec__head { display: flex; flex-direction: column; gap: 8px; }
.svc-sec__line { max-width: 70ch; font-size: 15px; line-height: 1.55; color: var(--muted); }

/* route table */
.svc-routes th[scope="row"] { font-weight: 400; min-width: 0; }
.svc-route { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.svc-method {
  display: inline-block; padding: 3px 6px; border-radius: var(--r1); background: var(--panel-2);
  font: 600 11px/1.2 var(--font-mono); letter-spacing: .06em; color: var(--dim);
}
.svc-path { font: 500 14px/1.45 var(--font-mono); color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.svc-route__sum { display: block; margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.svc-off { font: 600 11px/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.svc-price { white-space: nowrap; }
.svc-onoff { font-size: 14px; color: var(--muted); white-space: nowrap; }
.svc-onoff.is-on { color: var(--text); }
.svc-onoff.is-on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.svc-routes tr.is-off .svc-path { color: var(--dim); }
@media (min-width: 560px) { .svc-off { display: none; } }
@media (max-width: 559px) {
  .svc-col-state { display: none; }
  .svc-routes th, .svc-routes td { padding: 12px 10px; }
}

/* call block: the snippets beside the four steps from 1180px, stacked below that */
.svc-call { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s7); align-items: start; }
@media (min-width: 1180px) { .svc-call { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s8); } }
@media (min-width: 640px) and (max-width: 1179px) {
  .svc-call__side { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s7); align-items: start; }
  .svc-you { padding-top: 0; border-top: 0; padding-left: var(--s6); border-left: 1px solid var(--line); }
}
.svc-call__main { min-width: 0; display: flex; flex-direction: column; gap: var(--s5); }
.svc-pick { max-width: 560px; }
.svc-one { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.svc-one__price { font: 500 14px/1.4 var(--font-mono); color: var(--muted); }
.svc-snips { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.svc-snips [role="tab"] { flex: none; min-width: 44px; }
.svc-snips [role="tabpanel"] { min-width: 0; }
.svc-snips pre { max-height: 520px; }
.svc-call__side { display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
.svc-steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 14px; }
.svc-steps li { counter-increment: step; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; font-size: 14.5px; line-height: 1.55; color: var(--body); }
.svc-steps li::before { content: counter(step, decimal-leading-zero); font: 600 12px/1.9 var(--font-mono); color: var(--accent); }
.svc-you { padding-top: var(--s4); border-top: 1px solid var(--line); font-size: 14.5px; line-height: 1.6; color: var(--dim); }

/* settlements: the shared feed, each row a link to its transaction */
.svc-feed > li { border-bottom: 1px solid var(--line-row); }
.svc-feed > li:last-child { border-bottom: 0; }
.svc-feed .feed__row { border-bottom: 0; color: inherit; }
.svc-feed > li.is-new .feed__row { background: var(--accent-tint); }
html.motion .svc-feed > li.is-new .feed__row { animation: feed-in var(--t4) var(--ease-out) forwards; }
.svc-feed__more { margin-top: var(--s3); }

.svc-refund { max-width: 80ch; }
.svc-source { max-width: 84ch; margin-top: calc(-1 * var(--s6)); }
