html,body{max-width:100%;overflow-x:hidden}
.marketplace-catalog{
  --market-accent:#ff4b1f;
  display:grid;
  grid-template-columns:clamp(142px,17vw,230px) minmax(0,1fr);
  width:100%;
  max-width:100%;
  min-width:0;
  height:min(78vh,920px);
  min-height:620px;
  overflow:hidden;
  border:1px solid #dfe3e8;
  border-radius:24px;
  background:#fff;
  box-shadow:0 18px 48px rgba(8,17,31,.08);
}
.marketplace-major-nav{
  overflow-y:auto;
  overscroll-behavior:contain;
  background:#f4f4f1;
  border-right:1px solid #e2e4e7;
  scrollbar-width:thin;
}
.marketplace-major-nav button{
  position:relative;
  display:grid;
  grid-template-columns:44px minmax(0,1fr);
  align-items:center;
  gap:10px;
  width:100%;
  min-height:78px;
  padding:11px 13px;
  border:0;
  border-bottom:1px solid #e7e7e3;
  background:transparent;
  color:#303641;
  text-align:left;
  cursor:pointer;
}
.marketplace-major-nav button::before{
  content:"";
  position:absolute;
  inset:17px auto 17px 0;
  width:4px;
  border-radius:0 6px 6px 0;
  background:transparent;
}
.marketplace-major-nav button.active{
  background:#fff;
  color:#101828;
}
.marketplace-major-nav button:not(.active){grid-template-columns:1fr}
.marketplace-major-nav button:not(.active)>img,
.marketplace-major-nav button:not(.active) .lens-category-envelope{display:none}
.marketplace-major-nav button.active::before{background:var(--market-accent)}
.marketplace-major-nav img{
  width:44px;
  height:44px;
  padding:3px;
  border-radius:11px;
  background:#fff;
  object-fit:contain;
}
.marketplace-major-nav span{display:grid;gap:3px;min-width:0}
.marketplace-major-nav strong{font-size:13px;line-height:1.2}
.marketplace-major-nav small{
  color:#7c8491;
  font-size:9px;
  font-weight:800;
  letter-spacing:.05em;
  text-transform:uppercase;
}
.marketplace-scroll{
  position:relative;
  min-width:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  scroll-behavior:smooth;
  scrollbar-width:thin;
  background:#fff;
}
.marketplace-search{
  position:sticky;
  top:0;
  z-index:7;
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 18px;
  border-bottom:1px solid #e6e8eb;
  background:rgba(255,255,255,.96);
  backdrop-filter:blur(12px);
}
.marketplace-search input{
  width:100%;
  min-height:44px;
  padding:0 16px;
  border:1px solid #cfd5dd;
  border-radius:999px;
  background:#f8f9fa;
  color:#101828;
  font:inherit;
}
.marketplace-category{
  min-width:0;
  padding:22px 20px 32px;
  scroll-margin-top:72px;
  content-visibility:auto;
  contain-intrinsic-size:800px;
}
.marketplace-category+.marketplace-category{border-top:10px solid #f3f3ef}
.marketplace-category-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:20px;
  margin-bottom:14px;
}
.marketplace-category-head h2,
.marketplace-category-head h3{margin:0 0 5px;font-size:clamp(23px,2.6vw,34px);line-height:1.05;letter-spacing:-.035em}
.marketplace-category-head p{max-width:720px;margin:0;color:#667085;line-height:1.45}
.marketplace-category-count{
  flex:0 0 auto;
  color:#667085;
  font-size:11px;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
}
.marketplace-subnav{
  position:sticky;
  top:73px;
  z-index:6;
  display:flex;
  gap:8px;
  overflow-x:auto;
  margin:0 -20px 17px;
  padding:10px 20px;
  border-block:1px solid #eceeF1;
  background:rgba(255,255,255,.97);
  scrollbar-width:none;
}
.marketplace-subnav::-webkit-scrollbar{display:none}
.marketplace-no-search .marketplace-subnav{top:0}
.marketplace-subnav button{
  flex:0 0 auto;
  min-height:36px;
  padding:8px 13px;
  border:1px solid #d7dce2;
  border-radius:999px;
  background:#fff;
  color:#344054;
  font:inherit;
  font-size:12px;
  font-weight:850;
  cursor:pointer;
}
.marketplace-subnav button.active,
.marketplace-subnav button:hover{
  border-color:var(--market-accent);
  background:#fff4ef;
  color:#d93810;
}
.marketplace-products{
  min-width:0;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.marketplace-product-card{
  display:grid;
  grid-template-columns:142px minmax(0,1fr);
  min-height:160px;
  overflow:hidden;
  border:1px solid #e0e3e8;
  border-radius:18px;
  background:#fff;
  color:#101828;
  text-align:left;
  cursor:pointer;
  box-shadow:0 5px 18px rgba(8,17,31,.035);
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}
.marketplace-product-card:hover,
.marketplace-product-card:focus-visible{
  border-color:#aeb7c4;
  box-shadow:0 12px 30px rgba(8,17,31,.09);
  transform:translateY(-2px);
}
.marketplace-product-image{
  display:grid;
  place-items:center;
  min-width:0;
  padding:9px;
  background:#f6f6f3;
}
.marketplace-product-image img{
  width:100%;
  height:140px;
  border-radius:12px;
  object-fit:contain;
}
.marketplace-product-copy{
  display:flex;
  flex-direction:column;
  min-width:0;
  padding:15px 16px;
}
.marketplace-product-kicker{
  margin:0 0 6px;
  color:#0a7d8c;
  font-size:9px;
  font-weight:900;
  letter-spacing:.09em;
  text-transform:uppercase;
}
.marketplace-product-copy h3{
  margin:0 0 5px;
  font-size:19px;
  line-height:1.12;
  letter-spacing:-.02em;
  overflow-wrap:anywhere;
}
.marketplace-product-copy p{
  display:-webkit-box;
  overflow:hidden;
  margin:0;
  color:#566273;
  font-size:13px;
  line-height:1.38;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}
.marketplace-product-meta{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  margin-top:auto;
  padding-top:12px;
}
.marketplace-price{
  color:#e1461d;
  font-size:17px;
  font-weight:950;
  letter-spacing:-.02em;
}
.marketplace-price small{color:#667085;font-size:10px;font-weight:750}
.marketplace-open{
  flex:0 0 auto;
  color:#101828;
  font-size:11px;
  font-weight:900;
}
.marketplace-subsection{scroll-margin-top:128px}
.marketplace-subsection+.marketplace-subsection{margin-top:28px;padding-top:24px;border-top:1px solid #eaecf0}
.marketplace-empty{grid-column:1/-1;padding:42px 20px;text-align:center;color:#667085}

.marketplace-detail{
  position:fixed;
  inset:0;
  z-index:1200;
  display:none;
  place-items:center;
  padding:24px;
}
.marketplace-detail.active{display:grid}
.marketplace-detail-backdrop{position:absolute;inset:0;border:0;background:rgba(6,13,24,.68)}
.marketplace-detail-card{
  position:relative;
  display:grid;
  grid-template-columns:minmax(260px,430px) minmax(300px,540px);
  gap:28px;
  width:min(100%,1020px);
  max-height:min(88vh,840px);
  overflow:auto;
  padding:30px;
  border-radius:24px;
  background:#fff;
  box-shadow:0 30px 100px rgba(0,0,0,.3);
}
.marketplace-detail-close{
  position:absolute;
  top:12px;
  right:12px;
  z-index:2;
  width:42px;
  height:42px;
  border:0;
  border-radius:50%;
  background:#101828;
  color:#fff;
  font-size:26px;
  line-height:1;
  cursor:pointer;
}
.marketplace-detail-media{display:grid;align-content:start;gap:12px}
.marketplace-detail-media>img{width:100%;max-height:500px;border-radius:18px;background:#f6f6f3;object-fit:contain}
.marketplace-detail-copy{padding:10px 0}
.marketplace-detail-copy h2{margin:6px 0 7px;font-size:clamp(30px,4vw,50px);letter-spacing:-.045em}
.marketplace-detail-copy>p{color:#566273;line-height:1.55}
.marketplace-detail-option,
.marketplace-detail-quantity{display:grid;gap:7px;margin-top:16px;color:#344054;font-size:12px;font-weight:900;text-transform:uppercase;letter-spacing:.05em}
.marketplace-detail-option select,
.marketplace-detail-quantity input{
  width:100%;
  min-height:48px;
  border:1px solid #cdd4de;
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
  color:#101828;
  font:inherit;
  font-weight:750;
  text-transform:none;
  letter-spacing:0;
}
.marketplace-detail-quantity input{max-width:130px}
.marketplace-detail-add{
  width:100%;
  min-height:50px;
  margin-top:16px;
  border:0;
  border-radius:999px;
  background:#101828;
  color:#fff;
  font:inherit;
  font-weight:900;
  cursor:pointer;
}

@media(max-width:1050px){
  .marketplace-products{grid-template-columns:1fr}
}
@media(max-width:720px){
  .marketplace-catalog{
    grid-template-columns:96px minmax(0,1fr);
    height:calc(100dvh - 138px);
    min-height:540px;
    border-radius:16px;
  }
  .marketplace-major-nav button{grid-template-columns:1fr;justify-items:center;gap:5px;min-height:84px;padding:9px 5px;text-align:center}
  .marketplace-major-nav img{width:38px;height:38px}
  .marketplace-major-nav strong{font-size:10px}
  .marketplace-major-nav small{display:none}
  .marketplace-search{top:0;padding:9px}
  .marketplace-search input{min-height:40px;font-size:13px}
  .marketplace-category{padding:17px 10px 24px;scroll-margin-top:60px}
  .marketplace-category+.marketplace-category{border-top-width:7px}
  .marketplace-category-head{align-items:flex-start}
  .marketplace-category-head h2,.marketplace-category-head h3{font-size:22px}
  .marketplace-category-head p,.marketplace-category-count{display:none}
  .marketplace-subnav{top:59px;margin:0 -10px 12px;padding:8px 10px}
  .marketplace-no-search .marketplace-subnav{top:0}
  .marketplace-subnav button{min-height:33px;padding:6px 10px;font-size:10px}
  .marketplace-products{gap:9px}
  .marketplace-product-card{grid-template-columns:106px minmax(0,1fr);min-height:124px;border-radius:14px}
  .marketplace-product-image{padding:7px}
  .marketplace-product-image img{height:108px;border-radius:9px}
  .marketplace-product-copy{padding:11px 10px}
  .marketplace-product-kicker{margin-bottom:4px;font-size:8px}
  .marketplace-product-copy h3{font-size:15px}
  .marketplace-product-copy p{font-size:11px}
  .marketplace-price{font-size:14px}
  .marketplace-open{display:none}
  .marketplace-detail{padding:10px}
  .marketplace-detail-card{display:block;width:100%;max-height:94vh;padding:18px;border-radius:18px}
  .marketplace-detail-media>img{height:250px}
  .marketplace-detail-copy h2{font-size:30px}
  .catalog:has(> .marketplace-catalog)>.section-title{display:none}
}
@media(prefers-reduced-motion:reduce){
  .marketplace-scroll{scroll-behavior:auto}
  .marketplace-product-card{transition:none}
}
.product-card.marketplace-product-card>.marketplace-product-image,
.product-card.marketplace-product-card>.marketplace-product-copy{aspect-ratio:auto}
.product-card.marketplace-product-card>.marketplace-product-copy{place-items:normal;background:#fff}
.product-card.marketplace-product-card .marketplace-product-copy :is(span,p,h3){margin-left:0;margin-right:0}

/* Full-bleed storefront catalogs: the page itself is the catalog surface. */
body:is(.portfolio-devices,.portfolio-tools,.portfolio-lens,.portfolio-frames) main{
  width:100%!important;
  max-width:none!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  background:#fff;
}
body:is(.portfolio-devices,.portfolio-tools,.portfolio-lens,.portfolio-frames) :is(
  #workshop-devices,#categories,#view,.catalog
){
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:#fff!important;
  box-shadow:none!important;
}
body:is(.portfolio-devices,.portfolio-tools,.portfolio-lens,.portfolio-frames) :is(
  #workshop-devices>.section-head,.catalog>.section-title
){display:none!important}
body:is(.portfolio-devices,.portfolio-tools,.portfolio-lens,.portfolio-frames) .marketplace-catalog{
  width:100vw;
  max-width:none;
  height:calc(100dvh - 73px);
  min-height:0;
  margin:0;
  border:0;
  border-radius:0;
  box-shadow:none;
}
@media(max-width:720px){
  body:is(.portfolio-devices,.portfolio-tools,.portfolio-lens,.portfolio-frames) .marketplace-catalog{
    height:calc(100dvh - 68px);
    min-height:0;
    border-radius:0;
  }
}


/* Meituan-inspired dense mobile catalog: persistent category rail and compact product rows. */
@media(max-width:720px){
  body:is(.portfolio-devices,.portfolio-tools,.portfolio-lens,.portfolio-frames) .marketplace-catalog{
    grid-template-columns:86px minmax(0,1fr);
    height:calc(100dvh - 84px);
  }
  .marketplace-major-nav{
    height:100%;
    overflow-y:auto;
    scroll-behavior:smooth;
  }
  .marketplace-major-nav button{
    grid-template-columns:1fr;
    justify-items:center;
    gap:4px;
    min-height:68px;
    padding:7px 4px;
    text-align:center;
  }
  .marketplace-major-nav button::before{inset:12px auto 12px 0}
  .marketplace-major-nav img{
    width:30px;
    height:30px;
    padding:2px;
    border-radius:8px;
  }
  .marketplace-major-nav strong{
    display:-webkit-box;
    overflow:hidden;
    font-size:9px;
    line-height:1.15;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
  }
  .marketplace-category{
    padding:12px 7px 16px;
    scroll-margin-top:45px;
  }
  .marketplace-category+.marketplace-category{border-top-width:5px}
  .marketplace-category-head{margin-bottom:7px}
  .marketplace-category-head h2,.marketplace-category-head h3{
    margin:0;
    font-size:18px;
    line-height:1.08;
  }
  .marketplace-products{gap:6px}
  .marketplace-product-card{
    grid-template-columns:82px minmax(0,1fr);
    width:100%;
    height:112px;
    min-height:0;
    max-height:112px;
    border-radius:10px;
    box-shadow:none;
  }
  .marketplace-product-image{padding:4px}
  .marketplace-product-image img{
    width:100%;
    height:100%;
    max-height:104px;
    border-radius:7px;
  }
  .marketplace-product-copy{
    overflow:hidden;
    padding:7px 8px;
  }
  .marketplace-product-kicker{display:none}
  .marketplace-product-copy h3{
    margin:0 0 3px;
    font-size:13px;
    line-height:1.08;
  }
  .marketplace-product-copy p{
    font-size:10px;
    line-height:1.22;
    -webkit-line-clamp:2;
  }
  .marketplace-product-meta{
    align-items:center;
    gap:5px;
    margin-top:auto;
    padding-top:4px;
  }
  .marketplace-price{
    display:block;
    min-width:0;
    margin:0!important;
    font-size:12px;
    line-height:1.05;
  }
  .marketplace-price small{
    display:block;
    margin-top:2px;
    font-size:8px;
  }
  .marketplace-open{display:none!important}
}
@media(max-width:380px){
  body:is(.portfolio-devices,.portfolio-tools,.portfolio-lens,.portfolio-frames) .marketplace-catalog{
    grid-template-columns:78px minmax(0,1fr);
  }
  .marketplace-product-card{grid-template-columns:76px minmax(0,1fr);height:108px;max-height:108px}
  .marketplace-product-image img{max-height:100px}
  .marketplace-product-copy{padding:6px 7px}
  .marketplace-product-copy h3{font-size:12px}
}


/* Mobile category rail shows one preview only: the first product in the active category. */
@media(max-width:720px){
  .marketplace-major-nav button{
    min-height:52px;
    gap:0;
    padding:7px 4px;
  }
  .marketplace-major-nav img,
  .marketplace-major-nav .lens-category-envelope{display:none}
  .marketplace-major-nav button.active{
    min-height:68px;
    gap:4px;
  }
  .marketplace-major-nav button.active>img{display:block}
  .marketplace-major-nav button.active .lens-category-envelope{display:block}
  .marketplace-major-nav strong{
    font-size:10px;
    line-height:1.18;
  }
}
