/* Encabezado en celular: una sola fila con aire. Logo · búsqueda (ícono que se expande) · carrito · menú. */
@media (max-width: 700px) {
  body:not(#vf-x) .public-header .public-nav,
  body:not(#vf-x) .public-header .public-nav:has(.public-search) {
    grid-template-columns: minmax(0, 1fr) auto auto auto !important;
    grid-template-rows: auto !important;
    column-gap: 10px !important;
    row-gap: 0 !important;
    align-items: center !important;
    min-height: 72px !important;
    padding: 14px 0 !important;
    width: calc(100% - 32px) !important;
  }
  body:not(#vf-x) .public-header .public-brand { grid-column: 1 !important; grid-row: 1 !important; min-width: 0; }

  /* Búsqueda: ícono de 44 px; al tocarla se expande sobre toda la fila. */
  body:not(#vf-x) .public-header .public-nav .public-search {
    grid-column: 2 !important; grid-row: 1 !important;
    position: relative !important; width: 44px !important; height: 44px !important; min-height: 44px !important;
    padding: 0 !important; margin: 0 !important; gap: 0 !important;
    display: flex !important; align-items: center; justify-content: center;
    border-radius: 999px !important;
  }
  body:not(#vf-x) .public-header .public-nav .public-search label { flex: 0 0 44px !important; width: 44px; height: 44px; margin: 0; pointer-events: none; }
  body:not(#vf-x) .public-header .public-nav .public-search label svg { width: 21px !important; height: 21px !important; }
  /* El campo cubre el ícono sin verse, para que al tocar reciba el foco. */
  body:not(#vf-x) .public-header .public-nav .public-search input {
    position: absolute !important; inset: 0 !important; width: 44px !important; height: 44px !important;
    opacity: 0; padding: 0 !important; font-size: 16px !important; cursor: pointer;
  }
  body:not(#vf-x) .public-header .public-nav .public-search button { display: none !important; }

  body:not(#vf-x) .public-header .public-nav .public-search:focus-within {
    position: absolute !important; z-index: 8;
    left: 16px !important; right: 16px !important; top: 14px !important;
    width: auto !important; height: 44px !important;
    padding: 0 14px 0 4px !important; gap: 4px !important;
    justify-content: flex-start;
    box-shadow: 0 10px 26px rgb(7 40 30 / 18%);
  }
  body:not(#vf-x) .public-header .public-nav .public-search:focus-within input {
    position: static !important; inset: auto !important; opacity: 1; flex: 1 1 auto; width: 100% !important; height: 44px !important; padding: 0 !important; cursor: text;
  }
  body:not(#vf-x) .public-header .public-nav .public-search:focus-within button { display: block !important; }

  /* Carrito: solo ícono con contador. */
  body:not(#vf-x) .public-header .public-nav .public-cart {
    grid-column: 3 !important; grid-row: 1 !important;
    position: relative; width: 44px !important; height: 44px !important; min-height: 44px !important;
    padding: 0 !important; border-radius: 999px !important; justify-content: center; align-items: center; gap: 0 !important;
  }
  body:not(#vf-x) .public-header .public-nav .public-cart > span:not(.public-cart-count) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  body:not(#vf-x) .public-header .public-nav .public-cart .public-cart-count {
    position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; font-size: 11px; line-height: 18px; border-radius: 999px;
  }

  body:not(#vf-x) .public-header .public-nav .public-menu {
    grid-column: 4 !important; grid-row: 1 !important; width: 44px !important; height: 44px !important;
  }
  body:not(#vf-x) .public-header .public-nav .va-language-switch { display: none !important; }
}

/* Tablet o "sitio para computadora" en el celular (701-1019 px): también una sola fila.
   Logo · enlaces (si caben) · búsqueda (ícono que se expande) · carrito · menú. */
@media (min-width: 701px) and (max-width: 1019px) {
  body:not(#vf-x) .public-header .public-nav,
  body:not(#vf-x) .public-header .public-nav:has(.public-search) {
    grid-template-columns: 170px minmax(0, 1fr) 44px auto auto !important;
    grid-template-rows: auto !important;
    column-gap: 14px !important; row-gap: 0 !important;
    align-items: center !important;
    height: auto !important; min-height: 88px !important;
    padding: 16px 0 !important;
    width: calc(100% - 48px) !important;
  }
  body:not(#vf-x) .public-header .public-nav .public-brand { grid-column: 1 !important; grid-row: 1 !important; }
  body:not(#vf-x) .public-header .public-nav .public-links { grid-column: 2 !important; grid-row: 1 !important; }
  body:not(#vf-x) .public-header .public-nav .public-search {
    grid-column: 3 !important; grid-row: 1 !important;
    position: relative !important; width: 44px !important; height: 44px !important; min-height: 44px !important;
    padding: 0 !important; margin: 0 !important; gap: 0 !important;
    display: flex !important; align-items: center; justify-content: center; border-radius: 999px !important;
  }
  body:not(#vf-x) .public-header .public-nav .public-search label { flex: 0 0 44px !important; width: 44px; height: 44px; margin: 0; pointer-events: none; }
  body:not(#vf-x) .public-header .public-nav .public-search input {
    position: absolute !important; inset: 0 !important; width: 44px !important; height: 44px !important;
    opacity: 0; padding: 0 !important; font-size: 16px !important; cursor: pointer;
  }
  body:not(#vf-x) .public-header .public-nav .public-search button { display: none !important; }
  body:not(#vf-x) .public-header .public-nav .public-search:focus-within {
    position: absolute !important; z-index: 8; left: 0 !important; right: 0 !important; top: 16px !important;
    width: auto !important; padding: 0 16px 0 4px !important; gap: 4px !important; justify-content: flex-start;
    box-shadow: 0 10px 26px rgb(7 40 30 / 18%);
  }
  body:not(#vf-x) .public-header .public-nav .public-search:focus-within input {
    position: static !important; inset: auto !important; opacity: 1; flex: 1 1 auto; width: 100% !important; padding: 0 !important; cursor: text;
  }
  body:not(#vf-x) .public-header .public-nav .public-search:focus-within button { display: block !important; }
  body:not(#vf-x) .public-header .public-nav .public-cart { grid-column: 4 !important; grid-row: 1 !important; }
  body:not(#vf-x) .public-header .public-nav .public-menu { grid-column: 5 !important; grid-row: 1 !important; }
}

/* Portada en celular: mismo encabezado que las demás páginas (logo, lupa, carrito, menú). */
@media (max-width: 700px) {
  body.vf-home:not(#vf-x) .public-header .public-nav .public-brand {
    display: flex !important; align-items: center; width: auto !important; max-width: 150px !important;
    height: auto !important; max-height: none !important; min-height: 0 !important; margin: 0 !important;
  }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-brand img {
    display: block !important; width: 128px !important; height: auto !important; max-height: 46px !important; object-fit: contain;
  }
  body.vf-home:not(#vf-x) .public-header .public-nav .vf-reference-wordmark { display: none !important; }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-search { display: flex !important; }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-cart { height: 44px !important; padding: 0 !important; font-size: 0; }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-menu { display: grid !important; place-items: center; }
  html[data-theme="dark"] body:not(#vf-x) .public-header .public-nav .public-menu,
  html[data-theme="dark"] body:not(#vf-x) .public-header .public-nav .public-menu svg { color: #eaf3ef !important; stroke: #eaf3ef !important; }
}
/* Portada: el diseño propio de la portada ganaba en especificidad y orden; se reafirma la colocación en una fila. */
@media (max-width: 700px) {
  body.vf-home:not(#vf-x) .public-header .public-nav .public-brand { grid-column: 1 !important; grid-row: 1 !important; pointer-events: auto !important; }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-search { grid-column: 2 !important; grid-row: 1 !important; pointer-events: auto !important; width: 44px !important; }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-search:focus-within { width: auto !important; }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-cart {
    grid-column: 3 !important; grid-row: 1 !important; width: 44px !important; min-height: 44px !important; border-radius: 999px !important;
    padding: 0 !important; justify-content: center; pointer-events: auto !important;
  }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-cart > span:not(.public-cart-count) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-menu {
    grid-column: 4 !important; grid-row: 1 !important; width: 44px !important; height: 44px !important;
    background: transparent !important; box-shadow: none !important; border-radius: 999px !important; pointer-events: auto !important;
  }
  body.vf-home:not(#vf-x) .public-header .public-nav .public-menu svg { stroke: currentColor !important; width: 24px !important; height: 24px !important; }
}
/* Portada en celular: barra sólida arriba (no flota sobre el cartel, que ya trae su propio logo). */
@media (max-width: 700px) {
  html body.vf-home:not(#vf-x) .public-header {
    position: relative !important; top: auto !important; left: auto !important; right: auto !important;
    height: auto !important; min-height: 72px !important;
    background: #ffffff !important; border-bottom: 1px solid #e4ece8 !important;
    pointer-events: auto !important;
  }
  html body.vf-home:not(#vf-x) .public-header .public-nav { pointer-events: auto !important; background: transparent !important; }
  html[data-theme="dark"] body.vf-home:not(#vf-x) .public-header { background: #14201d !important; border-bottom-color: #2b3d37 !important; }
}