/* ==========================================================================
   Chef Fergany — Full-Width Responsive Storefront Layout
   Dynamic Department Page Tinting + Dual Marquee Showcase + 3-Zone Grid
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s ease;
}

/* Subtle noticeable background tint when standing on any department */
body[data-active-dept="all"] { background-color: var(--page-tint-all); }
body[data-active-dept="offers"] { background-color: var(--page-tint-offers); }
body[data-active-dept="meat"] { background-color: var(--page-tint-meat); }
body[data-active-dept="crafted"] { background-color: var(--page-tint-crafted); }
body[data-active-dept="poultry"] { background-color: var(--page-tint-poultry); }

body[data-active-dept="meat"] .site-header { border-bottom-color: var(--dept-meat-border); }
body[data-active-dept="crafted"] .site-header { border-bottom-color: var(--dept-crafted-border); }
body[data-active-dept="poultry"] .site-header { border-bottom-color: var(--dept-poultry-border); }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Top Utility Bar */
.topbar {
  background: var(--bg-topbar);
  color: var(--text-on-dark);
  min-height: var(--topbar-h);
  padding: 6px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
  font-weight: 500;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.topbar-promo {
  color: #E7E2DA;
  font-weight: 500;
}

.topbar-link {
  color: #FDE68A;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  direction: ltr;
  font-weight: 600;
}

.topbar-link:hover {
  text-decoration: underline;
}

.topbar-theme-btn {
  color: #FAF8F5;
  font-weight: 500;
  font-size: 0.74rem;
  padding: 2px 9px;
  border: 1px solid #3E3934;
  border-radius: 6px;
  white-space: nowrap;
}

.topbar-theme-btn:hover {
  background: #2C2824;
}

/* Sticky Full-Width Main Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-surface);
  border-bottom: 2px solid var(--border-color);
  box-shadow: var(--shadow-xs);
  width: 100%;
  transition: border-color 0.3s ease;
}

.header-inner {
  width: 100%;
  padding: 10px 20px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
  min-width: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 11px;
  object-fit: cover;
  border: 2px solid var(--brand-red);
  background: #000000;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-text span {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--brand-red);
  white-space: nowrap;
}

/* Header Search */
.search-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  justify-self: center;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 36px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface-alt);
  font-size: 0.88rem;
  font-weight: 400;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-red);
  background: var(--bg-surface);
}

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

.search-clear {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

.search-clear.visible {
  display: inline-flex;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-svg-icon {
  flex-shrink: 0;
}

/* Mobile Category Strip */
.mobile-cat-strip {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 8px;
}

.mobile-cat-strip::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   FULL-WIDTH 3-ZONE STOREFRONT SHELL
   ========================================================================== */
.store-shell {
  width: 100%;
  padding: 16px 20px 32px;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 368px;
  gap: 20px;
  align-items: start;
}

.sidebar-right {
  position: sticky;
  top: calc(var(--header-h) + 14px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.catalog-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-left {
  position: sticky;
  top: calc(var(--header-h) + 14px);
  max-height: calc(100vh - var(--header-h) - 28px);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 16px;
}

.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(275px, 1fr));
  gap: 14px;
}

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  z-index: 75;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  padding: 4px 6px;
}

@media (max-width: 1240px) {
  .store-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .sidebar-left {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(400px, 92vw);
    max-height: 100vh;
    border-radius: 0;
    border-right: 1px solid var(--border-color);
    z-index: 120;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

  .sidebar-left.drawer-open {
    transform: translateX(0);
  }

  .drawer-close-btn {
    display: inline-flex !important;
  }
}

@media (max-width: 860px) {
  body {
    padding-bottom: calc(var(--mobile-nav-h) + 12px);
  }

  .topbar {
    padding: 5px 12px;
    font-size: 0.72rem;
    justify-content: space-between;
  }

  .topbar-promo {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-inner {
    padding: 8px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
  }

  .search-wrap {
    grid-column: 1 / -1;
    order: 3;
    max-width: 100%;
  }

  .header-offers-btn,
  .hide-on-mobile {
    display: none !important;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .brand-text h1 {
    font-size: 0.98rem;
  }

  .brand-text span {
    font-size: 0.72rem;
  }

  .header-actions {
    gap: 6px;
  }

  .mobile-cat-strip {
    display: flex;
  }

  .store-shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 12px 24px;
    gap: 14px;
  }

  .sidebar-right {
    display: none;
  }

  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .offers-grid {
    grid-template-columns: 1fr;
  }

  .mobile-bottom-nav {
    display: grid;
  }
}

@media (max-width: 430px) {
  .topbar-promo {
    display: none;
  }
  .topbar {
    justify-content: space-between;
  }
}

@media (max-width: 370px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
}
