/*
Theme Name: 亚麻公社
Theme URI: https://local.wp.lncu.cn
Author: LNCU
Author URI: https://local.wp.lncu.cn
Description: 亚麻公社企业主题 —— 安全优先、响应式设计、纯净简约风格。
Version: 1.1.1
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: yama-commune
Tags: blog, custom-menu, featured-images, responsive-layout, translation-ready
*/

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === CSS 变量 === */
:root {
    --color-primary:    #8B7355;
    --color-primary-dk: #6B5840;
    --color-secondary:  #C4A882;
    --color-accent:     #5C7A3E;
    --color-bg:         #FAF7F2;
    --color-bg-alt:     #F2EDE4;
    --color-surface:    #FFFFFF;
    --color-text:       #2C2C2C;
    --color-text-muted: #7A7165;
    --color-border:     #E8E0D5;
    --color-error:      #C0392B;
    --color-success:    #27AE60;
    --radius:           6px;
    --radius-lg:        12px;
    --shadow-sm:        0 1px 4px rgba(0,0,0,.08);
    --shadow-md:        0 4px 16px rgba(0,0,0,.10);
    --transition:       .22s ease;
    --max-width:        1180px;
    --header-h:         60px;
}

/* === 排版基础 === */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 2px;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol { padding-left: 1.4rem; }
blockquote {
    border-left: 4px solid var(--color-secondary);
    padding: .75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--color-bg-alt);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--color-text-muted);
}

code, pre {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: .9rem;
    background: var(--color-bg-alt);
    border-radius: var(--radius);
}
code { padding: .15em .4em; }
pre {
    padding: 1rem 1.25rem;
    overflow-x: auto;
    border: 1px solid var(--color-border);
}
pre code { background: none; padding: 0; }

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

/* === 辅助类 === */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -999px;
    left: 1rem;
    background: var(--color-primary);
    color: #fff;
    padding: .5rem 1rem;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 9999;
    font-size: .875rem;
    transition: top .2s;
}
.skip-link:focus { top: 0; color: #fff; }

/* === 布局骨架 === */
.site {
    display: flex;
    flex-direction: column;
}
.site-content {
    flex: 1;
    padding: 0;
}

.content-area { flex: 1; min-width: 0; }
.content-sidebar-wrap {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}
.widget-area {
    width: 300px;
    flex-shrink: 0;
}

/* === 按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1.4rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-dk);
    border-color: var(--color-primary-dk);
    color: #fff;
}
.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline:hover {
    background: var(--color-primary);
    color: #fff;
}

/* === 卡片 === */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.card-body { padding: 1.5rem; }

/* === 文章列表 === */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.post-card .post-thumbnail img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}
.post-card .post-meta {
    font-size: .8rem;
    color: var(--color-text-muted);
    margin-bottom: .5rem;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}
.post-card .post-title {
    margin-bottom: .5rem;
}
.post-card .post-title a { color: var(--color-text); }
.post-card .post-title a:hover { color: var(--color-primary); }
.post-card .post-excerpt {
    color: var(--color-text-muted);
    font-size: .9rem;
    margin-bottom: 1rem;
}

/* === 分页 === */
.pagination {
    display: flex;
    justify-content: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 .75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .9rem;
    color: var(--color-text);
    transition: all var(--transition);
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* === 表单 === */
.wp-block-search__input,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: .55rem .85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    -webkit-appearance: none;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139,115,85,.15);
}
textarea { resize: vertical; min-height: 120px; }

/* === 单篇文章 === */
.single-post .entry-header { margin-bottom: 2rem; }
.single-post .entry-title { font-size: 1.8rem; margin-bottom: .75rem; }
.single-post .entry-meta {
    font-size: .85rem;
    color: var(--color-text-muted);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.entry-content { line-height: 1.9; }
.entry-content > * + * { margin-top: 1rem; }
.entry-content img { border-radius: var(--radius); }

/* === 注释 === */
.comment-form input,
.comment-form textarea {
    width: 100%;
    margin-bottom: .75rem;
}
.comments-area { margin-top: 3rem; }
.comment-list { list-style: none; padding: 0; }
.comment-body {
    padding: 1rem;
    background: var(--color-bg-alt);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* === 404 页 === */
.error-404 { text-align: center; padding: 5rem 1rem; }
.error-404 .error-code {
    font-size: 7rem;
    font-weight: 700;
    color: var(--color-secondary);
    line-height: 1;
    margin-bottom: .5rem;
}
.error-404 h2 { margin-bottom: 1rem; }

/* === Widget 侧边栏 === */
.widget-area .widget {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.widget-area .widget-title {
    font-size: 1rem;
    font-weight: 600;
    padding-bottom: .6rem;
    border-bottom: 2px solid var(--color-secondary);
    margin-bottom: 1rem;
}
.widget ul { list-style: none; padding: 0; }
.widget ul li {
    padding: .3rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: .9rem;
}
.widget ul li:last-child { border-bottom: none; }

/* === 响应式 === */
@media (max-width: 1024px) {
    .widget-area { width: 260px; }
}

@media (max-width: 768px) {
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.35rem; }
    .content-sidebar-wrap {
        flex-direction: column;
    }
    .widget-area {
        width: 100%;
    }
    .post-grid {
        grid-template-columns: 1fr;
    }
    .error-404 .error-code { font-size: 5rem; }
}

@media (max-width: 480px) {
    .container { padding: 0 1rem; }
    .btn { width: 100%; justify-content: center; }
}

/* === WordPress 核心类补全 === */
.alignleft  { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { display: block; margin: 1rem auto; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: .8rem; color: var(--color-text-muted); margin-top: .3rem; }
.sticky { border-left: 4px solid var(--color-primary); padding-left: 1rem; }
.bypostauthor {}
.screen-reader-text { @extend .sr-only; }
