/* Top Article Block Styles */
.wp-block-seo-top-article {
    --thumbnail-width: 25%;
    --thumbnail-aspect-ratio: 100%;
    width: 100%;
}

.top-article-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    color: #111;
}
@media (max-width: 991px) {
    .top-article-title {
        font-size: 16px;
    }
}

/* List Layout */
.wp-block-seo-top-article.layout-list .top-article-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wp-block-seo-top-article.layout-list .top-article-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}

.wp-block-seo-top-article.layout-list .top-article-item:first-child {
    padding-top: 0;
}

.wp-block-seo-top-article.layout-list .top-article-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.wp-block-seo-top-article.layout-list .top-article-item:hover {
    background-color: #f9f9f9;
}

/* Grid Layout */
.wp-block-seo-top-article.layout-grid .top-article-list {
    display: grid;
    gap: 24px;
}

.wp-block-seo-top-article.layout-grid .top-article-list[data-columns="1"] {
    grid-template-columns: 1fr;
}

.wp-block-seo-top-article.layout-grid .top-article-list[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.wp-block-seo-top-article.layout-grid .top-article-list[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.wp-block-seo-top-article.layout-grid .top-article-list[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.wp-block-seo-top-article.layout-grid .top-article-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.wp-block-seo-top-article.layout-grid .top-article-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.wp-block-seo-top-article.layout-grid .top-article-link:hover .top-article-item-title {
    color: #333;
}

/* List layout thumbnail */
.wp-block-seo-top-article.layout-list .top-article-thumbnail {
    flex-shrink: 0;
    position: relative;
    width: var(--thumbnail-width);
    border-radius: 4px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.wp-block-seo-top-article.layout-list .top-article-thumbnail::before {
    content: '';
    display: block;
    padding-bottom: var(--thumbnail-aspect-ratio);
}

.wp-block-seo-top-article.layout-list .top-article-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0 !important;
    padding: 0;
    border: none;
}

.wp-block-seo-top-article.layout-list .top-article-thumbnail .top-article-no-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Grid layout thumbnail - 1024x480 aspect ratio */
.wp-block-seo-top-article.layout-grid .top-article-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 46.875%; /* 1024:480 aspect ratio (480/1024 = 0.46875) */
    overflow: hidden;
    border-radius: 8px;
    background-color: #f0f0f0;
    margin-bottom: 16px;
}

.wp-block-seo-top-article.layout-grid .top-article-thumbnail img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0 !important;
    padding: 0;
    border: none;
    transition: transform 0.3s ease;
}

.wp-block-seo-top-article.layout-grid .top-article-link:hover .top-article-thumbnail img {
    transform: translate(-50%, -50%) scale(1.02);
}

.top-article-no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
}

.wp-block-seo-top-article.layout-grid .top-article-no-image {
    position: absolute;
    top: 0;
    left: 0;
}

/* List layout content */
.wp-block-seo-top-article.layout-list .top-article-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

/* Grid layout content */
.wp-block-seo-top-article.layout-grid .top-article-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.top-article-category {
    display: inline-block;
    font-size: 14px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0px;
    font-weight: 400;
    color: #666666;
    margin-bottom: 8px;
}

.wp-block-seo-top-article.layout-list .top-article-item-title {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
    margin: 0 0 4px 0;
    color: #111;
}

.wp-block-seo-top-article.layout-grid .top-article-item-title {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 8px 0;
    color: #111;
}

.wp-block-seo-top-article.layout-list .top-article-item:hover .top-article-item-title {
    color: #111111;
}

.top-article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.top-article-separator {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background-color: #999;
}

.top-article-empty {
    padding: 24px;
    text-align: center;
    color: #666;
    background-color: #f9f9f9;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
    .wp-block-seo-top-article.layout-grid .top-article-list[data-columns-tablet="1"] {
        grid-template-columns: 1fr;
    }

    .wp-block-seo-top-article.layout-grid .top-article-list[data-columns-tablet="2"] {
        grid-template-columns: repeat(2, 1fr);
    }

    .wp-block-seo-top-article.layout-grid .top-article-list[data-columns-tablet="3"] {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 991px) {
    .wp-block-seo-top-article.layout-grid .top-article-item-title {
        font-size: 16px;
    }

    .wp-block-seo-top-article.layout-list .top-article-item-title {
        font-size: 16px;
    }
}

@media (max-width: 575px) {
    .wp-block-seo-top-article.layout-grid .top-article-list[data-columns-mobile="1"] {
        grid-template-columns: 1fr;
    }

    .wp-block-seo-top-article.layout-grid .top-article-list[data-columns-mobile="2"] {
        grid-template-columns: repeat(2, 1fr);
    }

    .wp-block-seo-top-article.layout-grid .top-article-item-title {
        font-size: 16px;
    }
}

/* Editor specific */
.block-editor-block-list__block .wp-block-seo-top-article {
    margin-top: 0;
    margin-bottom: 0;
}

.wp-block-seo-top-article .components-placeholder {
    min-height: 150px;
}
