/**
 * Shenghe Blog Enhance — shared blog styling for .com and .net
 * - Light, professional cards; no giant letter placeholders.
 * - Theme-aware accent colors (blue for .com, navy/gold for .net).
 * - High-contrast CTAs and readable single-post layout.
 */

/* ====================== VARIABLES ====================== */
:root {
  --sh-font: "Inter", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --sh-radius: 12px;
  --sh-shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.06);
  --sh-shadow-hover: 0 6px 18px rgba(0,0,0,.10);
  --sh-transition: transform .18s ease, box-shadow .18s ease;

  /* default (.com) */
  --sh-card-bg: #ffffff;
  --sh-card-border: #e6edf5;
  --sh-text: #1f2937;
  --sh-text-light: #5a6474;
  --sh-accent: #1d4ed8;
  --sh-accent-dark: #153ea7;
  --sh-accent-soft: #eff6ff;
  --sh-cat-bg: #dbeafe;
  --sh-cat-text: #153ea7;
  --sh-hero-bg: #f8fafc;
  --sh-sep: #e2e8f0;
}

/* .net theme: warm background, navy/gold accents */
body.wp-theme-shenghe-net-theme {
  --sh-card-bg: #ffffff;
  --sh-card-border: #e2ddd1;
  --sh-text: #1a1f2b;
  --sh-text-light: #5c6370;
  --sh-accent: #1a3a5c;
  --sh-accent-dark: #122840;
  --sh-accent-soft: #fff8e7;
  --sh-cat-bg: #fde68a;
  --sh-cat-text: #5a4510;
  --sh-hero-bg: #faf7f0;
  --sh-sep: #d6d0c2;
}

/* ====================== BLOG LISTING ====================== */
.blog-grid,
body.page-id-297633 .wp-block-post-template,
body.page-template-page-blog .blog-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
  gap: 24px !important;
  padding: 0 !important;
  margin: 0 !important;
}

.blog-card,
body.page-id-297633 article,
body.page-template-page-blog article.blog-card {
  display: flex !important;
  flex-direction: column !important;
  background: var(--sh-card-bg) !important;
  border: 1px solid var(--sh-card-border) !important;
  border-radius: var(--sh-radius) !important;
  box-shadow: var(--sh-shadow) !important;
  overflow: hidden !important;
  transition: var(--sh-transition) !important;
  height: 100% !important;
}

.blog-card:hover,
body.page-id-297633 article:hover,
body.page-template-page-blog article.blog-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: var(--sh-shadow-hover) !important;
}

/* hide giant-letter placeholders */
.blog-card-thumb--empty,
.blog-card .thumb-empty,
.blog-card .blog-card-thumb--empty {
  display: none !important;
}

.blog-card-thumb,
.blog-card .post-thumbnail,
body.page-id-297633 article .wp-block-post-featured-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--sh-accent-soft), var(--sh-hero-bg));
  border-bottom: 1px solid var(--sh-card-border);
}

.blog-card-thumb img,
.blog-card .post-thumbnail img,
body.page-id-297633 article .wp-block-post-featured-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  transition: transform .25s ease;
}

.blog-card:hover .blog-card-thumb img,
.blog-card:hover .post-thumbnail img {
  transform: scale(1.03);
}

.blog-card-body,
.blog-card .entry-wrapper,
.blog-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 20px 22px 22px;
}

.blog-card-cat,
.blog-card .entry-category,
.blog-card .post-category {
  display: inline-flex;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--sh-cat-text);
  background: var(--sh-cat-bg);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.blog-card-title,
.blog-card h2,
.blog-card .entry-title,
body.page-id-297633 article h2.wp-block-post-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  margin: 0 0 10px !important;
  color: var(--sh-text) !important;
}

.blog-card-title a,
.blog-card h2 a,
.blog-card .entry-title a,
body.page-id-297633 article h2.wp-block-post-title a {
  color: var(--sh-text) !important;
  text-decoration: none !important;
  background: none !important;
}

.blog-card-title a:hover,
.blog-card h2 a:hover {
  color: var(--sh-accent) !important;
}

.blog-card-excerpt,
.blog-card .entry-summary,
.blog-card p.excerpt {
  font-size: 14px;
  line-height: 1.6;
  color: var(--sh-text-light);
  margin: 0 0 16px;
  flex: 1 1 auto;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-meta,
.blog-card .entry-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--sh-text-light);
  margin-top: auto;
}

.blog-card-read,
.blog-card .read-more,
.blog-card .entry-readmore {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sh-accent);
  text-decoration: none;
  margin-top: 14px;
}

.blog-card-read::after,
.blog-card .read-more::after {
  content: "→";
  transition: transform .18s ease;
}

.blog-card:hover .blog-card-read::after,
.blog-card:hover .read-more::after {
  transform: translateX(3px);
}

/* ====================== SINGLE POST ====================== */
body.single-post .sh-breadcrumb {
  font-size: 13px;
  color: var(--sh-text-light);
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

body.single-post .sh-breadcrumb a {
  color: var(--sh-accent);
  text-decoration: none;
}

body.single-post .sh-breadcrumb a:hover {
  text-decoration: underline;
}

body.single-post .sh-breadcrumb .sep {
  color: var(--sh-text-light);
  opacity: .6;
}

body.single-post .sh-postmeta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--sh-text-light);
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--sh-sep);
}

body.single-post .sh-postmeta .sh-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--sh-text);
}

body.single-post .sh-postmeta .av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sh-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

body.single-post .sh-toc {
  background: var(--sh-hero-bg);
  border: 1px solid var(--sh-card-border);
  border-radius: var(--sh-radius);
  padding: 18px 22px;
  margin: 0 0 28px;
}

body.single-post .sh-toc h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--sh-text);
}

body.single-post .sh-toc ol {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--sh-text-light);
}

body.single-post .sh-toc a {
  color: var(--sh-accent);
  text-decoration: none;
}

body.single-post .sh-toc a:hover {
  text-decoration: underline;
}

body.single-post .entry-content,
body.single-post .wp-block-post-content,
body.single-post .post-content {
  font-size: 16px;
  line-height: 1.75;
  color: var(--sh-text);
}

body.single-post .entry-content h2,
body.single-post .wp-block-post-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sh-accent);
  color: var(--sh-text);
}

body.single-post .entry-content h3,
body.single-post .wp-block-post-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 12px;
  color: var(--sh-accent-dark);
}

body.single-post .entry-content p {
  margin: 0 0 16px;
}

body.single-post .entry-content a {
  color: var(--sh-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.single-post .entry-content a:hover {
  color: var(--sh-accent-dark);
}

body.single-post .entry-content ul,
body.single-post .entry-content ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

body.single-post .entry-content li {
  margin-bottom: 8px;
}

body.single-post .entry-content blockquote {
  margin: 24px 0;
  padding: 16px 22px;
  border-left: 4px solid var(--sh-accent);
  background: var(--sh-hero-bg);
  color: var(--sh-text-light);
  font-style: italic;
}

body.single-post .entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

body.single-post .entry-content th,
body.single-post .entry-content td {
  border: 1px solid var(--sh-card-border);
  padding: 10px 14px;
  text-align: left;
}

body.single-post .entry-content th {
  background: var(--sh-hero-bg);
  font-weight: 700;
  color: var(--sh-text);
}

body.single-post .entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
}

/* ====================== RELATED ARTICLES ====================== */
body.single-post .sh-related {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--sh-sep);
}

body.single-post .sh-related h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--sh-text);
}

body.single-post .sh-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

body.single-post .sh-related-card {
  background: var(--sh-card-bg);
  border: 1px solid var(--sh-card-border);
  border-radius: var(--sh-radius);
  padding: 18px;
  box-shadow: var(--sh-shadow);
  transition: var(--sh-transition);
}

body.single-post .sh-related-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-shadow-hover);
}

body.single-post .sh-related-card .rc-cat {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sh-cat-text);
  background: var(--sh-cat-bg);
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}

body.single-post .sh-related-card .rc-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

body.single-post .sh-related-card .rc-title a {
  color: var(--sh-text);
  text-decoration: none;
}

body.single-post .sh-related-card .rc-title a:hover {
  color: var(--sh-accent);
}

body.single-post .sh-related-card .rc-date {
  font-size: 12px;
  color: var(--sh-text-light);
}

/* ====================== CTA ====================== */
body.single-post .sh-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--sh-accent-dark);
  color: #fff;
  border-radius: var(--sh-radius);
  padding: 24px 28px;
  margin-top: 36px;
  box-shadow: var(--sh-shadow);
}

body.single-post .sh-cta .cta-txt {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

body.single-post .sh-cta .cta-sub {
  display: block;
  font-size: 13px;
  font-weight: 400;
  opacity: .85;
  margin-top: 6px;
}

body.single-post .sh-cta .cta-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--sh-accent-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 8px;
  transition: transform .15s ease, box-shadow .15s ease;
}

body.single-post .sh-cta .cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}

/* ====================== .COM BLOG WIDTH OVERRIDE ====================== */
/* FSE theme constrains the blog page content to ~700px; widen it to a
   proper grid so cards aren't cramped in a narrow column. */
body.page-id-297633 .is-layout-constrained,
body.page-id-297633 .wp-block-post-content.is-layout-constrained,
body.page-id-297633 .entry-content.is-layout-constrained,
body.page-id-297633 .blog-grid {
  max-width: 1120px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* ====================== SEARCH RESULTS ====================== */
/* Products (custom `product` CPT) now appear in search; style them as cards. */
body.search .type-product,
.search-results .type-product {
  background: var(--sh-card-bg);
  border: 1px solid var(--sh-card-border);
  border-radius: var(--sh-radius);
  padding: 18px 22px;
  margin-bottom: 18px;
  box-shadow: var(--sh-shadow);
  transition: var(--sh-transition);
}

body.search .type-product:hover,
.search-results .type-product:hover {
  box-shadow: var(--sh-shadow-hover);
  transform: translateY(-2px);
}

body.search .type-product .entry-title,
body.search .type-product h2,
.search-results .type-product .entry-title,
.search-results .type-product h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--sh-text);
}

body.search .type-product a,
.search-results .type-product a {
  color: var(--sh-accent);
  text-decoration: none;
}

body.search .type-product .entry-summary,
.search-results .type-product .entry-summary {
  font-size: 14px;
  line-height: 1.6;
  color: var(--sh-text-light);
  margin: 0;
}

body.search .product-badge,
.search-results .product-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sh-cat-text);
  background: var(--sh-cat-bg);
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}

/* ====================== RESPONSIVE ====================== */
@media (max-width: 640px) {
  .blog-grid,
  body.page-id-297633 .wp-block-post-template,
  body.page-template-page-blog .blog-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  body.single-post .sh-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  body.single-post .sh-cta .cta-btn {
    width: 100%;
  }
}
