/* =============================================================
 *  index.css - 导航页 (/index.html) 专属样式
 *  依赖 theme.css
 * ============================================================= */

/* ===================== Hero / Search ===================== */
.hero {
    text-align: center;
    margin: 18px auto 36px;
    max-width: 820px;
}
.hero h2 {
    font-size: clamp(28px, 4.2vw, 48px);
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.15;
    background: linear-gradient(90deg, #fff, #c5d2ff 30%, #b693ff 65%, #19f7ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero h2 .char {
    display: inline-block;
    will-change: transform, opacity;
}
.hero p {
    margin-top: 14px;
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.7;
}
.search-wrap {
    position: relative;
    max-width: 540px;
    margin: 28px auto 6px;
}
.search-wrap .icon-left {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-mute);
    pointer-events: none;
}
.search-input {
    width: 100%;
    padding: 16px 50px 16px 50px;
    font-size: 15px;
    color: var(--text);
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    outline: none;
    transition: all .25s ease;
}
.search-input::placeholder { color: var(--text-mute); }
.search-input:focus {
    border-color: rgba(108, 140, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(108, 140, 255, 0.18);
}
.kbd-hint {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--text-mute);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
}

/* 分类筛选 */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 18px;
}
.filter-chip {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 999px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-soft);
    cursor: pointer;
    user-select: none;
    transition: all .25s ease;
}
.filter-chip:hover { color: var(--text); }
.filter-chip.active {
    background: linear-gradient(135deg, rgba(108, 140, 255, 0.45), rgba(176, 107, 255, 0.45));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(108, 140, 255, 0.35);
}

/* ===================== 卡片网格 ===================== */
.grid {
    margin-top: 36px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    perspective: 1200px;
}

.card {
    position: relative;
    padding: 22px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: var(--glass-shadow);
    cursor: pointer;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1),
        box-shadow .35s ease,
        border-color .35s ease,
        background .35s ease;
}

/* 流光描边 */
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(108, 140, 255, 0.55),
            rgba(176, 107, 255, 0.15) 40%,
            rgba(25, 247, 255, 0.55));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}
/* 鼠标位置光斑 */
.card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%),
            rgba(108, 140, 255, 0.18), transparent 40%);
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    background: var(--glass-bg-strong);
}
.card:hover::before { opacity: 1; }
.card:hover::after { opacity: 1; }

.card-name {
    margin-top: 4px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text);
}
.card-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-mute);
    display: flex;
    align-items: center;
    gap: 6px;
}
.card-url {
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(255, 255, 255, 0.06);
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
}
.btn-mini {
    flex: 1;
    text-align: center;
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: all .2s ease;
}
.btn-mini:hover {
    background: linear-gradient(135deg, rgba(108, 140, 255, 0.4), rgba(176, 107, 255, 0.4));
    border-color: transparent;
    transform: translateY(-1px);
}
.btn-mini.primary {
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(108, 140, 255, 0.35);
}

/* 键盘聚焦态 */
.card.focused {
    outline: 2px solid rgba(108, 140, 255, 0.65);
    outline-offset: 4px;
    background: var(--glass-bg-strong);
}

.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-mute);
}
.empty h3 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 8px;
}

/* ===================== 模态预览 ===================== */
.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(5, 6, 15, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 4vmin;
}
.modal-mask.show { display: flex; }

.modal {
    width: min(1100px, 96vw);
    height: min(78vh, 800px);
    background: rgba(15, 18, 40, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: center;
}
.modal-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}
.traffic {
    display: inline-flex;
    gap: 7px;
}
.traffic span {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
}
.traffic .r { background: #ff5f57; }
.traffic .y { background: #ffbd2e; }
.traffic .g { background: #28c840; }

.modal-title {
    flex: 1;
    font-size: 13px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-title img {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    object-fit: cover;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all .2s ease;
}
.icon-btn:hover {
    background: linear-gradient(135deg, rgba(108, 140, 255, 0.5), rgba(176, 107, 255, 0.5));
    border-color: transparent;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.close:hover {
    background: linear-gradient(135deg, #ff5f57, #ff5fb1);
}

.modal-body {
    flex: 1;
    position: relative;
    background: #ffffff;
}
.modal-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}
.modal-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #333;
    background: #f6f7fb;
    font-size: 13px;
}
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e1e6f0;
    border-top-color: #6c8cff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 点击波纹 */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
}

/* 移动端 */
@media (max-width: 720px) {
    .card { padding: 18px; }
    .modal { height: 86vh; }
}
