/**
 * Related Content Styles
 *
 * Responsive Grid Layout mit Skeleton Loader und Card Design
 *
 * @package Blocksy Child
 * @since 1.0.0
 */

/* ==========================================================================
   Section Container
   ========================================================================== */

.related-content-section {
    margin: 4rem 0;
    padding: 2.5rem;
    background: var(--theme-palette-color-8, #f9f9f9);
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.related-content-section:first-of-type {
    margin-top: 3rem;
}

/* Section Header */
.related-content-section__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--theme-palette-color-3, #e0e0e0);
}

.related-content-section__icon {
    font-size: 1.75rem;
    color: var(--theme-palette-color-1, #333);
}

.related-content-section__title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--theme-heading-color, #1a1a1a);
    line-height: 1.2;
}

/* ==========================================================================
   Grid Layout
   ========================================================================== */

.related-content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.related-card {
    background: #fff;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    gap: 0;
}

/* Card Image */
.related-card__image {
    display: block;
    flex: 0 0 160px;
    width: 160px;
    overflow: hidden;
    background: var(--theme-palette-color-7, #e5e5e5);
}

.related-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Card Content */
.related-card__content {
    padding: 0.75rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.related-card__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

.related-card__title a {
    color: var(--theme-heading-color, #1a1a1a);
    text-decoration: none;
    transition: color 0.2s ease;
}

.related-card__title a:hover {
    color: var(--theme-palette-color-1, #0066cc);
}

.related-card__date {
    display: block;
    font-size: 0.875rem;
    color: var(--theme-text-color, #666);
    font-weight: 500;
}

.related-card__excerpt {
    margin: 0.5rem 0 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--theme-text-color, #666);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   Load More Button
   ========================================================================== */

.related-content__load-more {
    display: block;
    margin: 2rem auto 0;
    padding: 0.875rem 2.5rem;
    background: var(--theme-button-background-initial-color, #0066cc);
    color: var(--theme-button-text-initial-color, #fff);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    min-height: 48px; /* Touch target */
}

.related-content__load-more:hover:not(:disabled) {
    background: var(--theme-button-background-hover-color, #0052a3);
    transform: translateY(-2px);
}

.related-content__load-more:active:not(:disabled) {
    transform: translateY(0);
}

.related-content__load-more:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ==========================================================================
   Empty & Error States
   ========================================================================== */

.related-content-empty,
.related-content__empty,
.related-content__error {
    grid-column: 1 / -1;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--theme-text-color, #666);
    font-size: 1rem;
    font-style: italic;
}

.related-content__error {
    color: var(--theme-palette-color-2, #c00);
}

/* ==========================================================================
   Skeleton Loader
   ========================================================================== */

.related-card.skeleton {
    pointer-events: none;
    user-select: none;
}

.skeleton-image {
    aspect-ratio: 16 / 9;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 80%;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1rem;
    width: 100%;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text:last-child {
    width: 60%;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Loading state fade */
.related-content-section.loading {
    opacity: 1;
    animation: fade-in 0.3s ease;
}

@keyframes fade-in {
    from {
        opacity: 0.6;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================================================
   Icon Styles (optional, using emoji as fallback)
   ========================================================================== */

.icon-calendar::before { content: ''; }
.icon-microphone::before { content: ''; }
.icon-camera::before { content: ''; }
.icon-map-marker::before { content: ''; }
.icon-user::before { content: ''; }
.icon-news::before { content: ''; }

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet (< 768px): 1 Spalte */
@media (max-width: 768px) {
    .related-content-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .related-card__content {
        padding: 1.25rem;
    }

    .related-card__title {
        font-size: 1rem;
    }

    .related-content__load-more {
        width: 100%;
        padding: 1rem;
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    .related-content-section {
        padding: 1.25rem;
        margin: 1.5rem -1rem; /* Extend to edges */
        border-radius: 0;
    }

    .related-content-grid {
        grid-template-columns: 1fr; /* Single column */
        gap: 1rem;
    }

    .related-card__excerpt {
        -webkit-line-clamp: 2;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .related-content-section {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .related-content__load-more {
        display: none;
    }

    .related-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .skeleton-image,
    .skeleton-title,
    .skeleton-text {
        animation: none;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus states */
.related-card a:focus-visible,
.related-content__load-more:focus-visible {
    outline: 3px solid var(--theme-palette-color-1, #0066cc);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .related-card__title a,
    .related-content__load-more {
        transition: none;
    }

    .skeleton-image,
    .skeleton-title,
    .skeleton-text {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .related-card {
        border: 2px solid currentColor;
    }

    .related-content-section {
        border: 2px solid currentColor;
    }
}
