/*
Theme Name: XinTheme
Theme URI: https://xintheme.com
Author: XinTheme
Author URI: https://xintheme.com
Description: 一款简洁大气的博客/资讯 WordPress 主题，支持轮播、分类展示、文章网格布局。
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: xintheme
Tags: blog, news, grid, responsive
*/

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

:root {
  --red: #e53935;
  --dark: #1a1a1a;
  --gray: #f5f5f5;
  --text: #333;
  --muted: #888;
  --border: #e0e0e0;
  --white: #fff;
  --nav-h: 52px;
}

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #f7f7f7;
  font-size: 14px;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ===== NAV ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
}

.site-logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: -.5px;
  margin-right: 32px;
  flex-shrink: 0;
}
.site-logo span { color: var(--dark); }

/* Nav Menu */
#primary-menu {
  display: flex;
  align-items: center;
  list-style: none;
  flex: 1;
  gap: 0;
}

#primary-menu li { position: relative; }

#primary-menu > li > a {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  padding: 0 14px;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  transition: color .2s;
}

#primary-menu > li > a:hover,
#primary-menu > li.current-menu-item > a,
#primary-menu > li.current_page_item > a { color: var(--red); }

/* Sub-menu */
#primary-menu .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  min-width: 160px;
  list-style: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  display: none;
  z-index: 100;
}

#primary-menu li:hover > .sub-menu { display: block; }

#primary-menu .sub-menu a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  transition: color .2s, background .2s;
  white-space: nowrap;
}

#primary-menu .sub-menu a:hover { color: var(--red); background: #fef2f2; }

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-search-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: color .2s, background .2s;
  display: flex;
  align-items: center;
}
.nav-search-btn:hover { color: var(--red); background: #fef2f2; }

.btn-register {
  background: var(--red);
  color: #fff !important;
  border-radius: 4px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 500;
  transition: opacity .2s;
}
.btn-register:hover { opacity: .85; }

/* ===== LAYOUT WRAPPER ===== */
.site-main { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ===== SLIDER ===== */
.home-slider {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
  background: var(--dark);
}

.slider-track {
  display: flex;
  height: 100%;
  transition: transform .55s cubic-bezier(.4,0,.2,1);
}

.slider-item {
  min-width: 100%;
  height: 100%;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

/* Full-bleed photo, slightly dimmed on right */
.slider-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 7s ease;
}
.slider-item.is-active img { transform: scale(1.05); }

/* Left panel — semi-transparent dark overlay only on left ~40% */
.slider-caption {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  /* gradient: solid dark left → transparent right */
  background: linear-gradient(
    to right,
    rgba(0,0,0,.72) 0%,
    rgba(0,0,0,.62) 28%,
    rgba(0,0,0,.18) 55%,
    transparent 75%
  );
  color: #fff;
  padding: 0 0 36px 40px;
  pointer-events: none;
}

.slider-caption-inner {
  max-width: 340px;
  pointer-events: auto;
}

/* Category tag */
.slider-caption .s-cat {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 12px;
  letter-spacing: .3px;
}

/* Title */
.slider-caption h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
  text-shadow: 0 1px 6px rgba(0,0,0,.5);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.slider-caption h2 a { color: #fff; }
.slider-caption h2 a:hover { opacity: .85; }

/* Excerpt */
.slider-caption p {
  font-size: 12.5px;
  line-height: 1.7;
  opacity: .88;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
}

/* Date */
.slider-caption .s-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  opacity: .75;
}
.slider-caption .s-date svg { opacity: .8; }

.slider-btn {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px;
  background: rgba(255,255,255,.15);
  border: none; border-radius: 50%;
  color: #fff; font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  transition: background .2s;
  z-index: 5;
}
.slider-btn:hover { background: rgba(229,57,53,.7); }
.slider-btn.prev { left: 16px; }
.slider-btn.next { right: 16px; }

.slider-dots {
  position: absolute;
  bottom: 16px; right: 40px;
  display: flex; gap: 6px;
  z-index: 5;
}
.slider-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.45);
  cursor: pointer;
  border: none;
  transition: background .2s, transform .2s;
}
.slider-dot.is-active { background: #fff; transform: scale(1.3); }

/* ===== CATEGORIES ===== */
.home-cats { padding: 28px 0 0; }

.cats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.cat-block {
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
}

.cat-block-images {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  grid-template-rows: repeat(2, 82px);
  gap: 2px;
  background: #ccc;
}

.cat-img-main { grid-row: span 2; overflow: hidden; }
.cat-img-sub { overflow: hidden; position: relative; }

.cat-img-main img,
.cat-img-sub img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s;
}
.cat-block:hover .cat-img-main img,
.cat-block:hover .cat-img-sub img { transform: scale(1.06); }

.cat-count-badge {
  position: absolute;
  bottom: 4px; right: 6px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 2px;
}

.cat-block-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--white);
}

.cat-block-footer .cat-name { font-size: 13px; font-weight: 600; }

.cat-block-footer .cat-more {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color .2s;
}
.cat-block-footer .cat-more:hover { color: var(--red); }

/* ===== POSTS SECTION ===== */
.home-posts { padding: 30px 0 48px; }

.section-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  padding-bottom: 10px;
  margin-bottom: 20px;
  border-bottom: 3px solid var(--red);
  display: inline-block;
}

.posts-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

/* ===== POST CARD ===== */
.post-card {
  background: var(--white);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .25s, transform .25s;
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  transform: translateY(-4px);
}

/* Thumbnail */
.post-card .card-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #e8e8e8;
  flex-shrink: 0;
}
.posts-row.row2 .post-card .card-thumb { aspect-ratio: 4/3; }

.post-card .card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
  display: block;
}
.post-card:hover .card-thumb img { transform: scale(1.06); }

/* No-image placeholder inside thumb */
.card-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ececec;
}
.card-thumb-placeholder svg { opacity: .35; }

/* Category tag — top-left corner */
.card-cat-tag {
  position: absolute;
  top: 0; left: 0;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 0 0 4px 0;
  z-index: 2;
  line-height: 1.6;
}

/* Card body */
.post-card .card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Title */
.post-card h3 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--dark);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .2s;
  margin-bottom: 6px;
}
.post-card:hover h3 { color: var(--red); }

/* Excerpt */
.post-card .card-excerpt {
  font-size: 12px;
  color: #999;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* Meta bar — date · views · comments · share */
.post-card .card-meta {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #f0f0f0;
  font-size: 11px;
  color: #bbb;
  flex-wrap: wrap;
  row-gap: 4px;
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
  padding-right: 10px;
  margin-right: 0;
  white-space: nowrap;
}

.card-meta-item svg {
  flex-shrink: 0;
  opacity: .55;
}


/* Price — 现代商品价格布局 */
.card-meta-item.card-price {
  margin-left: auto;
  color: #ff4d4f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
}
.card-price .price-symbol {
  font-size: 13px;
  font-weight: 600;
}
.card-price .price-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.card-price .price-decimal {
  font-size: 13px;
  font-weight: 700;
}
.card-price .price-label {
  font-size: 12px;
  color: #999;
  margin-left: 4px;
  font-weight: normal;
}

/* Share — 无价格时靠右显示 */
.card-meta-item.card-share {
  margin-left: auto;
  padding-right: 0 !important;
  color: #bbb;
}


/* ===== LOAD MORE BUTTON ===== */
.load-more-wrap {
  text-align: center;
  padding: 28px 0 8px;
}

.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f06b6b; /* slightly softer red matching screenshot */
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 11px 32px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: .3px;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(240,107,107,.35);
  font-family: inherit;
}

.btn-load-more:hover {
  background: #e85555;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(240,107,107,.45);
}

.btn-load-more:active {
  transform: translateY(0);
}

.btn-load-more svg {
  transition: transform .3s;
}

.btn-load-more.is-loading svg {
  animation: spin .8s linear infinite;
}

.btn-load-more.is-loading {
  pointer-events: none;
  opacity: .8;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== FOOTER ===== */
.site-footer {
  background: #2a2a2a;
  color: #999;
  text-align: center;
  padding: 24px 16px;
  font-size: 12px;
}
.site-footer a { color: #bbb; }
.site-footer a:hover { color: var(--red); }
.site-footer .footer-links { margin-bottom: 8px; }
.site-footer .footer-links a { margin: 0 10px; }

/* ===== SEARCH OVERLAY ===== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}
.search-overlay.open { display: flex; }
.search-box {
  background: var(--white);
  border-radius: 8px;
  padding: 24px;
  width: 560px;
  max-width: 90vw;
}
.search-box form { display: flex; gap: 8px; }
.search-box input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
}
.search-box input:focus { border-color: var(--red); }
.search-box button {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0 20px;
  font-size: 14px;
  cursor: pointer;
}
.search-close {
  display: block;
  text-align: right;
  margin-bottom: 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .posts-row, .posts-row.row2 { grid-template-columns: repeat(3, 1fr); }
  .cats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .posts-row, .posts-row.row2 { grid-template-columns: repeat(2, 1fr); }
  .cats-grid { grid-template-columns: 1fr 1fr; }
  .home-slider { height: 240px; }
  .slider-caption h2 { font-size: 16px; }
  #primary-menu { display: none; }
}
