/* =====================================================================
   ZippKart Storefront UX Foundation — Phase 2
   Loaded after the legacy storefront styles. This layer consolidates the
   customer-facing visual system without changing PHP or business logic.
   ===================================================================== */

:root {
  --zk-page-pad: clamp(14px, 3vw, 24px);
  --zk-section-gap: clamp(34px, 5vw, 64px);
  --zk-card-radius: 18px;
  --zk-control-radius: 12px;
  --zk-ease: cubic-bezier(.2,.7,.3,1);
  --zk-ring: 0 0 0 4px rgba(30,111,235,.16);
}

html { text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
.site-body {
  min-width: 0;
  overflow-x: clip;
  background: #F5F7FA;
}
.site-body *, .site-body *::before, .site-body *::after { min-width: 0; }
.site-body .container {
  width: min(100%, 1280px);
  padding-inline: var(--zk-page-pad);
}
.site-body main, .site-body section, .site-body footer, .site-body header { max-width: 100%; }
.site-body img { height: auto; }

/* Type and content rhythm */
.site-body h1, .site-body h2, .site-body h3 { text-wrap: balance; }
.site-body p { text-wrap: pretty; }
.site-body .section, .site-body .hx-sec { padding-block: var(--zk-section-gap); }
.site-body .section-head, .site-body .hx-head { margin-bottom: clamp(18px, 2.4vw, 28px); }
.site-body .section-head h2, .site-body .hx-head h2 {
  font-size: clamp(21px, 2.5vw, 30px);
  line-height: 1.15;
}

/* Header: stable, compact, touch-friendly */
.site-body .topbar .container { min-height: 34px; }
.site-body .navbar {
  background: rgba(255,255,255,.94);
  border-bottom-color: rgba(217,224,235,.9);
  box-shadow: 0 2px 14px rgba(14,30,56,.045);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
}
.site-body .navbar .container { gap: clamp(12px, 2vw, 24px); }
.site-body .nav-hamburger,
.site-body .icon-btn {
  min-width: 42px;
  min-height: 42px;
  border-radius: 12px;
}
.site-body .search-form input {
  min-height: 46px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(217,224,235,.35);
}
.site-body .search-form button { width: 42px; height: 42px; }
.site-body .category-strip { border-bottom: 1px solid var(--border); }
.site-body .category-strip .container { scrollbar-width: none; }
.site-body .category-strip .container::-webkit-scrollbar { display: none; }

/* Buttons and controls */
.site-body .btn {
  min-height: 42px;
  border-radius: var(--zk-control-radius);
  transition: transform .16s var(--zk-ease), box-shadow .16s var(--zk-ease),
              border-color .16s ease, background-color .16s ease, color .16s ease;
}
.site-body .btn:focus-visible,
.site-body input:focus-visible,
.site-body select:focus-visible,
.site-body textarea:focus-visible,
.site-body button:focus-visible,
.site-body a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.site-body input:not([type=checkbox]):not([type=radio]):not([type=file]),
.site-body select,
.site-body textarea {
  border-radius: var(--zk-control-radius);
  border-color: var(--border);
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.site-body input:not([type=checkbox]):not([type=radio]):not([type=file]):focus,
.site-body select:focus,
.site-body textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--zk-ring);
}

/* Product grids: dense enough to browse, large enough to tap */
.site-body .product-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 20px);
  align-items: stretch;
}
.site-body .pcard {
  height: 100%;
  border-radius: var(--zk-card-radius);
  border-color: #E2E8F1;
  box-shadow: 0 2px 10px rgba(14,30,56,.035);
  isolation: isolate;
}
.site-body .pcard:hover {
  transform: translateY(-4px);
  border-color: #C8D8F3;
  box-shadow: 0 16px 36px rgba(14,30,56,.12);
}
.site-body .pthumb {
  min-height: 0;
  aspect-ratio: 1 / .94;
  padding: clamp(10px, 1.2vw, 16px);
  background:
    radial-gradient(circle at 50% 34%, rgba(255,255,255,.98) 0 33%, transparent 70%),
    linear-gradient(145deg,#F8FAFD,#EEF3F9);
}
.site-body .pthumb > a { width: 100%; height: 100%; display: grid; place-items: center; }
.site-body .pthumb img { width: 100%; height: 100%; max-height: 172px; object-fit: contain; }
.site-body .pbody { padding: 13px 14px 15px; gap: 7px; }
.site-body .pname {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.site-body .pprice { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.site-body .pprice s { margin-left: 0; }
.site-body .pact { margin-top: 10px; }
.site-body .pact .btn-add,
.site-body .pact .btn-buy { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.site-body .pquick { pointer-events: none; }
.site-body .pquick a { pointer-events: auto; }

/* Cards, panels and tables */
.site-body .card,
.site-body .filter-panel,
.site-body .order-card,
.site-body .summary-card {
  border-color: #E2E8F1;
  box-shadow: 0 5px 20px rgba(14,30,56,.055);
}
.site-body .alert { border-radius: 12px; }
.site-body .data-table { border-radius: 14px; }

/* Drawer accessibility and body locking */
body.is-drawer-open,
body.is-rp-drawer-open { overflow: hidden; touch-action: none; }
.drawer-backdrop,
.rp-scrim { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.site-drawer { overscroll-behavior: contain; }

/* Footer: clearer hierarchy without changing links or data */
.site-body footer { margin-top: clamp(28px, 5vw, 64px); }
.site-body footer .footer-grid { gap: clamp(22px, 4vw, 48px); }
.site-body footer h4 { font-size: 14px; letter-spacing: -.01em; }
.site-body footer a { transition: color .15s ease; }
.site-body footer a:hover { color: var(--accent); }
.site-body .footer-bottom { gap: 14px; flex-wrap: wrap; }
.site-body .payment-icons { display: flex; flex-wrap: wrap; gap: 7px; }
.site-body .payment-icons span {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  padding: 5px 9px;
  line-height: 1;
}

/* Chat widget cannot cover essential mobile actions */
.site-body #chat-bubble {
  right: max(18px, env(safe-area-inset-right));
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 18px));
}
.site-body #chat-panel {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 82px));
  max-height: min(680px, calc(100dvh - 120px));
}

/* Responsive system */
@media (max-width: 1160px) {
  .site-body .product-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .site-body .product-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 768px) {
  .site-body .topbar .container { min-height: 32px; }
  .site-body .topbar .container > span:first-child { max-width: 72%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .site-body .navbar .container { padding-top: 10px; padding-bottom: 10px; }
  .site-body .search-form input { min-height: 44px; }
  .site-body .product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .site-body .pquick { display: none; }
  .site-body .pcard:hover { transform: none; box-shadow: 0 2px 10px rgba(14,30,56,.04); }
  .site-body footer .footer-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 520px) {
  :root { --zk-page-pad: 14px; --zk-section-gap: 34px; }
  .site-body .topbar { font-size: 11.5px; }
  .site-body .topbar .container > span:first-child { max-width: 66%; }
  .site-body .brand-logo-ic { height: 30px; }
  .site-body .brand-logo-word { height: 14px; }
  .site-body .nav-icons { gap: 0; }
  .site-body .nav-icons .icon-btn { min-width: 36px; width: 36px; min-height: 36px; height: 36px; }
  .site-body .nav-hamburger { min-width: 38px; width: 38px; min-height: 38px; height: 38px; }
  .site-body .pthumb { aspect-ratio: 1 / .9; padding: 9px; }
  .site-body .pthumb img { max-height: 132px; }
  .site-body .pbody { padding: 10px 10px 12px; gap: 6px; }
  .site-body .pname { font-size: 13px; }
  .site-body .pprice b { font-size: 15px; }
  .site-body .pact { gap: 6px; }
  .site-body .pact .btn-add,
  .site-body .pact .btn-buy { font-size: 11.5px; padding-inline: 7px; min-height: 38px; }
  .site-body footer .footer-grid { grid-template-columns: minmax(0,1fr); }
  .site-body #chat-bubble { width: 54px; height: 54px; }
  .site-body #chat-panel { left: 10px; right: 10px; width: auto; border-radius: 16px; }
}
@media (max-width: 360px) {
  .site-body .product-grid { gap: 9px; }
  .site-body .pact { grid-template-columns: minmax(0,1fr); }
  .site-body .pbody { padding-inline: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-body *, .site-body *::before, .site-body *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
