/**
 * Home grid builder — front office styles.
 * Responsive grid of clickable images: 3 columns -> 2 -> 1.
 */

.adhomegrid {
    --adhomegrid-accent: #E8720C;
    --adhomegrid-gap: 14px;
    --adhomegrid-tile-height: 260px;
    box-sizing: border-box;
    width: 100%;
    padding: 32px;
}

.adhomegrid *,
.adhomegrid *::before,
.adhomegrid *::after {
    box-sizing: border-box;
}

/* ===== Heading ===== */
.adhomegrid-heading {
    margin-bottom: 20px;
}

.adhomegrid-heading h2 {
    display: inline-block;
    margin: 0;
    padding-bottom: 8px;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.2;
    color: #1F2937;
    border-bottom: 4px solid var(--adhomegrid-accent);
}

/* ===== Grid ===== */
.adhomegrid-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: var(--adhomegrid-tile-height);
    grid-auto-flow: row dense;
    gap: var(--adhomegrid-gap);
}

/* ===== Tile ===== */
.adhomegrid-tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px;
    border-radius: 2px;
    text-decoration: none;
    background: #f3f4f6;
    transition: filter .18s ease, transform .18s ease;
}

a.adhomegrid-tile:hover {
    filter: brightness(1.05);
    transform: translateY(-2px);
}

a.adhomegrid-tile:focus-visible {
    outline: 3px solid #111827;
    outline-offset: 2px;
}

/* Featured tile spans two rows, like the main card on the mockup. */
.adhomegrid-tile--large {
    grid-row: span 2;
}

/* Image shown at its natural size, centered, never cropped.
   It only scales down if larger than the tile. */
.adhomegrid-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

/* Small badge signaling an external link. */
.adhomegrid-external {
    position: absolute;
    top: 12px;
    right: 14px;
    padding: 3px 8px;
    font-size: 11px;
    letter-spacing: .4px;
    color: #fff;
    background: rgba(0, 0, 0, .45);
    border-radius: 20px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .adhomegrid {
        padding: 24px 16px;
    }
    .adhomegrid-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /* On narrow layouts the featured tile behaves like the others. */
    .adhomegrid-tile--large {
        grid-row: auto;
    }
}

@media (max-width: 600px) {
    .adhomegrid-grid {
        grid-template-columns: 1fr;
    }
    .adhomegrid-heading h2 {
        font-size: 26px;
    }
}
