[SalesForce] How to make modal in LWC, with fixed header and footer and a scrollable content

I am creating a lightning web component called by a quick action (using Aura). I'am trying to make my modal to behave like this:
enter image description here

However I got this:

enter image description here

Both are zoomed 110%. Problem is the header, content and footer oversized the modal like this:

enter image description here

I'am new to CSS and JS, so I need your help to make this right. Thank you so much. Here is my code:

HTML:

<template> 

 
        <div class="modal-container slds-modal__container">
          <header class="modal-header slds-modal__header">
            <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
                <lightning-icon icon-name="utility:close"
                alternative-text="close"
                variant="inverse"
                size="small" ></lightning-icon>
              <span class="slds-assistive-text">Close</span>
            </button>
            <h2 id="modal-heading-01" class="slds-modal__title slds-hyphenate">Convert Lead</h2>            
          </header>
          <div class="modal-body scrollable slds-modal__content slds-p-around--medium" id="modal-content-id-1">
            <p>Sit nulla est ex deserunt exercitation anim occaecat. Nostrud ullamco deserunt aute id consequat veniam incididunt duis in sint irure nisi. Mollit officia cillum Lorem ullamco minim nostrud elit officia tempor esse quis. Cillum sunt ad dolore quis
              aute consequat ipsum magna exercitation reprehenderit magna. Tempor cupidatat consequat elit dolor adipisicing.</p>
            <p>Dolor eiusmod sunt ex incididunt cillum quis nostrud velit duis sit officia. Lorem aliqua enim laboris do dolor eiusmod officia. Mollit incididunt nisi consectetur esse laborum eiusmod pariatur proident. Eiusmod et adipisicing culpa deserunt nostrud
              ad veniam nulla aute est. Labore esse esse cupidatat amet velit id elit consequat minim ullamco mollit enim excepteur ea.</p>
          </div>
          <footer class="slds-modal__footer">
            <button class="slds-button slds-button_neutral">Cancel</button>
            <button class="slds-button slds-button_brand">Convert</button>
          </footer>
        </div>
    
   
</template>

CSS:

div {
    display: block;
}

.slds-modal__footer{
    flex-shrink: 0;
}

.modal-container {
    width: 90%;
    max-width: 1024px;
    min-width: 640px;
}

.slds-modal__container{
    padding: 0;
}

Best Answer

It looks like your min-width and width are fighting the size of your browser. I would move your .modal-container styles into a media query, like this:

@media (min-width: 48em)
.modal-container {
    width: 90%;
    max-width: 1024px;
    min-width: 640px;
}

This way when your browser window drops below 48em (pretty standard breakpoint), it'll use the standard styles from .slds-modal__container. By default, it doesn't have a width, min-width, or max-width applied. Which is probably what you want on a small device.

If you wish to refine your mobile styles on this modal, you could add styles to .modal-container outside of the media query.