/*
 * Kcorp Prime: Bootstrap 5 compatible grid subset.
 *
 * The theme declares the built-in "bootstrap5" grid framework, so the Layouts block
 * and the preset layouts emit .container / .row / .col-md-N / .offset-md-N (and the
 * d-* device classes for "hide on device"). This file implements exactly those with
 * CSS grid, so Bootstrap's own stylesheet is not needed.
 */

.container {
    width: 100%;
    max-width: calc(var(--kp-container) + 2 * var(--kp-gutter));
    margin-inline: auto;
    padding-inline: var(--kp-gutter);
}

/* A Layouts block inside an already padded region must not pad twice. */
.region__inner .container,
.container .container {
    max-width: none;
    padding-inline: 0;
}

/* Below 768px every column stacks. */
.row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--kp-gap);
    margin-bottom: var(--kp-gap);
}

.row:last-child {
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .row {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    /* Custom properties inherit: reset the offset per column (zero specificity, so
       the .offset-md-N classes below still win) or nested rows would inherit it. */
    :where(.row > [class*="col-md-"]) {
        --kp-offset: 0;
    }

    /* start = offset + 1, then span: columns wrap onto new rows automatically */
    .row > [class*="col-md-"] {
        grid-column: calc(var(--kp-offset) + 1) / span var(--kp-span);
    }

    .col-md-1 { --kp-span: 1; }
    .col-md-2 { --kp-span: 2; }
    .col-md-3 { --kp-span: 3; }
    .col-md-4 { --kp-span: 4; }
    .col-md-5 { --kp-span: 5; }
    .col-md-6 { --kp-span: 6; }
    .col-md-7 { --kp-span: 7; }
    .col-md-8 { --kp-span: 8; }
    .col-md-9 { --kp-span: 9; }
    .col-md-10 { --kp-span: 10; }
    .col-md-11 { --kp-span: 11; }
    .col-md-12 { --kp-span: 12; }

    .offset-md-1 { --kp-offset: 1; }
    .offset-md-2 { --kp-offset: 2; }
    .offset-md-3 { --kp-offset: 3; }
    .offset-md-4 { --kp-offset: 4; }
    .offset-md-5 { --kp-offset: 5; }
    .offset-md-6 { --kp-offset: 6; }
    .offset-md-7 { --kp-offset: 7; }
    .offset-md-8 { --kp-offset: 8; }
    .offset-md-9 { --kp-offset: 9; }
    .offset-md-10 { --kp-offset: 10; }
    .offset-md-11 { --kp-offset: 11; }
}

/*
 * Device visibility (Design > "Hide on device" and Bootstrap markup in core views).
 * Breakpoints: sm 576, md 768, lg 992, xl 1200. Ascending order is required.
 */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }

@media (min-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
}

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
}

@media (min-width: 1200px) {
    .d-xl-none { display: none !important; }
    .d-xl-block,
    /* core 9.5.7 ships the class ".d-xl-block" with a stray dot in its "hide on large" markup */
    .\.d-xl-block { display: block !important; }
}
