/* WordPress emits .home in the original HTML: mobile styles apply before scripts run. */
.nb-home-disclosure { display: none; }

/* Give homepage sections one spacing owner instead of stacking widget and wrapper gaps. */
body.home {
    --nb-home-section-gap: 32px;
    --nb-home-heading-gap: 16px;
}
.home #custom_html-17 { margin-bottom: 0 !important; }
.home .main-col > .c-sidebar {
    padding-top: var(--nb-home-section-gap);
    padding-bottom: 0;
}
.home .c-page-content .widget { margin-bottom: var(--nb-home-heading-gap); }
.home #custom_html-20,
.home #manga-recent-6 { margin-bottom: var(--nb-home-section-gap) !important; }
.home .main-col .c-blog__heading { margin-bottom: var(--nb-home-heading-gap); }
.home #loop-content { margin-top: var(--nb-home-heading-gap); }

@media (max-width: 767px) {
    body.home {
        --nb-home-section-gap: 24px;
        --nb-home-heading-gap: 12px;
        --nb-home-border: #dce5ea;
        --nb-home-surface: #f2f6fa;
        --nb-home-text: #3f606c;
    }
    body.home.text-ui-light {
        --nb-home-border: #46505a;
        --nb-home-surface: #252b32;
        --nb-home-text: #dce5ea;
    }
    .home .nb-home-disclosure:not([hidden]) {
        display: block;
        width: 100%;
        min-height: 44px;
        margin: 12px 0 20px;
        padding: 10px 14px;
        border: 1px solid var(--nb-home-border);
        border-radius: 8px;
        background: var(--nb-home-surface);
        color: var(--nb-home-text) !important;
        font: inherit;
        font-size: 14px;
        cursor: pointer;
    }
    .home .nb-home-disclosure:focus-visible {
        outline: 3px solid #355b9d;
        outline-offset: 3px;
    }
    .home .nb-home-collapsed .nb-home-extra,
    .home #loop-content.nb-home-collapsed .row-eq-height > div:has(> .nb-home-extra) {
        display: none !important;
    }

    /* Keep all three existing category links accessible in one horizontal row. */
    .home .c-sub-header-nav .sub-nav_content { max-width: 100%; width: 100%; }
    .home .c-sub-header-nav .second-menu {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 20px;
        margin: 0;
        padding: 0 2px;
    }
    .home .c-sub-header-nav .second-menu > li {
        display: block !important;
        flex: 0 0 auto;
    }
    .home .c-sub-header-nav .second-menu > .mobile-icon { display: none !important; }

    /* Make the current promotional text readable without a scrolling fragment. */
    .home #custom_html-40 .custom-html-widget > div {
        height: auto !important;
        padding: 10px 0 !important;
    }
    .home #tickerContainer {
        position: static !important;
        white-space: normal !important;
    }
    .home #tickerContainer span {
        display: block;
        padding: 0 !important;
        font-size: 13px !important;
        line-height: 1.5 !important;
    }
    .home .c-top-sidebar .widget { margin-bottom: 20px !important; }
    .home .widget-heading { margin-bottom: 12px !important; }
    .home .c-page-content .content-area { margin-top: 0 !important; padding-top: 0; }
    .home #darklight_toggle { left: auto; right: 16px; bottom: 96px; }

    /* Match the two-card layout before Slick and the theme's .mobile class initialize. */
    .home #custom_html-17 .grid9:not(.slick-initialized) {
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .home #custom_html-17 .grid9:not(.slick-initialized)::-webkit-scrollbar { display: none; }
    .home #custom_html-17 .grid9:not(.slick-initialized)::after { display: none; }
    .home #custom_html-17 .grid9:not(.slick-initialized) > .item {
        flex: 0 0 50%;
        width: 50% !important;
        max-width: 50%;
    }
    .home #custom_html-17 .grid9 .item {
        display: block;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 5px !important;
        float: none;
    }
    .home #custom_html-17 .item-inner { padding: 0 !important; }
    .home #custom_html-17 .description,
    .home #custom_html-17 .c-read-more-link { display: none; }

    /* The frame owns the dimensions; placeholder and loaded image fill that same frame. */
    .home #custom_html-17 .item-thumb {
        position: relative;
        width: 100%;
        height: auto !important;
        aspect-ratio: 193 / 278;
        margin: 0 0 12px !important;
        overflow: hidden;
        border-radius: 8px;
        background: #f5f5f5;
    }
    .home #custom_html-17 .item-thumb > a,
    .home #custom_html-17 .item-thumb img {
        position: absolute;
        inset: 0;
        display: block;
        width: 100% !important;
        height: 100% !important;
        padding: 0 !important;
        margin: 0;
    }
    .home #custom_html-17 .item-thumb img { object-fit: cover; }
    .home #custom_html-17 .item-summary { min-height: 94px; }
    .home #custom_html-17 .meta-item.genres {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .home #custom_html-17 .post-title h3 {
        height: 42px !important;
        max-height: 42px !important;
        margin: 8px 0 4px;
        line-height: 21px !important;
        font-size: 14px;
        overflow: hidden;
    }
    .home #custom_html-17 .c-page__content { padding-bottom: 0; }

    /* Long novels use a horizontal bookshelf instead of a tall two-column grid. */
    .home #custom_html-20 .page-content-listing {
        display: flex;
        overflow-x: auto;
        gap: 14px;
        padding-bottom: 10px;
        scroll-snap-type: x proximity;
    }
    .home #custom_html-20 .page-listing-item,
    .home #custom_html-20 .row-eq-height { display: contents; }
    .home #custom_html-20 .row-eq-height > div {
        flex: 0 0 136px;
        width: 136px;
        max-width: 136px;
        padding: 0;
        scroll-snap-align: start;
    }
    .home #custom_html-20 .page-item-detail { display: block; margin: 0 !important; padding: 0 !important; }
    .home #custom_html-20 .item-thumb {
        width: 136px !important;
        max-width: none !important;
        margin: 0 0 8px !important;
        float: none !important;
    }
    .home #custom_html-20 .item-thumb img {
        padding-top: 0 !important;
        width: 136px;
        height: 185px;
        object-fit: contain;
    }
    .home #custom_html-20 .item-summary { width: 100% !important; padding: 0 !important; }
    .home #custom_html-20 .list-chapter { display: none; }

    /* Latest and popular: compact cover + title + latest chapter, preserving lock indicators. */
    .home #loop-content .page-listing-item,
    .home #loop-content .row-eq-height { margin: 0 !important; padding: 0 !important; border: 0; }
    .home #loop-content .row-eq-height > div { width: 100%; max-width: 100%; flex-basis: 100%; }
    .home #loop-content .page-item-detail,
    .home #manga-recent-6 .popular-item-wrap {
        display: flex !important;
        gap: 12px;
        padding: 12px 0 !important;
        margin: 0 !important;
        border-bottom: 1px solid var(--nb-home-border);
        align-items: flex-start;
    }
    .home #loop-content .item-thumb,
    .home #manga-recent-6 .popular-img {
        flex: 0 0 64px;
        width: 64px !important;
        max-width: 64px !important;
        margin: 0 !important;
        float: none;
    }
    .home #loop-content .item-thumb img,
    .home #manga-recent-6 .popular-img img {
        width: 64px;
        height: 88px;
        padding-top: 0 !important;
        object-fit: cover;
    }
    .home #loop-content .item-summary,
    .home #manga-recent-6 .popular-content {
        flex: 1;
        min-width: 0;
        width: auto !important;
        padding: 0 !important;
    }
    .home #loop-content .rating { display: none; }
    .home #loop-content .post-title,
    .home #manga-recent-6 .widget-title { margin: 0 0 8px !important; }
    .home #loop-content .list-chapter .chapter-item:not(:first-child),
    .home #manga-recent-6 .list-chapter .chapter-item:not(:first-child) { display: none; }
    .home #loop-content .chapter-item,
    .home #manga-recent-6 .chapter-item { margin-bottom: 0 !important; }
    .home #loop-content .post-title h3,
    .home #manga-recent-6 .widget-title,
    .home #custom_html-20 .post-title h3 {
        height: auto !important;
        max-height: none !important;
        font-size: 14px !important;
        line-height: 21px !important;
        margin: 0;
    }
    .home #custom_html-20 .post-title h3 { height: 42px !important; overflow: hidden; }
    .home #loop-content .chapter,
    .home #manga-recent-6 .chapter { max-width: 100%; }

    /* Eight common genres initially; every existing category remains available. */
    .home #manga-genres-id-13 .row.genres { margin-left: 0; margin-right: 0; }
    .home #nb-home-genres-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px 12px;
        margin: 0;
    }
    .home #nb-home-genres-list > li { width: 100%; max-width: none; padding: 0; }
    .home #nb-home-genres-list::after { display: none; }
    .home #nb-home-genres-list a { display: block; padding: 8px 0; }
    .home #manga-recent-6 .nb-home-collapsed .popular-item-wrap.nb-home-extra {
        display: none !important;
    }
}
