/* 首页模块。只作用于子主题小工具，颜色跟随父主题变量。 */

.ripro-v5-child-home-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 280px;
    margin: 0 0 1.5rem;
    color: #fff;
    background-color: var(--ri-gray-800, #1a1c23);
    background-position: center;
    background-size: cover;
    overflow: hidden;
}

.ripro-v5-child-home-hero__mask {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(16, 18, 28, 0.45), rgba(16, 18, 28, 0.78));
}

.ripro-v5-child-home-hero.has-image .ripro-v5-child-home-hero__mask {
    background: linear-gradient(180deg, rgba(10, 12, 22, 0.35) 0%, rgba(10, 12, 22, 0.72) 70%);
}

.ripro-v5-child-home-hero__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    padding-top: 2.5rem;
    padding-bottom: 2.75rem;
    text-align: center;
}

.ripro-v5-child-home-hero__title {
    margin: 0 0 0.45rem;
    color: #fff;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.ripro-v5-child-home-hero__desc {
    max-width: 36rem;
    margin: 0 auto 1.25rem;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1rem;
}

.ripro-v5-child-home-search {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 680px;
    margin: 0 auto;
    padding: 0.3rem 0.35rem 0.3rem 1.1rem;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.ripro-v5-child-home-search .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ripro-v5-child-home-search input[type="search"] {
    flex: 1;
    min-width: 0;
    height: 44px;
    border: 0;
    background: transparent;
    color: #1a1c23;
    font-size: 1rem;
    outline: none;
}

.ripro-v5-child-home-search input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.ripro-v5-child-home-search button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ri-primary, #3b6ff5);
    font-size: 1rem;
    cursor: pointer;
}

.ripro-v5-child-home-search button:hover {
    color: var(--ri-primary-text, #2f59c4);
}

.ripro-v5-child-home-hots,
.ripro-v5-child-home-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.ripro-v5-child-home-hots > span {
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.9;
}

.ripro-v5-child-home-hots a,
.ripro-v5-child-home-chips a {
    color: var(--ri-gray-800, #1a1c23);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.92);
    border: 0;
    border-radius: 999px;
    padding: 0.12rem 0.7rem;
    line-height: 1.7;
}

.ripro-v5-child-home-hots a:hover,
.ripro-v5-child-home-chips a:hover {
    background: #fff;
    color: var(--ri-primary, #3b6ff5);
}

.ripro-v5-child-home-block {
    margin-bottom: 2.25rem;
}

.ripro-v5-child-home-block--tight {
    margin-bottom: 1.25rem;
}

.ripro-v5-child-home-heading {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 700;
}

.ripro-v5-child-home-block--cities.is-buttons {
    margin-bottom: 1.5rem;
}

/*
 * 父主题为每个 section 设置了较大的上下留白；首页小工具之间隔着包装层，
 * 因而父主题的 section + section 紧凑规则不会生效。这里按模块重新建立节奏。
 */
.ripro-v5-child-home-entries-wrap > .ripro-v5-child-home-block {
    margin-bottom: 0;
    padding-top: 1rem;
    padding-bottom: 0.5rem;
}

.ripro-v5-child-home-cities-wrap > .ripro-v5-child-home-block {
    margin-bottom: 0;
    padding-top: 0.75rem;
    padding-bottom: 1.25rem;
}

.ripro-v5-child-home-cities-wrap + .home-last-post > section {
    padding-top: 2rem;
}

.ripro-v5-child-home-cities {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.is-grid .ripro-v5-child-home-cities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ripro-v5-child-home-city {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 48px;
    padding: 0.55rem 0.4rem;
    border: 1px solid rgba(var(--ri-primary-rgb, 59, 111, 245), 0.08);
    border-radius: 12px;
    background: var(--bs-body-bg, #fff);
    color: var(--ri-gray-800, #1a1c23);
    text-decoration: none;
    font-weight: 600;
    transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms ease;
}

.is-grid .ripro-v5-child-home-city {
    justify-content: space-between;
    min-height: 52px;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
}

.ripro-v5-child-home-city:hover {
    border-color: rgba(var(--ri-primary-rgb, 59, 111, 245), 0.24);
    background: rgba(var(--ri-primary-rgb, 59, 111, 245), 0.04);
    color: var(--ri-primary-text, #2f59c4);
    transform: translateY(-2px);
}

.ripro-v5-child-home-city:active {
    transform: translateY(0) scale(0.98);
}

.ripro-v5-child-home-city__badge {
    position: absolute;
    top: 0.35rem;
    left: 0.4rem;
    padding: 0.08rem 0.3rem;
    border-radius: 5px;
    background: rgba(var(--ri-primary-rgb, 59, 111, 245), 0.1);
    color: var(--ri-primary-text, #2f59c4);
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.ripro-v5-child-home-city__name {
    font-weight: 600;
}

.ripro-v5-child-home-city__count {
    flex: none;
    color: var(--ri-gray-600, #5d616e);
    font-size: 0.8125rem;
    font-weight: 500;
}

.ripro-v5-child-home-citymore {
    margin-top: 0.85rem;
}

.ripro-v5-child-home-citymore > summary {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: fit-content;
    margin: 0 auto 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(var(--ri-primary-rgb, 59, 111, 245), 0.07);
    color: var(--ri-primary-text, #2f59c4);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    transition: background-color 200ms ease, transform 200ms ease;
}

.ripro-v5-child-home-citymore:not([open]) > summary {
    margin-bottom: 0;
}

.ripro-v5-child-home-citymore > summary::-webkit-details-marker {
    display: none;
}

.ripro-v5-child-home-citymore > summary::after {
    content: "▾";
}

.ripro-v5-child-home-citymore[open] > summary::after {
    content: "▴";
}

.ripro-v5-child-home-citymore > summary:hover {
    background: rgba(var(--ri-primary-rgb, 59, 111, 245), 0.12);
    transform: translateY(-1px);
}

.ripro-v5-child-home-morewrap {
    margin: 1rem 0 0;
    text-align: center;
}

.ripro-v5-child-home-more {
    display: inline-block;
    padding: 0.35rem 0.95rem;
    border: 1px solid var(--ri-primary, #3b6ff5);
    border-radius: 999px;
    color: var(--ri-primary, #3b6ff5);
    text-decoration: none;
    font-size: 0.875rem;
}

.ripro-v5-child-home-more:hover {
    background: var(--ri-primary, #3b6ff5);
    color: #fff;
}

.ripro-v5-child-home-entries {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.ripro-v5-child-home-entry {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 64px;
    padding: 0.625rem 0.75rem;
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 2px 8px rgba(38, 55, 91, 0.045);
    color: inherit;
    text-decoration: none;
    transition: box-shadow 220ms ease, color 220ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ripro-v5-child-home-entry:hover {
    box-shadow: 0 4px 12px rgba(38, 55, 91, 0.09);
    color: inherit;
    transform: translateY(-1px);
}

.ripro-v5-child-home-entry:active {
    transform: translateY(0);
}

.ripro-v5-child-home-entry__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(var(--ri-primary-rgb, 59, 111, 245), 0.1);
    color: var(--ri-primary, #3b6ff5);
    font-size: 0.875rem;
}

.ripro-v5-child-home-entry__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.ripro-v5-child-home-entry__name {
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.45;
}

.ripro-v5-child-home-entry__count,
.ripro-v5-child-home-entry__desc {
    overflow-wrap: anywhere;
    white-space: normal;
    color: var(--ri-gray-600, #5d616e);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.45;
}

.ripro-v5-child-home-entry__go {
    display: grid;
    place-items: center;
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--ri-primary, #3b6ff5);
    font-size: 0.6875rem;
    transition: transform 220ms ease;
}

.ripro-v5-child-home-entry:hover .ripro-v5-child-home-entry__go {
    transform: translateX(2px);
}

.ripro-v5-child-home-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    background: rgba(59, 111, 245, 0.1);
    color: inherit;
    text-decoration: none;
}

.ripro-v5-child-home-notice.is-warm {
    background: rgba(245, 158, 11, 0.16);
}

.ripro-v5-child-home-notice__text {
    min-width: 0;
}

.ripro-v5-child-home-notice__link {
    flex: none;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ri-primary, #3b6ff5);
}

.ripro-v5-child-home-notice.is-warm .ripro-v5-child-home-notice__link {
    color: #b45309;
}

.ripro-v5-child-home-city:focus-visible,
.ripro-v5-child-home-entry:focus-visible,
.ripro-v5-child-home-more:focus-visible,
.ripro-v5-child-home-notice:focus-visible,
.ripro-v5-child-home-citymore > summary:focus-visible,
.ripro-v5-child-home-search button:focus-visible,
.ripro-v5-child-home-hots a:focus-visible,
.ripro-v5-child-home-chips a:focus-visible {
    outline: 2px solid var(--ri-primary, #3b6ff5);
    outline-offset: 2px;
}

[data-bs-theme="dark"] .ripro-v5-child-home-city {
    background: var(--ri-gray-800, #1a1c23);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--ri-gray-100, #f8f9fb);
}

[data-bs-theme="dark"] .ripro-v5-child-home-entry {
    background: var(--ri-gray-800, #1a1c23);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

[data-bs-theme="dark"] .ripro-v5-child-home-entry .ripro-v5-child-home-entry__desc,
[data-bs-theme="dark"] .ripro-v5-child-home-entry .ripro-v5-child-home-entry__count {
    color: var(--ri-gray-400, #c5cad4);
}

@media (min-width: 768px) {
    .ripro-v5-child-home-hero {
        min-height: 360px;
    }

    .ripro-v5-child-home-hero__title {
        font-size: 2.4rem;
    }

    .is-grid .ripro-v5-child-home-cities {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .ripro-v5-child-home-entries {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .ripro-v5-child-home-cities,
    .is-grid .ripro-v5-child-home-cities {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .ripro-v5-child-home-cities {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }

    .is-grid .ripro-v5-child-home-cities {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .ripro-v5-child-home-entries-wrap > .ripro-v5-child-home-block {
        padding-top: 0.75rem;
        padding-bottom: 0.25rem;
    }

    .ripro-v5-child-home-cities-wrap > .ripro-v5-child-home-block {
        padding-top: 0.5rem;
        padding-bottom: 1rem;
    }

    .ripro-v5-child-home-cities-wrap + .home-last-post > section {
        padding-top: 1.5rem;
    }

    .ripro-v5-child-home-entry {
        display: grid;
        grid-template-columns: 28px minmax(0, 1fr);
        row-gap: 4px;
        min-height: 56px;
        padding: 0.5rem 0.625rem;
    }

    .ripro-v5-child-home-entry__icon {
        grid-column: 1;
        grid-row: 1;
        width: 28px;
        height: 28px;
        border-radius: 9px;
        font-size: 0.8125rem;
    }

    /* 说明占满卡片宽度，避免为横排图标挤小文字或截断内容。 */
    .ripro-v5-child-home-entry__body {
        display: contents;
    }

    .ripro-v5-child-home-entry__name {
        grid-column: 2;
        grid-row: 1;
    }

    .ripro-v5-child-home-entry__count,
    .ripro-v5-child-home-entry__desc {
        grid-column: 1 / -1;
    }

    .ripro-v5-child-home-entry__go {
        display: none;
    }

    .ripro-v5-child-home-notice {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ripro-v5-child-home-entry,
    .ripro-v5-child-home-entry__go,
    .ripro-v5-child-home-city,
    .ripro-v5-child-home-citymore > summary {
        transition: none;
    }

    .ripro-v5-child-home-entry:hover,
    .ripro-v5-child-home-entry:active,
    .ripro-v5-child-home-city:hover,
    .ripro-v5-child-home-city:active,
    .ripro-v5-child-home-citymore > summary:hover {
        transform: none;
    }
}

/* 首页前三页自动加载：自动阶段仅在请求时显示状态，第三页后显示手动按钮。 */
.ripro-v5-child-home-feed
    .ripro-v5-child-hybrid-pagination.is-auto-phase
    .infinite-scroll-action {
    min-height: 40px;
}

.ripro-v5-child-home-feed
    .ripro-v5-child-hybrid-pagination.is-auto-phase
    .infinite-scroll-button {
    display: none;
    pointer-events: none;
}

.ripro-v5-child-home-feed
    .ripro-v5-child-hybrid-pagination.is-auto-phase.is-loading
    .infinite-scroll-button {
    display: flex;
}
