/* ============================================================
   mod_article_grid — PureGlow Media
   Responsive article grid with configurable card styles
   ============================================================ */

/* --- Grid Layout --- */
.mag-grid-wrapper {
    width: 100%;
}

.mag-grid {
    display: grid;
    grid-template-columns: repeat(var(--mag-cols-desktop, 4), 1fr);
    gap: var(--mag-gap, 24px);
    list-style: none;
    padding: 0;
    margin: 0;
}

@media (max-width: 1024px) {
    .mag-grid {
        grid-template-columns: repeat(var(--mag-cols-tablet, 2), 1fr);
    }
}

@media (max-width: 640px) {
    .mag-grid {
        grid-template-columns: repeat(var(--mag-cols-mobile, 1), 1fr);
    }
}

/* --- Card Base --- */
.mag-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--mag-radius, 12px);
    background: var(--mag-card-bg, #fff);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}

/* Card Style Variants */
.mag-card--elevated {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.06);
}

.mag-card--bordered {
    box-shadow: none;
    border: 1px solid #e2e8f0;
}

.mag-card--flat {
    box-shadow: none;
    background: var(--mag-card-bg, #f8fafc);
}

.mag-card--overlay {
    background: transparent;
}

.mag-card--overlay .mag-card__body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.45) 60%, transparent 100%);
    z-index: 2;
    color: #fff;
    border-radius: 0 0 var(--mag-radius) var(--mag-radius);
}

.mag-card--overlay .mag-card__title a,
.mag-card--overlay .mag-card__meta,
.mag-card--overlay .mag-card__intro,
.mag-card--overlay .mag-card__field-label,
.mag-card--overlay .mag-card__field-value {
    color: #fff;
}

.mag-card--overlay .mag-card__readmore {
    color: rgba(255, 255, 255, 0.9);
}

.mag-card--overlay .mag-card__readmore:hover {
    color: #fff;
}

.mag-card--overlay .mag-card__image-wrap {
    padding-bottom: 80% !important;
}

/* Hover Effects */
.mag-hover--lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mag-hover--grow:hover {
    transform: scale(1.025);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.mag-hover--glow:hover {
    box-shadow: 0 0 0 3px rgba(var(--mag-accent-rgb), 0.25),
                0 4px 20px rgba(var(--mag-accent-rgb), 0.15);
}

/* --- Image --- */
.mag-card__image-link {
    display: block;
    position: relative;
    text-decoration: none;
    overflow: hidden;
}

.mag-card__image-wrap {
    position: relative;
    padding-bottom: var(--mag-ratio, 56.25%);
    overflow: hidden;
    background: #f1f5f9;
}

.mag-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                filter 0.4s ease;
}

/* Image Hover Effects */
.mag-img-hover--zoom:hover .mag-card__image {
    transform: scale(1.08);
}

.mag-img-hover--brighten:hover .mag-card__image {
    filter: brightness(1.12);
}

/* --- Badges --- */
.mag-card__badge {
    position: absolute;
    z-index: 3;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
    border-radius: 6px;
}

.mag-card__badge--category {
    bottom: 10px;
    left: 10px;
    background: var(--mag-accent);
    color: #fff;
}

.mag-card__badge--featured {
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.92);
    color: #f59e0b;
    font-size: 0.85rem;
    padding: 3px 8px;
    backdrop-filter: blur(4px);
    border-radius: 50%;
    line-height: 1;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mag-card__badges-top {
    padding: 14px 16px 0;
}

/* --- Card Body --- */
.mag-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px 18px 18px;
    gap: 8px;
    background: var(--mag-card-body-bg, transparent);
}

/* --- Title --- */
.mag-card__title {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.mag-card__title a {
    color: var(--mag-card-text, #1a202c);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mag-card__title a:hover {
    color: var(--mag-accent);
}

/* --- Meta (Date / Author) --- */
.mag-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 500;
}

.mag-card__author::after {
    content: '·';
    margin-left: 4px;
    color: #cbd5e1;
}

/* --- Intro Text --- */
.mag-card__intro {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--mag-card-text, #64748b);
}

/* --- Event Date (plain text, not a pill) --- */
.mag-card__event-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

/* --- Custom Fields --- */
.mag-card__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.mag-card__field {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1.4;
}

.mag-card__field-label {
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.65rem;
}

.mag-card__field-value {
    color: #475569;
    font-weight: 500;
}

/* --- Read More --- */
.mag-card__footer {
    margin-top: auto;
    padding-top: 8px;
}

.mag-card__readmore {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--mag-accent);
    text-decoration: none;
    transition: gap 0.25s ease, color 0.2s ease;
}

.mag-card__readmore:hover {
    gap: 9px;
    color: var(--mag-accent);
}

.mag-card__arrow {
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.mag-card__readmore:hover .mag-card__arrow {
    transform: translateX(2px);
}

/* --- Featured Card Highlight --- */
.mag-card--featured.mag-card--elevated {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06),
                0 4px 12px rgba(0, 0, 0, 0.06),
                inset 0 2px 0 0 var(--mag-accent);
}

.mag-card--featured.mag-card--bordered {
    border-top: 2px solid var(--mag-accent);
}

/* --- Accessibility --- */
.mag-card:focus-within {
    outline: 2px solid var(--mag-accent);
    outline-offset: 2px;
}

.mag-card__title a:focus-visible {
    outline: 2px solid var(--mag-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- Print --- */
@media print {
    .mag-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .mag-card {
        box-shadow: none !important;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .mag-card__image-wrap {
        display: none;
    }
}

/* --- Dark mode support (via prefers-color-scheme) --- */
@media (prefers-color-scheme: dark) {
    .mag-card {
        background: var(--mag-card-bg, #1e293b);
    }

    .mag-card--flat {
        background: var(--mag-card-bg, #0f172a);
    }

    .mag-card--bordered {
        border-color: #334155;
    }

    .mag-card__title a {
        color: var(--mag-card-text, #f1f5f9);
    }

    .mag-card__intro {
        color: var(--mag-card-text, #94a3b8);
    }

    .mag-card__field {
        background: #334155;
    }

    .mag-card__field-value {
        color: #cbd5e1;
    }

    .mag-card__meta {
        color: #64748b;
    }

    .mag-card--featured.mag-card--elevated {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2),
                    0 4px 12px rgba(0, 0, 0, 0.15),
                    inset 0 2px 0 0 var(--mag-accent);
    }
}
