/*
Theme Name: Mancs Clone
Theme URI: https://www.mancs.cn/
Author: Your Name
Author URI: https://www.mancs.cn/
Description: A WordPress theme that visually and functionally mimics the Mancs blog site.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mancs-clone
*/

/* CSS reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: #111827;
  background-color: #f3f4f6;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

/* Layout */
.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1 0 auto;
}

.site-footer {
  flex-shrink: 0;
}

/* Header / Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(249, 250, 251, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-branding {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.site-title {
  letter-spacing: 0.35em;
  font-size: 0.9rem;
  font-weight: 600;
}

.site-subtitle {
  font-size: 0.7rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.9rem;
}

.primary-nav a {
  position: relative;
  padding-bottom: 0.25rem;
  color: #4b5563;
  transition: color 0.2s ease;
}

.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: #111827;
  transition: width 0.2s ease;
}

.primary-nav a:hover {
  color: #111827;
}

.primary-nav a:hover::after,
.primary-nav .current-menu-item > a::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-toggle-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease,
    transform 0.1s ease;
}

.search-toggle-btn:hover {
  background: #f9fafb;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.search-toggle-btn svg {
  width: 16px;
  height: 16px;
  stroke: #6b7280;
}

.menu-toggle {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: white;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 16px;
  height: 1.5px;
  border-radius: 999px;
  background-color: #4b5563;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-toggle span::before {
  top: -5px;
}

.menu-toggle span::after {
  top: 5px;
}

.menu-toggle.is-open span {
  transform: rotate(45deg);
}

.menu-toggle.is-open span::before {
  transform: rotate(-90deg);
  top: 0;
}

.menu-toggle.is-open span::after {
  opacity: 0;
}

/* Mobile nav */
@media (max-width: 768px) {
  .primary-nav {
    position: fixed;
    inset: 56px 0 auto 0;
    background-color: rgba(249, 250, 251, 0.98);
    backdrop-filter: blur(16px);
    flex-direction: column;
    padding: 1rem 1.25rem 1.5rem;
    transform: translateY(-105%);
    opacity: 0;
    pointer-events: none;
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  }

  .primary-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .header-inner {
    padding-inline: 1rem;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .primary-nav-desktop-only {
    display: none;
  }
}

@media (min-width: 769px) {
  .primary-nav {
    position: static;
    inset: auto;
    flex-direction: row;
    padding: 0;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    border-bottom: none;
  }
}

/* Hero section */
.hero {
  max-width: 1120px;
  margin: 3rem auto 2.5rem;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr);
  gap: 2.25rem;
  align-items: center;
}

.hero-label {
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(2.2rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.hero-intro {
  font-size: 0.98rem;
  color: #4b5563;
  max-width: 32rem;
}

.hero-meta {
  margin-top: 1.5rem;
  font-size: 0.86rem;
  color: #6b7280;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-meta span {
  position: relative;
  padding-left: 0.9rem;
}

.hero-meta span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background-color: #9ca3af;
  transform: translateY(-50%);
}

.hero-sidecard {
  border-radius: 1.25rem;
  background: radial-gradient(circle at top left, #111827, #020617);
  color: #e5e7eb;
  padding: 1.75rem 1.75rem 1.6rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.4);
}

.hero-sidecard-label {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 0.75rem;
}

.hero-sidecard-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.hero-sidecard-desc {
  font-size: 0.9rem;
  color: #e5e7eb;
  margin-bottom: 1.25rem;
}

.hero-sidecard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.hero-sidecard-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(156, 163, 175, 0.4);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 2.25rem;
  }
}

/* Post list */
.home-section {
  max-width: 1120px;
  margin: 0 auto 3rem;
  padding: 0 1.25rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #9ca3af;
}

.section-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.post-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.8rem 1rem;
  border-radius: 0.9rem;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(229, 231, 235, 0.9);
  transition: box-shadow 0.12s ease, transform 0.12s ease,
    border-color 0.12s ease, background 0.12s ease;
}

.post-card:hover {
  background-color: #ffffff;
  border-color: rgba(148, 163, 184, 0.7);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.post-meta {
  font-size: 0.8rem;
  color: #9ca3af;
  white-space: nowrap;
}

.post-title {
  font-size: 0.98rem;
  font-weight: 500;
  color: #111827;
}

.post-excerpt {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.2rem;
}

.post-taxonomies {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: #9ca3af;
}

.post-taxonomies a {
  color: #6b7280;
}

.post-readmore {
  font-size: 0.8rem;
  color: #9ca3af;
}

@media (max-width: 640px) {
  .post-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-meta {
    order: -1;
  }
}

/* Pagination */
.pagination {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.pagination .page-numbers {
  min-width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background-color: white;
  color: #4b5563;
}

.pagination .page-numbers.current {
  border-color: #111827;
  color: #111827;
}

.pagination .page-numbers:hover {
  border-color: #9ca3af;
}

/* Single post */
.single-layout {
  max-width: 840px;
  margin: 3rem auto 3rem;
  padding: 0 1.25rem;
}

.single-header {
  margin-bottom: 1.75rem;
}

.single-title {
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.single-meta {
  font-size: 0.8rem;
  color: #9ca3af;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.single-content {
  font-size: 0.96rem;
  color: #111827;
}

.single-content p {
  margin-bottom: 1rem;
}

.single-content h2,
.single-content h3,
.single-content h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.single-content ul,
.single-content ol {
  margin: 0.75rem 0 1rem 1.25rem;
}

.single-content blockquote {
  border-left: 3px solid #e5e7eb;
  padding-left: 1rem;
  color: #6b7280;
  margin: 1.25rem 0;
}

.single-footer {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: #9ca3af;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* Search overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 50;
}

.search-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.search-panel {
  width: min(640px, 92vw);
  background: #f9fafb;
  border-radius: 1.25rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.5);
  padding: 1rem 1.1rem 0.9rem;
}

.search-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 0.45rem;
  border-radius: 999px;
  background-color: white;
  border: 1px solid #e5e7eb;
}

.search-panel-header svg {
  width: 16px;
  height: 16px;
  stroke: #9ca3af;
}

.search-panel-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.9rem;
}

.search-panel-kbd {
  font-size: 0.7rem;
  color: #9ca3af;
  padding: 0.1rem 0.45rem;
  border-radius: 0.4rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

.search-panel-body {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.search-panel-footer {
  margin-top: 0.7rem;
  display: flex;
  justify-content: flex-end;
  font-size: 0.74rem;
  color: #9ca3af;
}

.search-panel-footer span + span {
  margin-left: 1rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 1.2rem 0 1.6rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-links a {
  color: #6b7280;
}

.footer-links a:hover {
  color: #111827;
}

/* Generic page */
.page-layout {
  max-width: 840px;
  margin: 3rem auto 3rem;
  padding: 0 1.25rem;
}

.page-title {
  font-size: clamp(1.6rem, 2.4vw, 1.9rem);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Utility */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9ca3af;
}

.badge-dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background-color: #9ca3af;
}

/* Injected compatibility layer for advanced modules */
#site-preloader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  z-index: 9999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#site-preloader.hidden {
  opacity: 0;
  visibility: hidden;
}

.preloader-content {
  text-align: center;
}

.progress {
  height: 2px;
  width: min(180px, 40vw);
  margin-top: 10px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress .bar {
  height: 100%;
  width: 0;
  background: #111827;
}

body.preloader-lock > *:not(#site-preloader) {
  visibility: hidden !important;
}

.theme-toggle {
  border: 1px solid #e5e7eb;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.theme-icon-moon {
  display: none;
}

.back-to-top-mobile,
.back-to-top-desktop {
  position: fixed;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  opacity: 0;
  visibility: hidden;
  transition: 0.2s ease all;
  z-index: 40;
}

.back-to-top-mobile {
  bottom: 4rem;
}

.back-to-top-desktop {
  bottom: 1rem;
}

.back-to-top-mobile.show,
.back-to-top-desktop.show {
  opacity: 1;
  visibility: visible;
}

.cmenu {
  position: fixed;
  min-width: 180px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgb(0 0 0 / 8%);
  z-index: 2147483647;
}

.cmenu__list {
  padding: 0.35rem;
}

.cmenu__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}

.cmenu__item:hover {
  background: #f0f0f0;
}

.moment-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.moment-modal.is-open {
  display: flex;
}

.moment-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.moment-modal-content {
  position: relative;
  width: min(400px, 92vw);
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 1rem;
  z-index: 1;
}

.view-image {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.view-image img {
  max-width: 90vw;
  max-height: 90vh;
}

