/* ============================================
   GRID & LAYOUT — Bootstrap 5 compatibility layer
   Recreates the .container responsive widths and
   .container-fluid that the site's CSS was designed against.
   Must load AFTER page-level CSS so it takes precedence
   over any local .container overrides (e.g. home.css).
   ============================================ */

/* ---- Container base ---- */
.container,
.container-fluid {
    width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    margin-right: auto;
    margin-left: auto;
    box-sizing: border-box;
}

/* ---- Responsive container max-widths (matches Bootstrap 5) ---- */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ---- Row / column grid (Bootstrap 5 flex grid) ---- */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

[class^="col-"],
[class*=" col-"] {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    box-sizing: border-box;
    flex-shrink: 0;
    width: 100%;
}

/* xs — always 12 columns wide unless overridden */
.col-12 { width: 100%; }
.col-6  { width: 50%; }
.col-4  { width: 33.33333333%; }
.col-3  { width: 25%; }

/* sm ≥ 576px */
@media (min-width: 576px) {
    .col-sm-12 { width: 100%; }
    .col-sm-6  { width: 50%; }
    .col-sm-4  { width: 33.33333333%; }
    .col-sm-3  { width: 25%; }
}

/* md ≥ 768px */
@media (min-width: 768px) {
    .col-md-12 { width: 100%; }
    .col-md-6  { width: 50%; }
    .col-md-4  { width: 33.33333333%; }
    .col-md-3  { width: 25%; }
}

/* lg ≥ 992px */
@media (min-width: 992px) {
    .col-lg-12 { width: 100%; }
    .col-lg-6  { width: 50%; }
    .col-lg-4  { width: 33.33333333%; }
    .col-lg-3  { width: 25%; }
}

/* xl ≥ 1200px */
@media (min-width: 1200px) {
    .col-xl-12 { width: 100%; }
    .col-xl-6  { width: 50%; }
    .col-xl-4  { width: 33.33333333%; }
    .col-xl-3  { width: 25%; }
}

/* ---- Flex utilities ---- */
.d-flex         { display: flex !important; }
.d-block        { display: block !important; }
.d-none         { display: none !important; }
.d-grid         { display: grid !important; }

.flex-column    { flex-direction: column !important; }
.flex-row       { flex-direction: row !important; }
.flex-wrap      { flex-wrap: wrap !important; }

.justify-content-start   { justify-content: flex-start !important; }
.justify-content-end     { justify-content: flex-end !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }

.align-items-start   { align-items: flex-start !important; }
.align-items-end     { align-items: flex-end !important; }
.align-items-center  { align-items: center !important; }

/* ---- Spacing utilities (Bootstrap numeric scale) ---- */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

.g-1 { gap: 0.25rem !important; }
.g-2 { gap: 0.5rem !important; }
.g-3 { gap: 1rem !important; }
.g-4 { gap: 1.5rem !important; }
.g-5 { gap: 3rem !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

.ms-0 { margin-left: 0 !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }
.ms-auto { margin-left: auto !important; }

.me-0 { margin-right: 0 !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.me-auto { margin-right: auto !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 3rem !important; }

.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

.px-1 { padding-right: 0.25rem !important; padding-left: 0.25rem !important; }
.px-2 { padding-right: 0.5rem !important; padding-left: 0.5rem !important; }
.px-3 { padding-right: 1rem !important; padding-left: 1rem !important; }
.px-4 { padding-right: 1.5rem !important; padding-left: 1.5rem !important; }

/* ---- Responsive display utilities ---- */
@media (max-width: 575.98px) {
    .d-sm-none  { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex  { display: flex !important; }
}

@media (min-width: 768px) {
    .d-md-none  { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex  { display: flex !important; }
}

@media (min-width: 992px) {
    .d-lg-none  { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex  { display: flex !important; }
}
