/* ============================================ */
/*  全局重置与变量                                 */
/* ============================================ */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: rgb(255, 107, 0);
    --accent-hover: rgb(255, 130, 50);
    --button-primary: rgb(0, 86, 144);
    --button-primary-hover: rgb(0, 100, 170);
    --border: #27272a;
    --shadow: rgba(0, 0, 0, 0.3);

    /* 层级 */
    --z-content: 1;
    --z-bottom-bar: 100;
    --z-toast: 200;
    --z-modal: 300;

    /* 分组微妙色 - 暗灰底上的微弱色倾向 */
    --group-mood: rgb(168, 142, 128);      /* 暗灰橙 - 定调子 */
    --group-subject: rgb(128, 148, 168);   /* 暗灰蓝 - 定主体 */
    --group-perspective: rgb(128, 158, 138); /* 暗灰绿 - 定视角 */
    --group-text: rgb(152, 138, 168);      /* 暗灰紫 - 定文字 */
    --group-output: rgb(168, 128, 138);    /* 暗灰红 - 定输出 */
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================ */
/*  基础样式                                     */
/* ============================================ */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* 让主内容区占据剩余空间，保证 footer 在底部 */
body > *:not(.bottom-bar):not(.modal-overlay):not(.toast) {
    flex-shrink: 0;
}

.showcase {
    flex: 1;
}

/* ============================================ */
/*  网站Logo                                     */
/* ============================================ */
.site-logo {
    display: inline-block;
    height: 60px;
    width: auto;
    margin-bottom: 1rem;
}

/* 白色版本：使用filter反色（适用于深色背景） */
.site-logo.logo-white {
    filter: brightness(0) invert(1);
}

/* ============================================ */
/*  页面头部                                     */
/* ============================================ */
.header {
    text-align: center;
    padding: 3rem 1rem 2rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.back-link {
    position: absolute;
    top: 2rem;
    left: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

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

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--accent);
    text-wrap: balance;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    text-wrap: pretty;
}

/* ============================================ */
/*  控制区：搜索和标签                             */
/* ============================================ */
.controls {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.search-input {
    width: 100%;
    max-width: 500px;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.tag {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tag:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
}

.tag.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ============================================ */
/*  主内容区                                     */
/* ============================================ */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    min-height: 600px;
}

/* ============================================ */
/*  字体列表                                     */
/* ============================================ */
.font-list {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100svh - 300px);
    height: calc(100dvh - 300px);
    min-height: 500px;
}

.list-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-secondary);
}

.font-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

/* 滚动条样式 */
.font-list-container::-webkit-scrollbar {
    width: 6px;
}

.font-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.font-list-container::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

/* ============================================ */
/*  字体卡片                                     */
/* ============================================ */
.font-card {
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.font-card:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    transform: translateX(4px);
}

.font-card.active {
    background: var(--accent);
    border-color: var(--accent);
}

.font-card.active .font-name,
.font-card.active .font-style {
    color: white;
}

.font-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.font-style {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.font-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.mini-tag {
    padding: 0.125rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================ */
/*  预览面板                                     */
/* ============================================ */
.preview-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.preview-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.125rem;
}

/* 预览内容（隐藏，选中字体后显示） */
.preview-content {
    display: none;
}

.preview-content.show {
    display: block;
}


.preview-header {
    margin-bottom: 1.5rem;
}

.preview-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.preview-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.preview-image {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.preview-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.btn-secondary {
    background: var(--bg-tertiary);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

/* ============================================ */
/*  提示消息                                     */
/* ============================================ */
.toast {
    position: fixed;
    bottom: calc(2rem + env(safe-area-inset-bottom));
    right: calc(2rem + env(safe-area-inset-right));
    padding: 1rem 1.5rem;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: var(--z-toast);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@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;
    }
}

/* ============================================ */
/*  响应式设计                                   */
/* ============================================ */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
    }

    .font-list {
        height: 400px;
    }
}

@media (max-width: 640px) {
    .title {
        font-size: 1.75rem;
    }

    .controls {
        padding: 1rem;
    }

    .preview-panel {
        padding: 1rem;
    }
}
