/* ═══════════════════════════════════════════════════════════
   WOOLLY WONDERS — MOBILE EXPERIENCE
   Inspired by Stitch "Heirloom Digital Atelier" design system.
   Auto-detects phone screens via @media (max-width: 768px).
   ═══════════════════════════════════════════════════════════ */

/* Bottom nav — hidden on desktop, visible on mobile */
.ww-bottom-nav { display: none !important; }

@media (max-width: 768px) {
  .ww-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    z-index: 9999 !important;
    background: rgba(255,248,246,.95) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    padding: 8px 0 env(safe-area-inset-bottom, 6px) !important;
    gap: 0 !important;
    box-shadow: 0 -2px 20px rgba(0,0,0,.06) !important;
    border-radius: 0 !important;
    transform: none !important;
    justify-content: space-around !important;
    align-items: center !important;
    margin: 0 !important;
    width: 100% !important;
  }
  .ww-bottom-nav a, .ww-bottom-nav button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    padding: 6px 0 !important;
    border: none !important;
    background: none !important;
    cursor: pointer !important;
    text-decoration: none !important;
    color: #B0A09A !important;
    font-size: 0 !important; /* hide text labels */
    min-width: 48px !important;
    min-height: 44px !important;
    border-radius: 0 !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  .ww-bottom-nav a.active {
    color: #E8917A !important;
    background: none !important;
  }
  .ww-bottom-nav svg {
    width: 22px !important;
    height: 22px !important;
    stroke-width: 1.6 !important;
  }
  /* Add padding at bottom of page for the nav */
  body { padding-bottom: 60px !important; }
}

/* ── Root overrides for mobile ─────────────────────────── */
@media (max-width: 768px) {

  /* Warm background */
  body {
    background: #FFF8F6 !important;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
  }

  /* ── NAVBAR — Logo visible, below marquee on mobile ──── */
  .navbar, nav.navbar {
    position: fixed !important;
    top: 32px !important; /* below the marquee banner */
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    height: 48px !important;
    padding: 0 16px !important;
    background: rgba(255,248,246,.95) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-bottom: 1px solid rgba(0,0,0,.04) !important;
    box-shadow: none !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  /* Marquee banner compact on mobile */
  #wwMarqueeBanner {
    height: 32px !important;
    z-index: 101 !important;
  }

  .navbar .bname, .navbar .nav-brand span, .bname {
    font-size: 1rem !important;
    font-weight: 600 !important;
  }

  .nav-brand {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .logo-img {
    width: 32px !important;
    height: 32px !important;
  }

  /* Hide nav buttons on mobile — bottom nav handles navigation */
  .nav-actions, .nav-spacer, #searchWrap, .geo-pill {
    display: none !important;
  }

  /* Hide desktop nav links on mobile (toggled open via JS) */
  .nav-links {
    display: none;
  }
  .nav-links.mobile-open {
    display: flex !important;
    flex-direction: column !important;
    position: absolute !important;
    top: 56px !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(255,248,246,.97) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    padding: 16px 20px !important;
    box-shadow: 0 12px 40px rgba(0,0,0,.1) !important;
    z-index: 99 !important;
    gap: 0 !important;
    border-bottom: 1px solid rgba(0,0,0,.06) !important;
  }
  .nav-links.mobile-open li {
    list-style: none !important;
  }
  .nav-links.mobile-open li a {
    display: block !important;
    padding: 14px 0 !important;
    font-size: .95rem !important;
    font-weight: 500 !important;
    color: #3D2C24 !important;
    border-bottom: 1px solid rgba(0,0,0,.04) !important;
    text-decoration: none !important;
  }
  .nav-links.mobile-open li:last-child a {
    border-bottom: none !important;
  }
  .nav-links.mobile-open li a:active {
    color: #E8917A !important;
  }
  /* Sub-dropdown in mobile menu */
  .nav-links.mobile-open .nav-dropdown-menu,
  .nav-links.mobile-open .dropdown-menu {
    display: block !important;
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    padding: 0 0 0 16px !important;
    min-width: auto !important;
  }
  .nav-links.mobile-open .nav-dropdown-menu li a,
  .nav-links.mobile-open .dropdown-menu a {
    font-size: .85rem !important;
    color: #7A6559 !important;
    padding: 10px 0 !important;
  }
  .nav-dropdown, .geo-pill {
    display: none !important;
  }
  .nav-links.mobile-open .nav-dropdown {
    display: block !important;
  }

  /* Hide all nav chrome on mobile — bottom nav replaces it */
  .btn-nav, .btn-nav.outline, .btn-nav.primary, .nav-cart-btn,
  .mob-toggle, .nav-cart-badge {
    display: none !important;
  }

  /* ── HERO SECTION — Left-aligned like Stitch ────────── */
  .hero, .hero-section, [class*="hero-sec"], #hero {
    padding: 64px 20px 24px !important;
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    text-align: left !important;
    align-items: flex-start !important;
  }

  .hero h1, .hero-section h1, #hero h1, [class*="hero"] > h1 {
    font-size: 2.2rem !important;
    line-height: 1.1 !important;
    letter-spacing: -0.02em !important;
    text-align: left !important;
  }

  .hero p, .hero-section p {
    font-size: .88rem !important;
    max-width: 280px !important;
    line-height: 1.5 !important;
    text-align: left !important;
  }

  .hero-image, .hero-img, .hero img {
    border-radius: 24px !important;
    max-height: 360px !important;
    object-fit: cover !important;
  }

  /* Hero CTA buttons */
  .hero .btn-cta, .hero .cta-btn, .hero a[class*="btn"],
  .hero button[class*="btn"] {
    padding: 14px 28px !important;
    border-radius: 9999px !important;
    font-size: .92rem !important;
    width: 100% !important;
    text-align: center !important;
  }

  /* ── TRUST BAR ──────────────────────────────────────── */
  .trust-bar, [class*="trust-bar"], [class*="social-proof-bar"] {
    flex-wrap: wrap !important;
    gap: 12px !important;
    padding: 16px !important;
    justify-content: center !important;
    font-size: .75rem !important;
  }

  /* ── MARQUEE BANNER ─────────────────────────────────── */
  #wwMarqueeBanner {
    height: 32px !important;
    font-size: .72rem !important;
  }

  /* Push content below marquee (32px) + navbar (48px) */
  main, #main-content, .main-content {
    padding-top: 80px !important;
  }

  /* ── SECTION HEADERS ────────────────────────────────── */
  .section-head h2, section h2 {
    font-size: 1.5rem !important;
    letter-spacing: -0.01em !important;
  }

  .section-head p, .pill {
    font-size: .78rem !important;
  }

  /* ── CATEGORY GRID — 3-column grid (all visible) ────── */
  .cat-grid, #catGrid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px 12px !important;
    padding: 0 20px !important;
    overflow: visible !important;
  }

  .cat-grid .cat-card, #catGrid .cat-card {
    width: auto !important;
    border-radius: 16px !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    text-align: center !important;
    overflow: visible !important;
  }

  .cat-card .cat-img-wrap {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    margin: 0 auto 8px !important;
    background: #FFF1EB !important;
    padding: 8px !important;
    aspect-ratio: auto !important;
  }

  .cat-card .cat-img-wrap img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: 50% !important;
    mix-blend-mode: multiply !important;
  }

  .cat-card .cat-card-body {
    padding: 0 2px !important;
    overflow: visible !important;
  }

  .cat-card .cat-name {
    font-size: .68rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: #3D2C24 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    margin: 0 auto !important;
  }

  /* ── PRODUCT GRID — Staggered 2-column ─────────────── */
  .product-grid, #productGrid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px 10px !important;
    padding: 0 16px !important;
  }

  .product-card {
    border-radius: 16px !important;
    overflow: hidden !important;
    border: none !important;
    box-shadow: 0 2px 12px rgba(0,0,0,.04) !important;
    background: #FFFFFF !important;
  }

  /* Even product grid — no stagger offset for clean alignment */
  .product-card:nth-child(even) {
    margin-top: 0 !important;
  }

  .card-img-wrap {
    aspect-ratio: 1/1 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    margin: 6px !important;
    background: #FFF8F6 !important;
  }

  .card-img-wrap img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .card-body {
    padding: 8px 10px 12px !important;
  }

  .card-title {
    font-size: .82rem !important;
    line-height: 1.25 !important;
    margin-bottom: 2px !important;
  }

  .card-category {
    font-size: .65rem !important;
    display: none !important;
  }

  .card-stars {
    font-size: .7rem !important;
    margin-bottom: 4px !important;
  }

  .card-desc {
    display: none !important;
  }

  .card-bottom {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
  }

  .card-price {
    font-size: .82rem !important;
    font-weight: 700 !important;
  }

  .btn-add {
    width: auto !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    font-size: .65rem !important;
    text-align: center !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* ── FEATURED / MOST LOVED SECTION ─────────────────── */
  .feat-grid, #featuredGrid, [class*="feat-grid"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    padding: 0 16px !important;
  }

  .prod-card, [class*="prod-card"] {
    border-radius: 16px !important;
    overflow: hidden !important;
  }

  /* Featured card — match category page style exactly */
  .prod-card .card-bottom, [class*="prod-card"] .card-bottom,
  #featuredGrid .card-bottom {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 4px !important;
    padding: 0 !important;
    margin-top: 6px !important;
  }

  .prod-card .btn-add, [class*="prod-card"] .btn-add,
  .prod-card button, [class*="prod-card"] button[onclick],
  #featuredGrid .btn-add, #featuredGrid button {
    padding: 5px 10px !important;
    font-size: .62rem !important;
    white-space: nowrap !important;
    border-radius: 6px !important;
    width: auto !important;
    flex-shrink: 0 !important;
    min-height: 28px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
  }

  /* Hide the cart icon inside featured Add to Cart buttons */
  .prod-card .btn-add svg, [class*="prod-card"] .btn-add svg,
  #featuredGrid .btn-add svg, #featuredGrid button svg {
    display: none !important;
  }

  .prod-card .card-price, [class*="prod-card"] .card-price,
  #featuredGrid .card-price {
    font-size: .8rem !important;
  }

  .prod-card .card-title, [class*="prod-card"] h3,
  #featuredGrid h3 {
    font-size: .78rem !important;
    line-height: 1.2 !important;
  }

  /* ── TESTIMONIALS ───────────────────────────────────── */
  .test-grid, [class*="test-grid"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 0 16px !important;
  }

  .test-card {
    border-radius: 20px !important;
    padding: 20px !important;
  }

  /* ── OUR STORY SECTION ──────────────────────────────── */
  .story-section, #story, [class*="story"] {
    padding: 40px 20px !important;
  }

  .story-section img, #story img {
    border-radius: 24px !important;
    max-height: 300px !important;
    object-fit: cover !important;
    width: 100% !important;
  }

  /* ── FILTER BAR (Category Pages) ────────────────────── */
  .filter-bar {
    padding: 12px 16px !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .filter-select {
    width: 100% !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
    font-size: .82rem !important;
  }

  /* ── KNITTING vs CROCHET / COMPARISON CARDS ──────────── */
  .comparison-grid, [class*="comparison"], [class*="versus"],
  .craft-grid, [class*="craft-card"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .craft-card, [class*="craft-card"], [class*="comparison-card"] {
    padding: 16px !important;
    font-size: .82rem !important;
    line-height: 1.5 !important;
  }

  .craft-card p, [class*="craft-card"] p {
    font-size: .8rem !important;
    line-height: 1.45 !important;
  }

  /* ── WHY HANDMADE MATTERS — single column on mobile ──── */
  #craftArticle div[style*="repeat(3"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  #craftArticle div[style*="repeat(3"] > div {
    padding: 12px 16px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 12px !important;
    text-align: left !important;
  }

  #craftArticle div[style*="repeat(3"] > div > div:first-child {
    font-size: 1.5rem !important;
    margin-bottom: 0 !important;
    flex-shrink: 0 !important;
  }

  /* Knitting vs Crochet — stack vertically */
  #craftArticle div[style*="1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  #craftArticle div[style*="1fr 1fr"] > div {
    padding: 20px !important;
  }

  #craftArticle div[style*="1fr 1fr"] p {
    font-size: .82rem !important;
    line-height: 1.5 !important;
  }

  /* The container card for Why Handmade */
  #craftArticle .reveal[style*="background:#fff"] {
    padding: 20px 16px !important;
    margin-top: 16px !important;
  }

  #craftArticle .reveal[style*="background:#fff"] h2 {
    font-size: 1.2rem !important;
    margin-bottom: 12px !important;
  }

  /* ── FOOTER — Compact on mobile ────────────────────── */
  .footer, footer {
    padding: 24px 20px 16px !important;
    border-radius: 20px 20px 0 0 !important;
  }

  /* Hide the large logo in footer on mobile — saves a full screen */
  .footer .ww-footer-grid > div:first-child img,
  .ww-footer-grid > div:first-child img {
    width: 80px !important;
    height: 80px !important;
  }

  .footer .ww-footer-grid > div:first-child,
  .ww-footer-grid > div:first-child {
    margin-bottom: 0 !important;
  }

  .footer-grid, .ww-footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 16px 12px !important;
    text-align: left !important;
    padding: 0 !important;
  }

  .footer-col h4, .ww-footer-grid h4 {
    font-size: .78rem !important;
    margin-bottom: 8px !important;
  }

  .footer-col a, .ww-footer-grid a {
    font-size: .78rem !important;
    padding: 3px 0 !important;
    margin-bottom: 2px !important;
    display: block !important;
  }

  .footer-newsletter {
    flex-direction: column !important;
    text-align: center !important;
    gap: 10px !important;
    padding-bottom: 16px !important;
  }

  .fn-text h3 {
    font-size: 1rem !important;
  }

  .fn-text p {
    font-size: .78rem !important;
  }

  .fn-form {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .fn-input, .fn-form input[type="email"], .footer-newsletter input {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 12px 14px !important;
    font-size: 16px !important; /* prevents iOS zoom */
    border-radius: 10px !important;
    border: 1.5px solid rgba(0,0,0,.12) !important;
    background: #fff !important;
    color: #3D2C24 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  .fn-btn, .fn-form button {
    padding: 12px 18px !important;
    font-size: .82rem !important;
    white-space: nowrap !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    width: auto !important;
    max-width: 120px !important;
  }

  .footer-bottom {
    font-size: .68rem !important;
    padding-top: 12px !important;
  }

  .footer-social {
    gap: 8px !important;
  }

  /* Social links compact */
  .footer-col a[href*="instagram"],
  .footer-col a[href*="facebook"],
  .footer-col a[href*="tiktok"],
  .footer-col a[href*="pinterest"] {
    font-size: .8rem !important;
    padding: 4px 0 !important;
  }

  /* ── CART PANEL — Full screen on mobile ─────────────── */
  .cart-panel, #cartPanel, [class*="cart-panel"] {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
  }

  /* Cart drawer — full screen + larger touch targets */
  #wwCartDrawer {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Cart remove button — bigger tap target on mobile */
  .wcd-remove, .ci-remove {
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 22px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #E06060 !important;
    background: rgba(224,96,96,.08) !important;
    border-radius: 10px !important;
    border: none !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(224,96,96,.15) !important;
  }

  /* Cart qty buttons — bigger on mobile */
  .wcd-qty button, .qty-btn {
    min-width: 36px !important;
    min-height: 36px !important;
    font-size: 1.1rem !important;
    border-radius: 8px !important;
  }

  /* ── CHECKOUT MODAL — Full screen ───────────────────── */
  .checkout-modal .cm-card, .cm-card {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  /* ── QUICK VIEW MODAL — Adjusted for mobile ─────────── */
  #wwQvOverlay .wwqv-modal, [id*="QvOverlay"] > div {
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
  }

  /* ── CHAT WIDGET — Move above bottom nav ─────────────── */
  .chat-widget, [class*="chat-widget"], #chat-widget-container,
  .crisp-client, [class*="crisp"], .intercom-lightweight-app,
  [id*="chat"], [class*="tidio"], .fb-customerchat {
    bottom: 70px !important;
  }

  /* ── COOKIE CONSENT — Mobile friendly ───────────────── */
  .cookie-consent, [class*="cookie-consent"] {
    flex-direction: column !important;
    gap: 12px !important;
    padding: 16px !important;
    font-size: .78rem !important;
  }

  .cookie-consent button {
    width: 100% !important;
    padding: 10px !important;
  }

  /* ── BLOG PAGE — Single column ──────────────────────── */
  .blog-grid, [class*="blog-grid"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 16px !important;
  }

  .blog-card {
    border-radius: 20px !important;
    overflow: hidden !important;
  }

  .blog-card img {
    height: 200px !important;
    object-fit: cover !important;
    border-radius: 16px 16px 0 0 !important;
  }

  /* ── GENERAL SPACING & TOUCH TARGETS ────────────────── */
  section {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* All interactive elements 44px minimum */
  button, a, input, select, textarea {
    min-height: 44px;
  }

  input, select, textarea {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
  }

  /* Smooth scrolling */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  /* ── SKELETON CARDS on mobile ────────────────────────── */
  .sk-card {
    aspect-ratio: 4/5 !important;
    border-radius: 16px !important;
  }

  .sk-cat {
    width: 90px !important;
    height: 90px !important;
    border-radius: 50% !important;
    aspect-ratio: auto !important;
    flex: 0 0 auto !important;
  }

  /* ── HERO BANNER specific — mobile adjustments ──────── */
  .hero-banner {
    padding: 24px 20px !important;
    text-align: center !important;
  }

  .hero-banner h1 {
    font-size: 1.5rem !important;
  }

  .hero-banner p {
    font-size: .82rem !important;
    max-width: 100% !important;
  }

  /* ── Search dropdown — full width on mobile ─────────── */
  #searchDropdown {
    width: calc(100vw - 32px) !important;
    right: -60px !important;
  }

  /* ── VOTING SECTION ─────────────────────────────────── */
  #votingGrid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    padding: 0 16px !important;
  }

  /* ── Recently Viewed (Customer page) ────────────────── */
  .rec-grid, [class*="rec-grid"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  /* ── Customer Dashboard sidebar ─────────────────────── */
  .sidebar, [class*="sidebar"] {
    width: 100% !important;
    position: relative !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

}

  /* Hide hamburger menu — bottom nav replaces it */
  .mob-toggle { display: none !important; }
  .nav-links.mobile-open { display: none !important; }

  /* ── CATEGORY PAGES — Fix dark/gray bar ─────────────── */
  .filter-bar, [class*="filter-bar"] {
    background: #FFF1E6 !important;
    color: #3D2C24 !important;
    border-bottom: 1px solid rgba(0,0,0,.04) !important;
  }

  /* Fix hero banner on category pages — remove dark background */
  .hero-banner, .category-header, .page-header {
    background: linear-gradient(135deg, #FFF9F5 0%, #FFE8D6 50%, #FFF1E6 100%) !important;
    color: #3D2C24 !important;
  }

  .hero-banner h1, .hero-banner p, .hero-banner .breadcrumb,
  .hero-banner .breadcrumb span, .hero-banner .hero-count {
    color: #3D2C24 !important;
    -webkit-text-fill-color: #3D2C24 !important;
  }

  /* Fix dark orbs on mobile category pages */
  .page-orb {
    display: none !important;
  }

  /* Category page body — warm background instead of dark */
  body {
    background: #FFF8F6 !important;
  }

}

/* ── Extra small screens (< 400px) ────────────────────── */
@media (max-width: 400px) {
  .product-grid, #productGrid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .product-card:nth-child(even) {
    margin-top: 0 !important;
  }

  .cat-card .cat-img-wrap {
    width: 72px !important;
    height: 72px !important;
  }

  .hero h1, .hero-section h1, #hero h1 {
    font-size: 1.6rem !important;
  }
}
