/*
 * Layout formations
 */

/* ============================================================
   BASE
   ============================================================ */
.bht-layout {
    margin: 2rem auto;
    transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.bht-layout--w-content {
    max-width: var(--content-width, 768px);
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.bht-layout--w-wide {
    max-width: var(--wide-width, 1200px);
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.bht-layout--w-full {
    max-width: 100%;
}

.bht-layout__grid {
    display: grid;
}

.bht-layout-slot {
    min-width: 0;
}

/* ============================================================
   FORMATIONS
   ============================================================ */
.bht-layout--2 .bht-layout__grid {
    grid-template-columns: 1fr 1fr;
}

.bht-layout--2-60-40 .bht-layout__grid {
    grid-template-columns: 3fr 2fr;
}

.bht-layout--2-40-60 .bht-layout__grid {
    grid-template-columns: 2fr 3fr;
}

.bht-layout--3 .bht-layout__grid {
    grid-template-columns: 1fr 1fr 1fr;
}

.bht-layout--4 .bht-layout__grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* ============================================================
   GAP
   ============================================================ */
.bht-layout--gap-none .bht-layout__grid { gap: 0; }
.bht-layout--gap-sm   .bht-layout__grid { gap: .5rem; }
.bht-layout--gap-md   .bht-layout__grid { gap: 1rem; }
.bht-layout--gap-lg   .bht-layout__grid { gap: 1.5rem; }
.bht-layout--gap-xl   .bht-layout__grid { gap: 2.5rem; }

/* ============================================================
   ALIGN
   ============================================================ */
.bht-layout--align-stretch .bht-layout__grid { align-items: stretch; }
.bht-layout--align-start   .bht-layout__grid { align-items: start; }
.bht-layout--align-center  .bht-layout__grid { align-items: center; }
.bht-layout--align-end     .bht-layout__grid { align-items: end; }

/* ============================================================
   BACKGROUND
   ============================================================ */
.bht-layout--bg-transparent     { background: transparent; }
.bht-layout--bg-surface         { background: var(--bg-surface); }
.bht-layout--bg-surface-alt     { background: var(--bg-surface-alt); }
.bht-layout--bg-primary-soft    { background: var(--primary-soft); }
.bht-layout--bg-accent-soft     { background: var(--accent-soft); }
.bht-layout--bg-bio-accent-soft { background: var(--bio-accent-soft); }

/* ============================================================
   BORDER / RADIUS / SHADOW / PADDING
   ============================================================ */
.bht-layout--border {
    border: 1px solid var(--border);
}

.bht-layout--r-none { border-radius: 0; }
.bht-layout--r-sm   { border-radius: var(--r-sm, 6px); }
.bht-layout--r-md   { border-radius: var(--r-md, 10px); }
.bht-layout--r-lg   { border-radius: var(--r-lg, 16px); }
.bht-layout--r-xl   { border-radius: var(--r-xl, 24px); }

.bht-layout--p-none .bht-layout__grid { padding: 0; }
.bht-layout--p-sm   .bht-layout__grid { padding: .75rem; }
.bht-layout--p-md   .bht-layout__grid { padding: 1.5rem; }
.bht-layout--p-lg   .bht-layout__grid { padding: 2rem; }
.bht-layout--p-xl   .bht-layout__grid { padding: 3rem; }

.bht-layout--shadow-sm { box-shadow: var(--shadow-sm); }
.bht-layout--shadow-md { box-shadow: var(--shadow-md); }
.bht-layout--shadow-lg { box-shadow: var(--shadow-lg); }

/* ============================================================
   SLOT CONTENT RESET
   ============================================================ */
.bht-layout-slot > *:first-child { margin-top: 0; }
.bht-layout-slot > *:last-child  { margin-bottom: 0; }

.bht-layout-slot .bht-info-box,
.bht-layout-slot .bht-pros-cons,
.bht-layout-slot .bht-score-box,
.bht-layout-slot .bht-cta,
.bht-layout-slot .bht-image,
.bht-layout-slot .bht-layout {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 768px) {
    .bht-layout--w-content,
    .bht-layout--w-wide {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .bht-layout--2 .bht-layout__grid,
    .bht-layout--2-60-40 .bht-layout__grid,
    .bht-layout--2-40-60 .bht-layout__grid,
    .bht-layout--3 .bht-layout__grid,
    .bht-layout--4 .bht-layout__grid {
        grid-template-columns: 1fr;
    }

    .bht-layout--p-lg .bht-layout__grid { padding: 1.25rem; }
    .bht-layout--p-xl .bht-layout__grid { padding: 1.5rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .bht-layout--4 .bht-layout__grid {
        grid-template-columns: 1fr 1fr;
    }

    .bht-layout--3 .bht-layout__grid {
        grid-template-columns: 1fr 1fr;
    }

    .bht-layout--3 .bht-layout__grid > *:last-child:nth-child(3) {
        grid-column: 1 / -1;
    }
}