/*
Theme Name: Yellow Page
Theme URI:
Author:
Author URI:
Description: 黄页式目录主题：首页网格展示一级分类，点击进入二级分类，再进入文章标题列表。
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL v2 or later
Text Domain: yellowpage
*/

* { box-sizing: border-box; }

a, button, .category-card, .post-list li a {
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: #fff8dc;
    color: #1a1a1a;
    line-height: 1.6;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
}

a { color: #b8860b; text-decoration: none; }
@media (hover: hover) {
    a:hover { color: #8b6914; text-decoration: underline; }
}

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

/* ---------- Header ---------- */
.site-header {
    background: #ffd500;
    border-bottom: 4px solid #1a1a1a;
    padding: 24px 0;
}
.site-header .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.submit-supplier { margin-top: 24px; text-align: center; }
.submit-supplier-btn {
    display: inline-block;
    padding: 10px 22px;
    background: #fff;
    color: #1a1a1a;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    box-shadow: 4px 4px 0 #1a1a1a;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}
@media (hover: hover) {
    .submit-supplier-btn:hover {
        background: #ffd500;
        transform: translate(-2px, -2px);
        box-shadow: 6px 6px 0 #1a1a1a;
        text-decoration: none;
    }
}
.submit-supplier-btn:active {
    background: #ffd500;
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #1a1a1a;
}
.site-title {
    margin: 0;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 1px;
}
.site-title a { color: #1a1a1a; text-decoration: none; }
.site-description {
    margin: 6px 0 0;
    color: #4a4a4a;
    font-size: 16px;
}

/* ---------- Main ---------- */
.site-main {
    padding: 32px 0 64px;
    min-height: 60vh;
}

.page-title {
    font-size: 28px;
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #1a1a1a;
}

/* ---------- Homepage: supplier count ---------- */
.supplier-count {
    margin: 0 0 20px;
    text-align: right;
    font-size: 14px;
    color: #6b6b6b;
    letter-spacing: 0.2px;
}
.supplier-count strong {
    color: #1a1a1a;
    font-weight: 800;
    font-size: 16px;
    margin: 0 3px;
    padding-bottom: 1px;
    border-bottom: 2px solid #ffd500;
}
@media (max-width: 480px) {
    .supplier-count { font-size: 13px; }
    .supplier-count strong { font-size: 15px; }
}

/* ---------- Homepage: top-level section ---------- */
.category-section {
    margin-bottom: 40px;
}
.category-section:last-child {
    margin-bottom: 0;
}
.category-section-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 3px solid #1a1a1a;
    position: relative;
}
.category-section-title::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 80px;
    height: 3px;
    background: #ffd500;
}
.category-section-title a {
    color: #1a1a1a;
    text-decoration: none;
}
@media (hover: hover) {
    .category-section-title a:hover {
        color: #b8860b;
        text-decoration: none;
    }
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
    font-size: 17px;
    color: #555;
    margin-bottom: 24px;
}
.breadcrumbs a { color: #b8860b; }
.breadcrumbs .sep { margin: 0 8px; color: #999; }
.breadcrumbs .current { color: #1a1a1a; font-weight: 600; }

/* ---------- Category grid ---------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.category-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 18px;
    background: #fff;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    min-height: 96px;
    color: #1a1a1a;
    text-decoration: none;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
    box-shadow: 4px 4px 0 #1a1a1a;
}
@media (hover: hover) {
    .category-card:hover {
        background: #ffd500;
        transform: translate(-2px, -2px);
        box-shadow: 6px 6px 0 #1a1a1a;
        text-decoration: none;
        color: #1a1a1a;
    }
    .category-card:hover .category-desc { color: #1a1a1a; }
}
.category-card:active {
    background: #ffd500;
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #1a1a1a;
    transition-duration: 0s;
}
.category-card .category-name {
    font-size: clamp(17px, 4.5vw, 20px);
    font-weight: 700;
    line-height: 1.3;
}
.category-card .category-desc {
    margin-top: 10px;
    font-size: clamp(14px, 3.6vw, 16px);
    color: #555;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Post list (titles only) ---------- */
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    box-shadow: 4px 4px 0 #1a1a1a;
    overflow: hidden;
}
.post-list li {
    border-bottom: 1px solid #eee;
}
.post-list li:last-child { border-bottom: none; }

.post-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    color: #1a1a1a;
    text-decoration: none;
    transition: background 0.08s ease;
}
@media (hover: hover) {
    .post-list li a:hover {
        background: #fff8dc;
        color: #b8860b;
        text-decoration: none;
    }
}
.post-list li a:active {
    background: #ffd500;
    color: #1a1a1a;
    transition-duration: 0s;
}
.post-list .post-title { flex: 1; font-size: 17px; }
.post-list .post-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    max-width: 50%;
}
.post-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 2px 9px;
    font-size: 12px;
    line-height: 1;
    color: #4b5563;
    background: #f4f6f8;
    border: 1px solid #d8dee6;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 700;
    transition: color 0.12s ease,
                border-color 0.12s ease,
                background 0.12s ease;
}
.post-tag-verified {
    color: #06623b;
    background: #e8f8ef;
    border-color: #8fd7ae;
    font-weight: 800;
}
.post-tag-verified::before {
    content: "";
    width: 8px;
    height: 5px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-1px) rotate(-45deg);
}
.post-tag-recommended {
    color: #8a4b00;
    background: #fff4d8;
    border-color: #f2c86f;
    font-weight: 800;
}
.post-tag-recommended::before {
    content: "";
    width: 12px;
    height: 12px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V3a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.977a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507c.26.85 1.084 1.368 1.973 1.368H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z'/%3E%3C/svg%3E") no-repeat center / contain;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V3a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.977a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507c.26.85 1.084 1.368 1.973 1.368H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z'/%3E%3C/svg%3E") no-repeat center / contain;
}
@media (hover: hover) {
    .post-list li a:hover .post-tag {
        color: #1f2937;
        border-color: #c4ccd6;
        background: #eef2f6;
    }
    .post-list li a:hover .post-tag-verified {
        color: #044f30;
        border-color: #6dc694;
        background: #d9f5e6;
    }
    .post-list li a:hover .post-tag-recommended {
        color: #744000;
        border-color: #e4b64c;
        background: #ffeab2;
    }
}
.post-list li a:active .post-tag {
    background: #e9eef4;
    transition-duration: 0.06s;
}
.post-list li a:active .post-tag-verified {
    background: #e8f8ef;
}
.post-list li a:active .post-tag-recommended {
    background: #fff4d8;
}

.empty-state {
    padding: 32px;
    text-align: center;
    color: #666;
    background: #fff;
    border: 2px dashed #999;
    border-radius: 4px;
}

/* ---------- Pagination ---------- */
.pagination {
    margin-top: 24px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.pagination .page-numbers {
    padding: 8px 14px;
    background: #fff;
    border: 2px solid #1a1a1a;
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 600;
}
.pagination .page-numbers.current {
    background: #ffd500;
    text-decoration: none;
}
@media (hover: hover) {
    .pagination .page-numbers:hover {
        background: #ffd500;
        text-decoration: none;
    }
}

/* ---------- Single post / page ---------- */
article.single-post,
article.single-page {
    background: #fff;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    box-shadow: 4px 4px 0 #1a1a1a;
    padding: 32px;
}
article.single-post .post-header,
article.single-page .post-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #1a1a1a;
}
article.single-post .post-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 16px;
}
article.single-post .post-header h1,
article.single-page .post-header h1 {
    margin: 0 0 8px;
    font-size: 32px;
}
article.single-post .post-header h1 {
    flex: 1 1 auto;
    min-width: 0;
}
article.single-post .post-header .post-tags {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
}
article.single-post .post-content,
article.single-page .post-content { font-size: 18px; line-height: 1.8; }
article.single-post .post-content img,
article.single-page .post-content img { max-width: 100%; height: auto; }

/* ---------- Footer ---------- */
.site-footer {
    background: #1a1a1a;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    font-size: 15px;
}
.site-footer a { color: #ffd500; }
.footer-pages { margin-bottom: 10px; }
.footer-pages .sep { margin: 0 8px; color: #888; }
.footer-account {
    margin-bottom: 10px;
    color: #d6d6d6;
    font-size: 14px;
}
.footer-account .sep { margin: 0 8px; color: #777; }
.footer-account-name { color: #fff; font-weight: 700; }

/* ---------- WeChat share float ---------- */
.wechat-share-float {
    position: fixed;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
}

.wechat-share-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 50%;
    box-shadow: 4px 4px 0 #1a1a1a;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}

.wechat-share-button:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #1a1a1a;
}

@media (hover: hover) {
    .wechat-share-button:hover {
        transform: translate(-2px, -2px);
        box-shadow: 6px 6px 0 #1a1a1a;
    }
}

.wechat-share-icon,
.wechat-share-icon img {
    display: block;
    width: 52px;
    height: 52px;
}

.wechat-share-icon img {
    border-radius: 50%;
}

.wechat-share-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: 174px;
    padding: 12px 10px 14px;
    background: #fff;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    box-shadow: 4px 4px 0 #1a1a1a;
    text-align: center;
}

.wechat-share-panel[hidden] {
    display: none;
}

.wechat-share-title {
    margin-bottom: 10px;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}

.wechat-share-qr {
    width: 150px;
    height: 150px;
    margin: 0 auto;
    background: #fff;
}

.wechat-share-qr.is-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #bbb;
}

.wechat-share-qr.is-loading::before {
    content: "加载中";
    color: #666;
    font-size: 13px;
    font-weight: 700;
}

.wechat-share-qr svg {
    display: block;
    width: 100%;
    height: 100%;
}

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

.wechat-share-guide {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    cursor: pointer;
}

.wechat-share-guide-arrow {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 172px;
    height: 172px;
    overflow: visible;
}

.wechat-share-guide-arrow path {
    fill: none;
    stroke: currentColor;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wechat-share-guide-text {
    position: fixed;
    top: 150px;
    right: 24px;
    max-width: 260px;
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.35;
    text-align: right;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

@media (min-width: 768px) {
    .wechat-share-float {
        top: 50%;
        right: 20px;
        bottom: auto;
        transform: translateY(-50%);
    }

    .wechat-share-panel {
        top: 50%;
        right: 66px;
        bottom: auto;
        transform: translateY(-50%);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .category-card {
        padding: 14px 12px;
        min-height: 80px;
        box-shadow: 3px 3px 0 #1a1a1a;
    }
    .site-title { font-size: 28px; }
    .post-list li a { padding: 12px 14px; }
    .post-list .post-tags { max-width: 60%; gap: 4px; }
    .post-list .post-tag { min-height: 22px; padding: 2px 7px; font-size: 11px; }
    .post-list .post-tag-verified,
    .post-list .post-tag-recommended { font-size: 12px; }
    article.single-post,
    article.single-page { padding: 18px 16px; }
    article.single-post .post-header h1,
    article.single-page .post-header h1 { font-size: 24px; }
    article.single-post .post-content,
    article.single-page .post-content { font-size: 16px; }
}
