/* Homepage atmosphere — aligns with auth visual language */
:root {
    --home-ink: #15261a;
    --home-forest: #205A28;
    --home-forest-deep: #163f1c;
    --home-sage: #4a7a52;
    --home-mist: #e8eee8;
    --home-paper: #f6f7f4;
    --home-line: rgba(21, 38, 26, 0.12);
    --home-gold: #b08d3e;
    --home-font-display: "Literata", "Noto Serif SC", "Songti SC", Georgia, serif;
    --home-font-ui: "Manrope", "Noto Sans SC", "PingFang SC", "Segoe UI", sans-serif;
}

@keyframes homeFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes homeDrift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(1.2%, -0.8%, 0) scale(1.025); }
}

@media (prefers-reduced-motion: reduce) {
    .home-page *,
    .home-page *::before,
    .home-page *::after {
        animation: none !important;
        transition: none !important;
    }
}

body:has(.home-page) {
    background: var(--home-paper);
    font-family: var(--home-font-ui);
    color: var(--home-ink);
}

.home-page.main-content {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* —— Hero: one composition —— */
.home-hero {
    position: relative;
    overflow: hidden;
    color: #f4f7f4;
    background:
        linear-gradient(155deg, rgba(22, 63, 28, 0.94) 0%, rgba(21, 38, 26, 0.9) 48%, rgba(32, 90, 40, 0.88) 100%),
        radial-gradient(100% 70% at 85% 15%, rgba(176, 141, 62, 0.2), transparent 50%),
        linear-gradient(135deg, #1a3d22 0%, #0f1f14 100%);
    min-height: min(72vh, 640px);
    display: flex;
    align-items: center;
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2.75rem, 5vw, 3.75rem);
}

.home-hero::before {
    content: "";
    position: absolute;
    inset: -6%;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 44px,
            rgba(255, 255, 255, 0.03) 44px,
            rgba(255, 255, 255, 0.03) 48px,
            transparent 48px,
            transparent 82px,
            rgba(176, 141, 62, 0.06) 82px,
            rgba(176, 141, 62, 0.06) 86px
        );
    animation: homeDrift 24s ease-in-out infinite;
    pointer-events: none;
}

.home-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 55% 45% at 20% 80%, rgba(255, 255, 255, 0.06), transparent 55%),
        linear-gradient(180deg, transparent 55%, rgba(8, 16, 10, 0.28) 100%);
    pointer-events: none;
}

.home-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 920px;
    margin: 0 auto;
    padding: 0 1.25rem;
    text-align: center;
    animation: homeFadeUp 0.65s ease both;
}

.home-hero-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(244, 247, 244, 0.7);
    margin-bottom: 1rem;
}

.home-hero-brand {
    font-family: var(--home-font-display);
    font-size: clamp(2.75rem, 7vw, 4.25rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: #fff;
    margin: 0 0 0.85rem;
}

.home-hero-brand img {
    display: none;
}

.home-hero-tagline {
    font-family: var(--home-font-display);
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    font-weight: 450;
    line-height: 1.5;
    color: rgba(244, 247, 244, 0.9);
    margin: 0 auto 0.65rem;
    max-width: 36rem;
}

.home-hero-support {
    font-size: 0.98rem;
    line-height: 1.55;
    color: rgba(244, 247, 244, 0.72);
    margin: 0 auto 1.75rem;
    max-width: 32rem;
}

.home-hero .home-search-section {
    margin-bottom: 0 !important;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    animation: homeFadeUp 0.7s 0.1s ease both;
}

.home-hero .home-search-nav {
    margin-left: 0;
    justify-content: center;
}

.home-hero .home-search-nav .nav-link {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(244, 247, 244, 0.75);
    border-radius: 0;
    font-family: var(--home-font-ui);
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
}

.home-hero .home-search-nav .nav-link:hover:not(.active) {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.home-hero .home-search-nav .nav-link.active {
    background: var(--home-paper);
    color: var(--home-forest);
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 0;
}

.home-hero .home-search-nav .nav-link.active::after {
    background: var(--home-paper);
}

.home-hero .home-search-tab-content {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: var(--home-paper);
    border-radius: 0;
}

.home-hero .home-search-input {
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
    font-family: var(--home-font-ui);
    color: var(--home-ink);
}

.home-hero .home-search-input::placeholder {
    color: rgba(21, 38, 26, 0.42);
}

.home-hero .home-search-submit {
    border-radius: 0 !important;
    background: var(--home-forest) !important;
    color: #fff !important;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: none !important;
    white-space: nowrap;
}

.home-hero .home-search-submit:hover {
    background: var(--home-forest-deep) !important;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    justify-content: center;
    margin-top: 1.35rem;
    animation: homeFadeUp 0.75s 0.16s ease both;
}

.home-hero-link {
    color: rgba(244, 247, 244, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(244, 247, 244, 0.35);
    padding-bottom: 0.1rem;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.home-hero-link:hover {
    color: #fff;
    border-bottom-color: var(--home-gold);
}

/* —— Body sections —— */
.home-body {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
    animation: homeFadeUp 0.55s 0.12s ease both;
}

.home-topics {
    margin-bottom: 2rem;
    padding: 1rem 0 0.25rem;
    border-bottom: 1px solid var(--home-line);
}

.home-topics-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(21, 38, 26, 0.45);
    margin-bottom: 0.65rem;
    text-align: center;
}

.home-topics .word-cloud-section {
    justify-content: center !important;
    gap: 0.35rem 0.5rem !important;
    min-height: 0 !important;
}

.home-page .word-cloud-tag {
    color: var(--home-sage);
    font-family: var(--home-font-ui);
    font-size: 0.8rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid transparent;
    opacity: 0.85;
}

.home-page .word-cloud-tag:hover {
    color: var(--home-forest);
    border-color: var(--home-line);
    opacity: 1;
    background: rgba(32, 90, 40, 0.04);
}

.home-section {
    margin-bottom: 2.75rem;
}

.home-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--home-line);
}

.home-section-title {
    font-family: var(--home-font-display);
    font-size: clamp(1.35rem, 2.2vw, 1.65rem);
    font-weight: 600;
    color: var(--home-ink);
    margin: 0;
    letter-spacing: -0.01em;
}

.home-section-toggle {
    border-radius: 0 !important;
    border: 1px solid var(--home-line) !important;
    background: transparent !important;
    color: rgba(21, 38, 26, 0.55) !important;
    font-size: 0.8125rem !important;
    padding: 0.3rem 0.7rem !important;
    font-family: var(--home-font-ui);
}

.home-section-toggle:hover {
    color: var(--home-forest) !important;
    border-color: var(--home-forest) !important;
}

.home-page .latest-books-grid {
    gap: 1.35rem;
}

.home-page .home-book-cover {
    border-radius: 0 4px 4px 0;
}

.home-more-link {
    display: inline-block;
    margin-top: 1.75rem;
    padding: 0.55rem 0;
    color: var(--home-forest);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border-bottom: 2px solid var(--home-forest);
    letter-spacing: 0.02em;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.home-more-link:hover {
    color: var(--home-forest-deep);
    border-bottom-color: var(--home-gold);
}

.home-loading-bar {
    display: inline-block;
    padding: 0.85rem 0;
    color: rgba(21, 38, 26, 0.5);
    border-bottom: 1px solid var(--home-line);
    font-size: 0.9rem;
}

/* Footer blend on homepage */
body:has(.home-page) footer.bg-light {
    margin-top: 0 !important;
    background: var(--home-paper) !important;
    border-top: 1px solid var(--home-line);
    font-family: var(--home-font-ui);
}

body:has(.home-page) footer.bg-light .text-muted,
body:has(.home-page) footer.bg-light a.text-muted {
    color: rgba(21, 38, 26, 0.5) !important;
}

body:has(.home-page) footer.bg-light a.text-muted:hover {
    color: var(--home-forest) !important;
}

body:has(.home-page) footer.bg-light strong {
    font-family: var(--home-font-display);
    color: var(--home-ink);
}

@media (max-width: 767.98px) {
    .home-hero {
        min-height: auto;
        padding: 2rem 0 2.25rem;
    }

    .home-hero-brand {
        font-size: clamp(2.2rem, 10vw, 2.8rem);
    }

    .home-hero-support {
        margin-bottom: 1.35rem;
    }

    .home-hero .home-search-submit span {
        display: none;
    }

    .home-hero .home-search-submit .bi {
        margin-right: 0 !important;
    }
}
