/* =========================================================
   CALLED TO SNACK — Visual refresh + mobile-first layer
   Loaded after styles.css; overrides & extends it.
   ========================================================= */

:root {
  --nav-h: 68px;
  --bottom-bar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --grad-primary: linear-gradient(135deg, #F59E0B 0%, #D97706 55%, #B45309 100%);
  --grad-ctr: linear-gradient(135deg, #10B981 0%, #15803D 100%);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(245, 158, 11, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 40%, rgba(16, 185, 129, 0.05), transparent 60%),
    var(--bg-main);
  overflow-x: hidden;
}

body.menu-open { overflow: hidden; }

img { max-width: 100%; }

:focus-visible {
  outline: 3px solid rgba(217, 119, 6, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Critical stacking fix ----------
   The cart overlay (z 110) is activated together with the checkout modal,
   which previously sat underneath it at z 100 and couldn't be clicked. */
#checkout-modal { z-index: 130; }
#confirmation-modal { z-index: 140; }

/* ---------- Navbar ---------- */
.navbar { transition: box-shadow 0.3s ease, background 0.3s ease; }
.navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 6px 24px -10px rgba(15, 23, 42, 0.25);
}
.nav-link { position: relative; padding: 6px 0; }
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}
.nav-link:hover::after { transform: scaleX(1); }
.nav-link-accent { color: #15803D; font-weight: 800; }
.nav-link-accent::after { background: var(--grad-ctr); }

.cart-btn-label { display: inline-flex; align-items: center; gap: 6px; }

/* Hamburger (hidden on desktop) */
.hamburger-btn {
  display: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.hamburger-btn span {
  display: block;
  width: 20px; height: 2px;
  background: var(--black-tag);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.2s;
}
.hamburger-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.active span:nth-child(2) { opacity: 0; }
.hamburger-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile slide-in menu */
.mobile-menu-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 140;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.mobile-menu-overlay.active { opacity: 1; pointer-events: auto; }

.mobile-menu {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(86vw, 360px);
  background: #FFFFFF;
  z-index: 150;
  padding: 18px 16px calc(24px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
  transform: translateX(105%);
  transition: transform 0.4s var(--ease-out);
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.25);
}
.mobile-menu.active { transform: translateX(0); }
.mobile-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px 14px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}
.mobile-menu-head .brand-name { font-size: 1.2rem; }
.mobile-menu-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.98rem;
  transition: background 0.2s;
}
.mobile-menu-link span {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-subtle);
  border-radius: 10px;
  font-size: 1.1rem;
}
.mobile-menu-link:active, .mobile-menu-link:hover { background: var(--primary-light); }
.mobile-menu-link.featured {
  background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
  color: #065F46;
  font-weight: 800;
}
.mobile-menu-link.featured span { background: #FFFFFF; }
.mobile-menu-label {
  margin: 14px 12px 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-light);
}
.mobile-menu-foot {
  margin-top: auto;
  padding: 14px;
  border-radius: 14px;
  background: var(--black-tag);
  color: #E2E8F0;
  font-size: 0.85rem;
  text-align: center;
}
.mobile-menu-foot strong { color: #FBBF24; }

/* ---------- Buttons ---------- */
.btn, .filter-tab-btn, .mbb-item { position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--grad-primary); }
.btn-primary:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.97); }

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: ripple 0.6s var(--ease-out);
  pointer-events: none;
}
.btn-outline .ripple, .filter-tab-btn .ripple, .mbb-item .ripple { background: rgba(217, 119, 6, 0.2); }
@keyframes ripple { to { transform: scale(2.5); opacity: 0; } }

/* ---------- Hero ---------- */
.hero-section { isolation: isolate; }
.hero-section::before,
.hero-section::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  z-index: -1;
  opacity: 0.55;
  animation: float-blob 14s ease-in-out infinite alternate;
}
.hero-section::before {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #FCD34D, transparent 70%);
  top: -140px; right: -80px;
}
.hero-section::after {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #6EE7B7, transparent 70%);
  bottom: -160px; left: -100px;
  animation-delay: -6s;
}
@keyframes float-blob {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(40px, 30px) scale(1.12); }
}

.hero-title { font-size: clamp(2.1rem, 5.2vw, 3.4rem); letter-spacing: -1px; }
.hero-content > * { animation: rise-in 0.8s var(--ease-out) both; }
.hero-content > *:nth-child(2) { animation-delay: 0.08s; }
.hero-content > *:nth-child(3) { animation-delay: 0.16s; }
.hero-content > *:nth-child(4) { animation-delay: 0.24s; }
.hero-content > *:nth-child(5) { animation-delay: 0.32s; }
.hero-visual-card {
  animation: rise-in 1s 0.2s var(--ease-out) both;
  transition: transform 0.4s var(--ease-out);
  will-change: transform;
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

.trust-item {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(253, 230, 138, 0.8);
  padding: 7px 12px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

/* ---------- Store: search + tabs ---------- */
.store-search {
  position: relative;
  max-width: 520px;
  margin: 0 auto 18px;
}
.store-search input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #FFFFFF;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.store-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15);
}
.store-search-icon {
  position: absolute;
  left: 18px; top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.6;
}

.filter-tab-btn { white-space: nowrap; }
.filter-tab-btn.active { background: var(--black-tag); box-shadow: 0 6px 16px -6px rgba(15, 23, 42, 0.5); }

/* ---------- Product cards ---------- */
.product-card { border-radius: 22px; }
.product-card:hover { transform: translateY(-6px); box-shadow: 0 22px 40px -18px rgba(15, 23, 42, 0.35); }
.product-img-wrapper { height: auto; aspect-ratio: 4 / 3; }
.product-img-wrapper::after {
  content: '';
  position: absolute; inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.25), transparent);
  pointer-events: none;
}
.customizable-indicator { z-index: 1; }
.product-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.products-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: #FFFFFF;
  border: 2px dashed var(--border);
  border-radius: 22px;
}
.products-empty-icon { font-size: 2.6rem; margin-bottom: 10px; }
.products-empty h3 { font-family: var(--font-heading); color: var(--black-tag); margin-bottom: 6px; }
.products-empty p { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Scroll reveal ---------- */
.js-ui .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: calc(var(--stagger, 0) * 60ms);
}
.js-ui .reveal.in-view { opacity: 1; transform: none; }
.js-ui .product-card.reveal.in-view:hover { transform: translateY(-6px); }

/* ---------- Cart badge bump ---------- */
.cart-count-badge.bump { animation: bump 0.5s var(--ease-out); }
@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.5); background: #10B981; }
  100% { transform: scale(1); }
}

/* ---------- Modals: smoother entrance ---------- */
.customizer-modal-content,
.checkout-modal-content {
  transform: translateY(24px) scale(0.98);
  transition: transform 0.4s var(--ease-out);
}
.modal-backdrop.active .customizer-modal-content,
.modal-backdrop.active .checkout-modal-content { transform: none; }

.qty-btn { width: 32px; height: 32px; font-size: 1rem; }

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 22px;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--black-tag);
  color: #FFFFFF;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.6);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
}
.back-to-top.visible { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Mobile bottom bar (hidden on desktop) ---------- */
.mobile-bottom-bar { display: none; }

/* =========================================================
   TABLET  (≤ 992px)
   ========================================================= */
@media (max-width: 992px) {
  .nav-links { display: none; }
  .hamburger-btn { display: inline-flex; }
  .ctr-nav-badge { display: none; }

  .hero-container { gap: 28px; }
  .hero-visual-card img { height: 320px; }

  .fd-showcase-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   PHONE  (≤ 768px)
   ========================================================= */
@media (max-width: 768px) {
  :root { --nav-h: 60px; }

  body { padding-bottom: calc(var(--bottom-bar-h) + var(--safe-bottom)); }

  /* Prevent iOS zoom-on-focus */
  input, select, textarea { font-size: 16px !important; }

  .announcement-bar { padding: 6px 12px; font-size: 0.74rem; }
  .announcement-content { flex-wrap: wrap; justify-content: center; gap: 6px; text-align: center; }

  .nav-container { padding: 10px 14px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 1.15rem; }
  .black-tag-badge-icon { padding: 3px 7px; font-size: 0.72rem; }
  .cart-toggle-btn { padding: 9px 12px; min-height: 44px; }

  /* Hero */
  .hero-section { padding: 28px 16px 36px; }
  .hero-pill-tag { font-size: 0.74rem; margin-bottom: 12px; }
  .hero-description { font-size: 1rem; margin-bottom: 20px; }
  .hero-cta-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
  .hero-cta-group > :first-child { grid-column: 1 / -1; padding: 15px; font-size: 1.05rem; }
  .hero-cta-group .btn { width: 100%; padding: 12px 10px; font-size: 0.9rem; }
  .hero-trust-badges { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .trust-item { font-size: 0.76rem; padding: 7px 10px; justify-content: center; }
  .hero-visual-card { border-width: 3px; }
  .hero-visual-card img { height: 240px; }
  .hero-floating-badge { padding: 10px 12px; left: 10px; right: 10px; bottom: 10px; }
  .badge-text-left h5 { font-size: 0.82rem; }
  .badge-text-left p { display: none; }
  .badge-rate strong { font-size: 0.95rem; }

  /* Delivery benefits: swipeable chips */
  .delivery-info-banner { padding: 14px 0; }
  .delivery-banner-inner {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 0 16px;
    scrollbar-width: none;
  }
  .delivery-banner-inner::-webkit-scrollbar { display: none; }
  .delivery-feature-col {
    flex: 0 0 82%;
    scroll-snap-align: start;
    background: var(--bg-subtle);
    border-radius: 16px;
    padding: 12px;
  }

  /* Feature sections */
  .clear-can-feature-section, .freeze-dried-feature-section { padding: 44px 16px; }
  .clear-can-container { gap: 24px; text-align: left; }
  .clear-can-title, .fd-title { font-size: 1.85rem; line-height: 1.15; }
  .clear-can-desc, .fd-desc { font-size: 0.95rem; }
  .clear-can-perks { grid-template-columns: 1fr 1fr; gap: 10px; }
  .can-perk-item { padding: 10px; font-size: 0.82rem; }
  .clear-can-cta { flex-direction: column; }
  .clear-can-cta .btn { width: 100%; }
  .clear-can-visual img { height: 260px; }
  .clear-can-floating-label { flex-wrap: wrap; gap: 6px; }
  .fd-card-media { height: 210px; }
  .fd-card-body { padding: 18px; }
  .fd-card-footer { flex-direction: column; align-items: stretch; gap: 12px; }
  .fd-card-footer .btn { width: 100%; }

  /* Store */
  .store-section { margin: 36px auto 48px; padding: 0 14px; }
  .section-title { font-size: 1.7rem; }
  .section-header { margin-bottom: 22px; }

  .filter-tabs-wrapper {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    margin: 0 -14px 22px;
    padding: 4px 14px 8px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 24px), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 24px), transparent 100%);
  }
  .filter-tabs-wrapper::-webkit-scrollbar { display: none; }
  .filter-tab-btn { scroll-snap-align: start; padding: 10px 16px; font-size: 0.86rem; min-height: 42px; }

  /* Compact 2-column product grid */
  .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-card { border-radius: 18px; }
  .product-card:hover, .js-ui .product-card.reveal.in-view:hover { transform: none; }
  .product-img-wrapper { aspect-ratio: 1 / 1; }
  .product-badge { font-size: 0.62rem; padding: 3px 8px; top: 8px; left: 8px; max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .customizable-indicator { font-size: 0.62rem; padding: 3px 7px; bottom: 8px; right: 8px; }
  .product-info { padding: 12px; }
  .product-header { flex-direction: column; gap: 4px; margin-bottom: 6px; }
  .product-title { font-size: 0.88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .product-price { font-size: 1rem; }
  .product-desc { -webkit-line-clamp: 2; font-size: 0.76rem; margin-bottom: 10px; }
  .product-actions { gap: 6px; }
  .product-actions .btn { padding: 10px 8px; font-size: 0.78rem; min-height: 40px; border-radius: 12px; }

  /* Modals become full-height bottom sheets */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .customizer-modal-content,
  .checkout-modal-content {
    max-width: 100% !important;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    transform: translateY(100%);
  }
  .modal-backdrop.active .customizer-modal-content,
  .modal-backdrop.active .checkout-modal-content { transform: none; }
  #confirmation-modal .checkout-modal-content { height: auto; max-height: 92dvh; border-radius: 22px 22px 0 0; }

  .modal-header { padding: 12px 14px; gap: 10px; }
  .modal-title-group h3 { font-size: 1.02rem; line-height: 1.25; }
  .modal-title-group p { display: none; }
  .close-modal-btn { width: 40px; height: 40px; flex-shrink: 0; }

  .customizer-body { padding: 0 14px 16px; gap: 16px; }

  /* Keep the live can/sticker preview pinned while scrolling options */
  .preview-column {
    position: sticky;
    top: 64px;
    z-index: 5;
    background: #FFFFFF;
    margin: 0 -14px;
    padding: 10px 14px 8px;
    box-shadow: 0 10px 16px -14px rgba(15, 23, 42, 0.4);
  }
  .canvas-wrapper { padding: 6px; border-width: 1px; }
  #sticker-canvas { max-height: 32vh; width: auto; }
  .canvas-hint { display: none; }

  .controls-column { gap: 18px; }
  .drink-mixtures-grid { grid-template-columns: 1fr; }
  .boba-pill-btn, .portion-chip, .toggle-pill { min-height: 38px; }
  .theme-card { padding: 12px; }

  .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 6;
    padding: 12px 14px calc(12px + var(--safe-bottom));
    gap: 12px;
    border-radius: 0;
    box-shadow: 0 -8px 20px -12px rgba(15, 23, 42, 0.35);
  }
  .modal-footer .btn { flex: 1; padding: 14px 12px; font-size: 0.95rem; }
  .modal-pricing-col .product-badge { display: none; }

  .checkout-grid { padding: 16px 14px calc(24px + var(--safe-bottom)); gap: 22px; }
  .input-row-2 { grid-template-columns: 96px 1fr; }

  /* Cart drawer: full width on phones */
  .cart-drawer { max-width: 100%; transition: transform 0.35s var(--ease-out); }
  .cart-footer { padding-bottom: calc(18px + var(--safe-bottom)); }
  .cart-footer .btn { min-height: 50px; font-size: 1rem; }

  /* FAQ + footer */
  .faq-section { padding-left: 14px !important; padding-right: 14px !important; }
  .footer-container { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }

  /* Floating elements sit above the bottom bar */
  .toast-container { bottom: calc(var(--bottom-bar-h) + var(--safe-bottom) + 12px) !important; left: 12px; right: 12px; }
  .back-to-top { bottom: calc(var(--bottom-bar-h) + var(--safe-bottom) + 14px); right: 14px; width: 42px; height: 42px; }

  /* Bottom action bar */
  .mobile-bottom-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--bottom-bar-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px -14px rgba(15, 23, 42, 0.35);
    z-index: 90;
  }
  .mbb-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: none;
    text-decoration: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
  }
  .mbb-item:active { color: var(--primary); }
  .mbb-icon { font-size: 1.35rem; line-height: 1; position: relative; }
  .mbb-icon .cart-count-badge {
    position: absolute;
    top: -6px; right: -12px;
    font-size: 0.62rem;
    padding: 1px 6px;
    border: 2px solid #FFFFFF;
  }
  .mbb-cart { color: var(--primary-hover); }

  /* Hide bottom bar while a full-screen sheet is open */
  body:has(.modal-backdrop.active) .mobile-bottom-bar,
  body:has(.cart-drawer.active) .mobile-bottom-bar,
  body.menu-open .mobile-bottom-bar { transform: translateY(110%); }
  .mobile-bottom-bar { transition: transform 0.3s var(--ease-out); }
  body:has(.modal-backdrop.active) .back-to-top { opacity: 0; pointer-events: none; }
}

/* =========================================================
   SMALL PHONE  (≤ 420px)
   ========================================================= */
@media (max-width: 420px) {
  .cart-btn-text { display: none; }
  .clear-can-perks { grid-template-columns: 1fr; }
  .hero-trust-badges { grid-template-columns: 1fr 1fr; }
  .footer-container { grid-template-columns: 1fr; }
}

@media (max-width: 340px) {
  .products-grid { grid-template-columns: 1fr; }
}

/* Showcase full cookie cross section and can height */
.product-img-wrapper {
  height: 270px !important;
}
.product-img-wrapper img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
@media (max-width: 640px) {
  .product-img-wrapper {
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
  }
}
