/* Marketplace + creator profile - web mirror of the in-app Library.
   Reuses the Rad tokens from site.css. Load AFTER site.css. */

/* ---- Marketplace-only nav: full-bleed to match the feed, with a section label ---- */
.nav-mk .wrap.row { max-width: 1760px; padding-left: clamp(20px, 3.5vw, 44px); padding-right: clamp(20px, 3.5vw, 44px); }
.nav-left { display: flex; align-items: center; min-width: 0; }
.nav-mk-tag { font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em; color: var(--muted); text-decoration: none; margin-left: 14px; padding-left: 14px; border-left: 1px solid var(--line-2); transition: color .12s; }
.nav-mk-tag:hover { color: var(--ink); }
/* breadcrumb trail: Marketplace › current, chevron-separated (populated by JS) */
.nav-mk-crumb { display: inline-flex; align-items: center; min-width: 0; }
.nav-mk-crumb .sep { display: inline-flex; color: var(--dim); margin: 0 9px; flex: 0 0 auto; }
.nav-mk-crumb .sep svg { width: 13px; height: 13px; }
.nav-mk-crumb .cur { font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
@media (max-width: 620px) { .nav-mk-tag, .nav-mk-crumb { display: none; } }

/* ---- Full-bleed shell: the feed uses the whole viewport, not the 1120 marketing column ---- */
.mk-wrap { max-width: 1760px; margin: 0 auto; padding: 0 clamp(20px, 3.5vw, 44px); }

/* compact header bar (replaces the big centered hero) - content, not marketing */
.mk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 24px; flex-wrap: wrap; padding: 30px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.mk-head .eyebrow { margin: 0; }
.mk-title { font-size: clamp(21px, 2.6vw, 28px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 7px 0 0; }
.mk-title span { color: var(--muted); font-weight: 500; }
.mk-head-cta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); text-decoration: none; white-space: nowrap; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 13px; transition: color .12s, border-color .12s; }
.mk-head-cta:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ---- Layout: left facet nav (drawer on mobile) + card grid ---- */
.mk2 { display: flex; gap: 30px; align-items: flex-start; margin-top: 0; }
.mk-drawer { width: 210px; flex: 0 0 210px; position: sticky; top: 84px; align-self: flex-start; }
.mk-drawer-head, .mk-drawer-foot { display: none; }
.mk2-nav { width: 100%; }
.mk2-main { flex: 1; min-width: 0; }

/* filter button (mobile only) - opens the drawer, shows an active-filter badge */
.mk-filter-btn { position: relative; display: none; flex: 0 0 auto; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; color: var(--muted); cursor: pointer; }
.mk-filter-btn:hover { color: var(--ink); }
.mk-filter-btn.on { border-color: var(--accent); color: var(--ink); }
.mk-filter-btn svg { width: 16px; height: 16px; }
.mk-filter-badge { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 10.5px; font-weight: 500; line-height: 17px; text-align: center; }
.mk-backdrop { display: none; }

/* search bar: the primary control - bigger and sticky flush under the nav.
   The nav (solid, z-index 50) covers the strip above it, so no extra mask is needed. */
.mk2-searchbar { position: sticky; top: 63px; z-index: 5; background: var(--bg); padding: 14px 0 14px; margin-bottom: 4px; display: flex; align-items: center; gap: 14px; }
.mk2-search {
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px;
  padding: 9px 13px; transition: border-color .12s;
}
.mk2-search:focus-within { border-color: var(--accent); }
.mk2-search svg { width: 15px; height: 15px; color: var(--dim); flex: 0 0 15px; }
.mk2-search input {
  flex: 1; background: none; border: 0; outline: 0; color: var(--ink);
  font: inherit; font-size: 13.5px;
}
.mk2-search input::placeholder { color: var(--dim); }
.mk2-count { font-family: var(--mono); font-size: 12px; color: var(--dim); white-space: nowrap; flex: 0 0 auto; }

/* facet groups */
.facet-h { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 0 4px 8px; display: flex; align-items: center; justify-content: space-between; }
.facet-h .clear { cursor: pointer; color: var(--dim); }
.facet-h .clear:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.facet-div { height: 1px; background: var(--line); margin: 18px 0 16px; }

.facet {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 1px solid transparent; border-radius: 9px; padding: 8px 11px;
  background: none; color: var(--muted); font: inherit; font-size: 13px;
  cursor: pointer; text-align: left; transition: background .12s, color .12s, border-color .12s;
}
.facet:hover { background: var(--surface); color: var(--ink); }
.facet.on { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.facet svg.ic { width: 15px; height: 15px; flex: 0 0 15px; }
.facet .n { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.facet[disabled] { opacity: .4; cursor: default; }
.facet-list { display: flex; flex-direction: column; gap: 2px; }

/* tag checkbox */
.facet .box {
  width: 15px; height: 15px; flex: 0 0 15px; border-radius: 4px; border: 1px solid var(--line-2);
  display: grid; place-items: center; transition: background .12s, border-color .12s;
}
.facet.on .box { background: var(--accent); border-color: var(--accent); }
.facet .box svg { width: 10px; height: 10px; color: #fff; display: none; }
.facet.on .box svg { display: block; }
.facet.tag { color: var(--muted); }
.facet.tag.on { background: none; border-color: transparent; box-shadow: none; color: var(--ink); }
.facet.tag.on:hover { background: var(--surface); }
.facet .tname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-more { cursor: pointer; color: var(--dim); font-family: var(--mono); font-size: 11px; padding: 6px 11px; background: none; border: 0; text-align: left; }
.facet-more:hover { color: var(--ink); }

/* ---- Card grid: fills the full width, more columns on wide screens ---- */
/* Inline type education: a slim explainer that appears above the grid when one
   type is selected. Card-flat surface so it reads as a note, not another card. */
.mk2-typehint { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 12px 14px; margin: 2px 0 16px; }
.mk2-typehint svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 2px; color: var(--muted); }
.mk2-typehint p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.mk2-typehint strong { color: var(--ink); font-weight: 600; }
.mk2-typehint .dot { color: var(--dim); }
.mk2-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; padding-bottom: 20px; }
/* On wide screens cap at 4 columns instead of letting a 5th pack in */
@media (min-width: 1160px) { .mk2-grid { grid-template-columns: repeat(4, 1fr); } }
.card2 {
  position: relative;
  display: flex; flex-direction: column; gap: 11px; border: 1px solid var(--line);
  border-radius: 13px; background: var(--surface); padding: 15px; text-decoration: none;
  color: inherit; transition: border-color .12s;
}
.card2:hover { border-color: var(--line-2); }
/* full-cover link (stretched-link): the transparent cover sits above the
   non-interactive content so clicking anywhere opens the resource; only the
   byline is lifted above the cover so it stays an independent link. */
.card2-cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card2-foot .by { position: relative; z-index: 2; }
.card2-top { display: flex; gap: 12px; }
/* 3D-lift tile - mirrors the in-app GradientTile (neutral gradient + bevel + lifted glyph) */
.tile, .prof2-av, .prof-av {
  background: linear-gradient(160deg, #3B3F47 0%, #22252B 100%);
  box-shadow: inset 0 1.5px 1px rgba(255, 255, 255, .14), inset 0 -5px 8px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .28);
  color: #fff; text-shadow: 0 1px 1.5px rgba(0, 0, 0, .35); border: 0;
}
.tile {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center; font-weight: 700; font-size: 17px;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tglyph { width: 23px; height: 23px; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .35)); }
.rd-head2 .tile .tglyph { width: 29px; height: 29px; }
/* type as an eyebrow above the title (no more inline badge squishing the name) */
.card2-kind { font-family: var(--mono); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; color: var(--dim); margin: 0 0 5px; }
.card2 h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
/* official -> verified check with a real hover tooltip, flowing after the title.
   z-index:2 lifts it above the card's stretched-link cover so :hover reaches it. */
.card2 h3 .verified, .rd h1 .verified { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; color: var(--accent); cursor: help; vertical-align: middle; margin-left: 6px; position: relative; top: -1px; z-index: 2; flex: 0 0 auto; }
.card2 h3 .verified svg, .rd h1 .verified svg { width: 15px; height: 15px; }
.verified[data-tip]::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-family: var(--sans); font-weight: 500; font-size: 11.5px; letter-spacing: 0; text-transform: none; line-height: 1; white-space: nowrap; padding: 6px 9px; border-radius: 7px; box-shadow: 0 6px 16px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 20; }
.verified[data-tip]::before { content: ""; position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 20; }
.verified[data-tip]:hover::after, .verified[data-tip]:hover::before { opacity: 1; }

/* creator avatar chip in the card byline (mirrors the in-app author avatar) */
.card2-foot .by { display: inline-flex; align-items: center; gap: 6px; }
.by-av { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; flex: 0 0 auto; border-radius: 5px; overflow: hidden; background: linear-gradient(160deg, #3B3F47, #22252B); color: #fff; font-family: var(--display); font-weight: 700; font-size: 9px; box-shadow: inset 0 1px 0 rgba(255,255,255,.14); }
.by-av img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* detail page preview cover — ONLY a genuine visual asset (a real screenshot /
   rendered preview), never the icon. Renders solely when preview_url is present. */
.rd-preview { width: 100%; margin: 22px 0 4px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--recess); box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.rd-preview img { width: 100%; height: auto; max-height: 460px; object-fit: cover; display: block; }
.rd-preview-live { position: relative; height: 420px; overflow: hidden; border-radius: 12px; background: #fff; }
.rd-preview-live iframe { border: 0; pointer-events: none; display: block; }
.rd-preview-open { position: absolute; right: 10px; bottom: 10px; font-size: 11px; padding: 4px 10px; border-radius: 8px; background: rgba(0,0,0,.65); color: #fff; text-decoration: none; }
.card2 .sum { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card2-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.ctag { border: 1px solid var(--line); color: var(--dim); border-radius: 999px; padding: 2px 9px; font-size: 10.5px; }
.card2-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 11px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.card2-foot .by { color: var(--dim); text-decoration: none; }
.card2-foot .by b { color: var(--muted); font-weight: 500; }
.card2-foot .by:hover b { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.card2-foot .rt { margin-left: auto; white-space: nowrap; }
.card2-foot .inst { color: var(--muted); }

.mk2-empty { color: var(--dim); font-size: 14px; padding: 60px 0; text-align: center; }

/* ---- Creator profile ---- */
.prof2 { max-width: 900px; margin-top: 44px; }
.prof2-back { display: inline-block; margin-bottom: 22px; color: var(--dim); font-size: 13px; text-decoration: none; }
.prof2-back:hover { color: var(--ink); }
.prof2-head { display: flex; align-items: flex-start; gap: 18px; }
.prof2-av { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 17px; overflow: hidden; display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.prof2-av img { width: 100%; height: 100%; object-fit: cover; }
.prof2-head h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.prof2-id { font-family: var(--mono); font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.prof2-bio { margin-top: 10px; color: var(--muted); font-size: 14px; max-width: 560px; line-height: 1.6; }
.prof2-links { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 12px; }
.prof2-links a { color: var(--dim); font-family: var(--mono); font-size: 12px; text-decoration: none; display: inline-flex; align-items: center; }
.prof2-links a:hover { color: var(--ink); }
.prof2-links a.soc svg { width: 15px; height: 15px; }
.prof2-stats { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: 12px; }
.prof2-reslabel { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin: 34px 0 14px; }

/* ---- Resource detail additions ---- */
.rd-head2 { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.rd-head2 .tile { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 13px; font-size: 22px; }
/* the eyebrow carried a 26px top margin from the old standalone layout - reset it so the
   SKILL/PACKAGE label + title block sits centered against the icon */
.rd-head2 .rd-tag { margin: 0; }
.rd-more { margin-top: 18px; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.rd-more a { color: var(--muted); }
.rd-more a:hover { color: var(--ink); }

@media (max-width: 860px) {
  .mk2 { flex-direction: column; gap: 0; }
  .mk2-main { order: 1; width: 100%; }
  .mk-filter-btn { display: inline-flex; }

  /* off-canvas filter drawer - full viewport height, header/footer pinned, list scrolls */
  .mk-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh;
    width: min(330px, 87vw); flex: none;
    z-index: 80; background: var(--bg); border-right: 1px solid var(--line);
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.2, 0, 0, 1);
    display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 0 60px rgba(0, 0, 0, .5);
  }
  body.mk-drawer-open { overflow: hidden; }
  body.mk-drawer-open .mk-drawer { transform: none; }
  body.mk-drawer-open .mk-backdrop { display: block; position: fixed; inset: 0; z-index: 75; background: rgba(0, 0, 0, .55); }
  .mk-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; font-weight: 600; font-size: 16px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
  .mk-drawer-x { background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
  .mk-drawer-x:hover { color: var(--ink); }
  .mk-drawer .mk2-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 16px 8px; }
  .mk-drawer-foot { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); flex: 0 0 auto; }
  .mk-drawer-clear { flex: 0 0 auto; background: none; border: 1px solid var(--line-2); border-radius: 10px; color: var(--muted); font: inherit; font-size: 13px; padding: 10px 14px; cursor: pointer; }
  .mk-drawer-clear:hover { color: var(--ink); }
  .mk-drawer-foot #mkApply { flex: 1; }
  .facet-list { flex-direction: column; }
  .facet { width: 100%; }
}
