/* Compact-on-scroll navigation. Search geometry and its single DOM instance are untouched. */
#store-navigation { background: #fff; width: 100%; }
#store-navigation[data-ready="true"] { position: fixed; inset: 0 0 auto; z-index: 30; box-shadow: 0 2px 9px #173d500d; }
#header-categories { overflow: hidden; max-height: var(--header-categories-height, 80px); opacity: 1; visibility: visible; transition: max-height 180ms ease, opacity 140ms ease, visibility 180ms; }
#store-navigation .header-main { transition: min-height 180ms ease, padding 180ms ease, row-gap 180ms ease; }
#store-navigation .brand { transition: transform 180ms ease; transform-origin: left center; }
#store-navigation .header-chat { position: relative; }
#store-navigation .header-chat > span { transition: opacity 140ms ease, visibility 180ms; }
#store-navigation[data-compact="true"] .header-main { min-height: 80px; }
#store-navigation[data-compact="true"] .brand { transform: scale(.72); }
#store-navigation[data-compact="true"] .header-chat > span { opacity: 0; visibility: hidden; }
#store-navigation[data-compact="true"] .header-chat > svg { display: block; }
#store-navigation[data-compact="true"] #header-categories { max-height: 0; opacity: 0; visibility: hidden; pointer-events: none; }
#header-categories[hidden] { display: none; }
html { scroll-padding-top: var(--store-header-offset, 12px); }
#catalogo, #tiendas, #stores-heading { scroll-margin-top: 0; }
@media (max-width: 760px) {
  /* A tiny brand row preserves the full-width, 52px-high search on phones. */
  #store-navigation[data-compact="true"] .header-main { min-height: 0; padding-block: 8px; row-gap: 6px; grid-template-rows: 44px auto; }
  #store-navigation[data-compact="true"] .brand { transform: scale(.72); }
  #store-navigation[data-compact="true"] .header-chat { width: 44px; min-width: 44px; height: 44px; justify-content: center; }
  #store-navigation[data-compact="true"] .header-chat > span { position: absolute; width: 1px; height: 1px; overflow: hidden; }
  #store-navigation .header-chat > svg { display: block; flex-shrink: 0; }
}
#store-navigation[data-measuring="true"], #store-navigation[data-measuring="true"] * { transition: none !important; }
@media (prefers-reduced-motion: reduce) { #store-navigation, #store-navigation * { transition: none !important; scroll-behavior: auto !important; } }
/* Measure natural height rather than the previous collapsed/max-height value. */
#store-navigation[data-measuring="true"][data-compact="false"] #header-categories { max-height: none; }
.skip-link:focus { z-index: 40; }
/* Settle any in-flight transition before a control or anchored popup takes focus. */
#store-navigation:focus-within *, body.filters-open #store-navigation *, body.menu-open #store-navigation * { transition: none !important; }
/* A small return control, below navigation/modals and clear of safe-area edges. */
.back-to-top { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 20; width: 48px; height: 48px; padding: 12px; display: grid; place-items: center; border: 1px solid #00696f; border-radius: 50%; background: #e4f5fc; color: #00696f; box-shadow: 0 2px 8px #173d5026; cursor: pointer; }
.back-to-top[hidden], body.menu-open .back-to-top, body.filters-open .back-to-top { display: none; }
.back-to-top:hover { background: #a9e1f7; }
.back-to-top:focus-visible { outline: 2px solid #00696f; outline-offset: 3px; }
.back-to-top svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* The final footer controls can scroll fully above the floating button. */
body { padding-bottom: max(80px, calc(env(safe-area-inset-bottom) + 64px)); }
