/* mod_threejs_mbs — grid.css — Three.js Grid builder element (ported from TDM) */

.mbs-grid-wrap {
    width: 100%;
    overflow: visible;
}

/* let items translate from the centre without being clipped */
.mbs-grid-cells {
    overflow: visible !important;
}

.mbs-grid-card-img {
    width: 100%;
    overflow: hidden;
    line-height: 0;
}
.mbs-grid-card-img img,
.mbs-grid-card-img video,
.mbs-grid-card-img iframe {
    display: block;
    width: 100%;
}
.mbs-grid-card-img img {
    height: auto;
    object-fit: cover;
}
.uk-text-center .mbs-grid-card-img img { margin-left: auto; margin-right: auto; }
.uk-text-right  .mbs-grid-card-img img { margin-left: auto; }

/* Panel link overlay — invisible full-card click target */
.mbs-grid-linked { position: relative; }
.mbs-grid-card-link-overlay { position: absolute; inset: 0; z-index: 1; }
.mbs-grid-linked .uk-card-title a,
.mbs-grid-linked .mbs-grid-card-img a { position: relative; z-index: 2; }

/* Center columns — last row aligns to centre when incomplete */
.mbs-grid-centered .mbs-grid-cells { justify-content: center; }

/* Match height — all cards in a row stretch to the same height */
.mbs-grid-cells.mbs-grid-match > .mbs-grid-item { display: flex; }
.mbs-grid-cells.mbs-grid-match .mbs-grid-card {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.mbs-grid-cells.mbs-grid-match .mbs-grid-card-content { flex: 1; min-height: 0; }

.mbs-grid-card-content {
    line-height: 1.45;
}

/* Row Gap — overrides the UIkit row margin independently of the column gap */
.mbs-grid-cells.mbs-rowgap-collapse > .uk-grid-margin { margin-top: 0 !important; }
.mbs-grid-cells.mbs-rowgap-small    > .uk-grid-margin { margin-top: 15px !important; }
.mbs-grid-cells.mbs-rowgap-medium   > .uk-grid-margin { margin-top: 30px !important; }
.mbs-grid-cells.mbs-rowgap-large    > .uk-grid-margin { margin-top: 70px !important; }

/* YouTube facade — thumbnail + play button, click to load the player */
.mbs-grid-video {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    cursor: pointer;
    background: #000;
    overflow: hidden;
}
.mbs-grid-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.mbs-grid-play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 68px;
    height: 48px;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.55);
    border-radius: 12px;
    transition: background 0.2s ease;
}
.mbs-grid-play::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    border-style: solid;
    border-width: 11px 0 11px 18px;
    border-color: transparent transparent transparent #fff;
}
.mbs-grid-video:hover .mbs-grid-play { background: #f00; }
