/*
 * mobile-phase3.css — CHIC CHARMS Phase 3
 * Mobile Commerce Experience + Product Discovery
 *
 * Sections:
 *   3.0  Phase 3 Tokens
 *   3.1  Shop Page Refinement
 *   3.2  Product Grid System
 *   3.3  Product Card Refinement
 *   3.4  Filter + Sort Bottom Sheets
 *   3.5  Product Discovery Interactions
 *   3.6  Touch Interaction Refinement
 *   3.7  Safe Area + Stability
 *
 * SCOPE: ALL rules wrapped in @media (max-width: 767px)
 *        Desktop is NEVER touched.
 */

/* ══════════════════════════════════════════════════════
   3.0  PHASE 3 TOKENS
   Extended palette, spacing, and motion for commerce.
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  :root {
    /* Commerce palette */
    --p3-ink:          #201716;
    --p3-muted:        rgba(32, 23, 22, 0.52);
    --p3-ivory:        #fffaf5;
    --p3-blush:        #fff0f3;
    --p3-rose:         #c0607a;
    --p3-hot:          #e03f72;
    --p3-gold:         #b99663;
    --p3-line:         rgba(32, 23, 22, 0.08);
    --p3-card-bg:      rgba(255, 255, 255, 0.97);
    --p3-card-shadow:  0 8px 28px rgba(64, 39, 34, 0.10);
    --p3-card-hover:   0 16px 40px rgba(64, 39, 34, 0.16);
    --p3-radius-card:  20px;
    --p3-radius-img:   18px 18px 12px 12px;
    --p3-radius-pill:  999px;
    --p3-ease:         cubic-bezier(0.16, 1, 0.3, 1);
    --p3-ease-out:     cubic-bezier(0.0, 0, 0.2, 1);

    /* Grid */
    --p3-grid-gap:     10px;
    --p3-grid-pad:     12px;

    /* Sheet */
    --p3-sheet-bg:     rgba(255, 250, 245, 0.99);
    --p3-sheet-radius: 28px 28px 0 0;
  }
}


/* ══════════════════════════════════════════════════════
   3.1  SHOP PAGE REFINEMENT
   Announcement, header, search, category circles, tabs,
   hero banner, filter bar — luxury spacing + hierarchy.
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Suppress the shop page's own bottom nav (mobile-app.js provides .ma-bottom-nav) ── */
  .mobile-bottom-nav {
    display: none !important;
  }

  /* ── Announcement ticker ── */
  .shop-announcement {
    position: sticky;
    top: 0;
    z-index: 80;
    height: 30px;
    overflow: hidden;
    background: linear-gradient(90deg, #1e1012, #8a2a49 48%, #1e1012);
  }

  .shop-announcement span {
    padding: 0 20px;
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    line-height: 30px;
  }

  /* ── Shop header ── */
  .shop-header {
    position: sticky;
    top: 30px;
    z-index: 70;
    min-height: 54px;
    padding: 0 14px;
    gap: 8px;
    border-bottom: 1px solid var(--p3-line);
    background: rgba(255, 250, 245, 0.97);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    box-shadow: 0 4px 20px rgba(64, 39, 34, 0.08);
  }

  .shop-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--p3-line);
    background: #fff;
    font-size: 1rem;
    color: var(--p3-ink);
    transition: transform 180ms var(--p3-ease);
  }

  .shop-icon:active {
    transform: scale(0.93);
  }

  .shop-logo {
    font-size: 1.15rem;
    letter-spacing: 0.01em;
  }

  .shop-actions {
    gap: 6px;
  }

  /* ── Search bar ── */
  .shop-search {
    margin: 10px 14px;
    width: calc(100% - 28px);
    min-height: 46px;
    padding: 0 16px;
    gap: 10px;
    border: 1px solid rgba(185, 150, 99, 0.18);
    border-radius: var(--p3-radius-pill);
    background: #fff;
    box-shadow: 0 6px 20px rgba(64, 39, 34, 0.08);
    transition: box-shadow 200ms ease, border-color 200ms ease;
  }

  .shop-search:focus-within {
    border-color: rgba(192, 96, 122, 0.30);
    box-shadow: 0 8px 28px rgba(192, 96, 122, 0.14);
  }

  .shop-search input {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--p3-ink);
  }

  .shop-search input::placeholder {
    color: var(--p3-muted);
    font-weight: 400;
  }

  /* ── Category circles ── */
  .shop-category-circles {
    gap: 12px;
    padding: 4px 14px 16px;
    scroll-padding-inline: 14px;
  }

  .shop-circle {
    flex: 0 0 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--p3-ink);
    text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 180ms var(--p3-ease);
  }

  .shop-circle:active {
    transform: scale(0.92);
  }

  .shop-circle img {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    border: 2.5px solid #fff;
    box-shadow: 0 6px 18px rgba(192, 96, 122, 0.18);
    transition: box-shadow 200ms ease, transform 200ms var(--p3-ease);
  }

  .shop-circle:active img {
    transform: scale(0.94);
    box-shadow: 0 10px 24px rgba(192, 96, 122, 0.26);
  }

  /* ── Category tabs row ── */
  .shop-tabs {
    gap: 8px;
    padding: 0 14px 12px;
    scroll-padding-inline: 14px;
  }

  .shop-tab {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 16px;
    border: 1px solid var(--p3-line);
    border-radius: var(--p3-radius-pill);
    background: #fff;
    color: var(--p3-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease, transform 150ms var(--p3-ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .shop-tab:active {
    transform: scale(0.94);
  }

  .shop-tab.is-active {
    border-color: rgba(192, 96, 122, 0.36);
    background: linear-gradient(135deg, #fff1f4, #ffe8ef);
    color: var(--p3-rose);
  }

  /* ── Hero banner ── */
  .shop-hero {
    margin: 0 14px 14px;
    min-height: 160px;
    border-radius: 22px;
    box-shadow: 0 12px 32px rgba(64, 39, 34, 0.16);
    overflow: hidden;
  }

  .shop-hero img {
    object-position: center 20%;
  }

  .shop-hero-content {
    left: 16px;
    right: 16px;
    bottom: 18px;
  }

  .shop-hero h1 {
    font-size: 1.7rem;
    line-height: 1;
    max-width: 13ch;
  }

  .shop-hero p {
    font-size: 0.84rem;
    margin-top: 8px;
    max-width: 27ch;
    color: rgba(255, 250, 246, 0.80);
  }

  .shop-kicker {
    font-size: 0.60rem;
    letter-spacing: 0.16em;
    margin-bottom: 8px;
  }

  /* ── Filter bar (sticky below header) ── */
  .shop-bar {
    position: sticky;
    top: 84px;   /* header (54) + announcement (30) */
    z-index: 60;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 250, 245, 0.98);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border-top: none;
    border-bottom: 1px solid var(--p3-line);
    box-shadow: 0 4px 16px rgba(64, 39, 34, 0.07);
  }

  .shop-bar-top {
    align-items: center;
    gap: 10px;
  }

  .shop-count {
    font-size: 0.76rem;
    color: var(--p3-muted);
    font-weight: 500;
  }

  .shop-count strong {
    color: var(--p3-rose);
    font-weight: 800;
  }

  /* ── Sort select — replace with styled button look ── */
  .shop-sort {
    min-height: 36px;
    max-width: 148px;
    padding: 0 28px 0 12px;
    border: 1px solid var(--p3-line);
    border-radius: var(--p3-radius-pill);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a85f72' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: var(--p3-ink);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
  }

  /* ── Chips (quick filters) ── */
  .shop-chips {
    gap: 7px;
    padding: 2px 0 2px;
    scroll-padding-inline: 0;
  }

  .shop-chip {
    flex: 0 0 auto;
    min-height: 33px;
    padding: 0 13px;
    border: 1px solid var(--p3-line);
    border-radius: var(--p3-radius-pill);
    background: #fff;
    color: var(--p3-muted);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease, transform 150ms var(--p3-ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .shop-chip:active {
    transform: scale(0.93);
  }

  .shop-chip.is-active {
    border-color: rgba(192, 96, 122, 0.36);
    background: linear-gradient(135deg, #fff1f4, #ffe8ef);
    color: var(--p3-rose);
  }
}


/* ══════════════════════════════════════════════════════
   3.2  PRODUCT GRID SYSTEM
   Balanced 2-column grid with luxury rhythm.
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  .shop-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;   /* let cards breathe naturally */
    gap: var(--p3-grid-gap);
    padding: 14px var(--p3-grid-pad) 20px;
    align-items: start;     /* no forced equal heights — prevents dead space */
    contain: layout;
  }

  /* Stagger-fade as cards appear */
  .shop-card {
    animation: p3CardIn 380ms var(--p3-ease) both;
  }

  .shop-card:nth-child(2n) {
    animation-delay: 60ms;
  }

  .shop-card:nth-child(3),
  .shop-card:nth-child(4) {
    animation-delay: 90ms;
  }

  .shop-card:nth-child(5),
  .shop-card:nth-child(6) {
    animation-delay: 120ms;
  }

  .shop-card:nth-child(n+7) {
    animation-delay: 150ms;
  }

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


/* ══════════════════════════════════════════════════════
   3.3  PRODUCT CARD REFINEMENT
   Premium editorial card — image, badge, body, CTA.
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Card shell ── */
  .shop-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--p3-radius-card);
    background: var(--p3-card-bg);
    box-shadow: var(--p3-card-shadow);
    border: 0;
    contain: layout paint;
    transition: box-shadow 220ms ease, transform 220ms var(--p3-ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 0;
    /* Remove forced grid-template-rows so heights are natural */
    grid-template-rows: unset;
  }

  .shop-card:active {
    transform: scale(0.975);
    box-shadow: var(--p3-card-hover);
  }

  /* ── Product image area ── */
  .shop-card-media {
    position: relative;
    aspect-ratio: 3 / 4;   /* cinematic portrait — no awkward crops */
    overflow: hidden;
    border-radius: var(--p3-radius-img);
    background: linear-gradient(160deg, #fff5f7 0%, #ffedf2 100%);
    flex-shrink: 0;
    display: block;   /* <a> wrapping media */
  }

  .shop-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    /* Smooth loading pop-in */
    transition: transform 320ms var(--p3-ease);
  }

  .shop-card:active .shop-card-media img {
    transform: scale(1.03);
  }

  /* ── Badge ── */
  .shop-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 9px;
    border-radius: var(--p3-radius-pill);
    background: rgba(255, 250, 246, 0.94);
    color: var(--p3-rose);
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(64, 39, 34, 0.10);
    /* No overflow, no clipping */
    max-width: calc(100% - 50px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
  }

  /* Special badge colour variants */
  .shop-card-badge[data-badge="sale"],
  .shop-card-badge[data-badge="Sale"] {
    background: var(--p3-hot);
    color: #fff;
  }

  .shop-card-badge[data-badge="New Drop"],
  .shop-card-badge[data-badge="new"] {
    background: #1a1310;
    color: rgba(255, 250, 246, 0.92);
  }

  /* ── Heart / wishlist button ── */
  .shop-card-heart {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--p3-hot);
    font-size: 1rem;
    box-shadow: 0 4px 14px rgba(64, 39, 34, 0.14);
    transition: transform 180ms var(--p3-ease), background 180ms ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
    line-height: 1;
  }

  .shop-card-heart:active,
  .shop-card-heart.is-active {
    transform: scale(1.18);
    background: #fff0f4;
  }

  /* ── Quick-add button (bottom-right of image) ── */
  .shop-card-quick {
    position: absolute;
    bottom: 10px;
    right: 9px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: #1e1011;
    color: rgba(255, 250, 246, 0.94);
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(20, 10, 12, 0.24);
    transition: transform 180ms var(--p3-ease), background 180ms ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
    line-height: 1;
  }

  .shop-card-quick:active {
    transform: scale(0.90);
    background: var(--p3-rose);
  }

  /* ── Card body ── */
  .shop-card-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 10px 12px;
    flex: 1;
  }

  /* Category + rating line */
  .shop-card small {
    font-size: 0.63rem;
    color: var(--p3-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
    display: block;
  }

  /* Product name */
  .shop-card h2 {
    min-height: 0; /* remove fixed min-height */
    font-family: Jost, system-ui, sans-serif;
    font-size: 0.80rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--p3-ink);
    letter-spacing: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
  }

  /* Price row */
  .shop-card-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;
    margin-top: 2px;
    font-size: 0.88rem;
    font-weight: 900;
    color: var(--p3-hot);
    letter-spacing: 0;
    line-height: 1;
  }

  .shop-card-price span {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--p3-muted);
    text-decoration: line-through;
  }

  /* ── Add to Cart CTA ── */
  .shop-card button[data-add] {
    width: 100%;
    min-height: 38px;
    margin-top: 6px;
    border: none;
    border-radius: var(--p3-radius-pill);
    background: linear-gradient(100deg, #1e1011 0%, #c0607a 100%);
    color: #fffaf5;
    font-family: Jost, system-ui, sans-serif;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 180ms var(--p3-ease), box-shadow 180ms ease, opacity 180ms ease;
    box-shadow: 0 6px 18px rgba(192, 96, 122, 0.28);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .shop-card button[data-add]:active {
    transform: scale(0.96);
    box-shadow: 0 3px 10px rgba(192, 96, 122, 0.18);
  }

  .shop-card button[data-add]:disabled {
    background: linear-gradient(100deg, #3a2a2c 0%, #a85f72 100%);
    opacity: 0.85;
  }
}


/* ══════════════════════════════════════════════════════
   3.4  FILTER + SORT BOTTOM SHEETS
   Native-app quality — smooth open/close, luxury spacing.
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Sheet backdrop overlay ── */
  .p3-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 700;
    background: rgba(20, 14, 12, 0.52);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 280ms var(--p3-ease), visibility 0s linear 280ms;
  }

  .p3-sheet-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  /* ── Sheet panel ── */
  .p3-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 710;
    background: var(--p3-sheet-bg);
    border-radius: var(--p3-sheet-radius);
    padding: 0 0 calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 40px rgba(64, 39, 34, 0.18);
    transform: translateY(100%);
    transition: transform 360ms var(--p3-ease);
    /* Max readable height */
    max-height: 80dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .p3-sheet.is-open {
    transform: translateY(0);
  }

  /* ── Sheet handle ── */
  .p3-sheet-handle {
    width: 38px;
    height: 4px;
    background: rgba(32, 23, 22, 0.16);
    border-radius: 2px;
    margin: 12px auto 0;
  }

  /* ── Sheet header ── */
  .p3-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--p3-line);
  }

  .p3-sheet-title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--p3-ink);
    margin: 0;
  }

  .p3-sheet-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--p3-line);
    border-radius: 50%;
    background: #fff;
    color: var(--p3-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: transform 180ms var(--p3-ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .p3-sheet-close:active {
    transform: scale(0.90);
  }

  /* ── Filter sheet section ── */
  .p3-filter-section {
    padding: 16px 18px 10px;
    border-bottom: 1px solid var(--p3-line);
  }

  .p3-filter-section:last-child {
    border-bottom: none;
  }

  .p3-filter-label {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--p3-muted);
    margin-bottom: 10px;
    display: block;
  }

  /* ── Filter chip grid inside sheet ── */
  .p3-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .p3-filter-chip {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--p3-line);
    border-radius: var(--p3-radius-pill);
    background: #fff;
    color: var(--p3-muted);
    font-family: Jost, system-ui, sans-serif;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease, transform 150ms var(--p3-ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .p3-filter-chip:active {
    transform: scale(0.93);
  }

  .p3-filter-chip.is-active {
    border-color: rgba(192, 96, 122, 0.36);
    background: linear-gradient(135deg, #fff1f4, #ffe8ef);
    color: var(--p3-rose);
  }

  /* ── Sort sheet list ── */
  .p3-sort-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
  }

  .p3-sort-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 0 18px;
    border-bottom: 1px solid var(--p3-line);
    font-family: Jost, system-ui, sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--p3-ink);
    cursor: pointer;
    transition: background 180ms ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .p3-sort-item:last-child {
    border-bottom: none;
  }

  .p3-sort-item:active {
    background: var(--p3-blush);
  }

  .p3-sort-item.is-active {
    color: var(--p3-rose);
    font-weight: 700;
  }

  .p3-sort-item.is-active::after {
    content: "✓";
    font-weight: 800;
    color: var(--p3-rose);
  }

  /* ── Sheet CTA row ── */
  .p3-sheet-cta {
    display: flex;
    gap: 10px;
    padding: 14px 18px 0;
  }

  .p3-sheet-btn {
    flex: 1;
    min-height: 48px;
    border: 1px solid var(--p3-line);
    border-radius: var(--p3-radius-pill);
    background: #fff;
    color: var(--p3-muted);
    font-family: Jost, system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 180ms var(--p3-ease);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .p3-sheet-btn.p3-sheet-btn-apply {
    background: linear-gradient(100deg, #1e1011, #c0607a);
    color: #fffaf5;
    border-color: transparent;
    box-shadow: 0 8px 22px rgba(192, 96, 122, 0.30);
  }

  .p3-sheet-btn:active {
    transform: scale(0.96);
  }

  /* ── Body scroll lock when sheet is open ── */
  body.p3-sheet-open {
    overflow: hidden !important;
    touch-action: none !important;
  }

  /* ── Filter + Sort trigger buttons (inline in .shop-bar) ── */
  .p3-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--p3-line);
    border-radius: var(--p3-radius-pill);
    background: #fff;
    color: var(--p3-ink);
    font-family: Jost, system-ui, sans-serif;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 150ms var(--p3-ease), box-shadow 150ms ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 2px 8px rgba(64, 39, 34, 0.07);
  }

  .p3-bar-btn:active {
    transform: scale(0.94);
  }

  .p3-bar-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    flex-shrink: 0;
  }

  .p3-bar-btn.is-active {
    border-color: rgba(192, 96, 122, 0.36);
    background: linear-gradient(135deg, #fff1f4, #ffe8ef);
    color: var(--p3-rose);
  }
}


/* ══════════════════════════════════════════════════════
   3.5  PRODUCT DISCOVERY EXPERIENCE
   Section pacing, editorial story, scrollable rhythm.
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Story section below grid ── */
  .shop-story {
    margin: 8px 14px 0;
    padding: 18px 16px;
    border: 1px solid var(--p3-line);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(64, 39, 34, 0.06);
  }

  .shop-story h2 {
    font-size: 1.25rem;
    line-height: 1.2;
    margin-top: 8px;
  }

  .shop-story p {
    font-size: 0.84rem;
    line-height: 1.55;
    color: var(--p3-muted);
    margin-top: 8px;
  }

  /* ── Footer section ── */
  .shop-footer {
    margin: 12px 14px 16px;
    padding: 20px 16px;
    border-radius: 20px;
    background: #1e1011;
    border: none;
    box-shadow: 0 12px 32px rgba(20, 10, 12, 0.22);
  }

  .shop-footer h2 {
    color: #fffaf5;
    font-size: 1.2rem;
  }

  .shop-footer p {
    font-size: 0.82rem;
    line-height: 1.55;
    color: rgba(255, 250, 245, 0.62);
    margin-top: 8px;
  }

  .shop-footer nav {
    margin-top: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .shop-footer nav a {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 250, 245, 0.62);
    letter-spacing: 0.02em;
    transition: color 180ms ease;
  }

  .shop-footer nav a:active {
    color: var(--p3-gold);
  }

  /* ── Smooth entry for grid reloads ── */
  .shop-grid:empty::after {
    content: "";
    display: block;
    height: 120px;
  }
}


/* ══════════════════════════════════════════════════════
   3.6  TOUCH INTERACTION REFINEMENT
   Tap states, press feedback, animation restraint.
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Global tap feedback (suppress default blue flash) ── */
  .shop-card,
  .shop-tab,
  .shop-chip,
  .shop-circle,
  .shop-sort,
  .p3-bar-btn,
  .p3-filter-chip,
  .p3-sort-item,
  .shop-card-heart,
  .shop-card-quick,
  .shop-card button[data-add],
  .shop-icon {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* ── Prevent accidental text selection on tap ── */
  .shop-grid,
  .shop-tabs,
  .shop-chips,
  .shop-category-circles,
  .shop-bar {
    user-select: none;
    -webkit-user-select: none;
  }

  /* ── Scroll momentum on horizontal lists ── */
  .shop-tabs,
  .shop-chips,
  .shop-category-circles {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  /* ── Smooth grid scroll ── */
  .shop-grid {
    overscroll-behavior-y: none;
  }
}


/* ══════════════════════════════════════════════════════
   3.7  SAFE AREA + STABILITY
   Bottom nav spacing, viewport clipping, iPhone notch.
══════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Body padding accounts for shop.html's own fixed header
     (announcement 30px + shop-header ~54px) + bottom nav ── */
  body {
    padding-top: calc(30px + 54px) !important;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ── No horizontal bleed ── */
  .shop-shell,
  .shop-grid,
  .shop-category-circles,
  .shop-tabs,
  .shop-chips {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Ensure horizontal scroll containers don't cause full-page overflow */
  .shop-tabs,
  .shop-chips,
  .shop-category-circles {
    overflow-x: auto;
    overflow-y: hidden;
  }

  /* ── No content hidden under the bottom nav ── */
  .shop-footer {
    margin-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ── Fixed elements z-index safety ── */
  .shop-announcement { z-index: 80; }
  .shop-header       { z-index: 70; }
  .shop-bar          { z-index: 60; }
  .p3-sheet-backdrop { z-index: 700; }
  .p3-sheet          { z-index: 710; }
  .ma-bottom-nav     { z-index: 380 !important; }

  /* ── Prevent CLS on image load ── */
  .shop-card-media img {
    content-visibility: auto;
  }

  /* ── 360px safety: cards don't clip ── */
  @media (max-width: 380px) {
    .shop-card h2 {
      font-size: 0.74rem;
    }

    .shop-card-price {
      font-size: 0.80rem;
    }

    .shop-card button[data-add] {
      font-size: 0.60rem;
      min-height: 34px;
    }

    .shop-circle {
      flex: 0 0 58px;
    }

    .shop-circle img {
      width: 52px;
      height: 52px;
    }

    .p3-grid-pad {
      --p3-grid-pad: 10px;
    }

    .shop-grid {
      padding: 12px 10px 18px;
      gap: 8px;
    }
  }
}

@media (max-width: 767px) {
  html {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
  }

  body {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding-top: 0 !important;
  }

  .shop-shell {
    padding-top: 12px !important;
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .shop-bar {
    top: calc(58px + env(safe-area-inset-top, 0px)) !important;
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
  }

  .shop-card {
    min-width: 0 !important;
    height: 100% !important;
    display: grid !important;
    grid-template-rows: auto 1fr !important;
  }

  .shop-card-media {
    aspect-ratio: 4 / 5 !important;
  }

  .shop-card-media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center top !important;
  }

  .shop-card-badge {
    max-width: calc(100% - 54px) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .shop-card-body {
    min-width: 0 !important;
    gap: 7px !important;
    padding: 10px !important;
  }

  .shop-card h2 {
    min-height: 36px !important;
  }

  .shop-card button[data-add] {
    min-height: 38px !important;
    padding: 0 10px !important;
    font-size: 0.64rem !important;
    letter-spacing: 0.08em !important;
  }

  .mobile-bottom-nav {
    height: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
    min-height: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    align-items: center !important;
    padding: 4px 4px env(safe-area-inset-bottom, 0px) !important;
  }

  .mobile-bottom-tab {
    min-width: 0 !important;
    height: 52px !important;
    gap: 3px !important;
  }

  .mobile-bottom-tab svg {
    width: 20px !important;
    height: 20px !important;
  }

  .mobile-bottom-tab span {
    max-width: 100% !important;
    overflow: hidden !important;
    font-size: 0.56rem !important;
    line-height: 1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}
