:root{
  --bg:#f5f5f1;
  --card:#fff;
  --text:#111;
  --muted:#737373;
  --line:#e2e2dc;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,Arial,Helvetica,sans-serif}
.wrap{width:min(1480px,calc(100% - 32px));margin:auto}
.topbar{position:sticky;top:0;z-index:20;background:rgba(245,245,241,.94);backdrop-filter:blur(18px);border-bottom:1px solid var(--line)}
.topbar-inner{min-height:74px;display:grid;grid-template-columns:220px 1fr 180px;gap:22px;align-items:center}
.logo{font-size:27px;font-weight:900;letter-spacing:-1.2px;color:#111;text-decoration:none}
.search input{width:100%;padding:14px 19px;border:1px solid var(--line);background:#fff;border-radius:999px;font-size:15px;outline:none}
.search input:focus{border-color:#999}
.count{text-align:right;color:var(--muted);font-size:13px}
.hero{padding:58px 0 35px}
.hero h1{font-size:clamp(44px,7vw,92px);line-height:.94;letter-spacing:-4px;margin:8px 0 20px}
.hero p{color:var(--muted);font-size:17px;max-width:650px;line-height:1.55}
.kicker{font-size:11px;font-weight:800;letter-spacing:2px;color:var(--muted)}
.toolbar{display:flex;gap:10px;margin:0 0 24px}
.toolbar select,.toolbar button,.pagination button{border:1px solid var(--line);background:#fff;border-radius:999px;padding:11px 16px;cursor:pointer}
.status{color:var(--muted);padding:10px 0 20px}
.grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px}
.card{background:var(--card);border-radius:20px;overflow:hidden;border:1px solid rgba(0,0,0,.035);cursor:pointer;transition:.18s ease}
.card:hover{transform:translateY(-3px);box-shadow:0 16px 38px rgba(0,0,0,.08)}
.pic{aspect-ratio:1/1;background:#ecece8;overflow:hidden;position:relative}
.pic img{width:100%;height:100%;object-fit:cover;display:block;opacity:0;transition:opacity .22s ease}
.pic img.loaded{opacity:1}
.card-body{padding:14px}
.card-title{font-size:14px;line-height:1.45;margin:0 0 10px;min-height:40px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.card-row{display:flex;justify-content:space-between;gap:10px;color:var(--muted);font-size:12px}
.pagination{display:flex;justify-content:center;align-items:center;gap:18px;padding:44px 0 72px}
.pagination button:disabled{opacity:.35;cursor:not-allowed}

.modal.hidden{display:none}
.modal{position:fixed;inset:0;z-index:100;display:grid;place-items:center;padding:18px}
.backdrop{position:absolute;inset:0;background:rgba(0,0,0,.58);backdrop-filter:blur(2px)}
.product-modal{position:relative;z-index:1;background:#fff;border-radius:26px;padding:22px;width:min(1080px,calc(100vw - 36px));height:min(720px,calc(100vh - 36px));overflow:hidden;box-shadow:0 28px 80px rgba(0,0,0,.22)}
.close{position:absolute;right:14px;top:14px;z-index:5;width:42px;height:42px;border:0;border-radius:50%;background:#111;color:#fff;font-size:27px;line-height:1;cursor:pointer}
.product-layout{height:100%;display:grid;grid-template-columns:minmax(0,1.08fr) minmax(320px,.92fr);gap:30px;align-items:center}
.product-layout>div:first-child{min-width:0;display:flex;flex-direction:column;justify-content:center;align-items:stretch;height:100%}
.main-image-box{width:100%;height:min(56vh,520px);min-height:280px;background:#f2f2ee;border-radius:18px;overflow:hidden;display:grid;place-items:center}
.main-image-box img{width:100%;height:100%;object-fit:contain;display:block}
.thumbs{display:flex;gap:8px;overflow-x:auto;overflow-y:hidden;padding:10px 2px 2px;scrollbar-width:thin;flex:0 0 auto}
.thumbs img{width:58px;height:58px;flex:0 0 58px;object-fit:cover;border-radius:9px;border:2px solid transparent;cursor:pointer;background:#f2f2ee}
.thumbs img.active{border-color:#111}
.product-info{min-width:0;padding:24px 46px 24px 4px;display:flex;flex-direction:column;justify-content:center;max-height:100%;overflow:hidden}
.product-info h2{font-size:clamp(22px,2.4vw,32px);line-height:1.18;margin:10px 0 18px;display:-webkit-box;-webkit-line-clamp:6;-webkit-box-orient:vertical;overflow:hidden}
.product-price{font-weight:850;font-size:24px;margin-bottom:12px}
.sizes{font-weight:700;margin:8px 0;line-height:1.45;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
.muted{color:var(--muted);line-height:1.45;margin:8px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.primary{display:inline-flex;align-items:center;justify-content:center;align-self:flex-start;margin-top:20px;background:#111;color:#fff;text-decoration:none;padding:13px 18px;border-radius:999px;min-height:44px}

@media(max-width:1050px){
  .grid{grid-template-columns:repeat(3,1fr)}
  .product-modal{width:min(920px,calc(100vw - 28px));height:min(650px,calc(100vh - 28px));padding:18px}
  .product-layout{grid-template-columns:minmax(0,1fr) minmax(280px,.85fr);gap:22px}
  .main-image-box{height:min(52vh,450px)}
  .product-info{padding:20px 34px 20px 2px}
  .thumbs img{width:52px;height:52px;flex-basis:52px}
}

@media(max-height:760px) and (min-width:761px){
  .product-modal{height:calc(100vh - 22px);padding:16px}
  .main-image-box{height:min(50vh,390px);min-height:220px}
  .product-layout{gap:20px}
  .product-info{padding-top:12px;padding-bottom:12px}
  .product-info h2{font-size:23px;margin:8px 0 12px;-webkit-line-clamp:4}
  .product-price{font-size:21px;margin-bottom:8px}
  .sizes{margin:6px 0;-webkit-line-clamp:3}
  .primary{margin-top:14px}
  .thumbs{padding-top:8px}
  .thumbs img{width:48px;height:48px;flex-basis:48px}
}

@media(max-width:760px){
  .topbar-inner{grid-template-columns:1fr;gap:9px;padding:13px 0}
  .count{text-align:left}
  .grid{grid-template-columns:repeat(2,1fr);gap:10px}
  .hero{padding-top:38px}

  .modal{padding:8px;align-items:center}
  .product-modal{width:calc(100vw - 16px);height:calc(100vh - 16px);border-radius:20px;padding:14px 14px 16px;overflow:hidden}
  .close{right:10px;top:10px;width:40px;height:40px;font-size:25px}
  .product-layout{height:100%;display:grid;grid-template-columns:1fr;grid-template-rows:minmax(0,55%) minmax(0,45%);gap:10px;align-items:stretch}
  .product-layout>div:first-child{height:100%;min-height:0;justify-content:flex-start}
  .main-image-box{height:calc(100% - 58px);min-height:0;border-radius:14px}
  .thumbs{height:58px;padding:7px 0 0;gap:6px}
  .thumbs img{width:50px;height:50px;flex:0 0 50px;border-radius:8px}
  .product-info{height:100%;min-height:0;padding:8px 4px 2px;justify-content:flex-start;overflow:hidden}
  .product-info .kicker{font-size:10px}
  .product-info h2{font-size:20px;line-height:1.18;margin:6px 0 10px;-webkit-line-clamp:4}
  .product-price{font-size:20px;margin-bottom:7px}
  .sizes{font-size:14px;line-height:1.35;margin:5px 0;-webkit-line-clamp:3}
  .muted{font-size:12px;margin:5px 0}
  .primary{width:100%;margin-top:auto;padding:11px 14px;min-height:44px}
}

@media(max-width:420px){
  .product-modal{border-radius:16px;padding:11px 11px 13px}
  .product-layout{grid-template-rows:minmax(0,52%) minmax(0,48%);gap:8px}
  .main-image-box{height:calc(100% - 52px)}
  .thumbs{height:52px;padding-top:6px}
  .thumbs img{width:44px;height:44px;flex-basis:44px}
  .product-info h2{font-size:18px;-webkit-line-clamp:4;margin:5px 0 8px}
  .product-price{font-size:18px}
  .sizes{font-size:13px;-webkit-line-clamp:3}
}

@media(max-height:680px) and (max-width:760px){
  .product-layout{grid-template-rows:minmax(0,49%) minmax(0,51%)}
  .product-info h2{font-size:17px;-webkit-line-clamp:3;margin:4px 0 7px}
  .product-price{font-size:17px;margin-bottom:4px}
  .sizes{font-size:12px;margin:3px 0;-webkit-line-clamp:2}
  .muted{font-size:11px;margin:3px 0}
  .primary{min-height:40px;padding:9px 12px}
}
