/* assets/css/style_home.css (V47 Modern Glass UI) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Noto+Serif+SC:wght@500;700;900&family=JetBrains+Mono&display=swap');

:root {
    --accent: #0071E3;
    --bg-body: #F5F5F7;
    --text-primary: #1D1D1F;
    --radius: 14px;
    --header-h: 70px;
    --gap: 20px;
}

* {
    box-sizing: border-box;
    outline: none;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-y: auto;
    padding-top: calc(var(--header-h) + 20px);
    /* 留出 header 高度 */
}

a {
    text-decoration: none;
    color: inherit;
}

.app {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100%;
    gap: var(--gap);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- 1. Topbar: Fixed & Frosted Glass --- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    display: flex;
    justify-content: center;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.5);
    /* Tweaked opacity */
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.header-inner {
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    /* Left, Center (Nav), Right */
    align-items: center;
    height: 100%;
}

/* Site Branding (Left) */
.site-branding {
    justify-self: start;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.site-logo {
    height: 32px !important;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.site-text-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center Align Text */
}

.site-title {
    font-family: 'Noto Serif SC', serif;
    font-weight: 900;
    font-size: 24px;
    color: #1d1d1f;
    line-height: 1;
}

.site-subtitle {
    font-size: 11px;
    /* Smaller */
    color: #999;
    /* Lighter details */
    font-weight: 400;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* ... Previous styles ... */

/* --- Navigation & Mobile Logic (STRICT ISOLATION) --- */

/* DEFAULT: Desktop First (min-width: 769px) */
.mobile-menu-btn,
.mobile-nav-drawer {
    display: none !important;
    /* Hide mobile elements on desktop */
}

.nav-menu {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.nav-item {
    font-size: 15px;
    color: #555;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Force Blue on Desktop */
.nav-item:hover,
.nav-item.active {
    background-color: var(--accent);
    color: white;
}

/* Dropdown (Desktop) */
.nav-dropdown {
    position: relative;
    padding: 6px 14px;
    display: flex;
    align-items: center;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 140px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 6px;
    margin-top: 8px;
    display: none;
    opacity: 0;
    transition: all 0.2s;
    z-index: 2000;
    /* Super high z-index */
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    transform: translateX(-50%) translateY(0) !important;
    pointer-events: auto;
}

.dropdown-item {
    display: block;
    padding: 8px 16px;
    font-size: 13px;
    color: #333;
    border-radius: 8px;
    transition: 0.2s;
    text-align: center;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent);
}

.dropdown-item.active {
    background: var(--accent);
    color: white;
}


/* Right Actions (Right) */
.right-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ... Search & Login styles ... */
.search-wrapper {
    position: relative;
}

.search-icon-btn,
.login-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #1d1d1f;
    cursor: pointer;
    transition: background 0.2s;
}

.search-icon-btn:hover,
.login-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* --- Added Carousel Nav Buttons --- */
.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    z-index: 10;
    transition: 0.2s;
    opacity: 0;
}

.hero-section:hover .carousel-nav-btn {
    opacity: 1;
}

.carousel-nav-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

/* --- Fixed Card Tag Style (Blue) --- */
.card-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--accent);
    color: white;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

/* Search Input Expanded */
.search-input-box {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: 0.3s;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 18px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-input-box.active {
    width: 240px;
    opacity: 1;
    padding: 0 12px;
}

.search-input-real {
    border: none;
    background: transparent;
    height: 32px;
    width: 100%;
    font-size: 14px;
}

/* --- 2. Carousel / Pinned Posts --- */
.hero-section {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    margin-bottom: 0px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    height: 380px;
}

.carousel-slide {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    transition: opacity 0.6s ease-in-out;
    opacity: 0;
    z-index: 1;
    cursor: pointer;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 2;
}

.slide-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 6s ease;
}

.carousel-slide.active .slide-bg {
    transform: scale(1.05);
}

.slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px;
}

.slide-info {
    color: white;
    max-width: 700px;
    transform: translateY(20px);
    opacity: 0;
    transition: 0.6s 0.3s;
}

.carousel-slide.active .slide-info {
    transform: translateY(0);
    opacity: 1;
}

.slide-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--accent);
    color: white;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.slide-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.slide-desc {
    font-size: 15px;
    opacity: 0.9;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.carousel-dots {
    position: absolute;
    bottom: 20px;
    right: 40px;
    z-index: 10;
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.dot.active {
    background: white;
    width: 20px;
    border-radius: 10px;
}


/* --- 3. Content Grid --- */
.content-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    gap: 30px;
}

.main-area {
    flex: 1;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin: 30px 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: 0.3s;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.card-cover {
    height: 160px;
    background: linear-gradient(135deg, #E2E8F0 0%, #F1F5F9 100%);
    background-size: cover;
    background-position: center;
    position: relative;
}

.card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1D1D1F;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-desc {
    font-size: 13px;
    color: #86868B;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    margin-bottom: 15px;
    flex: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #AEAEB2;
    border-top: 1px solid #f5f5f7;
    padding-top: 12px;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 40px 0;
    color: #999;
    font-size: 13px;
    letter-spacing: 0.5px;
}

/* --- MOBILE STYLES (max-width: 768px) --- */
@media (max-width: 768px) {
    body {
        padding-top: calc(var(--header-h) + 20px);
    }

    /* Flex Header */
    .header-inner {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    /* HIDE DESKTOP NAV & ACTIONS */
    .nav-menu,
    .right-actions {
        display: none !important;
    }

    /* SHOW MOBILE ELEMENTS */
    /* SHOW MOBILE ELEMENTS */
    .mobile-menu-btn {
        display: flex !important;
        position: absolute;
        left: 16px;
        /* Moved right to avoid edge sticking */
        font-size: 24px;
        color: #333;
        cursor: pointer;
        height: 100%;
        align-items: center;
    }

    .site-branding {
        flex: 1;
        justify-content: center;
    }

    .site-text-wrap {
        align-items: center;
    }

    /* Center text */

    /* Backdrop */
    .mobile-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        z-index: 9998;
        display: none;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .mobile-backdrop.show {
        display: block;
        opacity: 1;
    }

    /* Mobile Drawer (Side) */
    .mobile-nav-drawer {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 75%;
        max-width: 320px;
        background: #fff;
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 24px 20px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
        border-right: 1px solid rgba(0, 0, 0, 0.05);
    }

    .mobile-nav-drawer.open {
        transform: translateX(0);
    }

    .drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 24px;
    }

    .drawer-title {
        font-size: 20px;
        font-weight: 800;
        font-family: 'Noto Serif SC';
    }

    .drawer-login-btn {
        font-size: 13px;
        color: var(--accent);
        background: rgba(0, 113, 227, 0.1);
        padding: 6px 12px;
        border-radius: 100px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 4px;
    }

    /* Mobile Search */
    .drawer-search {
        background: #F5F5F7;
        border-radius: 12px;
        padding: 10px 14px;
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 24px;
    }

    .drawer-search i {
        color: #999;
        font-size: 18px;
    }

    .drawer-search input {
        border: none;
        background: transparent;
        font-size: 15px;
        width: 100%;
        color: #333;
    }

    .mobile-nav-content {
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow-y: auto;
    }

    .mobile-nav-content .nav-item {
        width: 100%;
        text-align: left;
        padding: 14px 16px;
        background: transparent;
        font-size: 16px;
        border-radius: 12px;
        color: #333;
        display: flex;
        align-items: center;
        transition: 0.2s;
    }

    .mobile-nav-content .nav-item.active {
        background: var(--accent) !important;
        color: white !important;
        box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
    }

    .mobile-nav-content .nav-item i {
        margin-right: 10px;
    }

    /* Adjust Layout */
    .hero-section {
        height: 220px;
        border-radius: 0;
        margin-left: -20px;
        margin-right: -20px;
        width: calc(100% + 40px);
    }

    .slide-title {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .slide-desc {
        font-size: 12px;
        -webkit-line-clamp: 1;
    }

    .slide-tag {
        padding: 2px 8px;
        font-size: 10px;
        margin-bottom: 8px;
    }

    .app {
        padding: 0 16px;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}