/*
Theme Name:  B2B Catalog Theme
Theme URI:   https://example.com/b2b-catalog-theme
Author:      B2B Catalog
Description: Лёгкая минималистичная тема для B2B-сайтов с каталогом и RFQ. Оболочка для плагина B2B Catalog & RFQ for WooCommerce.
Version:     1.1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: b2b-theme
Tags:        b2b, catalog, woocommerce, minimal, responsive
*/

/* ============================================================
   CSS CUSTOM PROPERTIES (defaults — overridden by Customizer)
   ============================================================ */
:root {
  /* Глобальные цвета */
  --color-primary:     #2563eb;
  --color-secondary:   #1e40af;
  --color-accent:      #f59e0b;
  --color-text:        #1e293b;
  --color-text-muted:  #64748b;
  --color-bg:          #f8fafc;
  --color-surface:     #ffffff;
  --color-border:      #e2e8f0;
  --color-danger:      #dc2626;
  --color-success:     #16a34a;
  /* Шапка */
  --header-bg:         #ffffff;
  --header-text:       #1e293b;
  --header-link-hover: #2563eb;
  /* Подвал */
  --footer-bg:         #1e293b;
  --footer-text:       #94a3b8;
  --footer-heading:    #f1f5f9;
  --footer-link:       #94a3b8;
  --footer-link-hover: #ffffff;
  --footer-border:     #334155;
  /* Hero */
  --hero-bg-start:     #1e293b;
  --hero-bg-end:       #1e40af;
  --hero-text:         #ffffff;
  --hero-subtext:      #cbd5e1;
  /* Кнопка RFQ / btn-primary */
  --btn-primary-bg:       #2563eb;
  --btn-primary-text:     #ffffff;
  --btn-primary-hover-bg: #1e40af;
  --btn-radius:           6px;
  --btn-font-weight:      600;
  /* Типографика и лейаут */
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-size-base: 16px;
  --line-height: 1.6;
  --container-width: 1280px;
  --container-pad: 0 20px;
  --header-height: 64px;
  --radius: 6px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --transition: .18s ease;
}

/* ============================================================ RESET ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-size-base); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); color: var(--color-text); background: var(--color-bg); line-height: var(--line-height); min-height: 100vh; display: flex; flex-direction: column; }
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-secondary); }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

/* ============================================================ LAYOUT ============================================================ */
.container { max-width: var(--container-width); margin: 0 auto; padding: var(--container-pad); width: 100%; }
.site-main  { flex: 1; padding: 40px 0 60px; }

/* ============================================================ TYPOGRAPHY ============================================================ */
h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.25; color: var(--color-text); margin-bottom: .5em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h4 { font-size: 1.1rem; }
p  { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
.text-muted  { color: var(--color-text-muted); }
.text-center { text-align: center; }
.text-small  { font-size: .875rem; }

/* ============================================================
   BUTTONS
   btn-primary использует CSS-переменные — управляется Customizer
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  border-radius: var(--btn-radius, var(--radius));
  font-size: .9375rem;
  font-weight: var(--btn-font-weight, 600);
  border: 2px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap; line-height: 1;
}
.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
}
.btn-primary:hover {
  background: var(--btn-primary-hover-bg);
  border-color: var(--btn-primary-hover-bg);
  color: var(--btn-primary-text);
}
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary); color: #fff; }
.btn-outline-white {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.7);
}
.btn-outline-white:hover { background: rgba(255,255,255,.15); color: #fff; border-color: #fff; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-sm { padding: 6px 14px; font-size: .8125rem; }

/* ============================================================
   HEADER — использует CSS-переменные
   ============================================================ */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
  z-index: 100;
}
.site-header--sticky { position: sticky; top: 0; }
.site-header.is-scrolled { box-shadow: 0 2px 12px rgba(0,0,0,.10); }
.header-inner {
  display: flex;
  align-items: center;
  gap: var(--header-gap, 24px);
  height: 100%;
  padding-top: var(--header-padding-y, 0);
  padding-bottom: var(--header-padding-y, 0);
}
.site-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.site-logo img { height: var(--header-logo-height, 40px); width: auto; }
.site-logo .logo-text { font-size: 1.125rem; font-weight: 700; color: var(--header-text); white-space: nowrap; }
.header-nav { flex: 1; }
.nav-menu { display: flex; align-items: center; gap: 4px; }
.nav-menu li a {
  display: block; padding: 6px 12px; font-size: var(--header-menu-font-size, 14px); font-weight: 500;
  color: var(--header-text); border-radius: 4px;
  transition: background var(--transition), color var(--transition); white-space: nowrap;
}
.nav-menu li a:hover,
.nav-menu li.current-menu-item > a,
.nav-menu li.current_page_item > a { background: var(--color-bg); color: var(--header-link-hover); }
.nav-menu li.menu-catalog > a {
  background: var(--btn-primary-bg); color: var(--btn-primary-text);
  border-radius: var(--btn-radius, var(--radius)); padding: 6px 14px;
}
.nav-menu li.menu-catalog > a:hover { background: var(--btn-primary-hover-bg); color: var(--btn-primary-text); }
.header-contacts {
  display: flex; flex-direction: column; align-items: flex-end;
  font-size: var(--header-contact-font-size, 13px); color: var(--color-text-muted); flex-shrink: 0;
}
.header-contacts a { color: var(--header-text); font-weight: 600; }
.header-contacts a:hover { color: var(--header-link-hover); }
.burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 8px; border-radius: 4px; }
.burger span { display: block; width: 22px; height: 2px; background: var(--header-text); border-radius: 2px; transition: transform var(--transition), opacity var(--transition); }
.burger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.is-active span:nth-child(2) { opacity: 0; }
.burger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-nav {
  display: none; position: fixed; top: var(--header-height); left: 0; right: 0;
  background: var(--header-bg); border-bottom: 1px solid var(--color-border);
  z-index: 99; padding: 16px 20px 24px; box-shadow: var(--shadow-md);
}
.mobile-nav.is-open { display: block; }
.mobile-nav .nav-menu { flex-direction: column; align-items: flex-start; gap: 2px; }
.mobile-nav .nav-menu li { width: 100%; }
.mobile-nav .nav-menu li a { width: 100%; font-size: 1rem; padding: 10px 14px; color: var(--header-text); }
.mobile-nav .header-contacts { align-items: flex-start; margin-top: 16px; gap: 4px; }

/* ============================================================
   FOOTER — использует CSS-переменные
   ============================================================ */
.site-footer { background: var(--footer-bg); color: var(--footer-text); padding: 40px 0 24px; margin-top: auto; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding-bottom: 32px; border-bottom: 1px solid var(--footer-border); }
.footer-brand .logo-text { color: var(--footer-heading); font-size: 1.125rem; font-weight: 700; }
.footer-brand p { font-size: .875rem; margin-top: 12px; color: var(--footer-text); }
.footer-contacts { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; font-size: .875rem; }
.footer-contacts a, .footer-contacts span { color: var(--footer-link); display: flex; align-items: flex-start; gap: 6px; }
.footer-contacts a:hover { color: var(--footer-link-hover); }
.footer-icon { flex-shrink: 0; }
.footer-col h4 { color: var(--footer-heading); font-size: .875rem; font-weight: 700; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .05em; }
.footer-col ul { display: flex; flex-direction: column; gap: 6px; }
.footer-col ul li a { color: var(--footer-link); font-size: .875rem; transition: color var(--transition); }
.footer-col ul li a:hover { color: var(--footer-link-hover); }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding-top: 20px; font-size: .8125rem; color: var(--footer-text); flex-wrap: wrap; gap: 8px; }
.footer-bottom a { color: var(--footer-link); }
.footer-bottom a:hover { color: var(--footer-link-hover); }

/* ============================================================
   FRONT PAGE — Hero использует CSS-переменные
   ============================================================ */
.hero-section {
  background: linear-gradient(135deg, var(--hero-bg-start) 0%, var(--hero-bg-end) 100%);
  color: var(--hero-text); padding: 80px 0; text-align: center;
}
.hero-section h1 { color: var(--hero-text); font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 16px; }
.hero-section > .container > p { font-size: 1.125rem; color: var(--hero-subtext); max-width: 600px; margin: 0 auto 32px; }
.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.features-section { padding: 64px 0; }
.section-title { text-align: center; margin-bottom: 48px; }
.section-title p { color: var(--color-text-muted); font-size: 1.0625rem; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.feature-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; padding: 24px 20px; text-align: center; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition); }
.feature-card:hover { box-shadow: var(--shadow-md); }
.feature-icon { font-size: 2.5rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 1rem; margin-bottom: 8px; }
.feature-card p  { font-size: .875rem; color: var(--color-text-muted); margin: 0; }
.cta-section { background: var(--btn-primary-bg); color: #fff; padding: 56px 0; text-align: center; }
.cta-section h2 { color: #fff; margin-bottom: 12px; }
.cta-section > .container > p { color: rgba(255,255,255,.8); margin-bottom: 28px; font-size: 1.0625rem; }

/* ============================================================ PAGES ============================================================ */
.page-content-wrap { max-width: 860px; margin: 0 auto; }
.entry-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--color-border); }
.entry-title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.entry-content { font-size: 1rem; }
.entry-content h2 { margin-top: 2em; }
.entry-content h3 { margin-top: 1.5em; }
.entry-content ul, .entry-content ol { padding-left: 1.5em; list-style: disc; margin-bottom: 1rem; }
.entry-content ol { list-style: decimal; }
.entry-content li { margin-bottom: .25em; }
.entry-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: .9375rem; }
.entry-content th, .entry-content td { border: 1px solid var(--color-border); padding: 8px 12px; }
.entry-content th { background: var(--color-bg); font-weight: 600; }
.entry-content blockquote { border-left: 4px solid var(--color-primary); padding: 12px 20px; background: #eff6ff; border-radius: 0 var(--radius) var(--radius) 0; margin: 1.5rem 0; color: #1e40af; }
.entry-content img { border-radius: var(--radius); margin: 1rem 0; }

/* ============================================================ CATALOG AREA ============================================================ */
.catalog-page-header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--color-border); }
.catalog-page-header h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 4px; }
.catalog-page-header p  { color: var(--color-text-muted); font-size: .9375rem; margin: 0; }
.catalog-shortcode-area > p:last-child { margin-bottom: 0; }

/* ============================================================ CONTACTS ============================================================ */
.contacts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.contacts-info h2 { margin-bottom: 24px; }
.contact-item { display: flex; gap: 14px; margin-bottom: 20px; align-items: flex-start; }
.contact-item-icon { font-size: 1.5rem; flex-shrink: 0; }
.contact-item h4 { font-size: .875rem; color: var(--color-text-muted); font-weight: 500; margin-bottom: 2px; }
.contact-item p, .contact-item a { font-size: 1rem; font-weight: 600; color: var(--color-text); margin: 0; }
.contact-item a:hover { color: var(--color-primary); }
.contact-map { border-radius: 8px; overflow: hidden; border: 1px solid var(--color-border); }
.contact-map iframe { display: block; width: 100%; height: 360px; border: none; }
.contact-form-section { margin-top: 48px; }
.contact-form-section h2 { margin-bottom: 24px; }
.theme-form .form-row { margin-bottom: 16px; }
.theme-form label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 5px; }
.theme-form input[type="text"],
.theme-form input[type="email"],
.theme-form input[type="tel"],
.theme-form textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: .9375rem; font-family: inherit; transition: border-color var(--transition); outline: none; background: #fff; }
.theme-form input:focus, .theme-form textarea:focus { border-color: var(--color-primary); }
.theme-form textarea { min-height: 120px; resize: vertical; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================================ CARDS / UTILS ============================================================ */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; padding: 24px; box-shadow: var(--shadow-sm); }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 50px; font-size: .75rem; font-weight: 600; }
.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-success  { background: #dcfce7; color: #15803d; }
.breadcrumbs { font-size: .8125rem; color: var(--color-text-muted); margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs .sep { color: var(--color-border); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.notice-box { border-radius: var(--radius); padding: 14px 18px; font-size: .9375rem; margin: 16px 0; display: flex; gap: 10px; align-items: flex-start; }
.notice-box-info    { background: #eff6ff; border-left: 4px solid var(--color-primary); color: #1e40af; }
.notice-box-success { background: #f0fdf4; border-left: 4px solid var(--color-success); color: #166534; }
.notice-box-warning { background: #fffbeb; border-left: 4px solid var(--color-accent);  color: #92400e; }
.notice-box-danger  { background: #fef2f2; border-left: 4px solid var(--color-danger);  color: #991b1b; }

/* ============================================================ 404 ============================================================ */
.error404-wrap { text-align: center; padding: 80px 20px; }
.error404-wrap .error-code { font-size: clamp(5rem, 15vw, 10rem); font-weight: 900; color: var(--color-border); line-height: 1; margin-bottom: 16px; }
.error404-wrap h1 { margin-bottom: 12px; }
.error404-wrap p  { color: var(--color-text-muted); margin-bottom: 32px; }
.error404-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============================================================ ARCHIVE / BLOG ============================================================ */
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; margin-bottom: 40px; }
.post-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: box-shadow var(--transition); }
.post-card:hover { box-shadow: var(--shadow-md); }
.post-card .post-thumb img { width: 100%; height: 200px; object-fit: cover; }
.post-card .post-body { padding: 20px; flex: 1; }
.post-card .post-meta { font-size: .8125rem; color: var(--color-text-muted); margin-bottom: 8px; }
.post-card .post-title { font-size: 1.0625rem; font-weight: 700; margin-bottom: 8px; }
.post-card .post-title a { color: var(--color-text); }
.post-card .post-title a:hover { color: var(--color-primary); }
.post-card .post-excerpt { font-size: .875rem; color: var(--color-text-muted); }
.post-card .post-footer { padding: 12px 20px; border-top: 1px solid var(--color-border); }
.pagination { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: .875rem; color: var(--color-text); background: #fff; }
.pagination .page-numbers.current,
.pagination .page-numbers:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ============================================================ RESPONSIVE ============================================================ */
@media (max-width: 1024px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .contacts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  /*:root { --header-height: 56px; } */
  .header-nav, .header-contacts { display: none; }
  .burger { display: flex; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .hero-section { padding: 56px 0; }
  .features-section { padding: 40px 0; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .site-main { padding: 24px 0 40px; }
}
@media (max-width: 480px) {
  .hero-section h1 { font-size: 1.75rem; }
  .btn-lg { padding: 12px 24px; font-size: .9375rem; }
}
