/**
 * Homepage — 百鸣软件首页样式（由 index.php 内联样式迁出）
 */

/* 配色与字号基准：/assets/css/design-tokens.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.is-home {
    font-family: var(--bm-font-sans);
    font-size: var(--bm-text-base);
    line-height: var(--bm-leading-normal);
    color: var(--bm-ink-2);
    background-color: var(--bm-surface-muted);
    padding-top: clamp(4.25rem, 11vw, 4.75rem);
    -webkit-font-smoothing: antialiased;
}

/* Header: shared in assets/css/site.css (.bm-header) */

/* Hero — static background only (no continuous repaints / heavy DOM) */
.hero-section {
    background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(255, 255, 255, 0.08) 0%, transparent 55%),
        linear-gradient(180deg, #0a0a0a 0%, #050505 55%, #0a0a0a 100%);
    padding: clamp(4rem, 12vw, 7.5rem) 0 clamp(3rem, 8vw, 5.5rem);
    margin-top: 0;
    color: var(--bm-fg-on-dark);
    position: relative;
    overflow: visible;
    border-bottom: 1px solid var(--bm-line-on-dark);
    contain: layout style;
    /* 整块高于下方浅色区块，避免候选下拉溢出时被「软件分类」等盖住 */
    z-index: 10;
    isolation: isolate;
}

.hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.38;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 64px 64px;
}

.hero-section::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image:
        radial-gradient(circle at 20% 28%, rgba(255, 255, 255, 0.06) 0, transparent 45%),
        radial-gradient(circle at 82% 64%, rgba(255, 255, 255, 0.04) 0, transparent 42%);
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: var(--bm-text-4xl);
    font-weight: 600;
    letter-spacing: -0.04em;
    margin-bottom: var(--bm-space-5);
    line-height: var(--bm-leading-tight);
}

.hero-subtitle {
    font-size: var(--bm-text-md);
    margin-bottom: 0.75rem;
    opacity: 0.72;
    font-weight: 400;
    letter-spacing: 0.02em;
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
}

/* Search Box */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 30;
}

.search-rim {
    position: relative;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.22));
}

.search-container:has(.search-suggestions:not(.d-none)) .search-rim {
    border-radius: 12px 12px 0 0;
}

.search-container:has(.search-suggestions:not(.d-none)) .search-rim form {
    border-radius: 11px 11px 0 0;
}

.search-container:has(.search-suggestions:not(.d-none)) .search-box {
    border-radius: 10px 10px 0 0;
}

.search-rim form {
    position: relative;
    border-radius: 11px;
    overflow: hidden;
    background: #fff;
}

.search-box {
    background: #fff;
    border-radius: 10px;
    padding: 0.95rem 1.1rem;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 18px 50px rgba(0, 0, 0, 0.35);
    border: none;
    font-size: 1rem;
    width: 100%;
    color: var(--bm-ink);
}

.search-box::placeholder {
    color: #737373;
}

.search-box:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(255, 255, 255, 0.25), 0 20px 55px rgba(0, 0, 0, 0.4);
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    border: none;
    border-radius: 10px;
    width: 48px;
    height: 40px;
    color: white;
    font-size: 1.2rem;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.search-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-50%) scale(1.04);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.search-btn:active {
    transform: translateY(-50%) scale(0.98);
}

/* Categories Section */
.categories-section {
    padding: 5rem 0;
    background: var(--bg-light);
    content-visibility: auto;
    contain-intrinsic-size: 1px 480px;
    position: relative;
    z-index: 0;
}

.section-title {
    text-align: center;
    font-size: var(--bm-text-3xl);
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: var(--bm-space-3);
    color: var(--text-dark);
}

.section-subtitle {
    text-align: center;
    font-size: var(--bm-text-sm);
    color: var(--text-light);
    margin-bottom: 2.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

.category-card {
    background: #fff;
    border-radius: 14px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease, border-color 0.28s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
    height: 100%;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0);
    transition: box-shadow 0.28s ease;
    pointer-events: none;
}

.category-card:hover::before {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.category-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.025) 2px,
        rgba(0, 0, 0, 0.025) 4px
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.category-card:hover::after {
    opacity: 1;
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.12);
}

.category-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.category-card:hover .category-icon {
    transform: scale(1.06) translateY(-2px);
}

.category-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.category-description {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.category-count {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-card:hover .category-count {
    transform: scale(1.03);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* Featured Software */
.featured-section {
    padding: 5rem 0;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    content-visibility: auto;
    contain-intrinsic-size: 1px 520px;
    position: relative;
    z-index: 0;
}

.hero-tagline {
    font-size: var(--bm-text-xs);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.5;
    margin-bottom: 2rem;
}

.software-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease, border-color 0.28s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
    height: 100%;
    cursor: pointer;
    position: relative;
}

.software-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 55%,
        rgba(0, 0, 0, 0.04) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.software-card:hover::after {
    opacity: 1;
}

.software-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.12);
}

.software-image {
    height: 200px;
    background: linear-gradient(160deg, #f5f5f5 0%, #e5e5e5 50%, #d4d4d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #404040;
    position: relative;
    transition: filter 0.3s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.software-card:hover .software-image {
    filter: contrast(1.03);
}

html.bm-lite .software-card:hover .software-image {
    filter: none;
}

html.bm-lite .category-card:hover {
    transform: translateY(-2px);
}

html.bm-lite .software-card:hover {
    transform: translateY(-2px);
}

.software-content {
    padding: 1.5rem;
    position: relative;
    z-index: 2;
    background: #fff;
}

.software-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.software-description {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-suggestions {
    position: absolute !important;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 0;
    width: 100%;
    min-height: 0;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    background-color: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-top: none;
    border-radius: 0 0 10px 10px !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14) !important;
}

.search-suggestions.search-suggestions--open {
    animation: suggestPanelIn 0.2s ease-out;
}

@keyframes suggestPanelIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.suggestion-item {
    transition: background-color 0.15s ease, transform 0.05s ease;
    color: var(--text-dark) !important;
    padding: 0.4rem 0.8rem !important;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 36px;
}

.suggestion-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: var(--text-dark) !important;
}

.suggestion-item.selected {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.suggestion-item.selected .fw-bold {
    color: white !important;
}

.suggestion-item.selected .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.suggestion-item .fw-bold {
    color: var(--text-dark) !important;
}

.suggestion-item .text-muted {
    color: var(--text-light) !important;
}

/* 优化建议项缩略图外观 */
.suggestion-item img[alt="icon"] {
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.highlight {
    color: inherit !important;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    padding: 0 0.12em;
}

.cursor-pointer {
    cursor: pointer;
}

.software-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

.download-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.download-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.04);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.download-btn:active {
    transform: scale(0.98);
}

/* Footer (page-specific tweaks; base in assets/css/site.css) */
.footer {
    background: var(--bm-bg-footer);
    color: var(--bm-fg-on-dark);
    padding: 3rem 0 1rem;
}

.footer-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.footer-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: white;
}

/* 法律链接样式 */
.footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.footer a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.footer a i {
    color: #e5e5e5;
    margin-right: 0.5rem;
}

.is-home .text-primary {
    color: #0a0a0a !important;
}

.is-home .badge.bg-primary {
    background: #0a0a0a !important;
    color: #fff !important;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.is-home .suggestion-item .text-warning {
    color: #525252 !important;
}

/* Scroll / stagger reveal */
.bm-reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.bm-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.bm-reveal-stagger.is-visible {
    transition-delay: calc(var(--i, 0) * 0.06s);
}

@media (prefers-reduced-motion: reduce) {
    .search-rim {
        background: rgba(255, 255, 255, 0.2);
    }

    .category-card,
    .category-card:hover,
    .software-card,
    .software-card:hover,
    .category-icon,
    .software-image {
        transition: none !important;
        transform: none !important;
    }

    .search-suggestions.search-suggestions--open {
        animation: none;
    }

    .bm-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}
