/*
Theme Name: Qizhi KOMPAN
Theme URI: https://qizitoy.com
Description: KOMPAN-inspired Scandinavian design theme for Qizhi Play Equipment
Author: Qizhi
Version: 2.0
Text Domain: qizhi-kompan
*/

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

:root {
  --red: #d32f2f;
  --red-dark: #b71c1c;
  --red-light: #ef5350;
  --white: #ffffff;
  --off-white: #f5f5f5;
  --light-gray: #e0e0e0;
  --mid-gray: #9e9e9e;
  --dark-gray: #424242;
  --black: #212121;
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1280px;
  --header-height: 72px;
  --transition: 0.3s ease;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
  --radius: 4px;
  --radius-lg: 8px;
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-primary);
  color: var(--black);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--red-dark); }
ul { list-style: none; }

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 600; line-height: 1.3; color: var(--black); }
h1 { font-size: 3rem; font-weight: 700; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ==============================================
   BUTTONS & CTAs
   ============================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 32px; font-size: 0.9375rem; font-weight: 600;
  border: 2px solid transparent; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  text-transform: none; letter-spacing: 0.02em;
  font-family: var(--font-primary); line-height: 1.2;
}
.btn-primary {
  background: var(--red); color: var(--white); border-color: var(--red);
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }
.btn-outline {
  background: transparent; color: var(--red); border-color: var(--red);
}
.btn-outline:hover { background: var(--red); color: var(--white); }
.btn-outline-white {
  background: transparent; color: var(--white); border-color: var(--white);
}
.btn-outline-white:hover { background: var(--white); color: var(--black); }
.btn-sm { padding: 10px 24px; font-size: 0.875rem; }
.btn-lg { padding: 18px 40px; font-size: 1.0625rem; }

/* ==============================================
   HEADER & MEGA-MENU
   ============================================== */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: var(--white); height: var(--header-height);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}
.site-branding {
  display: flex; align-items: center; gap: 12px;
}
.site-logo {
  height: 40px; width: auto;
}
.site-title {
  font-size: 1.5rem; font-weight: 700; color: var(--black);
  letter-spacing: -0.02em;
}
.site-title span { color: var(--red); }

/* Main Nav */
.main-nav { display: flex; align-items: center; height: 100%; }
.nav-list { display: flex; align-items: center; gap: 4px; height: 100%; }
.nav-list > li { position: relative; height: 100%; display: flex; align-items: center; }
.nav-list > li > a {
  display: flex; align-items: center; height: 100%;
  padding: 0 16px; font-size: 0.9375rem; font-weight: 500;
  color: var(--black); white-space: nowrap;
  border-bottom: 3px solid transparent; transition: all var(--transition);
}
.nav-list > li > a:hover { color: var(--red); }
.nav-list > li.current-menu-item > a,
.nav-list > li.current-menu-parent > a { color: var(--red); border-bottom-color: var(--red); }

/* Mega Menu Dropdown */
.has-mega-menu .mega-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  width: 800px; max-width: calc(100vw - 48px);
  background: var(--white); box-shadow: var(--shadow-lg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: all 0.25s ease; padding: 32px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.has-mega-menu:hover .mega-menu {
  opacity: 1; visibility: visible; pointer-events: auto;
}
.mega-col h4 {
  font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--mid-gray); margin-bottom: 12px;
}
.mega-col ul li { margin-bottom: 8px; }
.mega-col ul li a {
  font-size: 0.9375rem; color: var(--dark-gray); transition: color var(--transition);
}
.mega-col ul li a:hover { color: var(--red); }

/* Mobile Menu Toggle */
.menu-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px;
}
.menu-toggle span {
  display: block; width: 24px; height: 2px;
  background: var(--black); transition: all var(--transition);
}

/* Mobile Nav */
.mobile-nav {
  display: none; position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0;
  background: var(--white); z-index: 999; padding: 24px;
  overflow-y: auto; flex-direction: column;
}
.mobile-nav.active { display: flex; }
.mobile-nav a {
  display: block; padding: 14px 0; font-size: 1.125rem; color: var(--black);
  border-bottom: 1px solid var(--light-gray);
}
.mobile-nav a:hover { color: var(--red); }
.mobile-nav .mega-col h4 { margin-top: 16px; }
.header-actions { display: flex; align-items: center; gap: 12px; position: relative; }

/* Header inline search bar */
.header-search {
  display: flex; align-items: center;
  border: 2px solid var(--light-gray); border-radius: 24px;
  overflow: hidden; transition: border-color var(--transition);
  background: var(--off-white);
}
.header-search:focus-within {
  border-color: var(--red);
  background: var(--white);
}
.header-search-input {
  border: none; background: transparent; padding: 8px 14px;
  font-size: 0.875rem; font-family: var(--font-primary);
  color: var(--black); outline: none; width: 180px;
  transition: width var(--transition);
}
.header-search-input:focus { width: 240px; }
.header-search-input::placeholder { color: var(--mid-gray); }
.header-search-btn {
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; padding: 8px 12px;
  cursor: pointer; color: var(--mid-gray);
  transition: color var(--transition);
}
.header-search-btn:hover { color: var(--red); }

/* Tag pills on cards */
.tag-pill {
  display: inline-block;
  background: rgba(211,47,47,0.08); color: var(--red);
  padding: 2px 10px; border-radius: 12px;
  font-size: 12px; text-decoration: none;
  border: 1px solid rgba(211,47,47,0.2);
  transition: all var(--transition);
}
.tag-pill:hover {
  background: var(--red); color: var(--white);
  border-color: var(--red);
}

/* ==============================================
   FOOTER
   ============================================== */
.site-footer {
  background: var(--black); color: var(--white); padding: 64px 0 0;
}
.footer-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px;
}
.footer-col h4 {
  color: var(--white); font-size: 1.0625rem; margin-bottom: 20px;
  position: relative; padding-bottom: 12px;
}
.footer-col h4::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 32px; height: 2px; background: var(--red);
}
.footer-col p { color: var(--mid-gray); font-size: 0.9375rem; line-height: 1.7; margin-bottom: 8px; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: var(--mid-gray); font-size: 0.9375rem; transition: color var(--transition); }
.footer-col ul li a:hover { color: var(--white); }
.footer-col .contact-item { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; color: var(--mid-gray); }
.footer-col .contact-item .icon { font-size: 1.125rem; color: var(--red); flex-shrink: 0; margin-top: 2px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1); margin-top: 48px;
  padding: 24px 0; display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.footer-bottom p { color: var(--mid-gray); font-size: 0.875rem; }
.footer-social { display: flex; gap: 16px; }
.footer-social a {
  width: 40px; height: 40px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 1.125rem;
  background: rgba(255,255,255,0.08); color: var(--white); transition: all var(--transition);
}
.footer-social a:hover { background: var(--red); }

/* ==============================================
   HERO SECTION
   ============================================== */
.hero {
  position: relative; min-height: 560px; display: flex; align-items: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
}
.hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 60%, rgba(0,0,0,0.05) 100%);
}
.hero .container { position: relative; z-index: 2; }
.hero-content { max-width: 600px; }
.hero-content h1 {
  color: var(--white); font-size: 3.25rem; font-weight: 700;
  line-height: 1.15; margin-bottom: 20px; letter-spacing: -0.02em;
}
.hero-content p {
  color: rgba(255,255,255,0.9); font-size: 1.1875rem;
  line-height: 1.6; margin-bottom: 32px; max-width: 500px;
}
.hero-ctas { display: flex; gap: 16px; flex-wrap: wrap; }

/* ==============================================
   SECTION LAYOUT
   ============================================== */
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }
.section-lg { padding: 120px 0; }
.section-dark { background: var(--black); color: var(--white); }
.section-dark h2, .section-dark h3 { color: var(--white); }
.section-light { background: var(--off-white); }
.section-red { background: var(--red); color: var(--white); }
.section-red h2, .section-red h3 { color: var(--white); }

.section-header { text-align: center; margin-bottom: 56px; }
.section-header h2 { margin-bottom: 12px; letter-spacing: -0.02em; }
.section-header p { color: var(--mid-gray); font-size: 1.125rem; max-width: 650px; margin: 0 auto; }
.section-dark .section-header p, .section-red .section-header p { color: rgba(255,255,255,0.7); }

.section-label {
  display: inline-block; font-size: 0.8125rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--red);
  margin-bottom: 8px;
}

/* ==============================================
   CARD GRIDS
   ============================================== */
.card-grid { display: grid; gap: 24px; }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--white); border-radius: var(--radius-lg);
  overflow: hidden; transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.card-img { position: relative; overflow: hidden; aspect-ratio: 4/3; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.card:hover .card-img img { transform: scale(1.05); }
.card-body { padding: 24px; }
.card-body h3 { font-size: 1.25rem; margin-bottom: 8px; }
.card-body p { color: var(--dark-gray); font-size: 0.9375rem; line-height: 1.6; }
.card-footer { padding: 0 24px 24px; }
.card-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.card-meta span { font-size: 0.8125rem; color: var(--mid-gray); }

/* ==============================================
   PRODUCT CAROUSEL
   ============================================== */
.product-carousel { position: relative; }
.product-carousel .swiper { overflow: visible; padding: 16px 0; }
.product-carousel .swiper-slide { height: auto; }
.product-carousel .card { height: 100%; }

.swiper-button-next, .swiper-button-prev {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--white); box-shadow: var(--shadow-md);
  color: var(--black); transition: all var(--transition);
}
.swiper-button-next:hover, .swiper-button-prev:hover { background: var(--red); color: var(--white); }
.swiper-button-next::after, .swiper-button-prev::after { font-size: 1rem; font-weight: bold; }
.swiper-pagination-bullet-active { background: var(--red); }

/* ==============================================
   CATEGORY CARDS
   ============================================== */
.category-card {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  aspect-ratio: 3/2; display: flex; align-items: flex-end;
  cursor: pointer;
}
.category-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.category-card:hover img { transform: scale(1.05); }
.category-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 50%);
}
.category-card-content {
  position: relative; z-index: 1; padding: 32px;
}
.category-card-content h3 { color: var(--white); font-size: 1.5rem; margin-bottom: 8px; }
.category-card-content p { color: rgba(255,255,255,0.8); font-size: 0.9375rem; }

/* ==============================================
   HELP CARDS (4-col CTA)
   ============================================== */
.help-card {
  text-align: center; padding: 40px 24px; border-radius: var(--radius-lg);
  background: var(--white); box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.help-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }
.help-card-icon {
  width: 64px; height: 64px; margin: 0 auto 20px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; background: rgba(211,47,47,0.1); color: var(--red);
}
.help-card h3 { font-size: 1.125rem; margin-bottom: 12px; }
.help-card p { font-size: 0.9375rem; color: var(--dark-gray); margin-bottom: 20px; }

/* ==============================================
   MISSION QUOTE
   ============================================== */
.mission-quote {
  text-align: center; max-width: 800px; margin: 0 auto;
}
.mission-quote blockquote {
  font-size: 1.75rem; font-weight: 300; line-height: 1.5;
  color: var(--black); font-style: italic; margin-bottom: 16px;
}
.mission-quote cite {
  font-style: normal; font-size: 1rem; color: var(--mid-gray);
  font-weight: 500;
}

/* ==============================================
   LOAD MORE PAGINATION
   ============================================== */
.load-more-wrap { text-align: center; margin-top: 48px; }
.load-more-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 40px; font-size: 0.9375rem; font-weight: 600;
  background: var(--white); color: var(--red); border: 2px solid var(--red);
  border-radius: var(--radius); cursor: pointer; transition: all var(--transition);
}
.load-more-btn:hover { background: var(--red); color: var(--white); }
.load-more-btn.loading { pointer-events: none; opacity: 0.7; }

/* ==============================================
   BLOG / ARCHIVE
   ============================================== */
.page-header {
  padding: 80px 0 48px; text-align: center;
  background: var(--off-white);
}
.page-header h1 { font-size: 2.5rem; margin-bottom: 12px; }
.page-header p { color: var(--dark-gray); font-size: 1.125rem; }

.blog-grid, .archive-grid { padding: 48px 0; }

/* Pagination */
.pagination {
  display: flex; justify-content: center; gap: 8px; margin-top: 48px;
}
.pagination .page-numbers {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius);
  background: var(--off-white); color: var(--dark-gray);
  font-size: 0.9375rem; font-weight: 500; transition: all var(--transition);
}
.pagination .page-numbers.current { background: var(--red); color: var(--white); }
.pagination .page-numbers:hover:not(.current) { background: var(--light-gray); }

/* ==============================================
   SINGLE POST / PRODUCT
   ============================================== */
.entry-header { margin-bottom: 32px; }
.entry-title { font-size: 2.5rem; margin-bottom: 12px; }
.entry-meta { color: var(--mid-gray); font-size: 0.9375rem; margin-bottom: 24px; }
.entry-content { font-size: 1.0625rem; line-height: 1.8; color: var(--dark-gray); }
.entry-content h2 { margin-top: 40px; margin-bottom: 16px; }
.entry-content h3 { margin-top: 32px; margin-bottom: 12px; }
.entry-content p { margin-bottom: 20px; }
.entry-content ul, .entry-content ol { margin-bottom: 20px; padding-left: 24px; }
.entry-content li { margin-bottom: 8px; }

/* Product Gallery */
.product-gallery { margin-bottom: 32px; }
.product-gallery-main { margin-bottom: 12px; border-radius: var(--radius-lg); overflow: hidden; }
.product-gallery-main img { width: 100%; height: auto; }
.product-gallery-thumbs { display: flex; gap: 8px; }
.product-gallery-thumbs button {
  width: 80px; height: 60px; border: 2px solid transparent; border-radius: var(--radius);
  overflow: hidden; cursor: pointer; padding: 0; transition: border-color var(--transition);
}
.product-gallery-thumbs button.active { border-color: var(--red); }
.product-gallery-thumbs button img { width: 100%; height: 100%; object-fit: cover; }

/* Product detail layout */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.product-info h1 { font-size: 2.25rem; margin-bottom: 16px; }
.product-specs { margin: 24px 0; padding: 24px; background: var(--off-white); border-radius: var(--radius-lg); }
.product-specs dt { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; color: var(--mid-gray); margin-bottom: 4px; }
.product-specs dd { font-size: 1.0625rem; margin-bottom: 16px; }
.product-specs dd:last-child { margin-bottom: 0; }
.product-description { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--light-gray); }

/* ==============================================
   CONTACT PAGE
   ============================================== */
.contact-layout { display: grid; grid-template-columns: 1fr 360px; gap: 48px; }
.contact-form-wrap { background: var(--white); border-radius: var(--radius-lg); padding: 40px; box-shadow: var(--shadow-sm); }
.contact-form-wrap h2 { margin-bottom: 24px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--dark-gray); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 16px; border: 2px solid var(--light-gray);
  border-radius: var(--radius); font-family: var(--font-primary);
  font-size: 0.9375rem; transition: border-color var(--transition);
  background: var(--white);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--red);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-message { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; display: none; }
.form-message.success { display: block; background: #e8f5e9; color: #2e7d32; }
.form-message.error { display: block; background: #fbe9e7; color: #c62828; }

.contact-sidebar { position: sticky; top: calc(var(--header-height) + 24px); }
.contact-info-card {
  background: var(--black); color: var(--white); border-radius: var(--radius-lg);
  padding: 32px;
}
.contact-info-card h3 { color: var(--white); margin-bottom: 24px; font-size: 1.25rem; }
.contact-info-item { display: flex; gap: 14px; margin-bottom: 20px; }
.contact-info-item .icon { color: var(--red); font-size: 1.25rem; flex-shrink: 0; }
.contact-info-item p { color: var(--mid-gray); font-size: 0.9375rem; }

/* ==============================================
   RESPONSIVE
   ============================================== */
@media (max-width: 1024px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.875rem; }
  .hero-content h1 { font-size: 2.5rem; }
  .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .product-detail { grid-template-columns: 1fr; }
  .contact-layout { grid-template-columns: 1fr; }
  .contact-sidebar { position: static; }

  .nav-list { display: none; }
  .menu-toggle { display: flex; }
  .header-actions .btn { display: none; }
  .header-actions .btn-sm { display: inline-flex; }
  .header-search-input { width: 140px; }
  .header-search-input:focus { width: 160px; }
}

@media (max-width: 768px) {
  :root { --header-height: 64px; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.625rem; }
  .hero { min-height: 420px; }
  .hero-content h1 { font-size: 2rem; }
  .hero-content p { font-size: 1rem; }
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .section { padding: 48px 0; }
  .section-lg { padding: 64px 0; }
  .category-card { aspect-ratio: 4/3; }
  .mission-quote blockquote { font-size: 1.375rem; }
  .entry-title { font-size: 2rem; }
}

@media (max-width: 480px) {
  .hero { min-height: 360px; }
  .hero-content h1 { font-size: 1.75rem; }
  .hero-ctas { flex-direction: column; }
  .hero-ctas .btn { width: 100%; }
  .contact-form-wrap { padding: 24px; }
}

/* ==============================================
   UTILITY
   ============================================== */
.text-center { text-align: center; }
.text-red { color: var(--red); }
.bg-red { background: var(--red); color: var(--white); }
.bg-dark { background: var(--black); color: var(--white); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* WordPress core styles */
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: 0.875rem; color: var(--mid-gray); margin-top: 8px; }
.alignleft { float: left; margin: 0 24px 16px 0; }
.alignright { float: right; margin: 0 0 16px 24px; }
.aligncenter { display: block; margin: 0 auto 16px; }
.screen-reader-text { clip: rect(1px, 1px, 1px, 1px); position: absolute !important; height: 1px; width: 1px; overflow: hidden; }
