/**
 * Avozova Theme - Boxes Layout CSS
 *
 * File: avozova-boxes.css
 *
 * OWNS: the box grid, the space between boxes, the box height, the slot
 * structure, and the look + inner padding of title boxes (where the slot
 * itself is the card).
 *
 * DOES NOT OWN: the look of other components' content (e.g. radio cards).
 * Those components style themselves in their own file.
 *
 * HEIGHT:  change "min-height" of .avozova-box-item in section 2.
 *          The box grows automatically when the content is taller.
 * GAP:     change the gap in section 1 (equal in every direction).
 * PADDING: change "padding" of the title box in section 3.
 *
 * @package AVOZOVA_Theme
 */


/* =========================================================
 * 1. WRAPPER & GRID
 *
 * Two columns. With an odd count the last box stays in its
 * own cell. Works for any count from 1 to 20.
 * column-gap and row-gap are equal, so the space between boxes
 * is the same side by side and one under another.
 * align-items: stretch makes boxes in the same row equal in height.
 * ========================================================= */

.avozova-boxes-wrapper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--avozova-card-gap, var(--avozova-space-3));
    row-gap: var(--avozova-card-gap, var(--avozova-space-3));
    justify-items: stretch;
    align-items: stretch;
    width: var(--avozova-width-1);
    box-sizing: border-box;
    margin: var(--avozova-space-3) 0;
}

/* 1 box: one column, kept at half width so it is not huge */

.avozova-boxes-count-1 {
    grid-template-columns: minmax(0, 1fr);
}

.avozova-boxes-count-1 .avozova-box-item {
    max-width: var(--avozova-width-3);
}


/* =========================================================
 * 2. SLOT (STRUCTURE + SIZE)
 *
 * Every slot fills its grid cell. No padding and no margin here:
 * the slot is only a frame, so content that is its own card
 * (radio card) fills it completely and the only space between
 * boxes is the grid gap.
 *
 * Height is flexible: the box is at least 100px tall and grows
 * with its content.
 * ========================================================= */

.avozova-box-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 100px; /* <-- change the minimum box height here */
    height: auto;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Content that fills the slot (e.g. a radio card face).
   Title boxes are excluded: they are cards themselves (section 3). */

.avozova-box-item:not(:has(.avozova-box-title)) > :last-child {
    flex: 1 1 auto;
    width: 100%;
    box-sizing: border-box;
}


/* =========================================================
 * 3. TITLE BOX (slot is the card)
 *
 * Card look and equal inner padding on all four sides, only for
 * slots that hold a box title.
 * ========================================================= */

.avozova-box-item:has(.avozova-box-title) {
    padding: 12px; /* <-- equal space around the content here */
    background-color: var(--avozova-color-white);
    border: 1px solid var(--avozova-color-border);
    border-radius: var(--avozova-radius-3);
    box-shadow: var(--avozova-shadow-2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: visible;
}

.avozova-box-item:has(.avozova-box-title):hover {
    transform: translateY(-4px);
    box-shadow: var(--avozova-shadow-3);
}


/* =========================================================
 * 4. TITLE BOX INTERNAL ELEMENTS
 * ========================================================= */

.avozova-box-icon {
    font-size: 32px;
    margin-bottom: var(--avozova-space-4);
    color: var(--avozova-color-primary);
}

.avozova-box-title {
    font-size: var(--avozova-font-size-5);
    font-weight: 600;
    color: var(--avozova-color-heading);
    margin: 0 0 var(--avozova-space-2) 0;
}

.avozova-box-title a {
    color: inherit;
    text-decoration: none;
}

.avozova-box-title a:hover,
.avozova-box-title a:focus-visible {
    color: var(--avozova-color-primary);
}

.avozova-box-desc {
    font-size: var(--avozova-font-size-2);
    color: var(--avozova-color-text);
    line-height: 1.6;
    margin: 0;
}


/* =========================================================
 * 5. ACCESSIBILITY
 * ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .avozova-box-item:has(.avozova-box-title) {
        transition: none;
    }

    .avozova-box-item:has(.avozova-box-title):hover {
        transform: none;
    }
}