/* =========================================================
   Themenwelten: Ähnliche Beiträge (Modern Magazine Bento Grid)
   Palette: Blau (#1E48FA), Grau (#0f172a, #64748b, #e2e8f0), Weiß (#ffffff)
   ========================================================= */

:root {
    --tw-blue-primary: #1E48FA;
    --tw-blue-light: #eef2ff;
    --tw-blue-glow: rgba(30, 72, 250, 0.16);
    --tw-gray-dark: #0f172a;
    --tw-gray-body: #334155;
    --tw-gray-muted: #64748b;
    --tw-gray-border: #e2e8f0;
    --tw-gray-bg: #f8fafc;
    --tw-white: #ffffff;
}

/* Joomla Card Wrapper Override (entfernt klobige Standard-Rahmen) */
.card:has(.themenwelt-related) {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.card:has(.themenwelt-related) > .card-header,
.card:has(.themenwelt-related) > .card-title {
    display: none !important; /* Verhindert doppelte Überschriften */
}

.card:has(.themenwelt-related) > .card-body {
    padding: 0 !important;
}

/* Hauptcontainer */
.themenwelt-related {
    margin-top: 4.5rem;
    padding-top: 3.5rem;
    border-top: 1px solid var(--tw-gray-border);
    width: 100%;
}

/* Kopfbereich */
.themenwelt-related__header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.themenwelt-related__badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tw-blue-primary);
    background: var(--tw-blue-light);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    margin-bottom: 0.6rem;
}

.themenwelt-related__heading {
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 800;
    color: var(--tw-gray-dark);
    margin: 0;
    letter-spacing: -0.02em;
}

/* --- MOBILE FIRST: Feed Ansicht --- */
.themenwelt-related__grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.themenwelt-related-card {
    background: var(--tw-white);
    border: 1px solid var(--tw-gray-border);
    border-radius: 0.85rem;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.25s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.themenwelt-related-card:hover {
    transform: translateY(-4px);
    border-color: rgba(30, 72, 250, 0.35);
    box-shadow: 0 16px 32px -8px var(--tw-blue-glow), 0 4px 8px rgba(15, 23, 42, 0.04);
}

.themenwelt-related-card__link {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

/* Bild / Placeholder Container */
.themenwelt-related-card__media {
    flex: 0 0 100px;
    width: 100px;
    height: 100px;
    margin: 0.75rem;
    border-radius: 0.6rem;
    overflow: hidden;
    background: var(--tw-gray-bg);
    position: relative;
}

.themenwelt-related-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.themenwelt-related-card:hover .themenwelt-related-card__image {
    transform: scale(1.06);
}

/* Eleganter SVG-Placeholder, wenn kein Beitragsbild vorhanden ist */
.themenwelt-related-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    color: var(--tw-blue-primary);
}

.themenwelt-related-card__icon {
    width: 36px;
    height: 36px;
    opacity: 0.85;
    transition: transform 0.3s ease;
}

.themenwelt-related-card:hover .themenwelt-related-card__icon {
    transform: scale(1.1);
}

/* Textbereich */
.themenwelt-related-card__content {
    flex: 1;
    padding: 0.75rem 1rem 0.75rem 0.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.themenwelt-related-card__category {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tw-blue-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.themenwelt-related-card__title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--tw-gray-dark);
    margin: 0 0 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.themenwelt-related-card:hover .themenwelt-related-card__title {
    color: var(--tw-blue-primary);
}

/* Action Link mit animiertem Pfeil */
.themenwelt-related-card__action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--tw-gray-muted);
    transition: color 0.2s ease, gap 0.2s ease;
}

.themenwelt-related-card__arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.themenwelt-related-card:hover .themenwelt-related-card__action {
    color: var(--tw-blue-primary);
}

.themenwelt-related-card:hover .themenwelt-related-card__arrow {
    transform: translateX(4px);
}

/* --- DESKTOP ANSICHT (ab 768px): 3 Spalten Bento Grid --- */
@media (min-width: 48rem) {
    .themenwelt-related__grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1.75rem;
    }

    .themenwelt-related-card__link {
        flex-direction: column;
        align-items: stretch;
    }

    .themenwelt-related-card__media {
        flex: none;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        margin: 0;
        border-radius: 0;
        border-bottom: 1px solid var(--tw-gray-border);
    }

    .themenwelt-related-card__content {
        padding: 1.4rem;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .themenwelt-related-card__title {
        font-size: 1.125rem;
        -webkit-line-clamp: 3;
        margin-bottom: 1rem;
    }

    .themenwelt-related-card__action {
        margin-top: auto;
        padding-top: 0.5rem;
    }
}
