/* Moshimo Easy Link. New opt-in cards only.
 * Wrap NEW, unmodified Moshimo code in <div class="kh-moshimo-modern">.
 * Old cards outside that wrapper keep their existing appearance.
 */
div.kh-moshimo-modern {
    min-width: 0;
    container: kh-moshimo / inline-size;
}

/* wpautop can add breaks and empty/comment-only paragraphs around the loader.
 * They are formatting artifacts, not card content. Keep product paragraphs intact. */
div.kh-moshimo-modern > br,
div.kh-moshimo-modern > p:empty { display: none; }

/* Per-card choices override the site default; article HTML stores only the color name. */
div.kh-moshimo-modern[data-kh-color="white"] { --kh-ml-paper: #ffffff; }
div.kh-moshimo-modern[data-kh-color="lemon"] { --kh-ml-paper: #ffeb8a; }
div.kh-moshimo-modern[data-kh-color="cream"] { --kh-ml-paper: #fff5d6; }
div.kh-moshimo-modern[data-kh-color="apricot"] { --kh-ml-paper: #ffd49a; }
div.kh-moshimo-modern[data-kh-color="sky"] { --kh-ml-paper: #cde7fa; }
div.kh-moshimo-modern[data-kh-color="mint"] { --kh-ml-paper: #d9eedd; }

/* Per-card mascot choices also remove the space reserved above a hidden pair. */
div.kh-moshimo-modern[data-kh-mascots="hide"] { --kh-ml-mascots-display: none; --kh-ml-headroom: 0px; }
div.kh-moshimo-modern[data-kh-mascots="show"] { --kh-ml-mascots-display: block; --kh-ml-headroom: var(--kh-ml-mascot-headroom, 80px); }

div.kh-moshimo-modern div.easyLink-box {
    --kh-ml-columns: 184px minmax(0, 1fr);
    --kh-ml-buttons: repeat(3, minmax(0, 1fr));
    --kh-ml-gap: 28px;
    --kh-ml-photo: 184px;
    --kh-ml-info-height: 208px;
    position: relative;
    isolation: isolate;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: var(--kh-ml-columns);
    align-items: start;
    gap: var(--kh-ml-gap);
    width: 100%;
    max-width: none;
    margin: var(--kh-ml-headroom, 80px) 0 28px;
    padding: 20px;
    border: 1px solid #dce3ec;
    border-radius: 18px;
    background: var(--kh-ml-paper, #fff);
    color: #1c2b40;
    box-shadow: 0 8px 28px -18px #243b5a38;
    font-family: inherit;
    text-align: left;
}

/* Decorative cutouts: no changes to the generated affiliate HTML or links. */
div.kh-moshimo-modern div.easyLink-box::before,
div.kh-moshimo-modern div.easyLink-box::after {
    content: "";
    position: absolute;
    z-index: 2;
    display: var(--kh-ml-mascots-display, block);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
}

div.kh-moshimo-modern div.easyLink-box::before {
    top: -1px;
    left: 12px;
    width: min(var(--kh-ml-neko-width, 150px), calc((100% - 32px) / 2));
    aspect-ratio: 4 / 3;
    transform: translateY(-70%);
    background-image: url("../images/product-links/nekosuke-peeking-v1.png");
}

div.kh-moshimo-modern div.easyLink-box::after {
    top: -1px;
    right: 12px;
    width: min(var(--kh-ml-tora-width, 144px), calc((100% - 32px) / 2));
    aspect-ratio: 3 / 2;
    transform: translateY(-80%);
    background-image: url("../images/product-links/toranosuke-peeking-v1.png");
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-img {
    position: relative;
    width: var(--kh-ml-photo);
    max-width: 100%;
    height: var(--kh-ml-photo);
    margin: 0 auto;
    padding: 0;
    border: 1px solid #e9edf2;
    border-radius: 12px;
    background: #f8fafc;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-img::before {
    content: none;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-img p.easyLink-img-box {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-img p.easyLink-img-box span {
    inset: 12px;
    width: calc(100% - 24px);
    height: calc(100% - 24px);
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-img p.easyLink-img-box span > img.easyLink-img-pht {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-img a.easyLink-arrow-left,
div.kh-moshimo-modern div.easyLink-box div.easyLink-img a.easyLink-arrow-right {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    border: 1px solid #dce3ec;
    border-radius: 50%;
    background: #ffffffed;
    box-shadow: 0 2px 6px #243b5a12;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-img a.easyLink-arrow-left { left: -9px; }
div.kh-moshimo-modern div.easyLink-box div.easyLink-img a.easyLink-arrow-right { right: -9px; }

div.kh-moshimo-modern div.easyLink-box div.easyLink-img a.easyLink-arrow-left img,
div.kh-moshimo-modern div.easyLink-box div.easyLink-img a.easyLink-arrow-right img {
    width: 18px;
    height: 18px;
    opacity: .8;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-width: 0;
    width: 100%;
    min-height: var(--kh-ml-info-height);
    margin: 0;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-maker,
div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-model {
    margin: 0;
    color: #637187;
    font-size: 12px;
    line-height: 1.7;
    letter-spacing: .025em;
    overflow-wrap: anywhere;
    word-break: normal;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-name {
    margin: 7px 0 10px;
    padding: 0;
    color: #1c2b40;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.75;
    letter-spacing: .015em;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-name a {
    color: inherit;
    text-decoration: none;
    word-break: normal;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-name a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn {
    display: grid;
    grid-template-columns: var(--kh-ml-buttons);
    gap: 9px;
    margin: auto 0 0;
    padding: 22px 0 0;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn a {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 50px;
    margin: 0;
    padding: 12px 8px;
    border: 1px solid #dce3ec;
    border-radius: 9px;
    /* Moshimo sets the button background inline; override presentation only. */
    background: #f5f7fa !important;
    color: #24364e;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    word-break: normal;
    opacity: 1;
    box-shadow: inset 0 -3px var(--kh-ml-button-edge, #b5c0cf);
    transition: transform .16s ease, box-shadow .16s ease;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn a::after {
    content: "";
    flex: 0 0 5px;
    width: 5px;
    height: 5px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn a.easyLink-info-btn-amazon {
    --kh-ml-button-edge: #f5b754;
    border-color: #202e40;
    background: #202e40 !important;
    color: #fff;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn a.easyLink-info-btn-rakuten {
    --kh-ml-button-edge: #8b1726;
    border-color: #b22839;
    background: #c53042 !important;
    color: #fff;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn a.easyLink-info-btn-yahoo {
    --kh-ml-button-edge: #b76815;
    border-color: #e28b22;
    background: #f6a137 !important;
    color: #482700;
}

div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn a:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 -3px var(--kh-ml-button-edge, #b5c0cf), 0 5px 12px #243b5a20;
    opacity: 1;
}

div.kh-moshimo-modern div.easyLink-box a:focus-visible {
    outline: 3px solid #216ac1;
    outline-offset: 4px;
}

/* Stack for narrow article columns, even inside a wide desktop viewport. */
@container kh-moshimo (max-width: 620px) {
    div.kh-moshimo-modern div.easyLink-box {
        --kh-ml-columns: minmax(0, 1fr);
        --kh-ml-buttons: minmax(0, 1fr);
        --kh-ml-gap: 22px;
        --kh-ml-photo: 196px;
        --kh-ml-info-height: 0;
    }
}

/* Viewport fallback for browsers without container queries. */
@media (max-width: 640px) {
    div.kh-moshimo-modern div.easyLink-box {
        --kh-ml-columns: minmax(0, 1fr);
        --kh-ml-buttons: minmax(0, 1fr);
        --kh-ml-gap: 22px;
        --kh-ml-photo: 196px;
        --kh-ml-info-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn a {
        transition: none;
    }
    div.kh-moshimo-modern div.easyLink-box div.easyLink-info p.easyLink-info-btn a:hover {
        transform: none;
    }
}
