/* -------------------------------------------------------------------------- */
/* LEAF CNNBS — US MARKET DESIGN SYSTEM & APOTHECARY STYLESHEET               */
/* Founded 2023, Portland, Oregon                                              */
/* Aesthetic: Aesop / Equilibria Apothecary Restraint ("Patagonia of Hemp")   */
/* Mobile-First | Shopify Store Format Ready                                   */
/* -------------------------------------------------------------------------- */

/* Custom CSS Variables & Typography Defaults */
:root {
  --color-olive: #4D5431;
  --color-olive-dark: #383D22;
  --color-sage-muted: #9EA37D;
  --color-sage-linen: #D2D8B4;
  --color-chestnut: #6B4227;
  --color-ochre: #754C31;
  --color-sand-light: #F4F1EA;
  --color-sand-muted: #EBE5D9;
  --color-sand-border: #D2C1B2;
  --color-charcoal: #232021;
  --color-espresso: #322E29;
  --color-linen: #FAF8F5;
  /* Mobile bottom nav height + iOS safe area */
  --mobile-nav-height: 64px;
}

/* Page View & Hidden Utilities for SPA navigation */
.hidden, [hidden], section.page-view.hidden {
  display: none !important;
}

section.page-view {
  width: 100%;
}

/* Explicit SVG Icon Sizing, Stroke, and Fill Fallbacks */
svg {
  display: inline-block !important;
  vertical-align: middle;
  stroke-width: 1.75px;
  stroke: currentColor;
  fill: none;
}

svg path {
  stroke: inherit;
  stroke-width: inherit;
  fill: inherit;
}

svg.w-6, .w-6 svg {
  width: 1.5rem !important;
  height: 1.5rem !important;
  min-width: 1.5rem !important;
  min-height: 1.5rem !important;
}

svg.w-5, .w-5 svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  min-width: 1.25rem !important;
  min-height: 1.25rem !important;
}

svg.w-4, .w-4 svg {
  width: 1rem !important;
  height: 1rem !important;
  min-width: 1rem !important;
  min-height: 1rem !important;
}

#open-cart-btn svg, #mobile-menu-toggle svg {
  stroke: var(--color-olive) !important;
}

/* Base Body Styling */
body {
  background-color: var(--color-sand-light);
  color: var(--color-charcoal);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Space for mobile bottom nav */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Add bottom padding when mobile nav is visible (< lg) */
@media (max-width: 1023px) {
  body {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px));
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--color-sand-light); }
::-webkit-scrollbar-thumb { background: var(--color-sage-muted); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-olive); }

/* -------------------------------------------------------------------------- */
/* HERO                                                                        */
/* -------------------------------------------------------------------------- */

.hero-fullbleed {
  min-height: 75vh;
  position: relative;
  display: flex;
  align-items: center;
}

@media (min-width: 768px) {
  .hero-fullbleed { min-height: 82vh; }
}

@media (min-width: 1024px) {
  .hero-fullbleed { min-height: 88vh; }
}

/* -------------------------------------------------------------------------- */
/* PRODUCT CARDS — Shopify-style compact format                                */
/* -------------------------------------------------------------------------- */

.apothecary-card {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease;
  background-color: var(--color-sand-muted);
  border: 1px solid rgba(77, 84, 49, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.apothecary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -6px rgba(35, 32, 33, 0.14);
  border-color: rgba(117, 76, 49, 0.35);
}

/* Mobile: remove lift on touch devices to avoid stuck hover state */
@media (hover: none) {
  .apothecary-card:hover {
    transform: none;
    box-shadow: none;
  }
}

/* -------------------------------------------------------------------------- */
/* SHOPIFY FILTER BAR — horizontal scroll chips                                */
/* -------------------------------------------------------------------------- */

.shopify-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
  /* Extend to edges on mobile */
  margin-left: -1rem;
  margin-right: -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.shopify-filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 6px 14px;
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  border: 1px solid rgba(77, 84, 49, 0.3);
  color: var(--color-olive);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip:active,
.filter-chip.active {
  background: var(--color-olive);
  color: var(--color-sand-light);
  border-color: var(--color-olive);
}

/* -------------------------------------------------------------------------- */
/* MOBILE BOTTOM TAB BAR — Shopify mobile nav pattern                         */
/* -------------------------------------------------------------------------- */

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  background: var(--color-sand-light);
  border-top: 1px solid rgba(77, 84, 49, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 60px;
  padding: 4px 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
  box-shadow: 0 -4px 16px rgba(35, 32, 33, 0.08);
}

@media (min-width: 1024px) {
  .mobile-bottom-nav { display: none !important; }
}

.mobile-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 12px;
  color: var(--color-espresso);
  opacity: 0.6;
  font-family: 'Roboto Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease, color 0.15s ease;
  min-width: 60px;
}

.mobile-tab-btn.active,
.mobile-tab-btn:active,
.mobile-tab-btn:hover {
  opacity: 1;
  color: var(--color-olive);
}

.mobile-tab-btn svg {
  width: 22px !important;
  height: 22px !important;
  stroke: currentColor !important;
  stroke-width: 1.75px !important;
  fill: none !important;
  display: block;
}

.mobile-tab-btn svg path {
  stroke: currentColor !important;
  stroke-width: 1.75px !important;
  fill: none !important;
}

/* -------------------------------------------------------------------------- */
/* PRODUCT MODAL — full screen on mobile, side panel feel on desktop          */
/* -------------------------------------------------------------------------- */

.product-modal-inner {
  width: 100%;
  max-width: 900px;
  background: var(--color-sand-light);
  border: 1px solid rgba(77, 84, 49, 0.25);
  box-shadow: 0 24px 60px -12px rgba(35, 32, 33, 0.35);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

/* Full screen on mobile */
@media (max-width: 767px) {
  #product-modal {
    padding: 0 !important;
    align-items: flex-end;
  }
  .product-modal-inner {
    border-radius: 12px 12px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    border: none;
    border-top: 1px solid rgba(77, 84, 49, 0.2);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* Sticky Add to Cart bar on mobile */
.sticky-atc-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-sand-light);
  border-top: 1px solid rgba(77, 84, 49, 0.15);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 5;
}

@media (min-width: 768px) {
  .sticky-atc-bar { display: none; }
}

/* -------------------------------------------------------------------------- */
/* TRUST BADGES — Shopify store pattern                                        */
/* -------------------------------------------------------------------------- */

.trust-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.trust-badge-row::-webkit-scrollbar { display: none; }

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-family: 'Roboto Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.05em;
  color: var(--color-olive);
  padding: 4px 10px;
  border: 1px solid rgba(77, 84, 49, 0.2);
  border-radius: 20px;
  background: rgba(77, 84, 49, 0.04);
  flex-shrink: 0;
}

.trust-badge svg {
  width: 11px;
  height: 11px;
  stroke: var(--color-ochre);
  fill: none;
  stroke-width: 2;
}

/* -------------------------------------------------------------------------- */
/* COLLECTION HEADER — Shopify collection page style                          */
/* -------------------------------------------------------------------------- */

.collection-header {
  background: linear-gradient(135deg, var(--color-olive-dark) 0%, var(--color-olive) 100%);
  color: var(--color-sand-light);
  padding: 32px 16px 28px;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .collection-header { padding: 48px 32px 40px; }
}

.collection-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='20' cy='20' r='1' fill='rgba(255,255,255,0.04)'/%3E%3C/g%3E%3C/svg%3E") repeat;
  pointer-events: none;
}

/* -------------------------------------------------------------------------- */
/* PAGE TRANSITIONS                                                            */
/* -------------------------------------------------------------------------- */

.page-view {
  animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------------------- */
/* UTILITIES                                                                   */
/* -------------------------------------------------------------------------- */

.technical-fact-sheet {
  font-family: 'Roboto Mono', monospace;
  background-color: var(--color-sand-muted);
  border: 1px solid rgba(77, 84, 49, 0.3);
}

table { border-collapse: separate; border-spacing: 0; }

.backdrop-blur-xs {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-olive);
  outline-offset: 2px;
}

button:active { transform: scale(0.985); }

.animate-pulse-slow { animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* Prevent horizontal overflow globally */
html, body { overflow-x: hidden; max-width: 100vw; }

