/* Bot marketplace: the listing on /bots/ and each /bots/<id>/ page. Uses lp.css tokens only, so
   light and dark follow the rest of the site. Classes are written by scripts/gen-bot-marketplace.mjs,
   behaviour (gallery, lightbox, card hover previews) lives in gallery.js. Output first: every card
   and every page leads with what the bot actually made. */

.lp { --mk-ease: cubic-bezier(.2,.7,.2,1); --mk-stage: color-mix(in oklab, var(--paper-3) 70%, var(--paper)); }

/* ---------- listing grid (also on /bots/) ---------- */
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; margin-top: 28px; }
.mk-card {
  display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: var(--paper-2); border: 1px solid var(--rule); color: var(--ink); text-decoration: none;
  box-shadow: var(--sh-card); transition: transform .3s var(--mk-ease), border-color .2s, box-shadow .3s;
}
.mk-card:hover { transform: translateY(-4px); border-color: var(--rule-2); box-shadow: var(--sh-win, var(--sh-card)); }
.mk-card:active { transform: translateY(-1px) scale(.995); }
.mk-card:focus-visible { outline: 2px solid var(--amber-line); outline-offset: 3px; }
.mk-cbody { display: flex; flex-direction: column; gap: 7px; padding: 18px 20px 18px; flex: 1; }
.mk-card b { font-family: "Newsreader", Georgia, serif; font-weight: 500; font-size: 24px; letter-spacing: -.02em; line-height: 1.15; }
.mk-cat, .mk-by, .mk-kind, .mk-lab { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.mk-tag { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); flex: 1; }
.mk-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--rule); }
.mk-p { font-weight: 600; font-size: 15px; }

/* the thumbnail: the bot's cover output */
.mk-thumb { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--mk-stage); border-bottom: 1px solid var(--rule); isolation: isolate; }
.mk-thumb > img, .mk-thumb > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transition: opacity .45s ease, transform .9s var(--mk-ease); }
.mk-card:hover .mk-thumb > img:first-child { transform: scale(1.025); }
.mk-thumb > .mk-layer { opacity: 0; }
.mk-thumb > .mk-layer.on { opacity: 1; }
.mk-chips { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 2; }
.mk-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px;
  font: 600 11.5px/1 Inter, system-ui, sans-serif; color: #fff; background: rgba(20,17,14,.62);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.mk-chip svg { width: 12px; height: 12px; }
.mk-thumb .mk-bar { position: absolute; left: 12px; right: 12px; top: 10px; display: flex; gap: 4px; z-index: 2; opacity: 0; transition: opacity .2s; }
.mk-thumb .mk-bar i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255,255,255,.45); }
.mk-thumb .mk-bar i.on { background: #fff; }
.mk-card:hover .mk-bar { opacity: 1; }

/* no samples yet: a paper excerpt of a written example */
.mk-thumb.doc { display: flex; align-items: flex-end; justify-content: center; padding: 22px 22px 0;
  background: radial-gradient(120% 90% at 20% 0%, var(--amber-soft), transparent 60%), var(--mk-stage); }
.mk-paper {
  position: relative; display: flex; flex-direction: column; gap: 6px; width: 100%; height: 100%; padding: 16px 18px 0;
  border-radius: 12px 12px 0 0; background: var(--paper); border: 1px solid var(--rule); border-bottom: 0; overflow: hidden;
  box-shadow: 0 10px 30px -18px rgba(20,17,14,.35); transform: translateY(6px); transition: transform .4s var(--mk-ease);
}
.mk-card:hover .mk-paper { transform: translateY(0); }
.mk-paper b { font-family: Inter, system-ui, sans-serif; font-size: 13.5px; font-weight: 600; letter-spacing: 0; line-height: 1.35; }
.mk-lines { font-size: 12px; line-height: 1.55; color: var(--ink-2); white-space: pre-line;
  -webkit-mask-image: linear-gradient(#000 45%, transparent); mask-image: linear-gradient(#000 45%, transparent); }
.mk-av-s { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; z-index: 2; }
.mk-av-l { margin: auto; }

/* ---------- bot page ---------- */
.mk-top { padding-top: 28px; }
.mk-back { display: inline-block; font-size: 14px; margin-bottom: 22px; }
.mk-back::before { content: "\2190\00a0"; }
.mk-hero { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.mk-side { position: sticky; top: 88px; display: grid; gap: 16px; }
.mk-idrow { display: flex; align-items: center; gap: 10px; }
.mk-idrow .kick { margin: 0; }
.mk-av { width: 40px; height: 40px; }
.mk-name { font-size: clamp(34px, 3.4vw, 46px); font-weight: 500; letter-spacing: -.025em; line-height: 1.04; margin: 14px 0 10px; }
.mk-outcome { font-size: 17px; line-height: 1.5; color: var(--ink-2); margin: 0; }
.mk-pub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; font-size: 14.5px; }

/* gallery */
.mk-gal { min-width: 0; }
.mk-stage {
  position: relative; aspect-ratio: 16 / 11; border-radius: 22px; overflow: hidden;
  background: radial-gradient(90% 70% at 50% 0%, color-mix(in oklab, var(--paper) 55%, transparent), transparent 70%), var(--mk-stage);
  border: 1px solid var(--rule); box-shadow: var(--sh-card);
}
.mk-slide { --pad: clamp(14px, 2.4vw, 28px); margin: 0; position: relative; box-sizing: border-box; height: 100%; }
.mk-gal.js .mk-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s .35s; }
.mk-gal.js .mk-slide.on { opacity: 1; visibility: visible; transition: opacity .35s ease; }
.mk-gal:not(.js) .mk-stage { aspect-ratio: auto; }
.mk-gal:not(.js) .mk-slide { aspect-ratio: 16 / 11; }
.mk-zoom { all: unset; position: absolute; inset: var(--pad); cursor: zoom-in; border-radius: 12px; }
.mk-zoom:focus-visible { outline: 2px solid var(--amber-line); outline-offset: 2px; }
.mk-zoom img { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 10px; box-shadow: 0 18px 50px -24px rgba(20,17,14,.55); }
.mk-vid { position: absolute; inset: var(--pad); width: calc(100% - 2 * var(--pad)); height: calc(100% - 2 * var(--pad)); object-fit: contain; border-radius: 12px; background: #0d0b09; }
.mk-zi { position: absolute; right: 10px; bottom: 10px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff; background: rgba(20,17,14,.55); opacity: 0; transition: opacity .2s; }
.mk-zoom:hover .mk-zi, .mk-zoom:focus-visible .mk-zi { opacity: 1; }
.mk-doc { position: absolute; inset: var(--pad); margin: 0 auto; max-width: 640px; box-sizing: border-box; overflow: auto; padding: 22px 24px; border-radius: 14px; background: var(--paper); border: 1px solid var(--rule); box-shadow: 0 18px 50px -30px rgba(20,17,14,.5); }
.mk-doc h3 { font-size: 17px; font-weight: 600; margin: 8px 0 12px; letter-spacing: -.01em; }
.mk-doc pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.mk-nav {
  position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 42px; height: 42px; margin-top: -21px; border-radius: 50%;
  border: 1px solid var(--rule-2); background: color-mix(in oklab, var(--paper) 86%, transparent); color: var(--ink); cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: var(--sh-card); transition: transform .2s var(--mk-ease), opacity .2s;
}
.mk-nav.prev { left: 14px; } .mk-nav.next { right: 14px; }
.mk-nav:hover { transform: scale(1.06); } .mk-nav:active { transform: scale(.94); }
.mk-nav:focus-visible { outline: 2px solid var(--amber-line); outline-offset: 2px; }
.mk-gal:not(.js) .mk-nav, .mk-gal:not(.js) .mk-count { display: none; }
.mk-count { position: absolute; right: 14px; top: 14px; z-index: 3; padding: 5px 10px; border-radius: 99px; font: 600 12px/1 Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; color: #fff; background: rgba(20,17,14,.55); }
.mk-capline { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 14px 4px 0; }
.mk-cap { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); min-height: 1.5em; }
.mk-capline .mk-lab { flex-shrink: 0; }
.mk-thumbs { display: flex; gap: 10px; margin-top: 14px; overflow-x: auto; padding: 3px 3px 6px; scrollbar-width: thin; }
.mk-th {
  all: unset; box-sizing: border-box; position: relative; flex: 0 0 auto; width: 86px; height: 64px; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: var(--mk-stage); border: 1px solid var(--rule); opacity: .72; transition: opacity .2s, transform .2s var(--mk-ease), box-shadow .2s;
}
.mk-th img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; }
.mk-th:hover { opacity: 1; transform: translateY(-2px); }
.mk-th[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.mk-th:focus-visible { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--amber-line); }
.mk-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(20,17,14,.25); }
.mk-th.txt { width: auto; min-width: 86px; padding: 0 14px; display: grid; place-items: center; background: var(--paper); }
.mk-thdoc { font: 600 12px/1.25 Inter, system-ui, sans-serif; color: var(--ink-2); text-align: center; white-space: nowrap; }

/* lightbox */
.mk-lb { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(12,10,8,.92); color: #fff; }
.mk-lb::backdrop { background: rgba(12,10,8,.6); }
.mk-lb[open] { display: grid; grid-template-rows: 1fr auto; animation: mk-fade .2s ease; }
.mk-lb-stage { display: grid; place-items: center; padding: 64px 72px 12px; min-height: 0; }
.mk-lb-stage img, .mk-lb-stage video { max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; border-radius: 8px; }
.mk-lb-foot { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 20px 22px; font-size: 14.5px; color: rgba(255,255,255,.82); text-align: center; }
.mk-lb-foot b { font-variant-numeric: tabular-nums; font-weight: 600; color: #fff; }
.mk-lb button { all: unset; position: absolute; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; cursor: pointer; color: #fff; background: rgba(255,255,255,.12); transition: background .2s, transform .2s var(--mk-ease); }
.mk-lb button:hover { background: rgba(255,255,255,.22); }
.mk-lb button:active { transform: scale(.94); }
.mk-lb button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mk-lb .x { right: 16px; top: 16px; }
.mk-lb .prev { left: 16px; top: 50%; margin-top: -40px; }
.mk-lb .next { right: 16px; top: 50%; margin-top: -40px; }
@keyframes mk-fade { from { opacity: 0; } }

/* buy box */
.mk-buy { padding: 24px; border-radius: 22px; background: var(--paper-2); border: 1px solid var(--rule); box-shadow: var(--sh-card); }
.mk-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mk-price b { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.mk-price span { font-size: 13.5px; color: var(--ink-3); }
.mk-why { font-size: 14px; line-height: 1.55; color: var(--ink-2); margin: 12px 0 18px; }
[data-buy] [hidden] { display: none !important; }
.lp .mk-buy .btn { width: 100%; justify-content: center; background: var(--ink); color: var(--paper); }
.lp .mk-buy .btn:hover { transform: translateY(-1px); }
.lp .mk-buy .btn:active { transform: scale(.98); }
.mk-form { display: flex; flex-direction: column; gap: 10px; }
.mk-form label { font-size: 13.5px; color: var(--ink-2); }
.mk-form input {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--rule-2); background: var(--paper); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.mk-form input:focus { border-color: var(--amber-line); box-shadow: 0 0 0 4px var(--amber-soft); }
.mk-form input#mk-code { letter-spacing: .4em; font-variant-numeric: tabular-nums; text-align: center; }
.mk-busy { opacity: .6; pointer-events: none; }
.mk-err { color: #C2412D; font-size: 13.5px; margin: 10px 0 0; min-height: 0; }
.mk-err:empty { display: none; }
.mk-done b { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: 16px; }
.mk-done ol { margin: 12px 0 14px; padding-left: 20px; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.mk-facts { list-style: none; margin: 20px 0 0; padding: 16px 0 0; border-top: 1px solid var(--rule); display: grid; gap: 10px; }
.mk-facts li, .mk-needs li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.mk-facts svg, .mk-needs svg { flex-shrink: 0; margin-top: 3px; color: var(--ok); }

.mk-sec.wrap { padding: 56px 48px 0; }
.mk-desc { max-width: 760px; }
.mk-note { font-size: 14px; color: var(--ink-3); margin: 6px 0 0; }

/* how it works (collapsed) */
.mk-how { border: 1px solid var(--rule); border-radius: 22px; background: var(--paper-2); box-shadow: var(--sh-card); }
.mk-how summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 26px; cursor: pointer; list-style: none; border-radius: 22px; }
.mk-how summary::-webkit-details-marker { display: none; }
.mk-how summary:focus-visible { outline: 2px solid var(--amber-line); outline-offset: 2px; }
.mk-how summary > span:first-child { display: flex; flex-direction: column; gap: 4px; }
.mk-how summary b { font-family: "Newsreader", Georgia, serif; font-weight: 500; font-size: 24px; letter-spacing: -.015em; }
.mk-how summary > span > span { font-size: 14px; color: var(--ink-3); }
.mk-plus { position: relative; flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--rule-2); transition: transform .3s var(--mk-ease); }
.mk-plus::before, .mk-plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.6px; margin: -.8px 0 0 -6px; background: var(--ink); border-radius: 1px; }
.mk-plus::after { transform: rotate(90deg); transition: transform .3s var(--mk-ease); }
.mk-how[open] .mk-plus::after { transform: rotate(0deg); }
.mk-how-body { padding: 4px 26px 28px; display: grid; gap: 30px; border-top: 1px solid var(--rule); padding-top: 24px; margin: 0 0 0; }
.mk-files ul { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.mk-files li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border-radius: 10px; background: var(--paper); border: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); }
.mk-files code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: var(--ink); }
.mk-ex { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 14px; }
.mk-excard { padding: 20px; border-radius: 18px; background: var(--paper); border: 1px solid var(--rule); min-width: 0; }
.mk-excard h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; margin: 8px 0 12px; }
.mk-excard pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 14px; line-height: 1.6; color: var(--ink-2); max-height: 340px; overflow: auto; }
.mk-needs { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.mk-needs ul, .mk-needs ol { margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.mk-needs ul { list-style: none; }
.mk-needs ol { padding-left: 20px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }

@media (max-width: 960px) {
  .mk-hero { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .mk-side { display: contents; }
  .mk-id { order: -1; }
  .mk-name { margin-top: 10px; }
}
@media (max-width: 860px) {
  .mk-sec.wrap { padding: 44px 16px 0; }
  .mk-needs { grid-template-columns: 1fr; gap: 24px; }
  .mk-ex { grid-template-columns: 1fr; }
  .mk-how summary { padding: 18px 18px; }
  .mk-how-body { padding: 20px 18px 22px; }
  .mk-grid { gap: 16px; }
}
@media (max-width: 560px) {
  .mk-stage { aspect-ratio: 1 / 1; border-radius: 18px; }
  .mk-nav { width: 36px; height: 36px; margin-top: -18px; }
  .mk-nav.prev { left: 8px; } .mk-nav.next { right: 8px; }
  .mk-capline { flex-direction: column; gap: 4px; }
  .mk-th { width: 72px; height: 54px; }
  .mk-lb-stage { padding: 64px 10px 8px; }
  .mk-lb .prev, .mk-lb .next { top: auto; bottom: 14px; margin: 0; }
  .mk-lb-foot { padding: 12px 70px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .mk-card, .mk-thumb > img, .mk-paper, .mk-th, .mk-nav, .mk-gal.js .mk-slide, .mk-plus, .mk-plus::after { transition: none; }
  .mk-card:hover, .mk-th:hover { transform: none; }
  .mk-card:hover .mk-thumb > img:first-child, .mk-card:hover .mk-paper { transform: none; }
  .mk-lb[open] { animation: none; }
}
