/**
 * 首页样式
 */

/* Hero：标题区 + 搜索条，居中 */
.index-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.35rem;
    padding: 2rem 1rem 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
body.theme-light .index-hero {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}
.index-hero-inner {
    width: 100%;
    max-width: 21rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}
.index-hero-title {
    margin: 0;
    display: inline-block;
    max-width: 100%;
    font-size: clamp(1.95rem, 5.8vw, 2.85rem);
    font-weight: 900;
    letter-spacing: 0;
    word-spacing: -0.04em;
    line-height: 1.18;
    /* 渐变字色 + 缓慢流动 */
    background: linear-gradient(
        110deg,
        var(--text) 0%,
        var(--primary) 32%,
        var(--text) 52%,
        var(--primary) 78%,
        var(--text) 100%
    );
    background-size: 240% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: index-hero-title-flow 10s ease-in-out infinite alternate,
        index-hero-fade-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes index-hero-title-flow {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}
@keyframes index-hero-fade-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* 不支持 background-clip: text 时回退为纯色 */
@supports not (background-clip: text) {
    .index-hero-title {
        -webkit-text-fill-color: unset;
        color: var(--text);
        background: none;
        background-size: auto;
        animation: index-hero-fade-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    }
}
.index-hero-title::after {
    content: '';
    display: block;
    width: 3.5rem;
    height: 0.2rem;
    margin: 0.9rem auto 0;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(22, 186, 170, 0.15),
        var(--primary) 50%,
        rgba(22, 186, 170, 0.15)
    );
    box-shadow: 0 0 20px rgba(22, 186, 170, 0.35);
    transform-origin: center;
    animation: index-hero-underline-pulse 3s ease-in-out infinite;
}
@keyframes index-hero-underline-pulse {
    0%,
    100% {
        opacity: 0.82;
        transform: scaleX(1);
        box-shadow: 0 0 14px rgba(22, 186, 170, 0.28);
    }
    50% {
        opacity: 1;
        transform: scaleX(1.12);
        box-shadow: 0 0 26px rgba(22, 186, 170, 0.48);
    }
}
body.theme-light .index-hero-title::after {
    box-shadow: 0 0 16px rgba(22, 186, 170, 0.28);
}
@media (prefers-reduced-motion: reduce) {
    .index-hero-title {
        animation: none;
        background: linear-gradient(
            105deg,
            var(--text) 0%,
            var(--text) 42%,
            var(--primary) 100%
        );
        background-size: auto;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }
    .index-hero-title::after {
        animation: none;
        transform: none;
    }
    .index-hero-desc,
    .index-search-wrap {
        animation: none;
    }
}
.index-hero-desc {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.6;
    max-width: 34em;
    animation: index-hero-fade-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.1s backwards;
}
.index-search-wrap {
    width: 100%;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.35rem 0.85rem 1.5rem;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    transition: border-color 0.2s, box-shadow 0.2s;
    animation: index-hero-fade-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.22s backwards;
}
.index-search-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(22, 186, 170, 0.12);
}
body.theme-light .index-search-wrap {
    border-color: rgba(0, 0, 0, 0.08);
}
body.theme-light .index-search-wrap:focus-within {
    box-shadow: 0 0 0 2px rgba(22, 186, 170, 0.18);
}
.index-search-wrap .fa {
    color: var(--muted);
    font-size: 1rem;
    flex-shrink: 0;
}
.index-search-wrap input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
}
.index-search-wrap input::placeholder {
    color: var(--muted);
}
.index-search-wrap input:focus {
    outline: none;
}
.index-search-wrap:focus-within input:focus-visible {
    outline: none;
}
a.index-api-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 14px;
}

/* 接口网格 */
.index-api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.75rem;
}

/* 接口卡片（整卡可点击进入详情） */
.index-api-card {
    position: relative;
    display: block;
    background: var(--card);
    border-radius: 14px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
/* 免费接口：绿色边框与阴影，背景默认 */
.index-api-card--free {
    border-color: rgba(34, 197, 94, 0.2);
}
.index-api-card--free:hover {
    border-color: rgba(34, 197, 94, 0.45);
    box-shadow: 0 12px 32px rgba(34, 197, 94, 0.12);
    transform: translateY(-3px);
}
/* 付费接口：整卡橙色（偏亮） */
.index-api-card--pay {
    background: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.35);
}
.index-api-card--pay:hover {
    background: rgba(251, 191, 36, 0.26);
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 12px 32px rgba(251, 191, 36, 0.15);
    transform: translateY(-3px);
}
/* 停用接口：整卡灰色，仍可进入文档 */
.index-api-card--off {
    background: rgba(113, 113, 122, 0.18);
    border-color: rgba(113, 113, 122, 0.3);
    opacity: 0.94;
    cursor: pointer;
}
.index-api-card--off:hover {
    opacity: 1;
    background: rgba(113, 113, 122, 0.22);
    border-color: rgba(161, 161, 170, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}
body.theme-light .index-api-card--free {
    border-color: rgba(34, 197, 94, 0.25);
}
body.theme-light .index-api-card--pay {
    background: rgba(251, 191, 36, 0.18);
    border-color: rgba(251, 191, 36, 0.35);
}
body.theme-light .index-api-card--pay:hover {
    background: rgba(251, 191, 36, 0.25);
}
body.theme-light .index-api-card--off {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
}
body.theme-light .index-api-card--off:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.18);
}
/* 维护中：可进文档，红色状态与呼吸灯（与付费黄、停用灰区分） */
.index-api-card--maint {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.38);
}
.index-api-card--maint:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 12px 32px rgba(239, 68, 68, 0.12);
    transform: translateY(-3px);
}
body.theme-light .index-api-card--maint {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.28);
}
body.theme-light .index-api-card--maint:hover {
    background: rgba(239, 68, 68, 0.13);
}
.index-api-card-tag--maint {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.18);
}
body.theme-light .index-api-card-tag--maint {
    background: rgba(239, 68, 68, 0.1);
}
.index-api-card--maint .index-api-card-status-text {
    color: #f87171;
}
body.theme-light .index-api-card--maint .index-api-card-status-text {
    color: #dc2626;
}
.index-api-card--maint .index-api-card-breath i {
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    animation-name: index-breath-maint;
}
@keyframes index-breath-maint {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50%      { opacity: 0.55; transform: scale(0.85); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
body.theme-light .index-api-card {
    border-color: rgba(0, 0, 0, 0.06);
}
body.theme-light .index-api-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
}
.index-api-card-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    line-height: 1.2;
    padding: 0.3rem 0.65rem;
    border-radius: 5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.index-api-card-tag--free {
    color: #4ade80;
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.28);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}
.index-api-card-tag--pay {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.32);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}
body.theme-light .index-api-card-tag--free {
    color: #15803d;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.22);
    box-shadow: none;
}
body.theme-light .index-api-card-tag--pay {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.28);
    box-shadow: none;
}
.index-api-card-tag--off {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.06);
}
body.theme-light .index-api-card-tag--off {
    background: rgba(0, 0, 0, 0.06);
}
.index-api-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.85rem;
    gap: 0.75rem;
}
.index-api-card-title {
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.index-api-card-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.index-api-card-count .fa {
    font-size: 0.7rem;
    opacity: 0.75;
    color: var(--muted);
}
.index-api-card-count-num {
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
body.theme-light .index-api-card-count-num {
    color: rgba(0, 0, 0, 0.65);
}
.index-api-card-desc {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0 0 1.15rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.55;
}
.index-api-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
body.theme-light .index-api-card-footer {
    border-top-color: rgba(0, 0, 0, 0.06);
}
/* 呼吸灯 + 状态提示 */
.index-api-card-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.index-api-card-status-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
}
.index-api-card--free .index-api-card-status-text {
    color: #22c55e;
}
.index-api-card--pay .index-api-card-status-text {
    color: #f59e0b;
}
.index-api-card--off .index-api-card-status-text {
    color: var(--muted);
}
.index-api-card-breath {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.index-api-card-breath i {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: index-breath 2s ease-in-out infinite;
}
.index-api-card--free .index-api-card-breath i {
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
}
.index-api-card--pay .index-api-card-breath i {
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
}
.index-api-card--off .index-api-card-breath i {
    background: var(--muted);
    box-shadow: 0 0 0 0 rgba(161, 161, 170, 0.3);
}
@keyframes index-breath {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50%      { opacity: 0.5; transform: scale(0.85); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}
.index-api-card--pay .index-api-card-breath i {
    animation-name: index-breath-pay;
}
@keyframes index-breath-pay {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50%      { opacity: 0.5; transform: scale(0.85); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}
.index-api-card--off .index-api-card-breath i {
    animation-name: index-breath-off;
}
@keyframes index-breath-off {
    0%, 100% { opacity: 0.9; transform: scale(1); box-shadow: 0 0 0 0 rgba(161, 161, 170, 0.3); }
    50%      { opacity: 0.4; transform: scale(0.85); box-shadow: 0 0 0 6px rgba(161, 161, 170, 0); }
}

/* 空状态：淡入 */
.index-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
    opacity: 0;
    transition: opacity 0.35s ease;
}
.index-empty.is-visible {
    opacity: 1;
}
.index-empty .fa {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}
.index-empty p {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}
.index-empty-note {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* 分页 */
.index-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}
.index-pagination a,
.index-pagination span {
    display: inline-block;
    min-width: 2.5rem;
    padding: 0.5rem 0.75rem;
    text-align: center;
    background: var(--card);
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.index-pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.index-pagination .current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.index-pagination a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
body.theme-light .index-pagination a,
body.theme-light .index-pagination span {
    border-color: rgba(0, 0, 0, 0.08);
}

/* 尊重“减少动效”系统设置 */
@media (prefers-reduced-motion: reduce) {
    .index-api-card,
    .index-api-card--free:hover,
    .index-api-card--pay:hover,
    .index-api-card--off:hover {
        transform: none;
    }
    .index-api-card-breath i {
        animation: none;
        opacity: 0.9;
    }
}

/* 首页友情链接 */
.index-links {
    margin-top: 2.5rem;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
body.theme-light .index-links {
    border-top-color: rgba(0, 0, 0, 0.08);
}
.index-links-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
    margin: 0 0 1rem;
}
.index-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}
.index-links-item,
.index-links-more {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    padding-bottom: 0.2rem;
    transition: color 0.2s;
}
.index-links-ico {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 3px;
}
.index-links-item::after,
.index-links-more::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.25s ease;
}
.index-links-item {
    color: var(--primary);
}
.index-links-item:hover::after,
.index-links-more:hover::after {
    transform: scaleX(1);
}
.index-links-more {
    color: var(--muted);
}
.index-links-more:hover {
    color: var(--primary);
}
@media (max-width: 768px) {
    .index-hero {
        padding: 1.1rem 0.75rem 1.35rem;
    }
    .index-search-wrap {
        padding: 0.7rem 1rem 0.7rem 1.15rem;
        gap: 0.65rem;
    }
    .index-api-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1.25rem;
    }
    .index-api-card {
        padding: 1.125rem;
    }
    .index-links {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
}
