.smc-related-title-block {
    margin: 0 0 0.55em !important;
}

.smc-related-wrap {
    width: 100%;
    box-sizing: border-box;
    margin-top: 0 !important;
    margin-bottom: 2.25em;
}

/*
 * 実カード本体。
 * 編集画面では親ブロックが横幅いっぱいになっても、
 * この内側を通常本文幅へ揃える。
 */
.smc-related-inner {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

/* SWELLの「枠線を見出しで切る」見た目に寄せる */
.smc-related-label {
    position: absolute;
    z-index: 4;
    top: -0.78em;
    left: 1.25em;
    margin: 0;
    padding: 0 0.5em;
    background: #fff;
    color: #222;
    font-size: 0.88em;
    font-weight: 700;
    line-height: 1.55;
    white-space: nowrap;
}

.smc-related-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.05em;
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: 1.15em 1.35em;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    color: #333 !important;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

/*
 * カード全面をクリック可能にする透明リンク。
 * 抜粋文自体はリンク要素の外に置くため、青字・下線にならない。
 */
.smc-related-card__overlay {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: block;
    border: 0;
    background: transparent;
    color: transparent !important;
    text-decoration: none !important;
}

.smc-related-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.11);
    transform: translateY(-1px);
}

.smc-related-card__image {
    position: relative;
    z-index: 1;
    flex: 0 0 160px;
    width: 160px;
    max-width: 34%;
}

.smc-related-card__image img {
    display: block;
    width: 160px;
    max-width: 100%;
    height: 90px;
    object-fit: cover;
}

.smc-related-card__body {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 90px;
    flex-direction: column;
    justify-content: space-between;
}

/* 抜粋は普通の本文色。カード全面の透明リンクでクリック可能。 */
.smc-related-card__excerpt {
    color: #333 !important;
    font-size: 0.9em;
    line-height: 1.55;
    text-decoration: none !important;
}

.smc-related-card__site {
    display: block !important;
    margin-top: 0.45em;
    color: #777 !important;
    font-size: 0.7em;
    line-height: 1.3;
    text-align: right;
    text-decoration: none !important;
}

.smc-related-card--no-image .smc-related-card__body {
    width: 100%;
}

/* Gutenberg編集画面の表示を公開画面の本文幅へ揃える */
.editor-styles-wrapper .smc-related-title-block {
    margin: 0 0 0.55em !important;
}

.editor-styles-wrapper .wp-block-swell-marker-internal-card.smc-related-wrap,
.editor-styles-wrapper [data-type="swell-marker/internal-card"] {
    width: 100% !important;
    max-width: var(--wp--style--global--content-size, 860px) !important;
    margin-top: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.editor-styles-wrapper .wp-block-swell-marker-internal-card .smc-related-inner,
.editor-styles-wrapper [data-type="swell-marker/internal-card"] .smc-related-inner {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.editor-styles-wrapper .smc-related-label {
    background: #fff;
}

/* 編集中は透明リンクがブロック選択を邪魔しないようにする */
.editor-styles-wrapper .smc-related-card__overlay {
    pointer-events: none;
}

.editor-styles-wrapper .smc-related-card__excerpt {
    color: #333 !important;
    text-decoration: none !important;
}

@media (max-width: 600px) {
    .smc-related-title-block {
        margin-bottom: 0.65em !important;
    }

    .smc-related-label {
        left: 0.8em;
        font-size: 0.82em;
    }

    .smc-related-card {
        gap: 0.8em;
        padding: 1em;
    }

    .smc-related-card__image {
        flex-basis: 112px;
        width: 112px;
        max-width: 38%;
    }

    .smc-related-card__image img {
        width: 112px;
        height: 72px;
    }

    .smc-related-card__body {
        min-height: 72px;
    }

    .smc-related-card__excerpt {
        font-size: 0.88em;
        line-height: 1.5;
    }
}
