/* ===================================
   Cardart 首页自定义样式 - custom-index.css
   =================================== */
/* 搜索栏样式已迁移到 custom-theme.css（全站生效），这里保留首页专属样式。 */

/* Index layout: add breathing room between aside and main */
.page-index.joe_main_container {
    column-gap: 32px;
    align-items: flex-start;
}

.page-index.joe_main_container .joe_aside {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* ===================================
   首页公告（导航条与搜索栏下方）
   =================================== */

.joe_home_notice_wrap {
    margin: 8px 0 0;
}

.joe_home_notice_container {
    display: block;
    margin-bottom: 0 !important;
}

.joe_home_notice {
    background: var(--sib-background, rgba(255, 255, 255, 0.88));
    border-radius: var(--radius, 8px);
    border: 1px solid var(--classC, rgba(0, 0, 0, 0.06));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    width: 100%;
    max-width: none;
}

.joe_home_notice__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--classC, rgba(0, 0, 0, 0.06));
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.16), transparent 55%);
}

.joe_home_notice__title {
    font-size: 14px;
    font-weight: 800;
    color: var(--main, #1a1a1a);
    letter-spacing: 0.02em;
}

.joe_home_notice__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 14px 14px;
}

.joe_home_notice__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease,
        border-color 0.2s ease;
    outline: none;
    color: var(--main, #1a1a1a);
    border-radius: 12px;
    border: 1px solid rgba(168, 85, 247, 0.18);
    background: var(--glass-background, rgba(255, 255, 255, 0.72));
}

.joe_home_notice__row + .joe_home_notice__row {
    border-top: none;
}

.joe_home_notice__row:hover {
    background: var(--sib-background, rgba(255, 255, 255, 0.88));
    border-color: rgba(168, 85, 247, 0.32);
    box-shadow: 0 14px 34px rgba(30, 16, 70, 0.12);
    transform: translateY(-1px);
}

.joe_home_notice__row:active {
    transform: translateY(1px);
}

.joe_home_notice__row:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(168, 85, 247, 0.40);
}

@media (max-width: 768px) {
    .joe_home_notice__list {
        display: grid;
        grid-template-columns: repeat(var(--joe-home-notice-count, 1), minmax(0, 1fr));
        gap: 12px;
        overflow-x: clip;
        overflow-y: hidden;
        padding: 12px 14px 14px;
    }

    .joe_home_notice__row {
        min-width: 0;
        flex: initial;
    }
}

.joe_home_notice__badge {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--classA, #f0f0f2);
    color: var(--theme, #1890ff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.joe_home_notice__arrow {
    margin-left: auto;
    color: var(--minor, #888);
    font-size: 14px;
    flex-shrink: 0;
}

.joe_home_notice__marquee {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}

.joe_home_notice__marquee-inner {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    will-change: transform;
}

.joe_home_notice__row.is-anim .joe_home_notice__marquee-inner {
    animation: joeNoticeMarqueeLTR var(--joe-notice-duration, 12s) linear infinite;
}

.joe_home_notice__row.is-static .joe_home_notice__marquee-inner {
    animation: none !important;
    transform: translateX(0) !important;
}

.joe_home_notice__full {
    display: none;
}

.joe_home_notice__text {
    color: inherit;
    display: inline-block;
    flex-shrink: 0;
}

.joe_home_notice__text--clone {
    margin-left: var(--joe-notice-gap, 40px);
}

@keyframes joeNoticeMarqueeLTR {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-1 * var(--joe-notice-distance, 0px)));
    }
}

/* 公告弹窗 */
html.joe_home_notice--open {
    overflow: hidden;
}

.joe_home_notice_modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.joe_home_notice_modal.active {
    display: flex;
}

.joe_home_notice_modal__mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
}

.joe_home_notice_modal__card {
    position: relative;
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    background: var(--sib-background, rgba(255, 255, 255, 0.92));
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    transform: translateY(6px) scale(0.98);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.joe_home_notice_modal.active .joe_home_notice_modal__card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.joe_home_notice_modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.joe_home_notice_modal__title {
    font-size: 15px;
    font-weight: 900;
    color: var(--main, #1a1a1a);
}

.joe_home_notice_modal__close {
    border: none;
    background: transparent;
    color: var(--minor, #888);
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.joe_home_notice_modal__close:hover {
    background: var(--classD, #f5f5f7);
    color: var(--main, #1a1a1a);
}

.joe_home_notice_modal__content {
    padding: 14px 16px 18px;
    color: var(--routine, #333);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-line;
    overflow: auto;
    max-height: calc(100vh - 140px);
}

/* 首页进站弹窗 */
html.joe_home_popup--open {
    overflow: hidden;
}

.joe_home_entry_popup {
    position: fixed;
    inset: 0;
    z-index: 2300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.joe_home_entry_popup.active {
    display: flex;
}

.joe_home_entry_popup__mask {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at top, rgba(167, 107, 255, 0.18), rgba(0, 0, 0, 0.48)),
        rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

.joe_home_entry_popup__card {
    position: relative;
    width: min(640px, 100%);
    max-height: calc(100vh - 36px);
    border-radius: 18px;
    border: 1px solid rgba(167, 107, 255, 0.40);
    background: linear-gradient(180deg, rgba(238, 231, 255, 0.98) 0%, rgba(250, 248, 255, 0.96) 100%);
    box-shadow:
        0 24px 80px rgba(37, 16, 90, 0.35),
        0 0 0 1px rgba(167, 107, 255, 0.14) inset;
    overflow: hidden;
    transform: translateY(10px) scale(0.97);
    opacity: 0;
    animation: joeHomeEntryPopIn 0.28s ease forwards;
}

.joe_home_entry_popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(124, 58, 237, 0.16);
    background: rgba(255, 255, 255, 0.74);
    color: #5f3cb6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.joe_home_entry_popup__close:hover {
    transform: rotate(90deg);
    background: rgba(124, 58, 237, 0.12);
    color: #4c1d95;
}

.joe_home_entry_popup__head {
    padding: 24px 56px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(124, 58, 237, 0.16);
}

.joe_home_entry_popup__title {
    font-size: clamp(22px, 3.4vw, 30px);
    font-weight: 900;
    letter-spacing: 0.06em;
    color: #5b2fc6;
    text-shadow: 0 3px 18px rgba(124, 58, 237, 0.20);
}

.joe_home_entry_popup__content {
    padding: 18px 24px 24px;
    font-size: 16px;
    line-height: 1.9;
    color: #3f335a;
    white-space: pre-line;
    text-align: center;
    overflow: auto;
    max-height: calc(100vh - 190px);
}

@keyframes joeHomeEntryPopIn {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .joe_home_entry_popup {
        padding: 12px;
    }

    .joe_home_entry_popup__head {
        padding: 20px 48px 14px;
    }

    .joe_home_entry_popup__content {
        padding: 16px 16px 20px;
        font-size: 15px;
        line-height: 1.75;
    }
}

/* ===================================
   分类文章卡片区域
   =================================== */

.joe_category_sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 每个分类区块 */
.joe_category_section {
    background: var(--background, #fff);
    border-radius: var(--radius, 8px);
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* 分类标题栏 */
.joe_category_section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.joe_category_section__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--main, #1a1a1a);
    position: relative;
    padding-left: 12px;
}

.joe_category_section__title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: var(--theme, #1890ff);
}

.joe_category_section__more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--classA, #f5f5f7);
    color: var(--minor, #666);
    transition: all 0.3s ease;
    text-decoration: none;
}

.joe_category_section__more:hover {
    background: var(--theme, #1890ff);
    color: #fff;
    transform: translateX(2px);
}

/* 文章卡片网格 */
.joe_category_section__posts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* 单个文章卡片 */
.joe_post_card {
    display: flex;
    flex-direction: column;
    background: var(--background, #fff);
    border-radius: var(--radius-inner, 6px);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.joe_post_card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 封面图区域 - 约占卡片50%高度 */
.joe_post_card__cover {
    position: relative;
    width: 100%;
    padding-top: 52%;
    overflow: hidden;
    background: var(--classA, #f0f0f2);
}

.joe_post_card__cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.joe_post_card:hover .joe_post_card__cover img {
    transform: scale(1.05);
}

/* 卡片标题 */
.joe_post_card__title {
    margin: 12px 14px 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--main, #1a1a1a);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 卡片摘要 */
.joe_post_card__excerpt {
    margin: 0 14px 14px;
    font-size: 13px;
    color: var(--minor, #888);
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

/* ===================================
   响应式适配
   =================================== */

/* 平板 */
@media (max-width: 1024px) {
    .joe_category_section__posts {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机 */
@media (max-width: 768px) {
    .joe_search_bar {
        top: 50px;
        padding: 8px 0;
    }

    .joe_search_bar__inner {
        max-width: 100%;
        height: 40px;
        margin: 0 15px;
    }

    .joe_category_sections {
        gap: 12px;
    }

    .joe_category_section {
        padding: 14px;
        border-radius: 6px;
    }

    .joe_category_section__posts {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ===================================
   无限加载与交互样式
   =================================== */

/* 激活状态的分类区块（展开后） */
.joe_category_section.active {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* 箭头旋转动画 */
.joe-icon-arrow-down {
    display: inline-block;
    animation: rotateDown 0.3s forwards;
}

@keyframes rotateDown {
    from {
        transform: rotate(-90deg);
    }

    to {
        transform: rotate(0deg);
    }
}

/* 加载中指示器 */
.joe_category_loading {
    grid-column: 1 / -1;
    /* 跨越所有列 */
    text-align: center;
    padding: 20px 0;
    color: var(--minor, #888);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.joe-loading-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 哨兵元素（用于 IntersectionObserver） */
.joe_sentinel {
    height: 1px;
    width: 100%;
    grid-column: 1 / -1;
    opacity: 0;
}

/* 悬浮关闭按钮 */
#joe_close_expand {
    position: fixed;
    right: 30px;
    bottom: 80px;
    /* 位于回到顶部按钮上方 */
    background: var(--theme, #303133);
    /* 深色背景 */
    color: #fff;
    padding: 10px 16px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
    /* 隐藏时不可点击 */
}

#joe_close_expand.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#joe_close_expand:hover {
    background: var(--main, #1a1a1a);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* 适配移动端 */
@media (max-width: 768px) {
    #joe_close_expand {
        right: 20px;
        bottom: 15px;
        /* 移动端在底部 */
        padding: 8px 14px;
    }
}
