/* MTG Related Products — compact related-cards grid */

.mtgrp-related {
    margin: 2em 0;
}

.mtgrp-related .mtgrp-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    /* column count is set inline from the shortcode's "columns" attribute */
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.mtgrp-related .mtgrp-card {
    position: relative;
    margin: 0;
    padding: 0;
    text-align: center;
}

.mtgrp-related .mtgrp-thumb {
    display: block;
}

.mtgrp-related .mtgrp-thumb img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    border-radius: 4px;
}

.mtgrp-related .mtgrp-name {
    display: block;
    margin-top: 6px;
    font-size: 0.8em;
    line-height: 1.3;
    text-decoration: none;
    color: inherit;
}

.mtgrp-related .mtgrp-actions {
    margin-top: 6px;
}

.mtgrp-related .mtgrp-actions .button {
    display: inline-block;
    font-size: 0.75em;
    padding: 4px 10px;
    line-height: 1.4;
}

/* On devices with a real pointer, reveal the button on hover/focus only.
   Touch devices (no hover) always show it so it stays usable. */
@media (hover: hover) {
    .mtgrp-related .mtgrp-actions {
        opacity: 0;
        transition: opacity 0.15s ease;
    }

    .mtgrp-related .mtgrp-card:hover .mtgrp-actions,
    .mtgrp-related .mtgrp-card:focus-within .mtgrp-actions {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .mtgrp-related .mtgrp-grid {
        gap: 8px;
    }

    .mtgrp-related .mtgrp-name {
        font-size: 0.72em;
    }

    .mtgrp-related .mtgrp-actions .button {
        font-size: 0.7em;
        padding: 3px 8px;
    }
}
