/* Mobile-only browsing controls. Desktop and non-pen grids keep their rules. */
.mobile-catalog-bar { display: none; }
@media (max-width: 719px) {
  .topbar[data-mobile-mode] {
    transition: transform 160ms ease, visibility 160ms;
    overflow-anchor: none;
  }
  .topbar[data-mobile-mode="hidden"], .topbar[data-mobile-mode="compact"] {
    transform: translateY(calc(-100% - 2px));
    visibility: hidden;
    pointer-events: none;
  }
  .topbar[data-mobile-mode="panel"] {
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: auto;
  }
  .topbar[data-mobile-mode="panel"].search-active { overflow: visible; }
  .mobile-catalog-bar:not([hidden]) {
    position: fixed; inset: 0 0 auto; z-index: 101;
    display: flex; align-items: center; gap: 6px;
    padding: calc(6px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 3px 12px rgba(31,41,55,.06);
  }
  .mobile-catalog-bar button {
    min-height: 44px; min-width: 44px;
    border: 1px solid var(--line); border-radius: 12px;
    padding: 8px 10px; font: inherit; font-size: 14px;
    background: var(--paper); color: var(--ink); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    touch-action: manipulation;
  }
  .mobile-catalog-bar .mobile-catalog-summary {
    flex: 1; min-width: 0; justify-content: space-between;
    background: var(--accent-soft); color: #315570;
  }
  .mobile-catalog-summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-catalog-bar .mobile-catalog-wishlist { background: var(--ink); color: white; }
  .mobile-catalog-bar button:focus-visible,
  .card-action-btn.heart:focus-visible { outline: 2px solid #1E6FA8; outline-offset: 2px; }
  /* The full 44px target stays inside the card; its white disc is only 34px. */
  #mainGrid .card-actions { top: 2px; right: 2px; }
  .card-action-btn.heart {
    width: 44px; height: 44px; font-size: 20px;
    background: transparent; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    isolation: isolate; position: relative; touch-action: manipulation;
  }
  .card-action-btn.heart::before {
    content: ''; position: absolute; inset: 5px; z-index: -1;
    background: rgba(255,255,255,.96); border-radius: 50%;
    box-shadow: 0 1px 5px rgba(31,41,55,.14);
  }
  #mainGrid .card-action-btn.heart.active { background: transparent; }
  .card-action-btn.heart.active::before { background: var(--accent-deep); }
}
@media (min-width: 360px) and (max-width: 719px) {
  #mainGrid.pen-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  #mainGrid.pen-grid .card-info { padding: 8px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .topbar[data-mobile-mode] { transition: none; }
}
