/* ============================================================
   LAYOUT — Header, Footer, Grids
   NexRC Design System v3
   ============================================================ */

/* ── Site Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 200ms ease;
}
.site-header.scrolled {
  box-shadow: 0 1px 12px rgba(0,0,0,0.06);
}

/* Inner 3-col: logo | nav | actions */
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0;
}

/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: 32px;
  text-decoration: none;
}
.header-logo__mark {
  width: 22px;
  height: 22px;
  color: var(--brand-primary);
  flex-shrink: 0;
}
.header-logo__text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  white-space: nowrap;
}
/* Legacy: img-based logo still works */
.header-logo img { height: 24px; width: auto; display: block; }

/* Nav — desktop */
.header-nav {
  display: flex;
  align-items: center;
  flex: 1;
}
.header-nav ul,
.header-nav > ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.header-nav li { list-style: none; }
.header-nav li a,
.header-nav > a {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease;
}
.header-nav li a:hover,
.header-nav > a:hover { color: var(--text-primary); background: var(--surface-2); }
.header-nav li.current-menu-item > a,
.header-nav li.current-page-ancestor > a { color: var(--text-primary); }

/* Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.header-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  transition: color 150ms ease, background 150ms ease;
  flex-shrink: 0;
}
.header-icon-btn:hover { color: var(--text-primary); background: var(--surface-2); }
.header-icon-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* Cart badge */
.cart-count {
  position: absolute;
  top: 5px; right: 5px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.cart-count:empty { display: none; }

/* Burger */
.header-burger {
  flex-direction: column;
  gap: 5px;
  display: none;
}
.header-burger span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 250ms ease, opacity 250ms ease;
  transform-origin: center;
}
.header-burger.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.header-burger.active span:nth-child(2) { opacity: 0; }
.header-burger.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Mobile menu ──────────────────────────────────────────────── */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  flex-direction: column;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease;
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:active { background: var(--surface-1); }

/* Header spacer (only needed when not sticky) */
.header-spacer { height: 0; }

/* ── Search bar ───────────────────────────────────────────────── */
.search-bar {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 98;
}
.search-bar.open { display: block; }
.search-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-bar-inner form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  height: 44px;
  transition: border-color 150ms, box-shadow 150ms;
}
.search-bar-inner form:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-muted);
}
.search-bar-inner form svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-bar-inner input[type="search"] {
  flex: 1; border: none; background: transparent;
  font-size: 15px; font-family: var(--font-primary);
  color: var(--text-primary); outline: none; height: 100%;
}
.search-bar-inner input[type="search"]::placeholder { color: var(--text-muted); }
.search-bar-close {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  color: var(--text-muted); font-size: 20px;
  transition: color 150ms, background 150ms;
}
.search-bar-close:hover { color: var(--text-primary); background: var(--surface-1); }

/* ── Bottom mobile navigation ─────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--surface-0);
  border-top: 1px solid var(--border);
  z-index: 99;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav__inner {
  display: flex;
  align-items: stretch;
  height: 100%;
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 6px 0;
  transition: color 150ms;
  text-decoration: none;
}
.bottom-nav__item svg { width: 22px; height: 22px; flex-shrink: 0; }
.bottom-nav__item.active { color: var(--brand-primary); }
.bottom-nav__item:active { color: var(--brand-primary); }

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface-1);
  color: var(--text-primary);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 40px;
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 56px;
  align-items: start;
}

.footer-brand {}
.footer-brand .footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  text-decoration: none;
}
.footer-brand .footer-logo img { height: 22px; width: auto; }
.footer-brand .footer-logo__text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.footer-brand .footer-logo__mark {
  width: 20px; height: 20px;
  color: var(--brand-primary);
}
.footer-tagline {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 20px;
  max-width: 280px;
}
.footer-telegram {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  transition: color 150ms, border-color 150ms, background 150ms;
}
.footer-telegram:hover {
  color: var(--text-primary);
  border-color: #229ED9;
  background: rgba(34,158,217,0.05);
}
.footer-telegram svg { width: 15px; height: 15px; }

.footer-col .footer-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col ul li { list-style: none; }
.footer-col ul li a,
.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 5px 0;
  transition: color 150ms;
  line-height: 1.5;
}
.footer-col ul li a:hover,
.footer-col a:hover { color: var(--text-primary); }

.footer-bottom {
  background: #F1F3F5;
  border-top: 1px solid var(--border);
}
.footer-bottom-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.footer-bottom-inner p { font-size: 12px; color: var(--text-muted); }

/* ── Grids ────────────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.categories-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.categories-grid--3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.categories-grid--4 {
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
