/* Marketplace pages (/marketplace/…), rendered by the server into the site layout. Uses site.css tokens. */

.mk-i { width: 18px; height: 18px; flex: none; }
.mk h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 3.1rem); }

/* --------------------------------------------------------------- hero */
.mk-hero, .mk-api-head { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--bg-2), var(--bg)); }
.mk-hero-glow { position: absolute; inset: -40% -10% auto; height: 520px; pointer-events: none; opacity: .9;
  background: radial-gradient(40% 55% at 22% 40%, var(--glow), transparent 70%), radial-gradient(35% 50% at 78% 25%, rgba(99, 102, 241, .14), transparent 70%), radial-gradient(30% 45% at 60% 80%, rgba(236, 72, 153, .08), transparent 70%); }
.mk-hero-inner { position: relative; padding: 56px 16px 44px; text-align: center; }
.mk-hero-inner .lede { margin: 0 auto 26px; }
@media (min-width: 720px) { .mk-hero-inner { padding: 76px 28px 56px; } }
.mk-search { position: relative; display: flex; gap: 8px; max-width: 640px; margin: 0 auto; padding: 6px; background: var(--card); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-lg); }
.mk-search:focus-within { border-color: var(--accent-line); box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-soft); }
.mk-search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--fg-3); }
.mk-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg); font: 400 16px/1.4 var(--sans); padding: 10px 10px 10px 42px; outline: none; }
.mk-search input::placeholder { color: var(--fg-3); }
.mk-search .btn { border-radius: 11px; }
.mk-search-hint { max-width: 640px; margin: 10px auto 0; color: var(--fg-3); font-size: 13.5px; line-height: 1.5; }
.mk-search-hint a { color: var(--fg-2); }
.mk-hero-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 28px; list-style: none; margin: 26px 0 0; padding: 0; color: var(--fg-3); font-size: 15px; }
.mk-hero-stats strong { color: var(--fg); font-weight: 700; font-size: 1.15rem; margin-right: 4px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- categories */
.mk-cats { margin-top: 22px; }
.mk-cats ul { list-style: none; margin: 0; padding: 2px 0 8px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
@media (min-width: 900px) { .mk-cats ul { flex-wrap: wrap; overflow: visible; } }
.mk-cats a { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--fg-2); font-size: 14px; font-weight: 500; text-decoration: none; transition: border-color .15s, color .15s, background .15s; }
.mk-cats a span { font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.mk-cats a:hover { border-color: var(--accent-line); color: var(--fg); }
.mk-cats a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.mk-cats a[aria-current] span { color: inherit; opacity: .8; }

/* ------------------------------------------------------------- results */
.mk-results { padding-top: 18px; padding-bottom: 48px; }
.mk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.mk-toolbar p { margin: 0; font-size: 14px; }
.mk-sort { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); overflow-x: auto; max-width: 100%; }
.mk-sort a { padding: 6px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--fg-2); text-decoration: none; white-space: nowrap; }
.mk-sort a:hover { color: var(--fg); }
.mk-sort a[aria-current] { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }

.mk-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .mk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .mk-grid:not(.mk-grid-2) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.mk-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: transform .18s ease, border-color .18s, box-shadow .18s; min-width: 0; }
.mk-card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(135deg, var(--accent-line), transparent 40%, transparent 60%, rgba(99, 102, 241, .25)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .18s; pointer-events: none; }
.mk-card:hover { transform: translateY(-2px); border-color: transparent; box-shadow: var(--shadow); }
.mk-card:hover::before { opacity: 1; }
.mk-card-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mk-card-id { min-width: 0; }
.mk-card h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.mk-card-link { color: var(--fg); text-decoration: none; }
.mk-card-link::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.mk-card-link:focus-visible { outline: none; }
.mk-card:has(.mk-card-link:focus-visible) { outline: 2px solid var(--accent-2); outline-offset: 2px; }
/* Block, not flex: a long name wraps and the badge stays right after its last word. */
.mk-by { display: block; margin: 2px 0 0; font-size: 13.5px; color: var(--fg-3); min-width: 0; overflow-wrap: anywhere; }
.mk-kind:not(:empty) { display: inline-block; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--bg-3); font-size: 11.5px; font-weight: 500; }
.mk-sum { margin: 0; color: var(--fg-2); font-size: 14.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.mk-chip { position: relative; z-index: 1; display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); color: var(--fg-2); font-size: 12.5px; text-decoration: none; }
a.mk-chip:hover { border-color: var(--accent-line); color: var(--fg); }
.mk-chip-cat { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); font-weight: 600; }
.mk-card-stats { display: flex; align-items: center; gap: 14px; margin: auto 0 0; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.mk-card-stats span { display: inline-flex; align-items: center; gap: 5px; }
.mk-card-stats .mk-i { width: 15px; height: 15px; }
.mk-updated { margin-left: auto; }

/* ----------------------------------------------------------------- logos */
.mk-logo { flex: none; border-radius: 12px; object-fit: cover; background: var(--card); border: 1px solid var(--line); }
.mk-logo-md { width: 44px; height: 44px; border-radius: 11px; }
.mk-logo-lg { width: 72px; height: 72px; border-radius: 18px; }
.mk-logo-xl { width: 112px; height: 112px; border-radius: 26px; box-shadow: var(--shadow-lg); border: 4px solid var(--bg); }
@media (max-width: 640px) { .mk-logo-xl { width: 88px; height: 88px; border-radius: 22px; } .mk-logo-lg { width: 56px; height: 56px; border-radius: 14px; } }
.mk-initials { display: inline-grid; place-items: center; font-weight: 700; letter-spacing: -.02em; color: #fff; border: 0;
  background: linear-gradient(135deg, hsl(var(--h) 70% 48%), hsl(calc(var(--h) + 40) 70% 38%)); }
.mk-logo-md.mk-initials { font-size: 16px; }
.mk-logo-lg.mk-initials { font-size: 24px; }
.mk-logo-xl.mk-initials { font-size: 36px; border: 4px solid var(--bg); }

.mk-verified { display: inline-flex; color: #1d9bf0; margin-left: 2px; vertical-align: middle; }
.mk-badge-svg { width: 17px; height: 17px; }
h1 .mk-verified .mk-badge-svg { width: .75em; height: .75em; }

/* ------------------------------------------------------- empty, pager */
.mk-empty { text-align: center; padding: 56px 16px; border: 1px dashed var(--line-2); border-radius: 18px; background: var(--bg-2); }
.mk-empty h1, .mk-empty h2 { font-size: 1.5rem; }
.mk-empty p { color: var(--fg-2); }
.mk-empty .btn { margin: 4px; }
.mk-empty-icon { width: 44px; height: 44px; margin: 0 auto 14px; color: var(--accent-text); }
.mk-404 { margin: 48px auto; max-width: 720px; }
.mk-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 28px; font-size: 14px; }

/* --------------------------------------------------- verified orgs, CTA */
.mk-publish { position: relative; overflow: hidden; display: grid; gap: 22px; align-items: center; padding: 30px 22px; border-radius: 22px; color: #e8f6f4;
  background: radial-gradient(60% 120% at 0% 0%, rgba(45, 212, 191, .35), transparent 60%), radial-gradient(60% 120% at 100% 100%, rgba(99, 102, 241, .35), transparent 60%), #0c1416; border: 1px solid #1f2a2d; }
.mk-publish h2 { color: #fff; }
.mk-publish p { color: #b7c9c9; max-width: 60ch; }
.mk-publish .section-kicker { text-align: left; color: #5eead4; margin-bottom: 8px; }
.mk-publish-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mk-publish > * { min-width: 0; }
.mk-publish .btn-ghost { background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .2); }
@media (min-width: 900px) { .mk-publish { grid-template-columns: 1.4fr 1fr; padding: 40px 44px; } .mk-publish-actions { justify-content: flex-end; } }
.mk-faq-wrap { padding-bottom: 56px; }

/* -------------------------------------------------------------- profile */
/* Cover, then an identity row: only the logo overlaps the cover, the name
   and handle sit below its edge, actions on the right, figures under it. */
.mk-profile { position: relative; border-bottom: 1px solid var(--line); }
.mk-cover { height: 96px; border-bottom: 1px solid var(--line);
  background: radial-gradient(50% 120% at 15% 0%, var(--glow), transparent 70%), radial-gradient(50% 140% at 85% 20%, rgba(99, 102, 241, .22), transparent 70%), linear-gradient(120deg, var(--bg-3), var(--bg-2)); }
.mk-profile-inner { display: grid; grid-template-columns: minmax(0, 1fr); position: relative; }
.mk-profile-inner > .mk-logo-xl { margin-top: -48px; justify-self: start; }
.mk-profile-id { min-width: 0; padding-top: 12px; }
.mk-profile-id h1 { margin: 0; font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.3rem); line-height: 1.15; letter-spacing: -.025em; overflow-wrap: anywhere; }
.mk-handle { margin: 6px 0 0; color: var(--fg-3); font-size: 14.5px; overflow-wrap: anywhere; }
.mk-tagline { margin: 10px 0 0; color: var(--fg-2); font-size: 1.05rem; max-width: 70ch; }
.mk-profile-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.mk-profile-actions .btn { gap: 7px; }
.mk-profile-actions .icon { width: 15px; height: 15px; }
.mk-profile-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 22px 0 0; padding: 14px 0 16px; border-top: 1px solid var(--line); color: var(--fg-3); font-size: 14.5px; }
.mk-profile-stats li { display: inline-flex; align-items: center; gap: 7px; cursor: help; }
.mk-profile-stats .mk-i { color: var(--accent-text); }
.mk-profile-stats strong { color: var(--fg); font-weight: 650; font-variant-numeric: tabular-nums; }
/* Wider screens: logo, name block and actions on one row, centred on each
   other, below the cover (an overlapping logo left the name beside its
   lower half). Phones keep the stacked layout with the logo on the cover. */
@media (min-width: 720px) {
  .mk-cover { height: 104px; }
  .mk-profile-inner { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 24px; align-items: center; padding-top: 24px; }
  .mk-profile-inner > .mk-logo-xl { margin-top: 0; }
  .mk-profile-id { padding-top: 0; }
  .mk-profile-actions { align-self: center; padding-top: 0; }
}
/* Two API cards side by side only where the main column is wide enough. */
@media (min-width: 960px) and (max-width: 1279px) { .mk-profile-body .mk-grid-2 { grid-template-columns: minmax(0, 1fr); } }
.mk-profile-body .mk-panel .mk-facts { margin-bottom: 0; }
.mk-profile-body .mk-panel .mk-social { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.mk-profile-body > .mk-main > .mk-block:last-child { margin-bottom: 0; }

.mk-profile-body, .mk-api-body { display: grid; gap: 28px; padding-top: 28px; padding-bottom: 64px; }
@media (min-width: 960px) {
  .mk-profile-body { grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; padding-top: 36px; }
  .mk-api-body { grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; }
}
.mk-main { min-width: 0; }
.mk-side { min-width: 0; }
@media (min-width: 960px) { .mk-side-sticky { position: sticky; top: 84px; align-self: start; } }
.mk-facts { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; font-size: 14.5px; color: var(--fg-2); }
.mk-facts li { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.mk-facts li > span, .mk-facts li > a { min-width: 0; overflow-wrap: anywhere; }
.mk-facts .mk-i { margin-top: 2px; color: var(--fg-3); }
.mk-fact-verified { padding: 10px 12px; border-radius: 12px; background: rgba(29, 155, 240, .08); border: 1px solid rgba(29, 155, 240, .25); color: var(--fg); }
.mk-fact-verified .mk-i { color: #1d9bf0; }
.mk-social { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-social a { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; color: var(--fg-2); text-decoration: none; }
.mk-social a:hover { border-color: var(--accent-line); color: var(--fg); }

.mk-block { margin-bottom: 40px; }
.mk-block > h2 { font-size: clamp(1.3rem, 1.15rem + .6vw, 1.6rem); display: flex; align-items: center; gap: 10px; }
.mk-block.prose > h2 { margin-top: 0; }

/* -------------------------------------------------------------- API page */
.mk-api-head-inner { position: relative; display: grid; gap: 18px; padding-top: 30px; padding-bottom: 34px; }
@media (min-width: 720px) { .mk-api-head-inner { grid-template-columns: auto minmax(0, 1fr); column-gap: 24px; padding-top: 40px; padding-bottom: 42px; } }
.mk-api-id { min-width: 0; }
.mk-api-id h1 { margin: 2px 0 8px; overflow-wrap: anywhere; }
.mk-api-id .lede { margin-bottom: 14px; }
.mk-api-by { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 600; font-size: 15px; }
.mk-api-by a { color: var(--fg-2); text-decoration: none; }
.mk-api-by a:hover { color: var(--fg); text-decoration: underline; }
.mk-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.mk-actions .btn { gap: 8px; }
.mk-count { min-width: 1.6em; padding: 1px 7px; margin-left: 2px; border-radius: 999px; background: var(--bg-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mk-static { cursor: default; }
.mk-static:hover { border-color: var(--line-2); }
.mk-star[aria-pressed="true"] { border-color: rgba(234, 179, 8, .55); background: rgba(234, 179, 8, .1); }
.mk-star[aria-pressed="true"] .mk-i { color: #eab308; fill: #eab308; }
.mk-star.is-busy { opacity: .6; pointer-events: none; }
@media (max-width: 560px) { .mk-actions .btn-primary { width: 100%; } .mk-actions .btn-ghost { flex: 1; } }

.mk-count-pill { padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.mk-eps { border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; }
.mk-ep-folder { margin: 0; padding: 10px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--fg-2); }
.mk-ep-list { list-style: none; margin: 0; padding: 0; }
.mk-ep-list + .mk-ep-folder { border-top: 1px solid var(--line); }
.mk-ep-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.mk-ep-list li:last-child { border-bottom: 0; }
.mk-ep-list li:hover { background: var(--bg-2); }
.mk-method { flex: none; min-width: 62px; padding: 3px 6px; border-radius: 6px; text-align: center; font: 700 11.5px/1.4 var(--mono); letter-spacing: .02em; color: var(--fg-2); background: var(--bg-3); }
.m-get { color: #0f8a4f; background: rgba(16, 185, 129, .12); }
.m-post { color: #b45309; background: rgba(245, 158, 11, .14); }
.m-put { color: #1d4ed8; background: rgba(59, 130, 246, .13); }
.m-patch { color: #7c3aed; background: rgba(139, 92, 246, .13); }
.m-delete { color: #dc2626; background: rgba(239, 68, 68, .12); }
.m-proto { color: var(--accent-text); background: var(--accent-soft); }
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-theme="light"])) .m-get { color: #34d399; }
  :where(:root:not([data-theme="light"])) .m-post { color: #fbbf24; }
  :where(:root:not([data-theme="light"])) .m-put { color: #60a5fa; }
  :where(:root:not([data-theme="light"])) .m-patch { color: #a78bfa; }
  :where(:root:not([data-theme="light"])) .m-delete { color: #f87171; }
}
:where(:root[data-theme="dark"]) .m-get { color: #34d399; }
:where(:root[data-theme="dark"]) .m-post { color: #fbbf24; }
:where(:root[data-theme="dark"]) .m-put { color: #60a5fa; }
:where(:root[data-theme="dark"]) .m-patch { color: #a78bfa; }
:where(:root[data-theme="dark"]) .m-delete { color: #f87171; }
.mk-ep-main { display: grid; gap: 2px; min-width: 0; }
.mk-ep-name { font-weight: 600; font-size: 14.5px; }
.mk-ep-url { font-size: 12.5px; color: var(--fg-3); overflow-wrap: anywhere; background: none; border: 0; padding: 0; }
.mk-ep-desc { font-size: 13.5px; color: var(--fg-2); }

.mk-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 720px) { .mk-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mk-steps li { counter-increment: step; position: relative; display: grid; gap: 4px; padding: 16px 16px 16px 58px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 14.5px; color: var(--fg-2); }
.mk-steps li::before { content: counter(step); position: absolute; left: 16px; top: 15px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 14px; }
.mk-steps strong { color: var(--fg); }

.mk-panel { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); margin-bottom: 14px; }
.mk-panel-title { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-3); }
.mk-stat-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mk-stat-list li { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 10px; border-radius: 12px; background: var(--bg-2); }
.mk-stat-list .mk-i { grid-row: span 2; color: var(--accent-text); }
.mk-stat-list span { font-size: 12px; color: var(--fg-3); }
.mk-stat-list strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.mk-dates { display: grid; gap: 2px; margin: 12px 0 0; font-size: 13px; color: var(--fg-3); }
.mk-pub-link { display: flex; gap: 12px; align-items: center; color: var(--fg); text-decoration: none; }
.mk-pub-link > span { display: grid; min-width: 0; }
.mk-pub-link strong { display: block; overflow-wrap: anywhere; }
.mk-pub-link:hover strong { text-decoration: underline; }
.mk-pub p { margin: 12px 0 0; color: var(--fg-2); }
.mk-verified-note { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.mk-verified-note .mk-i { color: #1d9bf0; }
.mk-copy.is-done { border-color: var(--accent-line); color: var(--accent-text); }

/* ------------------------------------------------------------------ FAQ */
.mk-faq-item { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-bottom: 10px; }
.mk-faq-item summary { cursor: pointer; padding: 14px 44px 14px 16px; font-weight: 600; list-style: none; position: relative; }
.mk-faq-item summary::-webkit-details-marker { display: none; }
.mk-faq-item summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 20px; font-weight: 400; color: var(--fg-3); transition: transform .15s; }
.mk-faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.mk-faq-item p { margin: 0; padding: 0 16px 16px; color: var(--fg-2); }

/* Toast for the star button. */
.mk-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--fg); color: var(--bg); font-size: 14px; box-shadow: var(--shadow-lg); }

@media (prefers-reduced-motion: reduce) { .mk-card, .mk-card::before { transition: none; } .mk-card:hover { transform: none; } }
/* Tablets: the track record and publisher come before the long content; phones read the API first. */
@media (max-width: 959px) {
  .mk-api-body > .mk-side { order: -1; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 640px) {
  .mk-api-body > .mk-side { order: 0; grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 959px) {
  .mk-api-body > .mk-side .mk-panel { margin-bottom: 0; }
  .mk-api-body > .mk-side .mk-panel:last-child { display: none; }
}

/* Phones: one-line breadcrumbs, a sort switch that fits, a roomier search field. */
@media (max-width: 560px) {
  .crumbs ol { flex-wrap: nowrap; }
  .crumbs li { flex: 0 1 auto; }
  .crumbs li:first-child { flex: none; }
  .crumbs li > a, .crumbs [aria-current] { min-width: 0; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mk-hero-inner { padding: 40px 16px 32px; }
  .mk-search-icon { left: 16px; }
  .mk-search input { padding-left: 36px; }
  .mk-search .btn { padding-left: 14px; padding-right: 14px; }
  .mk-search input { font-size: 15px; padding-right: 4px; }
  .mk-hero-stats { gap: 6px 18px; font-size: 14px; }
  .mk-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .mk-sort { width: 100%; flex-wrap: wrap; overflow-x: visible; }
  .mk-sort a { flex: 1 1 auto; padding: 7px 4px; font-size: 12.5px; text-align: center; }
  .mk-sort-pre { display: none; }
  .mk-sort a { text-transform: capitalize; }
  .mk-card { padding: 16px; }
  .mk-ep-list li { padding: 12px; gap: 10px; }
  .mk-method { min-width: 52px; padding: 3px 5px; font-size: 10.5px; }
  .mk-panel { padding: 16px; }
  .mk-publish-actions .btn { max-width: 100%; white-space: normal; text-align: center; }
}
/* Small phones (320-360 px): the sort switch and search still fit on one line. */
@media (max-width: 360px) {
  .mk-sort a { padding: 7px 2px; font-size: 12px; }
  .mk-search-icon { display: none; }
  .mk-search input { font-size: 14px; padding-left: 10px; }
  .mk-search .btn { padding-left: 11px; padding-right: 11px; }
}
/* One line under the API's actions saying what Fork and Star do. */
.mk-action-help { max-width: 640px; margin: 12px 0 0; color: var(--fg-3); font-size: 13.5px; line-height: 1.55; }
.mk-action-help strong { color: var(--fg-2); font-weight: 600; }
.mk-stat-list li[title] { cursor: help; }


/* ---- logos: the whole mark on a plate (wordmarks are not cropped); light artwork on a dark plate */
/* Fixed padding: a percentage would be taken from the container's width and leave no room for the image. */
img.mk-logo { box-sizing: border-box; object-fit: contain; padding: 5px; background: #fff; }
img.mk-logo-lg { padding: 8px; }
img.mk-logo.mk-logo-dark { background: #1f2328; border-color: #1f2328; }
img.mk-logo-xl { padding: 12px; }
@media (max-width: 640px) { img.mk-logo-xl { padding: 10px; } img.mk-logo-lg { padding: 6px; } }

/* ---- API details / at a glance: facts read from the API's description */
.mk-dl { margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mk-dl-row { display: grid; grid-template-columns: minmax(130px, 200px) minmax(0, 1fr); gap: 4px 18px; padding: 11px 16px; border-top: 1px solid var(--line); }
.mk-dl-row:first-child { border-top: 0; }
.mk-dl dt { color: var(--fg-3); font-size: 13.5px; font-weight: 600; }
.mk-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; line-height: 1.6; font-size: 14.5px; }
.mk-dl code { font-size: 13px; }
.mk-dl .mk-chip { margin: 0 6px 6px 0; }
.mk-dl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mk-dl-chips .mk-method { position: static; }
@media (max-width: 560px) { .mk-dl-row { grid-template-columns: minmax(0, 1fr); } }
.mk-linkbtn { padding: 0; border: 0; background: none; color: var(--accent, #2563eb); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---- Suggest an API */
.mk-suggest-line { margin: 18px 0 0; color: var(--fg-3); font-size: 14.5px; }
.mk-suggest { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 22px 22px 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); color: var(--fg); box-shadow: var(--shadow-lg); }
.mk-suggest::backdrop { background: rgba(10, 12, 16, .55); }
.mk-suggest h2 { margin: 0 0 6px; font-size: 1.25rem; }
.mk-suggest-x { position: absolute; top: 10px; right: 10px; margin: 0; }
.mk-field { display: grid; gap: 5px; margin: 12px 0 0; font-size: 14px; font-weight: 600; }
.mk-field em { font-style: normal; font-weight: 400; color: var(--fg-3); }
.mk-field input, .mk-field select, .mk-field textarea { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font: 400 15px/1.4 inherit; }
.mk-field textarea { resize: vertical; }
.mk-field input:focus, .mk-field select:focus, .mk-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.mk-suggest-err { margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; background: #fdecec; color: #8a1c1c; font-size: 14px; }
.mk-suggest-err a { color: inherit; font-weight: 600; }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) .mk-suggest-err { background: #3a1414; color: #f6b4b4; } }
:where(:root[data-theme="dark"]) .mk-suggest-err { background: #3a1414; color: #f6b4b4; }
.mk-suggest-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
@media (max-width: 560px) { .mk-suggest { padding: 18px 16px; } .mk-suggest-actions .btn { width: 100%; } }

/* Long names, paths and URLs wrap instead of widening the page. */
.mk-ep-main { flex: 1 1 0; }
.mk-ep-name, .mk-ep-desc { overflow-wrap: anywhere; }
.mk-steps { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .mk-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mk-steps li, .mk-steps li > * { min-width: 0; overflow-wrap: anywhere; }
.mk-faq-item summary, .mk-faq-item p, .mk-api-id h1, .mk-api-id .lede, .mk-tagline, .mk-profile-id h1 { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  /* Endpoints: the method badge above the name, everything else full width. */
  .mk-ep-list li { flex-direction: column; gap: 6px; }
  .mk-ep-list .mk-method { align-self: flex-start; }
  .mk-ep-main { flex: none; width: 100%; }
  .mk-steps li { padding: 14px 14px 14px 52px; }
  .mk-steps li::before { left: 12px; top: 13px; }
  .mk-api-id h1 { font-size: clamp(1.6rem, 7vw, 2.1rem); }
  .mk-actions { flex-wrap: wrap; }
}

/* ---- /marketplace/publishers/: every publisher, searchable */
.mk-hero-sm .mk-hero-inner { padding-top: 44px; padding-bottom: 32px; }
.mk-pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.mk-pubs > .mk-pub { display: flex; align-items: stretch; min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: border-color .15s, box-shadow .15s; }
.mk-pubs > .mk-pub:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
.mk-pub-main { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 auto; min-width: 0; padding: 14px 4px 14px 14px; color: inherit; text-decoration: none; }
.mk-pub-text { display: grid; gap: 3px; min-width: 0; }
.mk-pub-text strong { font-size: 15.5px; overflow-wrap: anywhere; }
.mk-pub-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12.5px; color: var(--fg-3); }
.mk-pub-dom { overflow-wrap: anywhere; }
.mk-pub-kind { padding: 1px 7px; border-radius: 999px; background: var(--bg-3); color: var(--fg-2); font-weight: 600; font-size: 11.5px; }
.mk-pub-kind.k-org { background: var(--accent-soft); color: var(--accent-text); }
.mk-pub-kind.k-directory { background: #fff3dc; color: #8a5a00; }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) .mk-pub-kind.k-directory { background: #3a2a08; color: #f8d48a; } }
:where(:root[data-theme="dark"]) .mk-pub-kind.k-directory { background: #3a2a08; color: #f8d48a; }
.mk-pub-tag { font-size: 13.5px; color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mk-pub-side { display: grid; align-content: space-between; justify-items: end; gap: 8px; flex: none; padding: 14px 14px 14px 4px; text-align: right; }
.mk-pub-apis { font-size: 12.5px; color: var(--fg-3); white-space: nowrap; }
.mk-pub-apis strong { display: block; font-size: 1.1rem; color: var(--fg); font-variant-numeric: tabular-nums; }
.mk-hero-stats a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }

/* Nothing in the header may widen a phone screen: the glow stays inside, the crumbs shrink. */
.mk-hero-glow { left: 0; right: 0; }
.crumbs ol { min-width: 0; overflow: hidden; }
.crumbs li { min-width: 0; }
.mk-chip-guided { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); font-weight: 600; }
/* Publisher panel head and the ⋯ menu (claim an unclaimed profile). */
.mk-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mk-panel-head .mk-panel-title { margin-bottom: 0; }
.mk-pub .mk-panel-head { margin-bottom: 12px; }
.mk-pub-link > span { min-width: 0; }
.mk-more { position: relative; flex: none; }
.mk-more-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg-2); cursor: pointer; list-style: none; }
.mk-more-btn::-webkit-details-marker { display: none; }
.mk-more-btn::marker { content: ""; }
.mk-more-btn:hover, .mk-more[open] > .mk-more-btn { border-color: var(--accent-line); color: var(--fg); }
.mk-more-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mk-more-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.mk-more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(280px, calc(100vw - 32px)); padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); text-align: left; }
.mk-more-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; color: var(--fg); font-size: 14px; font-weight: 600; text-decoration: none; }
.mk-more-item:hover, .mk-more-item:focus-visible { background: var(--bg-3); }
.mk-more-item .icon { width: 16px; height: 16px; }
.mk-more-note { margin: 2px 10px 6px !important; font-size: 12.5px; line-height: 1.45; color: var(--fg-3) !important; }
/* Markdown tables in API overviews (common errors, hosts, limits). */
.md-table { margin: 16px 0 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); -webkit-overflow-scrolling: touch; }
.md-table table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.md-table th, .md-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md-table tr:last-child td { border-bottom: 0; }
.md-table th { background: var(--bg-2, var(--bg-3)); color: var(--fg-2); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.md-table td:first-child { white-space: nowrap; font-weight: 600; color: var(--fg); }
.md-table td { color: var(--fg-2); min-width: 120px; }
.md-table code { font-size: 12.5px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .md-table table { font-size: 13.5px; } .md-table th, .md-table td { padding: 8px 10px; min-width: 0; } .md-table td:not(:first-child):not(:last-child) { min-width: 96px; } .md-table td:last-child { min-width: 150px; } }
/* API page: the product's own links (website, documentation, support). */
.mk-plinks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.mk-plinks li { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.mk-plinks .icon { width: 16px; height: 16px; flex: none; color: var(--accent-text); }
.mk-plinks a { display: flex; flex-wrap: wrap; gap: 0 6px; min-width: 0; color: var(--fg); text-decoration: none; }
.mk-plinks a:hover .mk-plink-v { text-decoration: underline; }
.mk-plink-k { color: var(--fg-3); font-size: 13px; }
.mk-plink-v { font-weight: 600; overflow-wrap: anywhere; }
