/* ============================================
   Ashura的小天地 - 全站样式
   简洁、响应式、无外部依赖
   ============================================ */

:root {
    --bg: #f7f7f8;
    --card: #ffffff;
    --text: #24292f;
    --text-muted: #6b7280;
    --accent: #4f46e5;
    --accent-soft: #eef2ff;
    --border: #e5e7eb;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
        "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.75;
}

.container {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- 顶部导航 ---------- */
.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.site-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.site-title:hover {
    text-decoration: none;
    color: var(--accent);
}

.site-nav a {
    margin-left: 22px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.site-nav a:hover {
    color: var(--accent);
    text-decoration: none;
}

.site-nav a.active {
    color: var(--accent);
    font-weight: 600;
}

/* ---------- 主内容 ---------- */
main {
    padding: 48px 0 96px;
}

h1 {
    font-size: 1.9rem;
    line-height: 1.3;
    margin: 0 0 12px;
}

h2 {
    font-size: 1.35rem;
    margin: 48px 0 16px;
}

p {
    margin: 0 0 16px;
}

.text-muted {
    color: var(--text-muted);
}

/* ---------- 首页 hero ---------- */
.hero {
    padding: 48px 0 8px;
}

.hero h1 {
    margin-bottom: 8px;
}

.hero .subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* ---------- 卡片 ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-decoration: none;
}

.card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--text);
}

.card p {
    margin: 0;
    font-size: 0.92rem;
    color: var(--text-muted);
}

/* ---------- 文章列表 ---------- */
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.post-list li {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.post-list a.title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.post-list a.title:hover {
    color: var(--accent);
    text-decoration: none;
}

.post-list .date {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---------- 文章正文 ---------- */
.article {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.article .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.article h1 {
    font-size: 1.6rem;
}

.article h2 {
    margin: 32px 0 12px;
    font-size: 1.2rem;
}

.article code {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 0.9em;
}

.article pre {
    background: #1f2933;
    color: #e5e7eb;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    line-height: 1.5;
}

.article pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* ---------- 工具页 ---------- */
.tool-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.tool-box textarea {
    width: 100%;
    min-height: 180px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 0.9rem;
    resize: vertical;
    background: var(--bg);
    color: var(--text);
}

.tool-box textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.tool-box .btn-row {
    margin: 12px 0;
    display: flex;
    gap: 10px;
}

.btn {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn:hover {
    opacity: 0.9;
}

.btn.secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tool-box .error {
    color: #dc2626;
    font-size: 0.9rem;
    min-height: 1.5em;
}

/* ---------- 页脚 ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
    .site-nav a {
        margin-left: 14px;
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .article {
        padding: 20px;
    }
}
