/*
Theme Name: Qing
Theme URI: https://example.com/qing
Author: Qing Theme
Author URI: https://example.com
Description: Qing is a clean, lightweight classic WordPress theme with a responsive layout, sidebar, and support for menus, featured images, and comments.
Version: 1.11.9
Requires at least: 5.9
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: qing
Tags: blog, one-column, two-columns, right-sidebar, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============================================================
   单篇文章正文排版
   Elementor 的「文章内容」组件默认继承模板 1440px 宽度，新闻正文
   会出现行长过长、原图被过度放大的问题。这里仅约束 single post，
   不影响普通页面、产品页和 Elementor 编辑器中的其他文本组件。
   ============================================================ */
.single-post .elementor-widget-theme-post-content {
    width: min(920px, calc(100% - 40px));
    max-width: 920px !important;
    margin-right: auto;
    margin-left: auto;
    color: #303744;
    font-size: 17px;
    line-height: 1.9;
    letter-spacing: 0.01em;
}

.single-post .elementor-widget-theme-post-content p {
    margin: 0 0 24px;
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}

.single-post .elementor-widget-theme-post-content :is(h2, h3, h4) {
    color: #101828;
    font-weight: 700;
    letter-spacing: 0;
}

.single-post .elementor-widget-theme-post-content h2 {
    position: relative;
    margin: 54px 0 24px;
    padding-left: 16px;
    font-size: clamp(25px, 2vw, 30px);
    line-height: 1.4;
}

.single-post .elementor-widget-theme-post-content h2::before {
    content: "";
    position: absolute;
    top: 0.16em;
    bottom: 0.16em;
    left: 0;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, #006cff, #42a5ff);
}

/* 原稿可能混用 h3/h4，正文中统一成同一视觉层级。 */
.single-post .elementor-widget-theme-post-content :is(h3, h4) {
    margin: 38px 0 18px;
    font-size: clamp(20px, 1.55vw, 23px);
    line-height: 1.5;
}

.single-post .elementor-widget-theme-post-content figure.wp-block-image {
    width: 100%;
    max-width: 920px;
    margin: 36px auto 48px;
    text-align: center;
}

.single-post .elementor-widget-theme-post-content figure.wp-block-image img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 680px;
    margin: 0 auto;
    object-fit: contain;
    border-radius: 8px;
}

.single-post .elementor-widget-theme-post-content figcaption {
    margin-top: 12px;
    color: #7a8494;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}

.single-post .elementor-widget-theme-post-content :is(ul, ol) {
    margin: 0 0 28px;
    padding-left: 1.35em;
}

.single-post .elementor-widget-theme-post-content li {
    margin-bottom: 10px;
}

.single-post .elementor-widget-theme-post-content blockquote {
    margin: 34px 0;
    padding: 22px 26px;
    border-left: 4px solid #1677ff;
    border-radius: 0 8px 8px 0;
    background: #f3f7fd;
    color: #42526a;
}

.single-post .elementor-widget-theme-post-content a {
    color: #086cf0;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.single-post .elementor-widget-theme-post-content table {
    width: 100%;
    margin: 32px 0 42px;
    border-collapse: collapse;
    font-size: 15px;
}

.single-post .elementor-widget-theme-post-content :is(th, td) {
    padding: 13px 15px;
    border: 1px solid #dfe6ef;
    text-align: left;
}

.single-post .elementor-widget-theme-post-content th {
    background: #f3f7fd;
    color: #182230;
}

@media (max-width: 767px) {
    .single-post .elementor-widget-theme-post-content {
        width: calc(100% - 32px);
        font-size: 16px;
        line-height: 1.85;
    }

    .single-post .elementor-widget-theme-post-content p {
        margin-bottom: 20px;
    }

    .single-post .elementor-widget-theme-post-content h2 {
        margin: 42px 0 20px;
        padding-left: 13px;
    }

    .single-post .elementor-widget-theme-post-content :is(h3, h4) {
        margin: 30px 0 15px;
    }

    .single-post .elementor-widget-theme-post-content figure.wp-block-image {
        margin: 28px auto 36px;
    }

    .single-post .elementor-widget-theme-post-content figure.wp-block-image img {
        max-height: 520px;
        border-radius: 6px;
    }
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;

    /* 禁用双击放大。
       manipulation 的含义是「只保留滚动与双指缩放，去掉双击缩放」——
       双指手动缩放仍然可用，视力障碍用户不受影响。
       不用 viewport 的 user-scalable=no 来实现：那会把双指缩放也一起
       禁掉，属于无障碍倒退，且 iOS 新版已忽略该指令。 */
    touch-action: manipulation;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: #2c2c2c;
    background-color: #f7f7f5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #2f6f4f;
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    color: #1c1c1c;
    margin: 0 0 0.6em;
}

p {
    margin: 0 0 1.2em;
}

/* ---------- Layout ---------- */
.site {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-content {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    padding: 40px 0;
}

.content-area {
    flex: 1 1 640px;
    min-width: 0;
}

.widget-area {
    flex: 0 0 300px;
}

body.no-sidebar .content-area {
    flex: 1 1 100%;
}

@media (max-width: 900px) {
    .site-content {
        flex-direction: column;
        gap: 32px;
    }
    .widget-area {
        flex: 1 1 auto;
    }
}

/* ---------- Header ---------- */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid #e6e6e2;
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 24px 0;
    gap: 16px;
}

.site-branding {
    display: flex;
    flex-direction: column;
}

.site-title {
    font-size: 1.6rem;
    margin: 0;
}

.site-title a {
    color: #1c1c1c;
    text-decoration: none;
}

.site-description {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: #777;
}

.custom-logo-link img {
    max-height: 80px;
    width: auto;
}

/* ---------- Navigation ---------- */
.main-navigation ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.main-navigation a {
    color: #333;
    font-weight: 500;
    padding: 6px 0;
}

.main-navigation a:hover {
    color: #2f6f4f;
    text-decoration: none;
}

.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
    color: #2f6f4f;
}

.menu-toggle {
    display: none;
    background: #2f6f4f;
    color: #fff;
    border: 0;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

@media (max-width: 782px) {
    .menu-toggle {
        display: inline-block;
    }
    .main-navigation ul {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0;
        margin-top: 12px;
    }
    .main-navigation.toggled ul {
        display: flex;
    }
    .main-navigation li {
        border-top: 1px solid #eee;
    }
}

/* ---------- Skip link ---------- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100000;
}

.skip-link:focus {
    left: 6px;
    top: 6px;
    background: #fff;
    color: #1c1c1c;
    padding: 10px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ---------- Posts ---------- */
.entry {
    background: #fff;
    border: 1px solid #ececea;
    border-radius: 8px;
    padding: 28px 32px;
    margin-bottom: 32px;
}

.entry-title {
    font-size: 1.6rem;
    margin: 0 0 12px;
}

.entry-title a {
    color: #1c1c1c;
}

.entry-title a:hover {
    color: #2f6f4f;
    text-decoration: none;
}

.entry-meta {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 16px;
}

.entry-meta a {
    color: #888;
}

.entry-meta span + span::before {
    content: "\00b7";
    margin: 0 8px;
    color: #ccc;
}

.post-thumbnail {
    display: block;
    margin-bottom: 20px;
    border-radius: 6px;
    overflow: hidden;
}

.entry-content,
.entry-summary {
    font-size: 1.02rem;
}

.entry-content ul,
.entry-content ol {
    padding-left: 1.4em;
}

.entry-content blockquote {
    margin: 1.4em 0;
    padding: 0.6em 1.2em;
    border-left: 4px solid #2f6f4f;
    background: #f2f6f3;
    color: #444;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.4em;
}

.entry-content th,
.entry-content td {
    border: 1px solid #e6e6e2;
    padding: 10px 12px;
    text-align: left;
}

.read-more {
    display: inline-block;
    margin-top: 8px;
    font-weight: 600;
}

.entry-footer {
    font-size: 0.85rem;
    color: #888;
}

.entry-footer a {
    color: #888;
}

.entry-footer span + span::before {
    content: "\00b7";
    margin: 0 8px;
    color: #ccc;
}

.page-links {
    margin-top: 16px;
    font-size: 0.9rem;
}

/* ---------- Buttons ----------
   这是给「文章正文、评论表单」等原生内容里的按钮准备的默认外观。

   选择器用 :where() 包起来，把特异性降为 0。原因：

   裸写 button:hover 的特异性是 (0,1,1)，而各 Elementor 小部件的按钮
   样式通常是 .qxx-btn（0,1,0）。CSS 的特异性是按属性逐个比较的，
   于是只要小部件的 :hover 规则漏写了某个属性（最常见是 background），
   该属性就会落到这条全局规则上 —— 表现为「悬停时按钮突然变成深绿色」。

   .qnp-tab 就踩过这个坑：它的 :hover 只声明了 color 和 border-color，
   background 被 button:hover 的 #245840 接管。

   :where() 内部的选择器不贡献特异性，因此这一组变成「谁都能覆盖」的
   基础层，小部件不必再逐个防御性补齐属性。
   注意 :where() 需要较新的浏览器（Chrome 88+ / Safari 14+ / Firefox 78+）；
   更老的浏览器会整条丢弃这组规则，那时按钮回落到浏览器默认外观 ——
   可用性不受影响。 */
:where(.btn, button, input[type="submit"]) {
    display: inline-block;
    background: #2f6f4f;
    color: #fff;
    border: 0;
    padding: 10px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
}

:where(.btn, button, input[type="submit"]):hover {
    background: #245840;
    text-decoration: none;
    color: #fff;
}

/* ---------- Page header (archive) ---------- */
.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 1.8rem;
    margin: 0 0 8px;
}

.archive-description {
    color: #666;
}

/* ---------- Pagination ---------- */
.pagination,
.posts-navigation,
.post-navigation {
    margin: 32px 0;
}

.pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
}

.pagination .page-numbers.current {
    background: #2f6f4f;
    color: #fff;
    border-color: #2f6f4f;
}

.post-navigation .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

.post-navigation .nav-subtitle {
    display: block;
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.post-navigation .nav-title {
    font-weight: 600;
}

/* ---------- Sidebar / Widgets ---------- */
.widget {
    background: #fff;
    border: 1px solid #ececea;
    border-radius: 8px;
    padding: 22px 24px;
    margin-bottom: 28px;
}

.widget-title {
    font-size: 1.1rem;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2f6f4f;
    display: inline-block;
}

.widget ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget ul li {
    padding: 6px 0;
    border-bottom: 1px solid #f0f0ee;
}

.widget ul li:last-child {
    border-bottom: 0;
}

/* ---------- Search form ---------- */
.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.search-form label {
    flex: 1 1 180px;
    margin: 0;
}

.search-form input[type="search"] {
    margin-bottom: 0;
}

/* ---------- Comments ---------- */
.comments-area {
    background: #fff;
    border: 1px solid #ececea;
    border-radius: 8px;
    padding: 28px 32px;
    margin-top: 32px;
}

.comments-title,
.comment-reply-title {
    font-size: 1.2rem;
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list .children {
    list-style: none;
    margin-left: 28px;
}

.comment-body {
    padding: 16px 0;
    border-bottom: 1px solid #f0f0ee;
}

.comment-author .avatar {
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 8px;
}

.comment-metadata {
    font-size: 0.82rem;
    color: #999;
    margin-bottom: 8px;
}

.comment-metadata a {
    color: #999;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea,
.search-form input[type="search"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    margin-bottom: 12px;
    font-family: inherit;
}

.comment-form textarea {
    min-height: 140px;
}

.no-comments {
    color: #888;
    font-size: 0.9rem;
}

/* ---------- Footer ---------- */
.site-footer {
    background: #1c1c1c;
    color: #cfcfcf;
    padding: 40px 0;
    margin-top: 20px;
}

.site-footer a {
    color: #9fd3b8;
}

.footer-widgets {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    margin-bottom: 28px;
}

.footer-widgets .widget {
    flex: 1 1 240px;
    background: transparent;
    border: 0;
    padding: 0;
    color: #cfcfcf;
}

.footer-widgets .widget-title {
    color: #fff;
    border-bottom-color: #3a3a3a;
}

.footer-widgets .widget ul li {
    border-bottom-color: #2c2c2c;
}

.footer-navigation ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 0 0 20px;
    padding: 0;
}

.site-info {
    text-align: center;
    font-size: 0.88rem;
    color: #9a9a9a;
    border-top: 1px solid #2c2c2c;
    padding-top: 20px;
}

.site-info span {
    display: block;
}

/* ---------- Helpers ---------- */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    word-wrap: normal !important;
}

.sticky,
.bypostauthor {
    /* required by theme review */
}

.alignleft {
    float: left;
    margin: 0 1.5em 1em 0;
}

.alignright {
    float: right;
    margin: 0 0 1em 1.5em;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    font-size: 0.85rem;
    color: #777;
    text-align: center;
}

.entry-content .alignwide {
    max-width: 100%;
}
