/* ============================================
   zhuye - Personal Navigation Hub
   Modern Glassmorphism Design
   Dark / Light / Auto (System) Theme
   ============================================ */

/* --- CSS Variables (Dark - Default) --- */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: rgba(255, 255, 255, 0.04);
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-search: rgba(255, 255, 255, 0.06);
    --bg-search-focus: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-search: rgba(255, 255, 255, 0.1);
    --border-search-focus: rgba(160, 128, 255, 0.4);
    --border-card-hover: rgba(160, 128, 255, 0.25);
    --text-primary: #e8e8f0;
    --text-secondary: #b8b8d0;
    --text-tertiary: #6a6a8a;
    --text-muted: #4a4a6a;
    --text-placeholder: #5a5a7a;
    --text-footer-link: #5a5a7a;
    --text-footer-link-hover: #a080ff;
    --gradient-title: linear-gradient(135deg, #f0f0f8, #a0a0c0);
    --gradient-hero: linear-gradient(135deg, #f0f0f8 0%, #a080ff 50%, #60a0f0 100%);
    --gradient-btn: linear-gradient(135deg, #483280, #6050a0);
    --gradient-btn-hover: linear-gradient(135deg, #5840a0, #7060c0);
    --gradient-section-line: linear-gradient(90deg, rgba(255,255,255,0.08), transparent);
    --gradient-bg-overlay: radial-gradient(ellipse at 20% 50%, rgba(72, 50, 128, 0.25) 0%, transparent 50%),
                           radial-gradient(ellipse at 80% 20%, rgba(30, 60, 140, 0.2) 0%, transparent 50%),
                           radial-gradient(ellipse at 50% 80%, rgba(20, 80, 100, 0.15) 0%, transparent 50%);
    --shadow-card: 0 8px 32px rgba(72, 50, 128, 0.15);
    --shadow-logo: 0 2px 12px rgba(72, 50, 128, 0.3);
    --shadow-search-focus: 0 0 30px rgba(72, 50, 128, 0.15);
    --footer-border: rgba(255, 255, 255, 0.05);
    --toggle-bg: rgba(255, 255, 255, 0.08);
    --toggle-border: rgba(255, 255, 255, 0.12);
    --toggle-hover: rgba(255, 255, 255, 0.14);
    --toggle-active: #483280;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --bg-primary: #f5f5fa;
    --bg-secondary: rgba(0, 0, 0, 0.03);
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --bg-search: rgba(255, 255, 255, 0.7);
    --bg-search-focus: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.06);
    --border-search: rgba(0, 0, 0, 0.1);
    --border-search-focus: rgba(100, 80, 180, 0.3);
    --border-card-hover: rgba(100, 80, 180, 0.2);
    --text-primary: #1a1a2e;
    --text-secondary: #3a3a5a;
    --text-tertiary: #6a6a8a;
    --text-muted: #8a8aaa;
    --text-placeholder: #9a9ab0;
    --text-footer-link: #7a7a9a;
    --text-footer-link-hover: #6050a0;
    --gradient-title: linear-gradient(135deg, #2a2a4a, #6a6a8a);
    --gradient-hero: linear-gradient(135deg, #2a2a4a 0%, #6050a0 50%, #4080c0 100%);
    --gradient-btn: linear-gradient(135deg, #6050a0, #8070c0);
    --gradient-btn-hover: linear-gradient(135deg, #7060b0, #9080d0);
    --gradient-section-line: linear-gradient(90deg, rgba(0,0,0,0.08), transparent);
    --gradient-bg-overlay: radial-gradient(ellipse at 20% 50%, rgba(100, 80, 180, 0.1) 0%, transparent 50%),
                           radial-gradient(ellipse at 80% 20%, rgba(60, 100, 200, 0.08) 0%, transparent 50%),
                           radial-gradient(ellipse at 50% 80%, rgba(40, 120, 140, 0.06) 0%, transparent 50%);
    --shadow-card: 0 8px 32px rgba(60, 40, 100, 0.08);
    --shadow-logo: 0 2px 12px rgba(60, 40, 100, 0.15);
    --shadow-search-focus: 0 0 30px rgba(60, 40, 100, 0.08);
    --footer-border: rgba(0, 0, 0, 0.06);
    --toggle-bg: rgba(0, 0, 0, 0.05);
    --toggle-border: rgba(0, 0, 0, 0.1);
    --toggle-hover: rgba(0, 0, 0, 0.08);
    --toggle-active: #6050a0;
}

/* --- System Preference (Auto) --- */
@media (prefers-color-scheme: light) {
    [data-theme="auto"] {
        --bg-primary: #f5f5fa;
        --bg-secondary: rgba(0, 0, 0, 0.03);
        --bg-card: rgba(255, 255, 255, 0.7);
        --bg-card-hover: rgba(255, 255, 255, 0.9);
        --bg-search: rgba(255, 255, 255, 0.7);
        --bg-search-focus: rgba(255, 255, 255, 0.9);
        --border-color: rgba(0, 0, 0, 0.06);
        --border-search: rgba(0, 0, 0, 0.1);
        --border-search-focus: rgba(100, 80, 180, 0.3);
        --border-card-hover: rgba(100, 80, 180, 0.2);
        --text-primary: #1a1a2e;
        --text-secondary: #3a3a5a;
        --text-tertiary: #6a6a8a;
        --text-muted: #8a8aaa;
        --text-placeholder: #9a9ab0;
        --text-footer-link: #7a7a9a;
        --text-footer-link-hover: #6050a0;
        --gradient-title: linear-gradient(135deg, #2a2a4a, #6a6a8a);
        --gradient-hero: linear-gradient(135deg, #2a2a4a 0%, #6050a0 50%, #4080c0 100%);
        --gradient-btn: linear-gradient(135deg, #6050a0, #8070c0);
        --gradient-btn-hover: linear-gradient(135deg, #7060b0, #9080d0);
        --gradient-section-line: linear-gradient(90deg, rgba(0,0,0,0.08), transparent);
        --gradient-bg-overlay: radial-gradient(ellipse at 20% 50%, rgba(100, 80, 180, 0.1) 0%, transparent 50%),
                               radial-gradient(ellipse at 80% 20%, rgba(60, 100, 200, 0.08) 0%, transparent 50%),
                               radial-gradient(ellipse at 50% 80%, rgba(40, 120, 140, 0.06) 0%, transparent 50%);
        --shadow-card: 0 8px 32px rgba(60, 40, 100, 0.08);
        --shadow-logo: 0 2px 12px rgba(60, 40, 100, 0.15);
        --shadow-search-focus: 0 0 30px rgba(60, 40, 100, 0.08);
        --footer-border: rgba(0, 0, 0, 0.06);
        --toggle-bg: rgba(0, 0, 0, 0.05);
        --toggle-border: rgba(0, 0, 0, 0.1);
        --toggle-hover: rgba(0, 0, 0, 0.08);
        --toggle-active: #6050a0;
    }
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

/* --- Animated Background --- */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: var(--gradient-bg-overlay);
    z-index: -1;
    animation: bgShift 20s ease-in-out infinite alternate;
    transition: background 0.6s ease;
}

@keyframes bgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-2%, -2%) rotate(3deg); }
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; vertical-align: middle; }

/* --- Layout --- */
.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 0 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-area .logo-img {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: var(--shadow-logo);
    transition: box-shadow 0.4s ease;
}

.logo-area .site-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: var(--gradient-title);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: background 0.4s ease;
}

.logo-area .site-subtitle {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-weight: 400;
    transition: color 0.4s ease;
}

/* --- Theme Toggle --- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--toggle-bg);
    border: 1px solid var(--toggle-border);
    border-radius: 20px;
    padding: 3px;
    transition: all 0.3s ease;
}

.theme-toggle .theme-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.theme-toggle .theme-btn:hover {
    background: var(--toggle-hover);
    color: var(--text-primary);
}

.theme-toggle .theme-btn.active {
    background: var(--toggle-active);
    color: #fff;
    box-shadow: 0 2px 8px rgba(72, 50, 128, 0.3);
}

.theme-toggle .theme-btn .tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.theme-toggle .theme-btn:hover .tooltip {
    opacity: 1;
}

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 48px 0 32px;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: background 0.4s ease;
}

.hero p {
    font-size: 0.95rem;
    color: var(--text-tertiary);
    max-width: 480px;
    margin: 0 auto;
    transition: color 0.4s ease;
}

/* --- Search Section --- */
.search-section {
    padding: 0 0 36px;
    text-align: center;
}

.search-section .search-form {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    gap: 0;
    background: var(--bg-search);
    border: 1px solid var(--border-search);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.search-section .search-form:focus-within {
    border-color: var(--border-search-focus);
    box-shadow: var(--shadow-search-focus);
    background: var(--bg-search-focus);
}

.search-section .search-form input {
    flex: 1;
    border: none;
    padding: 16px 22px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
    outline: none;
    transition: color 0.4s ease;
}

.search-section .search-form input::placeholder {
    color: var(--text-placeholder);
    transition: color 0.4s ease;
}

.search-section .search-form button {
    padding: 16px 30px;
    border: none;
    background: var(--gradient-btn);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.search-section .search-form button:hover {
    background: var(--gradient-btn-hover);
}

/* --- Section --- */
.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-top: 8px;
}

.section-header .section-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.section-header .section-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    text-transform: uppercase;
    transition: color 0.4s ease;
}

.section-header .section-line {
    flex: 1;
    height: 1px;
    background: var(--gradient-section-line);
    transition: background 0.4s ease;
}

/* --- App Grid --- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px;
    padding-bottom: 32px;
}

.app-grid .app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.app-grid .app-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-card-hover);
    box-shadow: var(--shadow-card);
    transform: translateY(-4px);
}

.app-grid .app-item:active {
    transform: translateY(-1px) scale(0.97);
}

.app-grid .app-item .app-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    object-fit: contain;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.app-grid .app-item:hover .app-icon {
    transform: scale(1.08);
}

.app-grid .app-item .app-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    word-break: break-word;
    transition: color 0.3s;
}

.app-grid .app-item:hover .app-name {
    color: var(--text-primary);
}

/* --- Footer --- */
footer {
    margin-top: auto;
    padding: 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--footer-border);
    transition: all 0.4s ease;
}

footer a {
    color: var(--text-footer-link);
    transition: color 0.2s;
}

footer a:hover {
    color: var(--text-footer-link-hover);
}

footer .footer-links {
    display: flex;
    gap: 20px;
}

/* --- Utility --- */
.hidden { display: none !important; }

/* --- Fade-in Animation --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-grid .app-item {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.app-grid .app-item:nth-child(1) { animation-delay: 0.05s; }
.app-grid .app-item:nth-child(2) { animation-delay: 0.1s; }
.app-grid .app-item:nth-child(3) { animation-delay: 0.15s; }
.app-grid .app-item:nth-child(4) { animation-delay: 0.2s; }
.app-grid .app-item:nth-child(5) { animation-delay: 0.25s; }
.app-grid .app-item:nth-child(6) { animation-delay: 0.3s; }
.app-grid .app-item:nth-child(7) { animation-delay: 0.35s; }
.app-grid .app-item:nth-child(8) { animation-delay: 0.4s; }
.app-grid .app-item:nth-child(9) { animation-delay: 0.45s; }
.app-grid .app-item:nth-child(10) { animation-delay: 0.5s; }
.app-grid .app-item:nth-child(11) { animation-delay: 0.55s; }
.app-grid .app-item:nth-child(12) { animation-delay: 0.6s; }
.app-grid .app-item:nth-child(13) { animation-delay: 0.65s; }

/* --- Responsive --- */
@media (max-width: 768px) {
    header { flex-wrap: wrap; gap: 12px; }
    .hero { padding: 32px 0 24px; }
    .hero h1 { font-size: 1.6rem; }
    .search-section { padding: 0 0 28px; }
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
    .app-grid .app-item { padding: 14px 6px 10px; }
    .app-grid .app-item .app-icon { width: 40px; height: 40px; }
    .app-grid .app-item .app-name { font-size: 0.7rem; }
    footer { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 480px) {
    .wrapper { padding: 0 16px; }
    .app-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .app-grid .app-item .app-icon { width: 36px; height: 36px; }
}

/* --- 来访统计 --- */
.visit-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 28px;
    margin-top: 20px;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: .3px;
}
.visit-stats .vs-item b {
    margin-left: 6px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
}
@media (max-width: 480px) {
    .visit-stats { gap: 6px 18px; font-size: 12px; }
    .visit-stats .vs-item b { font-size: 13px; }
}
/* ============================================================
   高质感增强层 (High-Quality Design Pass)
   保留现有内容与品牌资产，通过氛围光斑 / 卡片微物理 /
   字距与动效编排提升质感。增量覆盖，删除本区块即可回退。
   ============================================================ */
:root {
    --hq-accent: #a080ff;
    --hq-accent-2: #60a0f0;
    --hq-accent-soft: rgba(160, 128, 255, 0.14);
    --hq-shadow: 0 14px 40px rgba(72, 50, 128, 0.22);
}

/* --- 1. 页面氛围背景：多柔光斑 + 顶部细网格（固定层，不随内容滚动） --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(52rem 34rem at 10% 4%, rgba(160, 128, 255, 0.12), transparent 62%),
        radial-gradient(60rem 40rem at 92% 10%, rgba(96, 160, 240, 0.10), transparent 60%),
        radial-gradient(46rem 36rem at 78% 96%, rgba(160, 128, 255, 0.08), transparent 62%),
        radial-gradient(36rem 30rem at 8% 88%, rgba(96, 160, 240, 0.07), transparent 60%);
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(160, 128, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(160, 128, 255, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
    mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
}
.wrapper {
    position: relative;
    z-index: 1;
}

/* --- 2. Header / Logo 微动效 --- */
header { position: relative; z-index: 1; }
.logo-area .logo-img {
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.logo-area:hover .logo-img {
    transform: scale(1.06) rotate(-3deg);
    box-shadow: 0 6px 20px rgba(72, 50, 128, 0.35);
}

/* --- 3. 主题切换按钮精致化 --- */
.theme-toggle {
    box-shadow: 0 4px 16px rgba(72, 50, 128, 0.10);
}
.theme-toggle .theme-btn.active {
    box-shadow: 0 2px 10px rgba(160, 128, 255, 0.5);
}

/* --- 4. Hero 增强：氛围光晕 + 入场编排 --- */
.hero { position: relative; }
.hero::before {
    content: '';
    position: absolute;
    left: 50%; top: 42%;
    width: 480px; height: 280px;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse, var(--hq-accent-soft), transparent 70%);
    filter: blur(34px);
    opacity: 0.55;
    pointer-events: none;
    z-index: -1;
}
.hero h1 {
    letter-spacing: -0.045em;
    animation: hqFadeUp 0.7s cubic-bezier(0.22, 0.8, 0.36, 1) both;
}
.hero p {
    letter-spacing: 0.02em;
    animation: hqFadeUp 0.7s 0.12s cubic-bezier(0.22, 0.8, 0.36, 1) both;
}
@keyframes hqFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* --- 5. 搜索框质感 --- */
.search-section {
    animation: hqFadeUp 0.7s 0.22s cubic-bezier(0.22, 0.8, 0.36, 1) both;
}
.search-section .search-form {
    box-shadow: 0 12px 40px rgba(72, 50, 128, 0.12);
}
.search-section .search-form:focus-within {
    transform: translateY(-1px);
}
.search-section .search-form button {
    letter-spacing: 0.04em;
}

/* --- 6. 服务卡片质感升级 --- */
.app-grid .app-item {
    position: relative;
    overflow: hidden;
}
.app-grid .app-item::before {
    content: '';
    position: absolute;
    left: 14%; right: 14%; top: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(160, 128, 255, 0.45), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.app-grid .app-item:hover::before { opacity: 1; }
.app-grid .app-item:hover {
    background: var(--bg-card-hover);
    border-color: transparent;
    box-shadow:
        var(--hq-shadow),
        0 0 0 1px rgba(160, 128, 255, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(-5px);
}
.app-grid .app-item:hover .app-icon {
    transform: scale(1.1) translateY(-2px);
    filter: drop-shadow(0 6px 16px rgba(160, 128, 255, 0.35));
}
.app-grid .app-item .app-name {
    letter-spacing: 0.01em;
}
.app-grid .app-item:hover .app-name {
    letter-spacing: 0.02em;
}

/* --- 7. 区块标题精致化 --- */
.section-header .section-icon {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(72, 50, 128, 0.08);
}

/* --- 8. Footer / 统计区质感统一 --- */
footer { position: relative; z-index: 1; }
.visit-stats {
    box-shadow: 0 6px 24px rgba(72, 50, 128, 0.08);
}

/* --- 9. 减少动效偏好（无障碍） --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
