/* Astral 目录模块 —— 跟随 zibll 主题变量，浅色 / 深色自适应 */

.astral-module-widget {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

.astral-mod {
    --am-ink: #20242c;
    --am-muted: #727884;
    --am-faint: #98a0ac;
    --am-line: #e7e9ed;
    --am-soft: #f2f4f8;
    --am-surface: #ffffff;
    --am-surface-2: #f8f9fb;
    --am-accent: var(--focus-color, #315ddc);
    --am-gold: #d69519;
    --am-green: #2f8f63;
    --am-green-bg: #e9f7f0;
    color: var(--am-ink);
    font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.dark-theme .astral-mod {
    --am-ink: #f1f1f3;
    --am-muted: #b6b6bf;
    --am-faint: #8c8c96;
    --am-line: #2d2d35;
    --am-soft: #24242a;
    --am-surface: #1b1b20;
    --am-surface-2: #202026;
    --am-green: #6ee7a8;
    --am-green-bg: rgba(47, 143, 99, 0.18);
}

.astral-mod *,
.astral-mod *::before,
.astral-mod *::after {
    box-sizing: border-box;
}

.astral-mod a {
    color: inherit;
    text-decoration: none;
}

.astral-mod .am-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* Hero ------------------------------------------------------------------ */

.astral-mod-hero {
    background: transparent;
    border: 0;
}

.am-hero {
    padding-top: 56px;
    padding-bottom: 40px;
    text-align: center;
}

.am-eyebrow {
    margin: 0 0 10px;
    color: var(--am-accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.am-hero-title {
    margin: 0 0 12px;
    color: var(--am-ink);
    font-size: 44px;
    line-height: 1.15;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.am-hero-desc {
    max-width: 640px;
    margin: 0 auto 24px;
    color: var(--am-muted);
    font-size: 16px;
}

.am-search {
    display: flex;
    gap: 8px;
    max-width: 560px;
    margin: 0 auto 18px;
    padding: 6px;
    background: var(--am-surface-2);
    border: 1px solid var(--am-line);
    border-radius: 12px;
}

.am-search input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--am-ink);
    font-size: 15px;
}

.am-search input::placeholder {
    color: var(--am-faint);
}

.am-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: 1px solid var(--am-line);
    border-radius: 8px;
    background: var(--am-surface);
    color: var(--am-ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.am-btn:hover {
    border-color: var(--am-accent);
    color: var(--am-accent);
}

.am-btn-primary {
    background: var(--am-accent);
    border-color: var(--am-accent);
    color: #fff;
}

.am-btn-primary:hover {
    background: var(--am-accent);
    border-color: var(--am-accent);
    color: #fff;
    opacity: 0.88;
}

.am-search .am-btn {
    padding-left: 20px;
    padding-right: 20px;
}

.am-hero-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0 0 18px;
}

.am-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--am-soft);
    color: var(--am-muted);
    font-size: 12px;
    white-space: nowrap;
}

.am-chip-link:hover {
    color: var(--am-accent);
}

.am-chip-kind {
    background: color-mix(in srgb, var(--am-accent) 10%, transparent);
    color: var(--am-accent);
}

/* 数据条 ---------------------------------------------------------------- */

.astral-mod-stats {
    border-bottom: 1px solid var(--am-line);
}

.am-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 40px;
    padding-top: 18px;
    padding-bottom: 18px;
}

.am-stat strong {
    margin-right: 6px;
    color: var(--am-ink);
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.am-stat span {
    color: var(--am-muted);
    font-size: 12px;
}

/* 区块标题 -------------------------------------------------------------- */

.astral-mod-featured,
.astral-mod-categories,
.astral-mod-category_section {
    padding-top: 36px;
}

.am-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.am-section-head h2 {
    margin: 0;
    color: var(--am-ink);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.am-more {
    color: var(--am-accent);
    font-size: 13px;
    white-space: nowrap;
}

.am-more:hover {
    text-decoration: underline;
}

/* 卡片 ------------------------------------------------------------------ */

.am-grid {
    display: grid;
    grid-template-columns: repeat(var(--am-columns, 4), minmax(0, 1fr));
    gap: 14px;
}

.am-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: "logo body side" "logo meta side";
    gap: 5px 12px;
    align-items: start;
    padding: 14px;
    background: var(--am-surface);
    border: 1px solid var(--am-line);
    border-radius: 14px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.am-card:hover {
    border-color: color-mix(in srgb, var(--am-accent) 40%, var(--am-line));
    transform: translateY(-1px);
}

.am-card-logo {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border: 1px solid var(--am-line);
    border-radius: 10px;
    background: var(--am-soft);
    color: var(--am-muted);
    font-size: 18px;
}

.am-card-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.am-card-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.am-card-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.am-card-title strong {
    color: var(--am-ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.am-card:hover .am-card-title strong {
    color: var(--am-accent);
}

.am-card-desc {
    display: -webkit-box;
    overflow: hidden;
    color: var(--am-muted);
    font-size: 13px;
    line-height: 1.55;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.am-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.am-card-side {
    grid-area: side;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    align-self: stretch;
    height: 100%;
    padding-top: 2px;
}

.am-badge {
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.am-badge-verified {
    background: var(--am-green-bg);
    color: var(--am-green);
}

.am-badge-official {
    background: color-mix(in srgb, var(--am-accent) 10%, transparent);
    color: var(--am-accent);
}

.am-card-side > .am-heat:last-child {
    margin-top: auto;
}

.am-heat {
    color: var(--am-faint);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.am-heat-score {
    color: var(--am-gold);
    font-weight: 600;
}

/* 分类网格 -------------------------------------------------------------- */

.am-cat-grid {
    display: grid;
    grid-template-columns: repeat(var(--am-columns, 4), minmax(0, 1fr));
    gap: 12px;
}

.am-cat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--am-surface);
    border: 1px solid var(--am-line);
    border-radius: 12px;
    transition: border-color 0.15s ease;
}

.am-cat:hover {
    border-color: color-mix(in srgb, var(--am-accent) 40%, var(--am-line));
}

.am-cat-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--am-soft);
    color: var(--am-cat-color, var(--am-accent));
    font-size: 15px;
}

.am-cat-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.35;
}

.am-cat-body strong {
    overflow: hidden;
    color: var(--am-ink);
    font-size: 14px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.am-cat-count {
    color: var(--am-faint);
    font-size: 12px;
}

/* 收录引导 -------------------------------------------------------------- */

.astral-mod-submit {
    padding-top: 40px;
    padding-bottom: 56px;
}

.am-submit-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 32px;
    border: 1px solid var(--am-line);
    border-radius: 16px;
    background: var(--am-surface-2);
}

.am-submit-panel h2 {
    margin: 0 0 6px;
    color: var(--am-ink);
    font-size: 20px;
    font-weight: 600;
}

.am-submit-panel p {
    margin: 0;
    color: var(--am-muted);
    font-size: 14px;
}

/* 内容区 ---------------------------------------------------------------- */

.astral-modules-main {
    padding-top: 32px;
    padding-bottom: 32px;
}

.fluid-widget-wrap.astral-modules-fluid {
    background: transparent !important;
}

.astral-modules-fluid .zib-widget {
    margin-bottom: 0;
}

/* 响应式 ---------------------------------------------------------------- */

@media (max-width: 1100px) {
    .am-grid,
    .am-cat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .am-hero-title {
        font-size: 34px;
    }

    .am-grid,
    .am-cat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .am-hero {
        padding-top: 40px;
    }
}

@media (max-width: 560px) {
    .astral-mod .am-wrap {
        padding-left: 18px;
        padding-right: 18px;
    }

    .am-hero-title {
        font-size: 28px;
    }

    .am-search {
        flex-direction: column;
    }

    .am-search .am-btn {
        width: 100%;
    }

    .am-grid,
    .am-cat-grid {
        grid-template-columns: 1fr;
    }

    .am-submit-panel {
        flex-direction: column;
        align-items: flex-start;
        padding: 22px;
    }

    .am-stats {
        gap: 10px 24px;
    }
}

/* 模块布局样式：A 卡片 / B 编辑式 / C 紧凑 */
.am-num { display: none; }

.astral-mod.style-b .am-hero { text-align: left; }
.astral-mod.style-b .am-hero-title { font-size: 52px; letter-spacing: -0.035em; }
.astral-mod.style-b .am-hero-desc { margin-left: 0; max-width: 680px; }
.astral-mod.style-b .am-search { margin-left: 0; }
.astral-mod.style-b .am-hero-chips { justify-content: flex-start; }
.astral-mod.style-b .am-stats { justify-content: flex-start; }
.astral-mod.style-b .am-section-head h2 { font-size: 24px; }
.astral-mod.style-b .am-grid { grid-template-columns: 1fr; gap: 0; border-top: 1px solid var(--am-line); }
.astral-mod.style-b .am-card {
    grid-template-columns: 34px 44px minmax(0, 1fr) auto;
    grid-template-areas: "num logo body side" "num logo meta side";
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--am-line);
    border-radius: 0;
    padding: 15px 0;
    transform: none;
}
.astral-mod.style-b .am-card:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--am-accent) 6%, transparent), transparent 60%); transform: none; }
.astral-mod.style-b .am-num { display: block; grid-area: num; color: var(--am-faint); font-size: 11px; padding-top: 4px; }
.astral-mod.style-b .am-card-title strong { font-size: 18px; }
.astral-mod.style-b .am-card-desc { -webkit-line-clamp: 1; font-size: 13px; }
.astral-mod.style-b .am-cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--am-line); }
.astral-mod.style-b .am-cat { background: transparent; border: 0; border-bottom: 1px solid var(--am-line); border-radius: 0; padding: 12px 0; }

.astral-mod.style-c .am-hero { text-align: left; padding-top: 28px; padding-bottom: 18px; }
.astral-mod.style-c .am-hero-title { font-size: 30px; }
.astral-mod.style-c .am-hero-desc { margin-left: 0; font-size: 13px; margin-bottom: 14px; }
.astral-mod.style-c .am-search { margin-left: 0; max-width: none; }
.astral-mod.style-c .am-hero-chips { justify-content: flex-start; }
.astral-mod.style-c .am-stats { justify-content: flex-start; padding-top: 10px; padding-bottom: 10px; }
.astral-mod.style-c .am-section-head h2 { font-size: 18px; }
.astral-mod.style-c .am-grid { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--am-line); border-radius: 8px; overflow: hidden; }
.astral-mod.style-c .am-card {
    grid-template-columns: 32px minmax(0, 1fr) 220px 58px;
    grid-template-areas: "logo body meta side";
    align-items: center;
    gap: 10px;
    border: 0;
    border-bottom: 1px solid var(--am-line);
    border-radius: 0;
    padding: 9px 12px;
    background: var(--am-surface);
}
.astral-mod.style-c .am-card:last-child { border-bottom: 0; }
.astral-mod.style-c .am-card-logo { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; }
.astral-mod.style-c .am-card-title strong { font-size: 13px; }
.astral-mod.style-c .am-card-desc { -webkit-line-clamp: 1; font-size: 11.5px; }
.astral-mod.style-c .am-card-meta { flex-wrap: nowrap; overflow: hidden; }
.astral-mod.style-c .am-card .am-chip,
.astral-mod.style-c .am-card .am-badge { font-size: 10px; padding: 2px 7px; white-space: nowrap; }
.astral-mod.style-c .am-cat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.astral-mod.style-c .am-cat { padding: 8px 10px; border-radius: 8px; gap: 8px; }
.astral-mod.style-c .am-cat-icon { width: 26px; height: 26px; font-size: 12px; }

@media (max-width: 900px) {
    .astral-mod.style-b .am-hero-title { font-size: 38px; }
    .astral-mod.style-c .am-card { grid-template-columns: 30px minmax(0, 1fr); grid-template-areas: "logo body" "logo meta"; }
    .astral-mod.style-c .am-card .am-card-side { display: none; }
    .astral-mod.style-c .am-cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .astral-mod.style-b .am-hero-title { font-size: 30px; }
    .astral-mod.style-b .am-card { grid-template-columns: 26px 40px minmax(0, 1fr); grid-template-areas: "num logo body" "num logo meta"; }
    .astral-mod.style-b .am-card-side { display: none; }
    .astral-mod.style-c .am-cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* B 方向：hero 不再有白板背景 */
.astral-mod.style-b {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.astral-mod.style-b .astral-mod-hero,
.astral-mod.style-b .am-hero {
    background: transparent;
    border: 0;
}

/* B hero：左文案 + 右目录信息 */
.am-hero-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 48px;
    align-items: start;
    text-align: left;
    padding-top: 44px;
    padding-bottom: 34px;
}

.am-hero-copy {
    min-width: 0;
}

.am-hero-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.am-side-card {
    padding: 14px;
    border: 1px solid var(--am-line);
    border-radius: 12px;
    background: var(--am-surface-2);
}

.am-side-card h3 {
    margin: 0 0 10px;
    color: var(--am-faint);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.am-side-stats {
    display: flex;
    gap: 18px;
}

.am-side-stats span {
    display: flex;
    flex-direction: column;
    color: var(--am-faint);
    font-size: 10px;
}

.am-side-stats b {
    color: var(--am-ink);
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.am-side-links {
    display: flex;
    flex-direction: column;
}

.am-side-links a {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--am-line);
    color: var(--am-ink);
    font-size: 12px;
}

.am-side-links a:last-child {
    border-bottom: 0;
}

.am-side-links a:hover {
    color: var(--am-accent);
}

.am-side-links small {
    color: var(--am-faint);
    font-variant-numeric: tabular-nums;
}

/* B 分类：tile 网格，避免一行只有两个空条目 */
.astral-mod.style-b .astral-mod-categories {
    padding-top: 18px;
}

.astral-mod.style-b .am-cat-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    border-top: 0;
}

.astral-mod.style-b .am-cat {
    padding: 14px;
    border: 1px solid var(--am-line);
    border-radius: 12px;
    background: var(--am-surface);
}

.astral-mod.style-b .am-cat:hover {
    border-color: color-mix(in srgb, var(--am-accent) 40%, var(--am-line));
}

/* 说明步骤 */
.am-steps-section {
    padding-top: 36px;
}

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

.am-step {
    padding: 16px;
    border: 1px solid var(--am-line);
    border-radius: 12px;
    background: var(--am-surface);
}

.am-step span {
    color: var(--am-accent);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.am-step h3 {
    margin: 6px 0 6px;
    color: var(--am-ink);
    font-size: 14px;
    font-weight: 600;
}

.am-step p {
    margin: 0;
    color: var(--am-muted);
    font-size: 12.5px;
    line-height: 1.65;
}

.am-steps-code {
    margin-top: 14px;
}

@media (max-width: 900px) {
    .am-hero-split {
        grid-template-columns: 1fr;
        gap: 20px;
        padding-top: 28px;
    }

    .am-hero-side {
        display: none;
    }

    .astral-mod.style-b .am-cat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .am-steps {
        grid-template-columns: 1fr;
    }
}

.am-steps-code {
    margin: 14px 0 0;
    padding: 14px;
    border: 1px solid var(--am-line);
    border-radius: 10px;
    background: var(--am-surface-2);
    color: var(--am-ink);
    font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
    overflow-x: auto;
    white-space: pre;
}

/* 每个模块独立板块框（hero 作为页头保持开放） */
.astral-mod:not(.astral-mod-hero) > .am-wrap {
    max-width: 1350px;
    margin: 18px auto;
    padding: 26px 28px;
    background: var(--am-surface);
    border: 1px solid var(--am-line);
    border-radius: 16px;
}

@media (max-width: 700px) {
    .astral-mod:not(.astral-mod-hero) > .am-wrap {
        margin: 12px 14px;
        padding: 20px 18px;
    }
}

.am-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.am-section-head .am-section-link { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--am-muted); white-space: nowrap; }
.am-section-head .am-section-link:hover { color: var(--am-accent); }
.am-section-head .am-section-link .ic, .am-section-head .am-section-link svg { width: 12px; height: 12px; }
